JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.0p0 Hot Tips | CONFIDENTIAL | CodeSecure Inc |
A password is retrieved from a property file.
Password manipulation can be risky, for instance if passwords are stored in plain in a property file. Moreover, passwords stored as program constants expose to the risk of inferring the password by simply looking at the binary executable of the code. This checker identifies situations when password manipulation is done in an unsafe way.
| クラス名 | Password in Property File (Java) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 日本語クラス名 | Password in Property File (Java) | |||||||||
| クラス分類 | セキュリティ (security) | |||||||||
| ニーモニック | JAVA.HARDCODED.PASSWD.FILE | |||||||||
| カテゴリー |
|
|||||||||
| 対応言語 | Java で利用可能です。 |
|||||||||
| 有効/無効設定 | このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル
(configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Password in Property File (Java)" |
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
public class Passwords {
private final static String pwd = "password";
public void test(Properties props) throws SQLException {
String s = "password";
props.getProperty("password"); // Password in Property File (Java) warning issued here
props.getProperty(pwd); // Password in Property File (Java) warning issued here
props.getProperty(s); // Password in Property File (Java) warning issued here
props.getProperty("www.juliasoft.password"); // Password in Property File (Java) warning issued here
props.getProperty("password", "default"); // Password in Property File (Java) warning issued here
props.getProperty("www.juliasoft.password", "default"); // Password in Property File (Java) warning issued here
props.setProperty("com.julia.password", "goofy mouse"); // Hardcoded Password (Java) warning issued here
props.setProperty("com.julia.password", s); // Hardcoded Password (Java) warning issued here
props.setProperty("com.julia.password", s + " and " + pwd);
DriverManager.getConnection("www.juliasoft.com", "silvio", pwd); // Hardcoded Password (Java) warning issued here
}
}
Avoid storing passwords in property files and use encrypted files instead. Do not use program constants for passwords, store them in encrypted files instead.
設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。