secrets-audit
Skill0 starsChanged 33 days agoMITView on GitHub
Scanning, detecting, and remediating accidentally committed secrets: runs gitleaks or trufflehog against the repo history, triages real findings from false positives, rotates the exposed credential immediately, rewrites history only when safe, and adds pre-commit hooks and CI checks to prevent recurrence. Use when you want to scan for secrets, find leaked credentials, check if I committed an API key, remove a secret from git history, add a secrets scanner to CI, or prevent secret leaks.
- Reads credentials
- Installs packages
3 other projects use a version of this.
Adopted by
Most recently taken up by
- briiirussell/cybersecurity-skillstheir own version, first seen Nov 1, 2026
- chrisselig/claude-code-toolkittheir own version, first seen Oct 9, 2026
- imMamdouhaboammar/cybersecurity-skillstheir own version, first seen Sep 5, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- briiirussell/cybersecurity-skills★ 489same name
- chrisselig/claude-code-toolkit★ 1same name
- imMamdouhaboammar/cybersecurity-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository68 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- accessibilitySkill
- api-designSkill
- api-versioningSkill
- authSkill
- background-jobsSkill
- cachingSkill
- capacity-planningSkill
- changelogSkill
- chaos-engineeringSkill
- ci-cdSkill
- circuit-breakerSkill
- claude-best-practicesSkill
- code-commentsSkill
- code-hygieneSkill
- code-reviewSkill
- code-structureSkill
- commit-styleSkill
- concurrency-and-lockingSkill
- database-transactionsSkill
- data-consistencySkill
- debug-infra-startupSkill
- debug-sessionSkill
- demo-video-creatorSkill
- demo-video-script-creatorSkill
- dependency-injectionSkill
- dependency-updateSkill
- disk-cleanupSkill
- distributed-tracingSkill
- dockerSkill
- env-configSkill
- env-setupSkill
- error-handlingSkill
- event-driven-architectureSkill
- feature-flagsSkill
- file-storageSkill
- graceful-shutdownSkill
- idempotencySkill
- input-validationSkill
- jars-engineering-blogsmithSkill
- jars-workshop-builderSkill
- licensingSkill
- loggingSkill
- memory-and-allocationsSkill
- migrate-dbSkill
- monitoringSkill
- multi-tenancySkill
- notificationsSkill
- openapiSkill
- paginationSkill
- perf-profileSkill
- pr-descriptionSkill
- query-optimizationSkill
- rate-limitingSkill
- refactorSkill
- releaseSkill
- runbook-writerSkill
- searchSkill
- simplifySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 59
Use --only-verified to focus on credentials that are provably still active.
- Distinctive: line 72
Never ignore a finding without confirming it is a false positive.
- Very specific: line 82
Update the new value in your secrets manager or .env file (never hardcode the replacement).
- Distinctive: line 83
Verify the service still works with the new credential.
- Distinctive: line 128
Commit this file to the repo so the team benefits from the same allowlist.
- Distinctive: line 197
Never paste the actual secret value into a ticket, PR, or chat — even when reporting it.
- Very specific: line 198
Do not commit .env files. Add .env to .gitignore and provide a .env.example with placeholder values.
- Distinctive: line 200
If the repo is on a shared platform (GitHub, GitLab), contact their security team — they can invalidate cached views of the old content.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
secrets-audit
Scan for committed secrets, triage findings, rotate exposed credentials, and prevent recurrence.
1. Understand the scope first
Before scanning, clarify:
- Is this a first-time audit (full history) or a pre-commit / pre-merge check (new commits only)?
- Is the repo public or private? Public = treat every finding as already exposed.
- Are there known false-positive patterns (test fixtures, example keys, docs)?
2. Scan with gitleaks
gitleaks is fast, config-driven, and scans git history without checking out every commit.
Install:
# macOS
brew install gitleaks
# Linux / Windows (grab the binary from releases)
# https://github.com/gitleaks/gitleaks/releases
# Or via Docker (no install needed)
docker run --rm -v "$(pwd):/repo" ghcr.io/gitleaks/gitleaks:latest detect --source /repoFull history scan:
gitleaks detect --source . --report-format json --report-path gitleaks-report.jsonStaged / uncommitted files only:
gitleaks protect --stagedReview gitleaks-report.json — each finding includes File, StartLine, Commit,
RuleID, Secret (masked), and Date.
3. Scan with trufflehog (alternative / second opinion)
trufflehog verifies findings against live APIs where possible, which cuts false positives.
# Full git history
trufflehog git file://. --only-verified
# A specific branch
trufflehog git file://. --branch main --only-verifiedUse --only-verified to focus on credentials that are provably still active. Remove the
flag when you want every pattern match regardless of liveness.
4. Triage findings
For each finding decide:
| Category | Signals | Action |
| Real, active | Verified by trufflehog, or matches a known service pattern | Rotate immediately (step 5), then remediate history |
| Real, already rotated | Key format matches but revoked/expired | Remediate history, no urgent rotation needed |
| False positive | Test fixture, example in docs, placeholder like EXAMPLE_KEY | Add to .gitleaks.toml allowlist |
Never ignore a finding without confirming it is a false positive.
5. Rotate the exposed credential immediately
Do this before touching git history. An attacker who already cloned the repo has the secret — rewriting history does not un-expose it.
- Go to the service's dashboard (AWS IAM, GitHub Settings, Stripe, etc.).
- Revoke / delete the exposed key.
- Issue a new credential.
- Update the new value in your secrets manager or
.envfile (never hardcode the replacement). - Verify the service still works with the new credential.
6. Remove the secret from history
Option A — BFG Repo Cleaner (recommended for simple cases):
# Replace the literal secret value everywhere in history
echo 'ACTUAL_SECRET_VALUE' > secrets-to-remove.txt
bfg --replace-text secrets-to-remove.txt
git reflog expire --expire=now --all
git gc --prune=now --aggressiveOption B — git filter-repo (more control):
pip install git-filter-repo
git filter-repo --path path/to/file/with/secret --invert-paths # remove the file entirely
# or to scrub a value from all files:
git filter-repo --replace-text <(echo 'ACTUAL_SECRET==>***REMOVED***')Only force-push after the credential is rotated and team members are warned. Coordinate with anyone who has cloned the repo — they will need to re-clone or rebase.
If the repo is public, assume the secret is permanently compromised regardless of history rewrite. Rotation is the only real mitigation.
7. Add a .gitleaks.toml to suppress known false positives
[allowlist]
description = "Known false positives"
regexes = [
'''EXAMPLE_API_KEY''',
'''test-secret-placeholder''',
]
paths = [
'''tests/fixtures/''',
'''docs/examples/''',
]
commits = [
"abc123def456", # historical commit with example key in README
]Commit this file to the repo so the team benefits from the same allowlist.
8. Add a pre-commit hook
Catch secrets before they ever enter history.
With pre-commit framework:
# .pre-commit-config.yaml
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.2
hooks:
- id: gitleakspip install pre-commit
pre-commit installWithout pre-commit framework (plain git hook):
# .git/hooks/pre-commit (make executable: chmod +x)
#!/usr/bin/env bash
gitleaks protect --staged --redact --exit-code 19. Add a CI check
Block PRs that introduce new secrets.
GitHub Actions:
# .github/workflows/secrets-scan.yml
name: Secrets Scan
on: [pull_request, push]
jobs:
gitleaks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history needed for accurate scanning
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}GitLab CI:
secrets-scan:
image: ghcr.io/gitleaks/gitleaks:latest
script:
- gitleaks detect --source . --exit-code 110. Verify and document
- Re-run
gitleaks detectafter the history rewrite — confirm zero findings (or only known allowlisted patterns). - Confirm the rotated credential is working in all environments.
- Record the incident: what leaked, when it was introduced, when it was found, and what was rotated. Even a one-paragraph note in a private doc helps with future audits.
Rules
- Rotate before you rewrite history. Order matters.
- Never paste the actual secret value into a ticket, PR, or chat — even when reporting it.
- Do not commit
.envfiles. Add.envto.gitignoreand provide a.env.examplewith placeholder values. - If the repo is on a shared platform (GitHub, GitLab), contact their security team — they can invalidate cached views of the old content.
- A pre-commit hook only protects the developer who has it installed. CI is the safety net that protects everyone.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

