npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

Iโ€™ve always been into building performant and accessible sites, but lately Iโ€™ve been taking it extremely seriously. So much so that Iโ€™ve been building a tool to help me optimize and monitor the sites that I build to make sure that Iโ€™m making an attempt to offer the best experience to those who visit them. If youโ€™re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, ๐Ÿ‘‹, Iโ€™m Ryan Hefnerย  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If youโ€™re interested in other things Iโ€™m working on, follow me on Twitter or check out the open source projects Iโ€™ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soonโ€“ish.

Open Software & Tools

This site wouldnโ€™t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you ๐Ÿ™

ยฉ 2026 โ€“ย Pkg Stats / Ryan Hefner

secret-sweep

v1.0.0

Published

๐Ÿ” Scan your entire git history for accidentally committed secrets. Rotate, fix, and prevent credential exposure.

Readme

๐Ÿ” secret-sweep

Scan your entire git history for accidentally committed secrets. Find, report, and rotate leaked credentials โ€” before attackers do.

npm version License: MIT TypeScript Node.js >= 18 CI


  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ
  โ–ˆ                                                    โ–ˆ
  โ–ˆ     ๐Ÿ”  secret-sweep โ€” Secret Scanner              โ–ˆ
  โ–ˆ         Protect your git history                   โ–ˆ
  โ–ˆ                                                    โ–ˆ
  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ

  Repository: /home/user/my-project
  Branch:     main
  Risk Level: โ–ˆโ–ˆ CRITICAL RISK โ–ˆโ–ˆ

  Commits scanned:  1,247
  Files scanned:    3,891
  Scan duration:    4.2s

  Secrets Found
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  ๐Ÿ”ด CRITICAL (rotate NOW)        3
  ๐ŸŸ  HIGH     (rotate today)      7
  ๐ŸŸก MEDIUM   (investigate)       2
  โšช LOW      (review)            1

  Currently in HEAD:  โ–ˆโ–ˆ 3 โš ๏ธ
  History only:       10

The Problem

You pushed .env to GitHub three months ago. You deleted it in the next commit. But it's still in git history โ€” readable by anyone who clones your repo.

Every secret that was ever committed to git is still there. secret-sweep finds them all.


Features

๐Ÿ” Deep History Scan

Walks your entire git commit history โ€” not just the current files. Finds secrets in deleted files, reverted commits, old branches, everything.

๐ŸŽฏ 60+ Secret Patterns

Detects credentials across every major platform:

| Platform | Secrets Detected | |---|---| | โ˜๏ธ AWS | Access Key ID, Secret Key, Session Token | | ๐Ÿ”ต GCP | API Keys, Service Account JSON, OAuth Secrets | | ๐Ÿ”ท Azure | Storage Keys, Client Secrets, Connection Strings | | ๐Ÿ™ GitHub | PATs (classic + fine-grained), OAuth Tokens | | ๐Ÿ’ณ Stripe | Secret Keys, Publishable Keys, Webhook Secrets | | ๐Ÿค– OpenAI | API Keys (all formats) | | ๐Ÿง  Anthropic | Claude API Keys | | ๐Ÿ’ฌ Slack | Bot Tokens, User Tokens, Webhooks | | ๐ŸŽฎ Discord | Bot Tokens, Webhook URLs | | ๐Ÿ“ฑ Twilio | Account SIDs, Auth Tokens | | ๐Ÿ“ง SendGrid | API Keys | | ๐Ÿ”ฅ Firebase | API Keys, Admin SDK Keys | | ๐Ÿ—„๏ธ Databases | PostgreSQL, MySQL, MongoDB, Redis connection strings | | ๐Ÿ”‘ SSH/TLS | Private Keys (RSA, EC, DSA, OpenSSH), PGP Keys | | ๐ŸŽซ JWT | Secrets, Live Tokens | | ๐Ÿ“ฆ NPM | Access Tokens, .npmrc auth tokens | | + more | Vercel, Netlify, Heroku, Cloudflare, Shopify, Datadog... |

๐Ÿšฆ Severity Classification

Every finding is rated CRITICAL / HIGH / MEDIUM / LOW based on the potential blast radius.

 CRITICAL  AWS Access Keys, Stripe Live Keys, Private SSH Keys
 HIGH      GitHub PATs, Slack Tokens, DB Connection Strings
 MEDIUM    Webhooks, JWT Tokens, Generic API Keys
 LOW       Publishable Keys, Low-confidence Matches

๐Ÿ”„ Exact Rotation Instructions

Every finding includes:

  • Direct link to the credentials page for that service
  • Step-by-step instructions for rotating the specific credential
  • Priority ordering โ€” CRITICAL secrets first

๐Ÿ“Š Multi-Format Reports

  • Console: Beautiful color-coded terminal output
  • HTML: Shareable visual report for your team
  • JSON: Machine-readable for automation and SIEM integration

๐Ÿช Pre-commit Hook

Block secrets from being committed in the first place:

secret-sweep install-hook

๐Ÿคซ Allowlist Support

Mark known false positives in .guardianignore to keep scans clean:

[
  {
    "patternId": "generic-secret",
    "filePath": "tests/fixtures/",
    "reason": "Test fixtures contain fake secrets"
  }
]

Quick Start

Install

npm install -g secret-sweep

Scan your repo

# Full git history scan (recommended)
secret-sweep scan

# Scan a specific repo
secret-sweep scan /path/to/your/repo

# Quick scan of current files only
secret-sweep check

Example output

  โš  LIVE IN HEAD   ยท  a3f91bc  ยท  2024-11-14
  File: config/database.yml
  Commit: Add production database config

    CRITICAL   AWS Access Key ID
    Line 12:  aws_access_key_id: AKIA...MPLE (12 chars)
    Value:    AKIA...MPLE
    Confidence: 99%
    Rotate at: https://console.aws.amazon.com/iam/home#/security_credentials
    Action:   Go to IAM โ†’ Security Credentials โ†’ Deactivate key โ†’ Create new key

  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

CLI Reference

secret-sweep [command] [options]

Commands:
  scan [path]       Full git history scan (default: current directory)
  check [path]      Quick scan of current files only
  install-hook      Install pre-commit git hook
  init-ignore       Create .guardianignore allowlist file
  patterns          List all 60+ detectable secret patterns

Options (scan):
  -b, --branch <branch>      Branch to scan (default: current)
  --since <commit>           Scan commits after this hash
  --max-commits <n>          Limit number of commits scanned
  --min-severity <level>     LOW | MEDIUM | HIGH | CRITICAL (default: LOW)
  --include <patterns>       Only scan matching file paths
  --exclude <patterns>       Skip matching file paths
  --format <formats>         console,json,html (default: console)
  --output-dir <dir>         Report output directory
  --ci                       Exit code 1 if secrets found (for CI pipelines)
  -q, --quiet                Summary only, no detailed findings
  --allowlist <file>         Custom allowlist file

CI Integration

# GitHub Actions
- name: Scan for secrets
  run: npx secret-sweep scan --ci --min-severity HIGH
# GitLab CI
secret-sweep scan --ci --format console,json --output-dir reports/

Pre-commit Hook

secret-sweep install-hook
# Now secrets are blocked before every commit

How It Works

git log (full history)
      โ”‚
      โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Git Walker     โ”‚  โ† iterates every commit, every changed file
โ”‚  (git diff-tree)โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚  file content at each commit
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Pattern Engine โ”‚  โ† 60+ regex patterns with confidence scoring
โ”‚  (60+ patterns) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚  raw matches
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Filter Layer   โ”‚  โ† false positive removal, allowlist, dedup
โ”‚  (confidence +  โ”‚
โ”‚   allowlist)    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚  verified findings
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Risk Engine    โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Console โ”‚     โ”‚   HTML   โ”‚
โ”‚  (severity,     โ”‚     โ”‚  Report  โ”‚     โ”‚  Report  โ”‚
โ”‚   rotation,     โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚          โ”‚     โ”‚          โ”‚
โ”‚   recs)         โ”‚     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ–ผ
    JSON / SARIF

Comparison

| Tool | History Scan | 60+ Patterns | Rotation Guide | HTML Report | Pre-commit Hook | Free | |---|:---:|:---:|:---:|:---:|:---:|:---:| | secret-sweep | โœ… | โœ… | โœ… | โœ… | โœ… | โœ… | | GitHub Secret Scanning | โœ… | โœ… | โŒ | โŒ | โŒ | โš ๏ธ Teams+ | | truffleHog | โœ… | โœ… | โŒ | โŒ | โœ… | โœ… | | gitleaks | โœ… | โœ… | โŒ | โŒ | โœ… | โœ… | | detect-secrets | โŒ | โœ… | โŒ | โŒ | โœ… | โœ… |

secret-sweep's edge: Rotation instructions + HTML reports + zero configuration needed.


FAQ

Does it send my code anywhere? No. secret-sweep runs entirely locally. No network calls, no telemetry, no SaaS.

Will it slow down my team's workflow? The pre-commit hook only scans changed files โ€” typically under 0.5s per commit.

What about .env.example files? secret-sweep detects placeholder-looking values and reduces their confidence score. You can also allowlist entire paths in .guardianignore.

How do I purge a secret from git history? secret-sweep will tell you exactly which commits are affected. Use git-filter-repo to rewrite history:

pip install git-filter-repo
git-filter-repo --invert-paths --path .env
git push --force-with-lease

Contributing

git clone https://github.com/SergiuPogor/secret-sweep.git
cd secret-sweep
npm install
npm run dev

PRs welcome โ€” especially new patterns! Add them to src/scanner/patterns.ts with a test.


License

MIT ยฉ 2026 Sergiu Pogor


Found a secret in your history? Star the repo after you rotate it. ๐Ÿ”‘

Star