The analyzer has detected in the code data that may be confidential.
Such data can include passwords, API keys, access tokens, credentials, and other secrets. Storing them in the source code increases the risk of exposing them, as well as the risk of unauthorized access to protected data or functionality.
Since string literals may be stored directly within the program's binary file, sensitive data can be extracted from it. In the case of open-source projects, an attacker can gain access to such data directly from the source code.
Vulnerabilities related to insufficient protection of sensitive data are included in the risk category in the OWASP Top 10 Application Security Risks 2025: AO7:2025 Authentication Failures.
The example:
func login(user, pass string) {
if user == "admin" && pass == "admin123" {
....
}
}
In this example, the administrator password is stored in the code. By gaining access to the program's binary file or source code, an attacker can obtain authentication credentials and, as a result, all the privileges of a system administrator.
Sensitive data should not be stored directly in the source code. Instead, it is recommended to use secure secrets vaults or other external configuration mechanisms that provide access control for such data:
func login(secretStorage DataStorage, user, pass string) {
adminData := secretStorage.GetAdminData()
if user == adminData.UserName && pass == adminData.Password {
....
}
}
This diagnostic rule is classified as:
|
Was this page helpful?