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). If Presidio
can't load, it falls back to a HuggingFace transformer model
(
pip install "shieldprompt[ner]"). - 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
Metadata
Release files for shieldprompt 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| shieldprompt-0.1.5.tar.gz | 38.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shieldprompt-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 62.2 kB
Release files / shieldprompt-0.1.5.tar.gz
| Download URL | shieldprompt-0.1.5.tar.gz |
|---|---|
| Size | 38.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45a5171982b184668b5f393a3a9540b18c15a1e494f46532add47469b502d06d
|
|
BLAKE2b-256 checksum How to use checksums |
1c3e95e6b3a617c51d1aebbf5585b164780e1415df562cc77622080043fddae6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / shieldprompt-0.1.5-py3-none-any.whl
| Download URL | shieldprompt-0.1.5-py3-none-any.whl |
|---|---|
| Size | 23.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52d5a7a722f99b5c182b172bb8f971c4e2a33cb32b267064d942131e7f5987e7
|
|
BLAKE2b-256 checksum How to use checksums |
a46ff8814ec831005db79ebdf8f0a28ff52a863daddb8986912a7f769a378f0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logSecurity for shieldprompt 0.1.5
Provenance
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for shieldprompt-0.1.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logA 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.