hardcoded credential
A password, key or token written directly into source code or a configuration file in the repository.
Every reader of the code, including every clone and backup, receives the credential.
In more detail
It leaks to everyone who can read the repository and every clone, and cannot be rotated without a code change. Moving it to the environment is a step up, and a secret manager or workload identity is the real fix.
Related terms
- secret — Any value that grants access, such as a password, access token or private key, and must be kept out of code and version control.
- secret scanning — Searching code, commits and files for credentials such as keys and tokens, ideally before they are committed.
- environment variable — A named setting such as PORT=8000 that a program reads from its surroundings when it starts.
Taught in
- The Environment Variable Trap — Application Security & Threat Modeling for Engineers
- Static Application Security Testing — Application Security & Threat Modeling for Engineers
- Secret Scanning — Application Security & Threat Modeling for Engineers