RepoShield 🔐
AI-assisted pre-commit security scanner for Git repositories.
RepoShield catches secrets, vulnerable dependencies, and hygiene issues before they reach your repository — with optional AI-powered false-positive reduction via Claude.
The Problem
Developers accidentally commit API keys, passwords, private certificates, and cloud credentials every day. One leaked secret can mean a compromised AWS account, a data breach, or worse. RepoShield sits at the last line of defense — the pre-commit hook — and stops secrets before they ever touch your Git history.
Features
- 🔑 Secret Detection — AWS keys, GitHub tokens, OpenAI keys, database URLs, private keys, JWT secrets, Stripe keys, and 15+ other patterns
- 🧠 AI Context Analysis — Claude distinguishes real secrets from test fixtures and placeholders, eliminating false positives
- 📦 Dependency Scanning — CVE detection via
pip-auditandnpm audit - 🧹 Git Hygiene — detects tracked
.envfiles, missing.gitignoreentries, credentials in remote URLs - 📊 Security Health Score — category scores across Secrets, Dependencies, Git Hygiene, and Configuration
- ⚡ Fast — non-AI path completes in under 2 seconds for typical repos
- 🪟 Cross-platform — works on Windows, macOS, and Linux
Installation
pip install reposhield
Or with pipx for an isolated global install:
pipx install reposhield
Quick Start
# Install the pre-commit hook in your repo
cd your-project
reposhield init
# That's it — every git commit is now scanned automatically
git commit -m "update config" # RepoShield runs before the commit is created
Usage
reposhield scan # scan all tracked files
reposhield scan --staged # scan only staged files
reposhield scan --ai # enable AI false-positive filtering
reposhield scan --json # machine-readable output for CI
reposhield init # install pre-commit hook
reposhield init --ai # install AI-enabled hook
reposhield uninstall # remove the hook
reposhield version # show version
Example Output
╭─────────────────────────────────────────────────╮
│ RepoShield Security Scan · BLOCKED │
│ Scanned 2 files · 9 issues found · 0.06s │
╰─────────────────────────────────────────────────╯
Security Health Scores
╭────────────────────┬───────┬────────────╮
│ Secrets Management │ 0 │ Critical │
│ Dependency Safety │ 100 │ Excellent │
│ Git Hygiene │ 70 │ Good │
│ Overall │ 68 │ Needs Work │
╰────────────────────┴───────┴────────────╯
CRITICAL Potential AWS Access Key ID — config.py:1
CRITICAL Potential Database URL — config.py:3
HIGH Sensitive file tracked by Git: .env
Commit blocked. Resolve critical/high findings above.
To skip (not recommended): git commit --no-verify
AI Mode
Set your Anthropic API key to enable AI-powered context analysis:
export ANTHROPIC_API_KEY=sk-ant-...
reposhield scan --ai
The AI analyzes each finding in context and determines whether it's a real secret or a harmless placeholder — for example, distinguishing api_key = "your_key_here" (fake) from api_key = "sk-proj-xK9m..." (real). Verdicts are cached locally at ~/.reposhield/ai_cache/ to avoid redundant API calls.
Configuration
Create .reposhield.toml in your repository root to customize behaviour:
[general]
block_on_critical = true
block_on_high = true
exclude_patterns = ["docs/**", "*.md"]
[ai]
enabled = false # override with --ai flag or ANTHROPIC_API_KEY
[ignore]
files = ["tests/fixtures/sample_secrets.py"]
rules = ["HIGH_ENTROPY"]
How It Works
git commit
↓
pre-commit hook
↓
┌──────────────────────────────────────┐
│ Pattern scanner (regex + entropy) │
│ Dependency auditor (pip/npm) │
│ Git hygiene checker │
│ AI context analyzer (optional) │
└──────────────────────────────────────┘
↓
Risk scorer → Terminal report
↓
Block or pass
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Clean — no blocking issues found |
| 1 | Blocked — critical/high findings require attention |
Contributing
Contributions are welcome. Please open an issue first to discuss major changes.
git clone https://github.com/Rishiprasad17/reposhield.git
cd reposhield
pip install -e ".[dev]"
pytest -v
License
MIT — see LICENSE for details.
Metadata
Release files for reposhield 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| reposhield-0.1.0.tar.gz | 28.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| reposhield-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 58.8 kB
Release files / reposhield-0.1.0.tar.gz
| Download URL | reposhield-0.1.0.tar.gz |
|---|---|
| Size | 28.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7249f187ba0aa06771f031e6f6252e5de8103ab29584ad7229d52c7fbf1383ba
|
|
BLAKE2b-256 checksum How to use checksums |
051da9ca19813041685f8b285f2869c6f29a84e271215f1d5be0bce5d97f93af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / reposhield-0.1.0-py3-none-any.whl
| Download URL | reposhield-0.1.0-py3-none-any.whl |
|---|---|
| Size | 30.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ad3ce2048cd2f7c050c91a1c272e5b20c87dc88d8cc8f7209edfbd4cbbec1e7
|
|
BLAKE2b-256 checksum How to use checksums |
87d7818f1ff46d89e6c875a6da327bcb4a43c6e3f7e48cdfea1d3c73e1f2dd03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|