Secrets Audit
Purpose
Find secrets that have leaked or could leak — in code, config, git history, logs, images, and client bundles — confirm real exposure, and drive rotation of anything exposed. A committed secret is compromised; deleting it is not enough.
When to Use
- Auditing an existing codebase for secret exposure, in
../../security-review, or after a suspected leak.
- Not for designing secret storage (
../../devops/secrets-management) — this finds what's already exposed.
Inputs
- Repo (including history), build/CI config, deployed images, client bundles.
- The secret store design (
../../devops/secrets-management) to compare against.
Discovery Questions
- Are any secrets in the working tree (source,
.env, config) — or in git history even if since removed?
- Do CI logs, error messages, or observability sinks contain secrets (
../../devops/monitoring-logging redaction)?
- Are secrets baked into Docker image layers or shipped in client bundles (
../../devops/environment-management public/secret boundary)?
- For each finding: is it a real, live secret, and what's the rotation/revoke path?
Responsibilities
- Scan broadly: source, config files,
.envs, entire git history (removed-but-committed secrets persist), CI/workflow files, Docker layers, and client bundles for credential/key/token patterns and high-entropy strings.
- Confirm exposure: distinguish real live secrets from placeholders/examples/rotated-already; assess reach (public repo? shipped bundle? shared image?).
- Drive rotation, not deletion: every confirmed exposed secret is rotated/revoked — removing it from code leaves the leaked value valid. Coordinate with the owning system (
../../backend/backend-authentication for tokens, providers for API keys).
- Prevent recurrence: recommend secret scanning in CI/pre-commit (
../../devops/ci-cd, ../../devops/github-actions), .gitignore/.dockerignore gaps closed, and migration to the store (../../devops/secrets-management).
- Handle findings safely: never reproduce the secret value in reports/messages — reference location + type + severity only.
Required Workflow
- Scan working tree, git history, CI, images, bundles.
- Confirm which findings are real, live secrets; assess reach.
- For each: drive rotation/revocation with the owning system.
- Close the leak path (ignore rules, store migration).
- Add CI/pre-commit scanning; record findings (locations, not values).
Decision Rules
- History counts: a secret ever committed is exposed even if later removed — rotate it.
- Rotation is mandatory for confirmed exposure; deletion alone leaves a valid credential in the wild.
- Anything in a client bundle is public — bundle secrets are always findings.
- Prioritize by reach × privilege: a live admin key in a public repo outranks a rotated dev token.
Rules
- Never print discovered secret values — location, type, severity only.
- Confirmed exposures are rotated, not just deleted.
- Recurrence prevention (CI scanning) is part of the fix.
Anti-Patterns
- Deleting a committed secret from HEAD and calling it fixed (history + leaked value remain).
- Scanning only the working tree, ignoring git history.
- Pasting the found secret into the report/ticket.
- Treating bundle-shipped config as safe.
- No CI/pre-commit scanning to stop the next leak.
Validation Checklist
Definition of Done
A recorded secrets audit — everywhere secrets hide, including git history — with every confirmed exposure rotated/revoked, leak paths closed, and recurring scanning added, and no secret value reproduced in the findings.
Related Skills
../../devops/secrets-management, dependency-security, ../../devops/ci-cd, ../../devops/github-actions, ../../devops/environment-management, ../../backend/backend-authentication, ../../security-review, security-regression-testing.
Related Knowledge
../../../knowledge/ (secret inventory, owning systems).
Related References
../../../references/security/ (scan patterns, when populated).
Context Loading Guidance
- Requires: repo + history, CI config, images, bundles, store design.
- Does not require: app feature logic, the secret values in clear.
- May load:
../../devops/secrets-management, dependency-security.
- Stop when: exposures are confirmed, rotated, and recurrence-guarded.
Token Efficiency Guidance
The findings table (location, type, live?, reach, rotation status) is the artifact — never the secret values themselves.
1---2name: secrets-audit3description: Use to audit for exposed secrets — scanning code, config, git history, logs, images, and client bundles for credentials/keys/tokens; confirming exposure; and driving rotation (not just deletion). Auditing existing exposure; secrets-management is the design/build skill.4---56# Secrets Audit78## Purpose910Find secrets that have leaked or could leak — in code, config, **git history**, logs, images, and client bundles — confirm real exposure, and drive **rotation** of anything exposed. A committed secret is compromised; deleting it is not enough.1112## When to Use1314- Auditing an existing codebase for secret exposure, in `../../security-review`, or after a suspected leak.15- **Not** for designing secret storage (`../../devops/secrets-management`) — this finds what's already exposed.1617## Inputs1819- Repo (including history), build/CI config, deployed images, client bundles.20- The secret store design (`../../devops/secrets-management`) to compare against.2122## Discovery Questions2324- Are any secrets in the working tree (source, `.env`, config) — or in **git history** even if since removed?25- Do CI logs, error messages, or observability sinks contain secrets (`../../devops/monitoring-logging` redaction)?26- Are secrets baked into Docker image layers or shipped in client bundles (`../../devops/environment-management` public/secret boundary)?27- For each finding: is it a real, live secret, and what's the rotation/revoke path?2829## Responsibilities3031- **Scan broadly**: source, config files, `.env`s, **entire git history** (removed-but-committed secrets persist), CI/workflow files, Docker layers, and client bundles for credential/key/token patterns and high-entropy strings.32- **Confirm exposure**: distinguish real live secrets from placeholders/examples/rotated-already; assess reach (public repo? shipped bundle? shared image?).33- **Drive rotation, not deletion**: every confirmed exposed secret is **rotated/revoked** — removing it from code leaves the leaked value valid. Coordinate with the owning system (`../../backend/backend-authentication` for tokens, providers for API keys).34- **Prevent recurrence**: recommend secret scanning in CI/pre-commit (`../../devops/ci-cd`, `../../devops/github-actions`), `.gitignore`/`.dockerignore` gaps closed, and migration to the store (`../../devops/secrets-management`).35- **Handle findings safely**: never reproduce the secret value in reports/messages — reference location + type + severity only.3637## Required Workflow38391. Scan working tree, git history, CI, images, bundles.402. Confirm which findings are real, live secrets; assess reach.413. For each: drive rotation/revocation with the owning system.424. Close the leak path (ignore rules, store migration).435. Add CI/pre-commit scanning; record findings (locations, not values).4445## Decision Rules4647- History counts: a secret ever committed is exposed even if later removed — rotate it.48- Rotation is mandatory for confirmed exposure; deletion alone leaves a valid credential in the wild.49- Anything in a client bundle is public — bundle secrets are always findings.50- Prioritize by reach × privilege: a live admin key in a public repo outranks a rotated dev token.5152## Rules5354- Never print discovered secret values — location, type, severity only.55- Confirmed exposures are rotated, not just deleted.56- Recurrence prevention (CI scanning) is part of the fix.5758## Anti-Patterns5960- Deleting a committed secret from HEAD and calling it fixed (history + leaked value remain).61- Scanning only the working tree, ignoring git history.62- Pasting the found secret into the report/ticket.63- Treating bundle-shipped config as safe.64- No CI/pre-commit scanning to stop the next leak.6566## Validation Checklist6768- [ ] Scanned: working tree, git history, CI, images, bundles.69- [ ] Real exposures confirmed; reach assessed.70- [ ] Each confirmed secret rotated/revoked.71- [ ] Leak paths closed (ignore rules, store migration).72- [ ] CI/pre-commit scanning added; findings recorded without values.7374## Definition of Done7576A recorded secrets audit — everywhere secrets hide, including git history — with every confirmed exposure rotated/revoked, leak paths closed, and recurring scanning added, and no secret value reproduced in the findings.7778## Related Skills7980`../../devops/secrets-management`, `dependency-security`, `../../devops/ci-cd`, `../../devops/github-actions`, `../../devops/environment-management`, `../../backend/backend-authentication`, `../../security-review`, `security-regression-testing`.8182## Related Knowledge8384`../../../knowledge/` (secret inventory, owning systems).8586## Related References8788`../../../references/security/` (scan patterns, when populated).8990## Context Loading Guidance9192- **Requires:** repo + history, CI config, images, bundles, store design.93- **Does not require:** app feature logic, the secret values in clear.94- **May load:** `../../devops/secrets-management`, `dependency-security`.95- **Stop when:** exposures are confirmed, rotated, and recurrence-guarded.9697## Token Efficiency Guidance9899The findings table (location, type, live?, reach, rotation status) is the artifact — never the secret values themselves.