Skip to content
Security
Skill

/secrets-scan

Detect hardcoded credentials, API keys, tokens, and secrets in source code and configuration files. Use when reviewing code for leaked secrets before commit/merge, auditing a repository for credential exposure, or setting up secret detection.

BOOST
From plugin
agent-security-playbook
20018 skills6 agents
Install
$ npx -y skills add owasp/secure-agent-playbook --skill secrets-scan --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/secrets-scan

Context preview

The summary Claude sees to decide when to auto-load this skill.

Detect hardcoded credentials, API keys, tokens, and secrets in source code and configuration files. Use when reviewing code for leaked secrets before commit/merge, auditing a repository for credential exposure, or setting up secret detection.

SKILL.md

secrets-scan.SKILL.md
name: secrets-scan
description: Detect hardcoded credentials, API keys, tokens, and secrets in source code and configuration files. Use when reviewing code for leaked secrets before commit/merge, auditing a repository for credential exposure, or setting up secret detection.
license: CC-BY-4.0

Secrets Scan

Detect hardcoded secrets by following the full procedure in `plays/secrets-scan.md`.

Steps

1. **Run Automated Scanner** — Use available tools in preference order:

  • `trufflehog filesystem --directory=<path> --json` (recommended)
  • `trufflehog git file://<repo> --json` (includes git history)
  • `gitleaks detect --source=<path> --report-format=json`
  • `detect-secrets scan <path> --all-files`
  • If no scanner available, proceed with manual pattern analysis.

2. **Manual Pattern Analysis** — Search for high-confidence patterns:

  • AWS keys (`AKIA...`), OpenAI (`sk-...`), Anthropic (`sk-ant-...`), GitHub (`ghp_...`), Slack (`xoxb-...`), Stripe (`sk_live_...`), SendGrid (`SG.`)
  • Connection strings with embedded passwords (`://user:pass@host`)
  • Private keys (PEM headers), JWT secrets, database credentials
  • High-risk files: `.env`, `docker-compose*.yml`, `*.tfvars`, `terraform.tfstate`, `kubeconfig`, `.npmrc`, `.pypirc`

3. **Contextual Analysis** — For each detection: Is it real (not a placeholder/test fixture)? Is it active? What's the blast radius (service, permissions, prod vs dev, exposure duration)?

4. **Check Preventive Controls** — Verify: `.gitignore` covers sensitive files, pre-commit hooks for secret scanning, CI pipeline scanning, secrets management documentation.

**Important**: Never include actual secret values in findings. Show redacted versions only (e.g., `AKIA****EXAMPLE`). Active production secrets require immediate rotation.

Output

Scan summary, findings using `templates/finding.md`, preventive controls checklist, and immediate rotation actions if needed.

OWASP References

  • A07:2021: Identification and Authentication Failures
  • CWE-798: Use of Hard-coded Credentials
  • CWE-312: Cleartext Storage of Sensitive Information
Read more
Ships withagent-security-playbook

An open-source security playbook for AI agents. Structured, OWASP-grounded procedures that enable agents to perform security engineering tasks — from code review to AI agent security audits.

Get the whole plugin

Other skills on agent-security-playbook.