public-repo-safety-scan

Scans staged changes and working trees for secrets, credentials, and private data before public release.

1|Updated Jun 3, 2026
One-click install
npx skills add https://github.com/tanveerriaz/Skillz --skill public-repo-safety-scan-tanveerriaz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: public-repo-safety-scan
Source: https://github.com/tanveerriaz/Skillz/tree/main/skills/public-repo-safety-scan
Command: npx skills add https://github.com/tanveerriaz/Skillz --skill public-repo-safety-scan-tanveerriaz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Repositories pushed to public remotes often leak API keys, tokens, .env files, internal URLs, IP addresses, and personal or employer data. This Skill detects both machine secrets and organizational data before code goes public, and blocks unsafe commits automatically. ## Core Features & Use Cases - Secret Detection: Scans staged diffs and filenames for provider keys (sk-, sk_live_, whsec_), JWTs, database URLs with embedded credentials, and key/cert files (.pem, .key, .p12, id_rsa). - Private Data Auditing: Flags internal hostnames, private IP ranges (10.x, 192.168.x, 172.16-31.x), real personal data in fixtures, and employer/client references. - Automation: Ships an installable pre-commit hook that blocks unsafe commits and a strong .gitignore baseline covering env, key, backup, and dump patterns. - Use Case: Before open-sourcing a side project, run the scan to catch a leftover sk_live_ key in config.py and real customer emails in seed.sql, then rotate, redact, and generalize before pushing. ## Quick Start Scan my repository for secrets, credentials, and private data, then install the pre-commit hook and update my .gitignore before I make it public.

Frequently Asked Questions about public-repo-safety-scan

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I scan a git repository for secrets before pushing?▼

Scan the staged diff and working tree for patterns like sk-, sk_live_, whsec_, JWT tokens, and database URLs with embedded credentials. Also check filenames for .env, .pem, .key, and id_rsa files, and block the push on any finding until remediated.

How do I set up a pre-commit hook to block secrets?▼

Copy the provided pre-commit script to .git/hooks/pre-commit and run chmod +x on it. The hook greps staged changes for API keys, JWTs, credential-bearing database URLs, and sensitive filenames, aborting the commit if anything matches.

What should a .gitignore include to prevent leaking secrets?▼

A strong baseline covers .env and .env.* files, key and certificate extensions (.pem, .key, .p12, .pfx), SSH keys (id_rsa, id_ed25519), and backup or dump files (*.sql, *.db, *.bak) that may hide credentials or private data.

What should I do if a secret was already committed to git history?▼

Treat any exposed secret as compromised and rotate it immediately. History rewrites with git filter-repo or BFG reduce exposure but do not undo it, since the secret may already have been cloned or cached.

Are publishable or anonymous API keys safe to commit?▼

Publishable keys are technically public but should still be loaded from environment variables rather than hardcoded. This keeps environments swappable and prevents accidental mixing of live and test credentials.