Skip to content
Back to skills

Secrets Scan

ASecurity

Scan for secrets (API keys, tokens, private keys, credentials, real .env files) before committing or pushing — enforces "never commit secrets". Prefers gitleaks if installed; otherwise uses high-signal patterns. Reports findings by file:line with the value redacted. Use before any commit/push, when adding config or fixtures, or whenever asked to check for leaked secrets. Read-only.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 16, 2026
ai-agentsgogitapi

Works with

  • api

Security analysis

A100/100

Scanned October 16, 2026

npx -y skills add chipi/agentic-ai-homelab --skill secrets-scan --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Secrets Scan?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Secrets Scan
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/chipi-secrets-scan/badge)](https://www.skillsdirectory.com/skills/chipi-secrets-scan)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: secrets-scan
description: Scan for secrets (API keys, tokens, private keys, credentials, real .env files) before committing or pushing — enforces "never commit secrets". Prefers gitleaks if installed; otherwise uses high-signal patterns. Reports findings by file:line with the value redacted. Use before any commit/push, when adding config or fixtures, or whenever asked to check for leaked secrets. Read-only.
---

# secrets-scan

Catch secrets before they land in git. Enforces the non-negotiable: `.env`,
credentials, tokens, API keys — never in git, never in fixtures, never in a
commit message. **Read-only** — it never writes; it blocks by reporting.

## Scan (prefer a real scanner, else patterns)

1. **gitleaks** (preferred) — if installed:
   - staged / pre-commit: `gitleaks protect --staged --no-banner -v`
   - whole tree/history: `gitleaks detect --no-banner -v`
   If gitleaks isn't installed, say so and use the fallback.
2. **Pattern fallback** — over `git diff --cached` (staged) or the target diff.
   Redact the matched value in output. High-signal markers:
   - Provider keys: `sk-[A-Za-z0-9]{16,}`, `ghp_[A-Za-z0-9]{20,}`, `github_pat_`,
     `glpat-[A-Za-z0-9_-]{20,}`, `AKIA[0-9A-Z]{16}`, `AIza[0-9A-Za-z_-]{20,}`,
     `xox[baprs]-`, `sk-ant-`
   - Private keys: `-----BEGIN (RSA |EC |OPENSSH |DSA )?PRIVATE KEY-----`
   - Generic assignments: `(api[_-]?key|secret|token|password|passwd|bearer|auth)`
     followed by `=`/`:` and a 16+ char value
3. **`.env` guard** — flag any real `.env` (not `.env.example`) being added:
   `git diff --cached --name-only | grep -E '(^|/)\.env$'`.

## Report

- End with `SECRETS SCAN: PASS` or `SECRETS SCAN: FAIL`.
- On FAIL, list each hit as `file:line — <rule>` with the value **redacted**
  (never echo the secret). Tell the operator to remove it AND rotate — a secret
  committed to git is compromised even if later deleted.
- Don't cry wolf on obvious placeholders: `buddy-is-the-king`, `hf_xxx…`,
  `<your-…>`, `${VAR}`, `changeme`, `example`, empty values. Note them as skipped.

## Conventions this enforces

- **Never commit secrets** (rule #29). If one ever lands, treat it as compromised
  and rotate immediately.
- `.env` stays gitignored; only `.env.example` with placeholders is tracked.
- Install gitleaks for real coverage; the pattern fallback catches the common
  shapes but is not exhaustive — say so when you use it.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.