A Python Zero-Trust Data Loss Prevention (DLP) CLI, library, and GitHub Pull Request API auditor that catches LGPD/GDPR PII, API keys, database passwords, and internal RFC 1918 IPs across logs, PR diffs, and screenshots before they leak.
Validates Brazilian CPF & CNPJ (mod-11 check digits) and payment cards (Luhn) to cut false positives in production logs.
Fetches unified PR diffs via the GitHub API, scans only newly added lines with exact file/line mapping, and posts masked reports.
Raw credentials are never echoed in terminal or PR comments - every match renders as a truncated safe preview (e.g., AKI***LE).
Includes pluggable TesseractOCRAnalyzer (offline) and GeminiVisionAnalyzer for multimodal image auditing.
pip install git+https://github.com/gavicoding/pii-screenshot-guard.git
# Scan files, directories, or piped diffs
pii-guard scan ./logs --fail-on medium --format markdown
git diff | pii-guard scan -
# Redact sensitive spans deterministically
pii-guard redact app.log -o app.sanitized.log
Run pii-guard github-pr in CI or locally to audit Pull Request diffs directly against the GitHub REST API (GET /repos/{owner}/{repo}/pulls/{pr}) and optionally post a masked comment via POST /repos/{owner}/{repo}/issues/{pr}/comments.
export GITHUB_TOKEN="ghp_..."
pii-guard github-pr --repo gavicoding/pii-screenshot-guard --pr 1 --format markdown --comment
| Rule ID | Scope | Severity | Validation |
|---|---|---|---|
PRIVATE_KEY_BLOCK | Secrets | CRITICAL | PEM private key header |
AWS_ACCESS_KEY | Secrets | CRITICAL | AKIA / ASIA 20-char identifier |
GITHUB_TOKEN | Secrets | CRITICAL | GitHub PAT / fine-grained token prefix |
DB_CONNECTION_STRING | Secrets | CRITICAL | URI containing user:pass@host |
CREDIT_CARD | PCI / PII | HIGH | Luhn checksum verified |
BR_CPF | LGPD PII | HIGH | Official mod-11 check digits |
BR_CNPJ | LGPD Corp | MEDIUM | Official mod-11 check digits |
INTERNAL_IPV4 | Infra Leak | MEDIUM | Strict RFC 1918 private subnets |