Skip to main content Switch to mobile version pii-prompt-firewall 0.1.0 Local, zero-dependency guardrail for LLM apps: blocks PII (Luhn cards, Verhoeff Aadhaar), API-key/secret leaks, and prompt injection before text leaves your process.
pip install pii-prompt-firewall Copy PIP instructions
Local, zero-dependency guardrail for LLM apps. Catch leaking API keys / secrets, PII (credit cards validated by Luhn, India Aadhaar validated by Verhoeff, SSN, email, phone, IP) and prompt-injection attempts — before the text is sent to an LLM, logged, or stored. Pure regex + checksum math: no network calls, sub-millisecond, nothing leaves the host.
npm i prompt-firewall # Node >= 12 pip install prompt-firewall # Python >= 3.8 Quickstart (JS)
from prompt_firewall import guard, redact, scan, FirewallBlocked try: guard(user_input) # raises on high/critical findings except FirewallBlocked as e: for f in e.result.findings: print(f.rule, f.severity, f.start, f.end) clean = redact(user_input) # "[REDACTED:credit_card] ..." Why it's real (not just regex)
Credit cards are confirmed with the Luhn checksum, so a random 16-digit order number is not flagged — far fewer false positives than naive regex scanners.
Aadhaar numbers are confirmed with the Verhoeff checksum (the real algorithm UIDAI uses).
Secret patterns cover current formats: sk-…, sk-ant-…, AKIA…/ASIA…, ghp_…, xox…, AIza…, PEM private-key blocks, JWTs.
Findings carry exact start/end offsets and a severity, so you can redact precisely.
Free (MIT): all detectors above, scan / redact / guard, custom signatures.
Pro (threat-signatures pack): ship curated, versioned signature sets (new jailbreak phrasings, cloud-vendor tokens, regional IDs) and load them with scan(text, {extraSignatures}). Sell the maintained pack + updates; the loader is free.
cd npm && node test/test.js # 13 tests cd pypi && python3 tests/test_firewall.py # 12 tests Honest limits
Regex/heuristic detection is best-effort: it will miss novel obfuscations and can false-positive on odd text. Treat it as a fast first layer, not a complete security boundary. No ML, no guarantee of catching every injection — by design it is deterministic, auditable and offline.
llm prompt-injection pii redaction security guardrail ai firewall
Development Status 4 - Beta
License OSI Approved :: MIT License
Programming Language Python :: 3
Release files for pii-prompt-firewall 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 13.6 kB
Release files / pii_prompt_firewall-0.1.0.tar.gz
Security for pii-prompt-firewall 0.1.0
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Nov 27, 2026 2 release files No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation




