java通过用户名和密码查询_[Java] [SQL]查询时使用硬编码的用户名和密码

我的Java代码有问题.我的大学老师要求我使用“ kiuwan”作为在线代码评估者,他在我的代码中发现了以下问题:

Hardcoded credentials (username / password) are visible to any person reading the source code.

If the resource protected by such hardcoded credentials is important, this may compromise system security.

With hardcoded credentials, change is difficult. If the target account is compromised, and the software

is deployed in production, a code change is needed, which forces a redeployment.

Please note that source code access is not always necessary: if an attacker has access to the JAR file,

he/she may dis-assembly it to recover the password in clear.

它在我的3个查询中发现了这个问题:

public static final String CHECK_USER = "SELECT nome FROM utenti WHERE nome=? AND password=?";

public static final String INSERT_USER = "INSERT INTO utenti (nome, password) VALUES (?, ?)";

public static final String CHECK_USER_NAME = "SELECT nome FROM utenti WHERE nome=?";

我该如何解决?我以这种方式创建它们(从文本字段中获取信息)进行登录并检查数据库.

谢谢大家!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值