Repository navigation
Releases
Releases · meloch287/data-shield-ai
v1.12.0 — NDJSON/XML masking + server hardening
Local, zero-dependency privacy layer that masks confidential data (PII, secrets, national IDs, cards, crypto addresses) before text reaches an external AI. Pure Python stdlib · 90 detectors / 83 data types · P/R/F1 = 1.0 on the eval corpus · CI green on Python 3.9–3.13.
Highlights
Structured formats — mask values while keeping structure intact, by detector and by sensitive key/column/tag name:
json-data,ndjson(JSON Lines),csv,xmlviadatashield redact --format …- NDJSON masks each line independently; an invalid line is masked as plain text — raw data is never emitted
- XML masks node text + attributes;
<password>→[REDACTED];DOCTYPE/ENTITYrejected (no entity-expansion); depth-bounded - Importable:
from datashield import redact_ndjson, redact_xml, redact_format
Hardened local servers (MCP JSON-RPC stdio + HTTP):
- MCP: a valid-JSON-non-object request returns a spec-correct
-32600 Invalid Requestand never kills the read loop - HTTP: generic error bodies that never echo input; unexpected errors →
500without dropping the connection; boundedContent-Lengthhandling (413/400/408)
Distribution: pip install data-shield-ai (zero required deps), Docker image on GHCR, PyPI Trusted Publishing (opt-in via the PUBLISH_TO_PYPI repo variable).
Install
pip install data-shield-aiQuick start
echo '{"name":"Ivan","password":"hunter2"}' | datashield redact --format json-data
# {"name":"[PERSON_1]","password":"[REDACTED]"}Full changelog: CHANGELOG.md