A password or secret is written into the source as a string literal
What it finds
const char *password = "hunter2";: a secret in the source is in every copy of the code and the binary, cannot be changed without a release, and is the same for every installation. Read it from the environment, a file or a secret store.
The variable or field must be named for a password or secret, and the literal look like one: at least four characters, without spaces, format directives or a trailing colon, which prompts and labels have.
From the rule's source, hardcoded_password.rs.
Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/cpp:hardcoded-password" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/cpp:hardcoded-password] reason="..."tx0 explain tx0/cpp:hardcoded-password shows the same in the terminal. Found a false positive? Report it.