habitat-thinking/ai-literacy-superpowers/secrets-detection
Claude Code and agent skill by habitat-thinking/ai-literacy-superpowers
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Use when auditing a project for secrets committed to source control, setting up gitleaks, or hardening the "No secrets in source" harness constraint — covers scanning, baselining, configuration, and CI integration
Install
npx vskill@latest install habitat-thinking/ai-literacy-superpowers/secrets-detectionSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as habitat-thinking/ai-literacy-superpowers/secrets-detection.
Secrets Detection Audit
Overview
Secrets in source code — API keys, tokens, passwords, private keys — are one of the most common and most damaging security failures. A single committed secret can grant an attacker access to production systems, and git history means the secret persists even after the file is deleted.
Gitleaks is a SAST tool that scans git repositories for secrets using regex and entropy-based detection. It catches common patterns (AWS keys, GitHub tokens, private keys, connection strings) and supports custom rules via .gitleaks.toml.
Critical rule: Never assume a file is secret-free from visual inspection. Run the scanner. Encoded, split, or templated secrets are invisible to human review.
Audit Checklist
For every project
- [ ] Gitleaks is installed and available on the path
- [ ]
gitleaks detectruns cleanly against the current working directory - [ ] Git history has been scanned (
gitleaks detectwithout--no-git) - [ ] A
.gitleaks.tomlexists if the project has known false positives - [ ] Gitleaks runs in CI and fails the build on findings
- [ ] The HARNESS.md "No secrets in source" constraint is set to
deterministic with gitleaks as the tool
Installation
Running the Audit
Scan the working directory (no git history)
--no-git scans only the current file state, not git history. Fast and useful for commit-scope checks.
Scan the full git history
Without --no-git, gitleaks walks every commit in the repository. This catches secrets that were committed and later deleted — they still exist in history and are still exploitable.
Scan only staged changes (pre-commit style)
protect mode scans uncommitted changes. Useful for pre-commit hooks.
Generate a baseline for known false positives
Then on subsequent scans, exclude baseline findings:
The baseline file should be committed to the repository. Review it carefully — every entry is a finding you are explicitly accepting.
Configuration
.gitleaks.toml — custom rules and allowlists
Create a .gitleaks.toml in the project root to customise detection:
Common allowlist scenarios
| Scenario | Allowlist approach | |
|---|---|---|
| Test fixtures with fake keys | paths = ['''testdata/'''] | |
| Documentation with placeholder tokens | regexes = ['''EXAMPLE_.*'''] | |
| Known false positive on a specific line | Add to .gitleaks-baseline.json via baseline scan | |
| Encrypted secret files (e.g. SOPS) | paths = ['''*.enc.yaml'''] |
Never allowlist a real secret. If the finding is a real key, rotate it and remove it from history using git filter-repo or BFG Repo Cleaner.
CI Integration
GitHub Actions — using the official action (SHA-pinned)
The official action scans the PR diff by default, so it only flags new secrets — not historical ones. For full-history scanning, add:
Note: The SHA above follows the pinning guidance from the github-actions-supply-chain skill. Always verify the SHA matches the tagged release before using it. Check with:
Generic CI (any platform)
Exit code 1 means findings were detected; the CI step fails.
Harness Integration
Promoting the constraint
In your project's HARNESS.md, update the "No secrets in source" constraint:
This promotion means:
- The PreToolUse hook (agent-based) still warns at write time
- The Stop hook runs gitleaks deterministically at session end
- The CI gate runs gitleaks and blocks merge on findings
- The harness-enforcer agent can invoke gitleaks directly
Adding the GC rule
Add a garbage collection entry to catch scanner regression:
Report Format
After completing the audit, produce a findings table:
Severity guide:
- Critical — real secret with production access (AWS keys, database
credentials, private signing keys)
- High — real secret with limited access (API tokens, webhook
secrets, service account keys)
- Medium — secret-like pattern that may be real (high-entropy
strings, connection strings with credentials)
- Low — likely false positive but worth confirming (example keys,
test fixtures, placeholder tokens)
Remediating Found Secrets
Finding a secret is only half the job. The remediation steps:
- Rotate the secret immediately — assume it has been compromised
- Remove from the current codebase — delete or replace with env var
- Remove from git history — use
git filter-repoor BFG Repo Cleaner - Add to `.gitignore` — prevent the file from being re-committed
- Add a baseline entry if the finding was a false positive
- Verify the fix — re-run
gitleaks detectand confirm clean
Warning: History rewriting is destructive and requires a force push. Coordinate with your team before running these commands.
What Gitleaks Cannot Catch
- Encoded or encrypted secrets — base64-encoded keys, secrets
encrypted with SOPS or similar tools, secrets split across multiple lines or variables
- Secrets in build artifacts — compiled binaries, Docker image
layers, generated configuration files not tracked by git
- Runtime environment leaks — secrets logged at runtime, exposed
via error messages, or leaked through debug endpoints
- Secrets with no known pattern — custom tokens or internal keys
that do not match any regex rule. Add custom rules to .gitleaks.toml for these.
- Secrets in non-git-tracked files —
--no-gitmode scans the
working directory, but untracked files outside the project root are not scanned
For these gaps, combine gitleaks with runtime secret detection (e.g. AWS Macie, HashiCorp Vault audit logs) and regular manual review.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingai-literacy-superpowers/skills/secrets-detection/SKILL.md
Popularity
- Repository stars
- 35
- Repository forks
- 4
- 7-day trend score
- 18
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/habitat-thinking/ai-literacy-superpowers/secrets-detection)