Open source project / 2026
TokenGuard
A zero-dependency pre-commit scanner for detecting API keys and credentials in staged Git changes.
The problem
Developers need a fast local gate that catches tokens, private keys and high-entropy strings before commit — without sending code anywhere.
Approach
TokenGuard scans staged changes with pattern rules plus Shannon entropy analysis, and lets teams suppress accepted test credentials through an explicit baseline file.
System architecture
Pure Python standard library, zero external dependencies; results are emitted as OASIS SARIF v2.1.0 for GitHub Code Scanning integration.
Decisions & outcome
Every finding carries a severity, masked value preview, entropy score and a concrete remediation action — no vague warnings. Available on PyPI as tokenguard-cli. It scans staged changes, masks detected values in reports and supports pre-commit hooks and SARIF output.
Use Cases & CLI Reference
- Teams that want to block API keys, tokens, and high-entropy secrets in staged changes before git push via a fast local pre-commit hook.
- Python and CI pipelines that need OASIS SARIF v2.1.0 reports for GitHub Code Scanning without external binaries or SaaS uploads.
- Suppressing known test fixtures via an explicit baseline file while catching real production credential leaks with zero network calls.
# Install and scan staged changes
pip install tokenguard-cli
tokenguard scan --staged
# Emit SARIF v2.1.0 report for GitHub Code Scanning
tokenguard scan --staged --format sarif > tokenguard.sarif