gpt4 book ai didi

java - Appscan 问题 : Authentication. Credentials.Unprotected

转载 作者:行者123 更新时间:2023-11-30 10:51:39 24 4
gpt4 key购买 nike

Appscan 工具在我的应用程序中使用以下代码段时报告问题:

con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle");

问题属于 Authentication.Credentials.Unprotected 类型。

有人可以建议我解决此类问题的方法。

最佳答案

Appscan 正在报告您的凭据为纯文本的问题。
您应该隐藏凭据。一种方法是像这样从属性文件中读取凭据:

Properties props = new Properties();
props.load(new FileInputStream("credentials.txt"));
con = DriverManager.getConnection(props.getProperty("connectionUrl"),
props.getProperty("user"),
props.getProperty("password"));

credentials.txt 看起来像这样:

connectionUrl=jdbc:oracle:thin:@localhost:1521:xe
user=system
password=oracle

如果那是您的真实凭据,那么您现在应该更改它们。
如果你想更安全,那么你还应该加密文件中的凭据并在访问数据库之前解密它们。

希望对你有所帮助。祝你有美好的一天。

关于java - Appscan 问题 : Authentication. Credentials.Unprotected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34627081/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com