Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
jwynia avatar

Secrets Scan

  • 275 installs
  • 133 repo stars
  • Updated February 24, 2026
  • jwynia/agent-skills

secrets-scan is a security utility skill that scans repositories and changes for exposed API keys, passwords, tokens, and other credentials before merge or release so secrets do not reach production or public history.

About

secrets-scan is version 1.0 MIT utility skill by jwynia that performs deep detection of hardcoded credentials and sensitive data in source code. The SKILL.md documents CLI-style invocations such as `/secrets-scan`, `/secrets-scan --scope src/`, `/secrets-scan --entropy` for high-entropy strings, and `/secrets-scan --git-history` to inspect commits. It classifies high-confidence secret patterns including API keys, passwords, and tokens, and supports scoped directory scans for monorepos. Developers run it before pull request merge, release tagging, or after refactors that touch config files and `.env` examples. The evaluative mode fits CI pre-commit hooks and agent-assisted reviews where humans want a structured pass beyond ad hoc regex searches. It reduces incident risk from accidental credential commits without replacing dedicated secret managers or vault rotation workflows.

  • Detects tokens and API keys in code
  • Supports pre-merge and pre-release checks
  • Reduces credential leak incident risk
  • Fits agent-assisted repo review workflows
  • Encourages fast remediation of exposed secrets

Secrets Scan by the numbers

  • 275 all-time installs (skills.sh)
  • +2 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #646 of 2,203 Security skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/jwynia/agent-skills --skill secrets-scan

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs275
repo stars133
Last updatedFebruary 24, 2026
Repositoryjwynia/agent-skills

How do you scan a repo for hardcoded secrets before merge?

Scan repositories and changes for exposed API keys, tokens, and credentials before merge or release so secrets do not reach production or public history.

Who is it for?

Developers and release engineers who need a fast pre-merge credential scan with optional git-history and entropy checks.

Skip if: Teams that only need vault rotation, live secret revocation, or cloud IAM policy design without repository scanning.

When should I use this skill?

A pull request, release candidate, or refactor touches config, env samples, or credentials and needs a secrets scan before merge.

What you get

Secrets scan report, flagged file paths, entropy hits, and git-history credential findings for remediation.

  • secrets findings report
  • remediation file list

By the numbers

  • Published skill metadata version 1.0 in jwynia/agent-skills
  • Documents 4 scan modes: default, --scope, --entropy, and --git-history

Files

SKILL.mdMarkdownGitHub ↗

Secrets Scan

Deep detection of hardcoded credentials and sensitive data in source code.

Quick Start

/secrets-scan                    # Scan current directory
/secrets-scan --scope src/       # Scan specific path
/secrets-scan --entropy          # Include high-entropy detection
/secrets-scan --git-history      # Check git commit history

What This Skill Detects

High-Confidence Patterns

Patterns with very low false positive rates:

TypePattern ExampleProvider
AWS Access KeyAKIA... (20 chars)AWS
AWS Secret Key40 char base64AWS
GitHub Tokenghp_, gho_, ghu_, ghs_, ghr_GitHub
GitLab Tokenglpat-...GitLab
Slack Tokenxoxb-, xoxp-, xoxa-Slack
Stripe Keysk_live_, rk_live_Stripe
TwilioSK... (34 chars)Twilio
SendGridSG. followed by base64SendGrid
Private Key`-----BEGIN (RSA\EC\
Google API KeyAIza... (39 chars)Google

Medium-Confidence Patterns

May require context validation:

TypePatternNotes
Generic API Keyapi[_-]?key.*=.*['"][a-zA-Z0-9]{16,}Variable names
Generic Secretsecret.*=.*['"][^'"]+Context needed
Passwordpassword.*=.*['"][^'"]+May be config
Connection String://[^:]+:[^@]+@DB credentials
Bearer TokenBearer [a-zA-Z0-9_-]+In headers/code

High-Entropy Detection

Finds potential secrets via entropy analysis:

/secrets-scan --entropy

Detects strings with high randomness that may be:

  • Base64-encoded secrets
  • Hex-encoded tokens
  • Custom API key formats

Detection Patterns

Cloud Provider Keys

# AWS
AKIA[0-9A-Z]{16}                           # Access Key ID
[A-Za-z0-9/+=]{40}                         # Secret Access Key (context needed)

# Azure
[a-zA-Z0-9+/=]{88}                         # Storage Account Key

# GCP
AIza[0-9A-Za-z_-]{35}                      # API Key
[0-9]+-[a-z0-9]{32}\.apps\.googleusercontent\.com  # OAuth Client

Version Control Tokens

# GitHub
gh[pousr]_[A-Za-z0-9]{36,}                 # Personal/OAuth/User/Repo/App
github_pat_[A-Za-z0-9]{22}_[A-Za-z0-9]{59} # Fine-grained PAT

# GitLab
glpat-[A-Za-z0-9-_]{20,}                   # Personal Access Token

# Bitbucket
[a-zA-Z0-9]{24}                            # App Password (context needed)

Payment & Finance

# Stripe
sk_live_[a-zA-Z0-9]{24,}                   # Secret Key
rk_live_[a-zA-Z0-9]{24,}                   # Restricted Key
pk_live_[a-zA-Z0-9]{24,}                   # Publishable Key

# Square
sq0[a-z]{3}-[A-Za-z0-9_-]{22,}            # Access Token

# PayPal
access_token\$[a-zA-Z0-9-_.]+             # OAuth Token

Communication Services

# Slack
xox[bpas]-[0-9]{10,}-[a-zA-Z0-9]{24,}     # Bot/User/App Token

# Twilio
SK[a-f0-9]{32}                             # API Key SID
[a-f0-9]{32}                               # Auth Token (context)

# SendGrid
SG\.[a-zA-Z0-9_-]{22}\.[a-zA-Z0-9_-]{43}  # API Key

Database Connection Strings

# PostgreSQL/MySQL
(postgres|mysql|mariadb)://[^:]+:[^@]+@[^/]+/\w+

# MongoDB
mongodb(\+srv)?://[^:]+:[^@]+@

# Redis
redis://:[^@]+@

Private Keys

-----BEGIN (RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----
-----BEGIN PGP PRIVATE KEY BLOCK-----

JWT & Session

eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+   # JWT

Scan Options

Basic Scan

/secrets-scan

Scans for high-confidence patterns only.

With Entropy Analysis

/secrets-scan --entropy

Adds high-entropy string detection (more findings, some false positives).

Specific Scope

/secrets-scan --scope src/api/
/secrets-scan --scope "*.ts"

Git History Scan

/secrets-scan --git-history
/secrets-scan --git-history --since "2024-01-01"

Scans commit history for secrets that were committed and later removed.

Exclude Patterns

/secrets-scan --exclude "*.test.ts" --exclude "fixtures/"

Output Format

Finding Report

SECRETS SCAN RESULTS
====================

High-Confidence Findings: 2
Medium-Confidence Findings: 5
Entropy Findings: 3

[!] CRITICAL: AWS Access Key
    File: src/config/aws.ts:15
    Pattern: AKIAIOSFODNN7EXAMPLE
    Action: Rotate immediately, check CloudTrail

[!] CRITICAL: GitHub Token
    File: .env.example:8
    Pattern: ghp_xxxx...xxxx (redacted)
    Action: Revoke token, remove from history

[H] HIGH: Database Password
    File: docker-compose.yml:23
    Pattern: password: supersecret
    Action: Use environment variable

[M] MEDIUM: Possible API Key
    File: src/services/api.ts:44
    Pattern: apiKey = "a1b2c3..."
    Context: May be test value

Summary Statistics

Files scanned: 342
Patterns checked: 127
Time elapsed: 2.3s

By Severity:
  Critical: 2
  High: 5
  Medium: 8

By Type:
  Cloud credentials: 2
  API keys: 4
  Passwords: 3
  Private keys: 1
  Other: 5

False Positive Handling

Common False Positives

1. Example/placeholder values

  • AKIAIOSFODNN7EXAMPLE (AWS example)
  • sk_test_... (Stripe test key)
  • your-api-key-here

2. Test fixtures

  • Mock credentials in test files
  • Fixture data

3. Documentation

  • README examples
  • API documentation

Ignore File

Create .secrets-scan-ignore:

# Ignore test fixtures
**/fixtures/**
**/__mocks__/**
*.test.ts
*.spec.js

# Ignore documentation
docs/**
*.md

# Ignore specific false positives
src/constants.ts:EXAMPLE_KEY

# Inline ignore comment
# secrets-scan-ignore: test fixture

Inline Ignore

// secrets-scan-ignore: example value
const EXAMPLE_KEY = "AKIAIOSFODNN7EXAMPLE";

Remediation Steps

When Secrets Are Found

1. Immediate Actions

  • Rotate the credential immediately
  • Check access logs for unauthorized use
  • Remove from code/config

2. Clean Git History

   # Remove secret from history
   git filter-branch --force --index-filter \
     'git rm --cached --ignore-unmatch path/to/file' \
     --prune-empty --tag-name-filter cat -- --all

   # Or use BFG Repo Cleaner
   bfg --replace-text secrets.txt repo.git

3. Prevent Future Commits

  • Add pre-commit hooks
  • Configure secret scanning in CI

Prevention

# Install pre-commit hook
npx husky add .husky/pre-commit "npx secrets-scan --staged"

Integration

CI/CD Pipeline

# GitHub Actions
- name: Secrets Scan
  run: |
    /secrets-scan --fail-on-findings
    exit $?

# Exit codes:
# 0 = No findings
# 1 = Findings detected
# 2 = Error during scan

Pre-Commit Hook

#!/bin/sh
# .husky/pre-commit
files=$(git diff --cached --name-only)
/secrets-scan --files "$files"

Related Skills

  • /security-scan - Full security analysis
  • /config-scan - Configuration security
  • /dependency-scan - Package vulnerabilities

Related skills

FAQ

What commands does secrets-scan support?

secrets-scan supports `/secrets-scan` for the current directory, `--scope` for path-limited scans, `--entropy` for high-entropy detection, and `--git-history` to inspect commits. The published skill metadata lists version 1.0.

Does secrets-scan replace a secrets manager?

secrets-scan does not replace Vault, AWS Secrets Manager, or rotation tooling. It finds hardcoded credentials in source and git history so developers can remove them before merge or release.

Securitysecretsaudit

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.