Local-first deterministic security and privacy scanning CLI
Project description
PrivScan ๐
Local-First Deterministic Security & Privacy Scanner (CLI)
PrivScan is a local-first, deterministic, rule-based security and privacy auditing CLI tool that scans source code and configuration files to detect secrets, credentials, and PII (Personally Identifiable Information) using transparent YAML-driven rules.
Built for developers, security engineers, and CI/CD pipelines.
โจ Features
-
๐ Secrets Detection
- API keys (Stripe, GitHub, AWS, generic)
- Passwords & tokens
-
๐งพ PII Detection (India + Global)
- Aadhaar, PAN, Driving License
- Email addresses
- Phone numbers (India & international)
- Credit cards, passports, US SSN
-
๐ Exact Location Reporting
- File path
- Line number
- Matched value
-
๐ Multiple Output Formats
- Rich CLI table (default)
- Summary
- JSON (machine-readable)
-
๐ซ Noise Control
- Ignores virtualenvs, site-packages, build outputs
-
โ๏ธ Severity Filtering
-
๐ฆ CI/CD-Ready Exit Codes
-
๐ฆ pip-installable CLI
๐ฆ Installation (PyPI)
From pypi
pip install privscan
*Local / Development install:
git clone https://github.com/KNIHAL/PrivScan.git
pip install -e .
Verify installation:
privscan --help
๐ Usage
Basic Scan
privscan .
Scan Specific Directory
privscan src/
Minimum Severity Filter
privscan . --severity high
Summary Output
privscan . --format summary
JSON Output (Automation / CI)
privscan . --format json --output report.json
๐ค CI / Automation Mode
Fail pipeline if findings are detected:
privscan . --severity high --fail-on-findings
Exit codes:
- 0 โ No findings
- 1 โ Findings detected
Compatible with:
- GitHub Actions
- GitLab CI
- Jenkins
- Pre-commit hooks
๐ Example Output (CLI Table)
PrivScan Findings
โโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Severity โ Rule ID โ File โ Line โ Match โ Description โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ HIGH โ SECRET_STRIPE_KEY โ examples/sample_repo/app.py โ 1 โ sk_test_1234567890abcdef โ Stripe secret API key detected โ
โ HIGH โ SECRET_API_KEY โ examples/sample_repo/app.py โ 1 โ API_KEY="sk_test_1234567890abcdef" โ Hardcoded API key detected โ
โ HIGH โ SECRET_PASSWORD โ examples/sample_repo/config.env โ 1 โ DB_PASSWORD="supersecret123" โ Hardcoded password detected โ
โโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐งช Example Repository
PrivScan includes an example repository for demonstration:
privscan examples/sample_repo
This validates:
- real-world secret detection
- accurate line numbers
- low false positives
๐ง How It Works
Directory Scanner
โ
Safe File Reader
โ
YAML Rule Engine
โ
Secret / PII Detectors
โ
Location Enrichment
โ
Reporters (Table / Summary / JSON)
โ
Exit Codes
- Deterministic
- Explainable
- Fully offline
๐ Project Structure
privscan/
โโโ privscan/
โ โโโ cli/
โ โโโ scanner/
โ โโโ rules/
โ โโโ detectors/
โ โโโ engine/
โ โโโ reporter/
โโโ examples/
โ โโโ sample_repo/
โโโ tests/
โโโ pyproject.toml
โโโ README.md
๐ Rule Design Philosophy
- Prefix-based secrets (low false positives)
- Assignment-only detection
- Length & boundary checks
- Country-aware + global PII
- No entropy guessing
- No ML black boxes
๐ Project Status
Status: Stable / Complete (v1)
PrivScan is a finished, production-ready CLI tool.
Future additions (optional): - more rule packs - organization-specific policies
๐ License
MIT License
๐ค Author
Kumar Nihal Built as a demonstration of applied security engineering, deterministic rule engines, and professional CLI design.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file privscan-0.1.0.tar.gz.
File metadata
- Download URL: privscan-0.1.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9b6385f9070e82ec64605e53feda256237d2bc838c53f78504c3a0592696494
|
|
| MD5 |
8d05f204c9a202f149a371214b106b6e
|
|
| BLAKE2b-256 |
00adf3a6b02cb92d1d0841584fd225a54410c84302dc8ea1ddfe42f18f2e7ac8
|
File details
Details for the file privscan-0.1.0-py3-none-any.whl.
File metadata
- Download URL: privscan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bef61e6f258d70d6b6f801e97fc7eeef1e4929910c26fbb5881634ad901310b
|
|
| MD5 |
223d78f378424d8b822c634d3c2f4da7
|
|
| BLAKE2b-256 |
5726df1eed8331d20da7e4ed6366d44f85a71e92b18db84251eb43fc70c18af3
|