Scan for exposed secrets, credentials, API keys, and sensitive data in your codebase. Use when the user says "find secrets", "scan for API keys", "exposed credentials", "endor secrets", "check for hardcoded passwords", pre-commit / staged-only secret checks, or suspects leaked tokens in code. Detects AWS keys, GitHub tokens, Stripe keys, private keys, and more. Do NOT use for code vulnerability scanning (/endor-sast) or dependency checks (/endor-sca).
90
88%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advisory
Suggest reviewing before use
| Type | Pattern | Risk |
|---|---|---|
| AWS Access Key | AKIA[0-9A-Z]{16} | Cloud compromise |
| AWS Secret Key | 40-char base64 | Cloud compromise |
| GitHub Token | ghp_, gho_, ghu_, ghs_, ghr_ | Repo access |
| GitLab Token | glpat- | Repo access |
| Slack Token | xox[baprs]- | Workspace access |
| Stripe Key | sk_live_, pk_live_, sk_test_ | Payment data |
| Google API Key | AIza[0-9A-Za-z-_]{35} | Service abuse |
| Private Key | -----BEGIN.*PRIVATE KEY----- | Auth bypass |
| Database URL | Connection strings with creds | Data breach |
| JWT Secret | jwt_secret, JWT_KEY patterns | Token forging |
| NPM Token | npm_ | Package publish |
| PyPI Token | pypi- | Package publish |
Route by intent — If the user’s wording indicates pre-commit (hook, “before I commit”, “only my staged changes”, etc.), follow § Pre-commit / staged-only path only. Otherwise follow § Default path (full repo or directory).
Use this block end-to-end for staged / pre-commit secrets checks. Do not use the scan MCP tool here.
What endorctl covers — --pre-commit-checks scopes to staged changes and filters out findings that only exist on the base branch. Do not add git show, grep, or other manual base-branch logic.
endorctl — npx -y endorctl (see CLAUDE.md / /endor-setup). --path = absolute repository root. Follow Shell and Git in rules/endor-safety.md (git -C, avoid cd … && where it causes issues).npx -y endorctl scan --path <absolute-repo-root> --secrets --pre-commit-checks -n <namespace>-n <namespace> matches ENDOR_NAMESPACE (CLAUDE.md).endorctl init / ~/.endorctl/config.yaml): omit -n if config pins the namespace.--output-type with --pre-commit-checks (unsupported). Use the CLI default output.Hydrate (optional) — If output includes finding UUIDs, call get_resource (resource_type: Finding) per UUID. Never print raw secret values. If no UUIDs, parse file / line / … from CLI text only — do not invent fields.
Present — Use § Pre-commit presentation in Step 2: Present results (two-column table, Scan mode line, no Detail blocks unless the CLI actually provides them).
Use this block for normal secrets scans (not pre-commit).
scan MCP tool
path: absolute path to repo root (or directory)scan_types: ["secrets"]scan_options: { "quick_scan": true }Hydrate — For each finding UUID from scan, get_resource (resource_type: Finding) before presenting details.
Present — Use § Default presentation in Step 2: Present results (full table + Detail when fields exist).
CLI fallback (MCP unavailable) — Only if the user confirms MCP is unavailable:
npx -y endorctl scan --path $(pwd) --secrets --output-type summaryNo base-branch filtering unless the user asks.
rules/endor-safety.md (Safety).If secrets found, lead with:
SECRETS DETECTED - {count} secret credentials found. Rotate if they were pushed or live in remote git history; if only local and never pushed, fix the code first — rotation often unnecessary unless the value was committed or otherwise exposed.
Immediate Actions:
Remediation (no literals): generic steps only — no code blocks containing secrets.
.gitignore: .env, .env.local, *.pem, *.key, credentials.jsongit log --all --full-history -- "*.env"/endor-scan — Full scan for other issues/endor-review — Pre-PR security checkFor data source policy, read references/data-sources.md.
{count} = findings from endorctl --pre-commit-checks (staged / vs-base already applied by CLI).# and Location — do not fabricate Type / Severity / Description.## Secrets Scan Results
**Path:** {scanned path} | **Secrets Found:** {count}
**Scan mode:** pre-commit (`endorctl --pre-commit-checks` — staged changes; pre-existing-on-base handled by CLI)
### Detected Secrets
| # | Location |
|---|----------|
| 1 | `config/aws.js:15` |Then append Immediate Actions, Remediation, Recommendations, and Next Steps from § Shared rules above.
get_resource (or MCP) supplies type / severity / description / location.Never output both the pre-commit two-column table and the full table in one report.
## Secrets Scan Results
**Path:** {scanned path} | **Secrets Found:** {count}
### Detected Secrets
| # | Type | Severity | Description | Location |
|---|------|----------|-------------|----------|
| 1 | AWS Access Key | Critical | Detected long-lived cloud credential | `config/aws.js:15` |
### Detail: {Finding #N}
**Location:** `{file_path}:{line}`
**Type:** {secret_type}
**Severity:** {severity}
**Description:** {finding description / risk summary — no secret literal}Then append Immediate Actions, Remediation, Recommendations, and Next Steps from § Shared rules above.
| Condition | Action |
|---|---|
Tempted to use MCP scan | Use endorctl scan … --pre-commit-checks only |
endorctl / npx fails (auth, namespace) | /endor-setup; align -n with CLAUDE.md |
| Condition | Action |
|---|---|
| Auth error | /endor-setup |
| MCP not available | /endor-setup; then CLI fallback if user confirms |
| Condition | Action |
|---|---|
| No secrets found | Confirm the scan completed; suggest periodic re-scanning |
344e7ff
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.