Skip to content

v1.12.0 — NDJSON/XML masking + server hardening

Latest

Choose a tag to compare

@github-actions github-actions released this 13 Jun 12:28
· 2 commits to main since this release

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, xml via datashield 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/ENTITY rejected (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 Request and never kills the read loop
  • HTTP: generic error bodies that never echo input; unexpected errors → 500 without dropping the connection; bounded Content-Length handling (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-ai

Quick start

echo '{"name":"Ivan","password":"hunter2"}' | datashield redact --format json-data
# {"name":"[PERSON_1]","password":"[REDACTED]"}

Full changelog: CHANGELOG.md