Skip to content
Security
Skill

/secrets-audit

Find leaked secrets in source code, Git history, build artifacts, and infrastructure — and audit the secrets-management posture preventing future leaks. Use when the user mentions 'secrets audit,' 'secret scanning,' 'leaked credentials,' 'API key in code,' 'gitleaks,'

From plugin
cybersecurity-skills
52142 skills1 agent

Claude Code

$ npx -y skills add briiirussell/cybersecurity-skills --skill secrets-audit --agent claude-code

SKILL.md

secrets-audit.SKILL.md
name: secrets-audit
description: "Find leaked secrets in source code, Git history, build artifacts, and infrastructure — and audit the secrets-management posture preventing future leaks. Use when the user mentions 'secrets audit,' 'secret scanning,' 'leaked credentials,' 'API key in code,' 'gitleaks,' 'trufflehog,' 'betterleaks,' 'git history scan,' 'secrets management,' 'vault audit,' 'rotation policy,' 'AWS Secrets Manager,' 'HashiCorp Vault,' 'Doppler,' '1Password Secrets Automation,' 'sealed-secrets,' 'External Secrets Operator,' 'secrets in MCP config,' 'API key in Claude transcript,' 'is this key public,' 'hard spend cap,' 'OpenRouter key limit,' 'vendor-held secrets,' 'secrets a vendor stores,' 'which secrets did we give that vendor,' 'allow rule,' 'settings.local.json,' 'AI subprocessor,' 'agent traces,' 'credentials sent to support,' 'what zero-data-retention does not cover,' or needs to find or prevent credential exposure."
allowed-tools: Read, Grep, Glob, WebSearch, Bash(betterleaks version), Bash(betterleaks git . --validate=false --analyze=false --redact --silent -o .security/out/betterleaks.json), Bash(betterleaks config show ids --validation), Bash(betterleaks config show ids --analysis)

Secrets Audit — Credential Exposure and Secrets-Management Review

Two halves: (1) find secrets that have already leaked into source, history, or artifacts, and (2) audit the secrets-management posture that determines whether future leaks happen.

Most secret leaks aren't "we forgot to redact" — they're "we never had a system, so every developer made up their own approach." This skill covers both the cleanup and the prevention.

Cross-references: `dependency-audit` (CI-related secrets risk in build-time exposure), `iam-audit` (workload identity federation as the alternative to long-lived keys), `owasp-audit` A04:2025 Cryptographic Failures (hard-coded secrets found during an app review), `agent-supply-chain-audit` (the skills, hooks, and MCP servers that sit next to these agent configs and can read them), `incident-triage` (its vendor-breach playbook, and the exfiltration-collector domains below as egress indicators) and `threat-hunting` (sweep for those domains), `scanner-pipeline` (gitleaks / trufflehog across full history and a whole fleet of repos, on a schedule), `personal-opsec` (the operator's own machine, where agent tokens and pasted secrets actually live), `cicd-security` (which workflows and forks can reach CI secrets).

Authorization

Scan only repositories, CI systems and machines the user owns or is authorized to audit. Remote sources (a GitHub or GitLab org, Hugging Face, a bucket) only for accounts the user owns and names here, with their own token. Never print a full secret: give the type, location, and prefix plus last four. Checking that a key is live ("Verify it's live" below) uses the key, so ask first. That includes scanners that verify: trufflehog checks every candidate with its provider unless you pass `--no-verification`, so no secret scanner is pre-approved. Ask, use the provider's read-only identity call, and never use a found credential to read data. Rotation and history rewrites are the owner's call and always prompt.

Part 1 — Find leaked secrets

Provider key prefixes (high-confidence patterns)

The most useful first sweep is grep against known provider key prefixes. False positives are low and matches are almost always real.

These list matching files (`-l`) or counts (`-c`) rather than printing the match, so the secret isn't copied into your terminal scrollback or an agent transcript. Use the masked `rg` below when you need to tell keys apart.

# Stripe
grep -rlE "(sk_live_|sk_test_|rk_live_|whsec_)[A-Za-z0-9]{20,}" . \
  --include="*.{js,ts,jsx,tsx,py,rb,go,java,php,sh,env,yml,yaml,json}"

# AWS access keys
grep -rlE "(AKIA|ASIA)[A-Z0-9]{16}" .

# AWS secret keys (40 chars, base64-y). High FP rate: lockfile integrity hashes match too. Counts per file first
grep -rcE "[A-Za-z0-9/+=]{40}" . --include="*.env*" --include="*.json" | grep -v ':0$'

# GitHub
grep -rlE "gh[pousr]_[A-Za-z0-9]{36}" .

# Google Cloud API key + service-account JSON
grep -rlE "AIza[A-Za-z0-9_-]{35}" .
grep -rln '"type": "service_account"' . --include="*.json"

# Slack
grep -rlE "xox[baprs]-[A-Za-z0-9-]+" .

# OpenAI / Anthropic
grep -rlE "sk-[A-Za-z0-9]{32,}" .
grep -rlE "sk-ant-[A-Za-z0-9_-]{90,}" .

# Generic high-entropy values in env files: variable names and line numbers, value masked to first/last 4
grep -rnE "^[A-Z_]+=[A-Za-z0-9/+=]{32,}$" . --include="*.env*" | sed -E 's/=(.{4}).*(.{4})$/=\1…\2/'

For full repo coverage, use `git ls-files` to scope to tracked files and avoid `node_modules`:

git ls-files | xargs grep -lE 'sk_live_|ghp_|AKIA[A-Z0-9]{16}|sk-ant-|AIza[A-Za-z0-9_-]{35}' 2>/dev/null

**Running these inside an AI agent session?** Every match the agent prints is written into that session's transcript (see the agent section below), which creates a new copy of the secret. List files (`-l`) or counts (`-c`), or mask the value to prefix + last 4 when you need to tell keys apart:

rg -o -r '$1…$2' '(sk_live_|rk_live_|sk-ant-|ghp_|github_pat_|AKIA|xox[baprs]-|AIza)[A-Za-z0-9_-]{8,}([A-Za-z0-9]{4})' .

Confirm the key type before rating it

A prefix match tells you the provider, not the authority. Several providers issue keys that are public by design, and the same prefix can cover both. Before rating, establish what kind of key it is and what it can do — the severity follows the authority, not the match ([references/severity-calibration.md](references/severity-calibration.md)).

| Provider | Publishable (meant for clients) | Restricted / scoped | Secret (full authority) | |---|---|---|---| | Google | `AIza…` browser / Maps / Firebase keys — fine when application restrictions (referrer, app, IP) and API restrictions are set | Same `AIza…` prefix with API restrictions; check which APIs it can call in Cloud Console →

Read more
@briiirussell
Ships withcybersecurity-skills

A collection of cybersecurity skills for AI coding agents. The AI does the heavy lifting; you bring the context about your stack and your priorities.

52142 skills1 agent
Get the whole plugin

Stars on GitHub

Momentum

stars in total
521
Star history of briiirussell/cybersecurity-skills on GitHub, a chart by star-history.com

Other skills on cybersecurity-skills.

More skills from other plugins.

api-security

api-security

Use for authorized security assessment of REST, GraphQL, WebSocket, or SOAP APIs, including discovery, authentication,…

@zhaoxuya520@zhaoxuya520Install Skill
nemoclaw-user-guide

nemoclaw-user-guide

Find official NemoClaw documentation for installation, configuration, operation, or troubleshooting. Also handles requested docs…

@nvidia@nvidiaInstall Skill

Questions about secrets-audit.

Which coding agents can use secrets-audit?
secrets-audit installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.