我的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=?";
我该如何解决?我以这种方式创建它们(从文本字段中获取信息)进行登录并检查数据库.
谢谢大家!