Privacy bridge for LLMs — mask PII before it leaves your machine.
Project description
ShieldPrompt
Stop leaking personal data to LLMs.
ShieldPrompt sits between your app and any Large Language Model (ChatGPT, Claude, Gemini, a local model — doesn't matter which). Before your text leaves the machine, it swaps real emails, phone numbers, names, credit cards, and other sensitive values for reversible placeholders. When the model's answer comes back, the placeholders are swapped back so your users still see the real values.
The model never sees the real data. Your users never see placeholders.
How it works
Your text: "Email alice@example.com about the invoice."
↓ ShieldPrompt masks
Sent to the LLM: "Email [EMAIL_ADDRESS_1] about the invoice."
↓ LLM answers
Model reply: "I'll draft an email to [EMAIL_ADDRESS_1]."
↓ ShieldPrompt unmasks
User sees: "I'll draft an email to alice@example.com."
Under the hood:
- Detection — a hybrid engine combines deterministic regex patterns (emails, phones, credit cards with Luhn validation, SSNs, IPs, IBANs, URLs, AWS/API keys) with Microsoft Presidio + spaCy NER for contextual entities (people, organizations, locations).
- Masking — each detected value is stored in an in-memory vault and
replaced with a stable token like
[PERSON_1]or[EMAIL_ADDRESS_2]. - Unmasking — after the LLM responds, tokens are mapped back to the real values using the same vault. The vault is scoped to the request (or session) so data never leaks between users.
ShieldPrompt ships as:
- a Python library (
Shield,@mask_piidecorator), - a FastAPI middleware for automatic protection of chat endpoints,
- a CLI (
pii,retrace,shieldprompt) for one-off file masking, - an MCP server for Claude Code, Cursor, and other MCP-aware tools.
Getting started
See SETUP.md for installation, Claude Code integration, CLI usage, the Python API, and troubleshooting.
Contributing
See CONTRIBUTING.md. All changes land through pull requests reviewed by the project owner.
License
MIT
Project details
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 shieldprompt-0.1.4.tar.gz.
File metadata
- Download URL: shieldprompt-0.1.4.tar.gz
- Upload date:
- Size: 45.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1afbed5b51f9c85e116fd14161567c4e7234cbee6f692c24fbed8d733dc8943a
|
|
| MD5 |
9afa3e00700a5b99d257db2a3d64ddb4
|
|
| BLAKE2b-256 |
951751a9cdf8c28db03a6b6180fea693080c2652e647aa0210d04db8e27abefc
|
File details
Details for the file shieldprompt-0.1.4-py3-none-any.whl.
File metadata
- Download URL: shieldprompt-0.1.4-py3-none-any.whl
- Upload date:
- Size: 23.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39e134338292438d1a8b31c9646bbec1bb4ae4809dcf2170403ef3c1022fde37
|
|
| MD5 |
f4ab9bef1c429153166b71211afc3421
|
|
| BLAKE2b-256 |
91fe048f963d1030f0405c9e5d4c56cae9f189c47cd66ed3e5b1dbd99dc78442
|