Secret & Credential Exposure
Secret & Credential Exposure
A leaked secret is often the shortest path to a breach because it needs no exploitation, only discovery. Secrets accumulate in places teams forget: an old commit, a Dockerfile, a build log, or a value bundled into the frontend. Finding them is a baseline every audit should cover.
Hardcoded Secrets in Source
CWE-798- What it is
- API keys, passwords, or tokens are written directly into source files.
- Why it matters
- Anyone with repository access, and sometimes anyone at all, obtains working credentials.
- How to check
- Load secrets from the environment or a secrets manager; never commit them.
Secrets in Git History
CWE-798- What it is
- A secret was removed from the current code but still exists in an earlier commit.
- Why it matters
- The credential remains recoverable from history and must be treated as compromised.
- How to check
- Scan full history, rotate any exposed secret, and purge it from history.
Secrets Shipped to the Client
CWE-798- What it is
- A key or token is included in the frontend bundle, where it reaches every visitor.
- Why it matters
- The secret is public by definition and must be rotated and moved server-side.
- How to check
- Keep privileged keys on the server; only truly public values belong in client code.
In-depth guides
Related coverage
Check your code for secret & credential exposure
Tethlyn Audit checks your codebase for secret & credential exposure and more, then ranks each finding by real exploitability and data sensitivity.