Skip to main content
Glama

πŸ›‘ pii-veil: Ultrafast Reversible PII & Secret Anonymizer

IMPORTANT

Need Enterprise On-Premise deployment, SOC2/HIPAA compliance logs, or custom rules? Contact our enterprise security and infrastructure team at founder@glastor.es for on-premise air-gapped VPCs, custom compliance rules, and SLAs.

pii-veil is a sub-millisecond, zero-bloat Rust engine for detecting, anonymizing, and restoring PII and secrets across LLM prompts, MCP agents, HTTP/SSE proxies, JSON/NDJSON logs, CSVs, and multi-gigabyte SQL dumps.

Designed with the 6-in-1 Multi-Market Architecture:

  1. crates/veil-core (crates.io library: pii-veil-core)

  2. crates/veil-cli (crates.io / Homebrew CLI binary + built-in MCP Server & HTTP/SSE Proxy: veil)

  3. crates/veil-ffi (crates.io C-ABI cdylib/staticlib + pii_veil.h: pii-veil-ffi)

  4. crates/veil-py (PyPI package via PyO3 & maturin: glastor-pii-veil)

  5. crates/veil-node (npm package via napi-rs: pii-veil-node)

  6. sdks/go (Go SDK + net/http DLP middleware + Rust veil mcp bridge: github.com/glastor-core/pii-veil/sdks/go)


✨ Key Capabilities

  • Reversible LLM Roundtrip & Real-Time SSE Streaming (Placeholder Mode): Replaces sensitive data with semantic tokens ([EMAIL_1], [CREDIT_CARD_1], [IBAN_1]), restores full responses in $O(N)$ via aho-corasick, or restores live token streams chunk-by-chunk ([EMA + IL_1]) via StreamingRestorer.

  • Built-in Model Context Protocol (veil mcp) & HTTP/SSE Proxy (veil proxy):

    • veil mcp: Zero-dependency JSON-RPC 2.0 MCP server over stdio exposing veil_redact, veil_restore, veil_redact_json, and veil_scan directly to Claude Desktop, Cursor, and Windsurf.

    • Official MCP Registry Name: mcp-name: io.github.glastor-core/pii-veil

    • veil proxy: Local HTTP/SSE reverse proxy (127.0.0.1:8080) that redacts outgoing LLM JSON prompts and restores incoming text/event-stream SSE or JSON responses in real time.

  • 18 Built-in Detectors with Mathematical Checksum Verification:

    • Financial: Credit Cards (Luhn checksum) and IBANs (ISO 13616 Mod-97 checksum).

    • Regional National IDs: US SSN, Spain DNI/NIE (Mod-23 letter table), Argentina CUIT/CUIL (Mod-11 weights), and Chile RUT (Mod-11 verifier).

    • Cloud, AI & Infra Secrets: Database Connection URIs (postgres://, mysql://, mongodb+srv://, redis://), Slack/Discord Webhooks, OpenAI, Anthropic, AWS, GitHub, Slack, Google API, Stripe keys, JWTs, and PEM Private Keys.

    • Network & Contact: Emails, Phones, IPv4, IPv6, and MAC addresses.

  • Authenticated Encrypted Vaults (--vault-pass): Export and restore .vault files encrypted and authenticated with a passphrase for safe storage in Redis, S3, or disk.

  • Constant-Memory Streaming (Lines, NDJSON, SQL, CSV): Anonymize and restore multi-gigabyte pg_dump SQL streams (COPY ... FROM stdin), column-aware .csv files, and .jsonl logs in $O(1)$ memory per line.


Related MCP server: mcp-brave-search

πŸš€ Quickstart

1. Interactive Demo & Benchmark (Rust CLI)

cargo run --release -p pii-veil-cli -- demo
cargo run --release -p pii-veil-cli -- bench

2. Local HTTP/SSE DLP Proxy (veil proxy)

# Start in local LLM echo/SSE simulator mode (or pass --upstream host:port)
veil proxy --listen 127.0.0.1:8080 --echo

3. Redact & Restore with Encrypted Vault (--vault-pass)

# Redact text and save an authenticated encrypted vault
veil redact \
  --text "Charge maria@startup.io (CUIT 20-12345678-6) on card 4532-0151-1283-0366" \
  --vault-out vault.enc \
  --vault-pass "my-secret-passphrase"

# Restore original values from LLM response
veil restore \
  --text "Invoice sent to [EMAIL_1] (tax ID [NATIONAL_ID_1]) for card [CREDIT_CARD_1]." \
  --vault vault.enc \
  --vault-pass "my-secret-passphrase"

4. Stream Multi-GB SQL Dumps, CSVs, or NDJSON Logs

# Anonymize a PostgreSQL dump with deterministic synthetic data (Luhn & Mod-97 valid)
pg_dump mydb | veil stream --format sql --mode synthetic --key "prod-seed" > anon_dump.sql

# Anonymize a CSV file (detects sensitive column headers like password/api_key + regex PII)
veil stream --input users.csv --output anon_users.csv --format csv --vault-out csv.vault

# Stream-restore a huge file in O(1) memory per line
veil restore --file anon_users.csv --output restored_users.csv --vault csv.vault --stream

5. Go SDK (sdks/go)

cd sdks/go
go test -v ./...

6. GitHub Action (glastor-core/pii-veil@v1)

Use pii-veil as a sub-millisecond DLP gatekeeper in any GitHub Actions workflow:

- name: πŸ›‘ PII & Secret DLP Audit
  uses: glastor-core/pii-veil@v1
  with:
    path: "."
    exclude: "examples,tests"
    fail-on-detect: "true"

7. MCP Server Setup (Claude Desktop, Cursor & Windsurf)

pii-veil ships with a zero-dependency Model Context Protocol (MCP) server (veil mcp) over stdio exposing four tools: veil_redact, veil_restore, veil_redact_json, and veil_scan.

Official MCP Registry identifier: mcp-name: io.github.glastor-core/pii-veil

pii-veil MCP server – quality and maintenance score on Glama GLASTOR pii-veil MCP server

Add to your claude_desktop_config.json, Cursor (~/.cursor/mcp.json), or Windsurf MCP config:

Using the native Rust binary (cargo install pii-veil-cli):

{
  "mcpServers": {
    "pii-veil": {
      "command": "veil",
      "args": ["mcp"]
    }
  }
}

Using Docker (< 15 MB Distroless image):

{
  "mcpServers": {
    "pii-veil": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "ghcr.io/glastor-core/pii-veil:latest", "mcp"]
    }
  }
}

8. Fuzz Testing & SemVer Contract Verification

# Run multi-thousand iteration fuzz smoke test across all boundary conditions
cargo test -p pii-veil-core --test fuzz_smoke

# Run libFuzzer targets locally (requires cargo-fuzz)
cargo fuzz run fuzz_redact
cargo fuzz run fuzz_restore
cargo fuzz run fuzz_checksums

Every pull request is mathematically audited by GLASTOR Specter against Trojan Breaking Changes. Read our SemVer Stability & Specter Contract Guarantee.


πŸ“Š Scientific Benchmarks & Independent Reproducibility

DLP Engine / Solution

Latency (p99)

RAM Footprint

LLM SSE Streaming

Network Egress

Cost Model

pii-veil (Rust / WASM)

~100 Β΅s (0.1 ms)

< 15 MB

βœ… Native Token-by-Token

0 (100% In-Process)

Open Source (Apache-2.0 / MIT)

Microsoft Presidio (Python)

~35,000 Β΅s (35 ms)

~1,200 MB (spaCy)

❌ High buffer latency

Local Python server

High Cloud Server Costs

AWS Comprehend DLP

~120,000 Β΅s (120 ms)

N/A (Cloud API)

❌ No streaming

External Cloud Egress

$0.0001 per unit (Metered)

Google Cloud DLP

~150,000 Β΅s (150 ms)

N/A (Cloud API)

❌ No streaming

External Cloud Egress

$3.00 per GB inspected

🐳 Reproduce on your own hardware: Don't trust self-reported numbers. Run the built-in apples-to-apples Docker + k6 suite comparing pii-veil vs. Microsoft Presidio under identical 2 vCPUs / 2 GiB RAM quotas right from this repo (cd benchmarks/presidio-vs-veil && ./run-pii.sh), or via glastor-core/benchmarks/pii-dlp.

For in-depth statistical Criterion reports (AVX2/NEON micro-benchmarks), see BENCHMARKS.md.


πŸ“‚ Production Examples (examples/)


βš– Trade-offs & Limitations

pii-veil is intentionally engineered for deterministic, sub-millisecond protection rather than probabilistic NLP:

  • Structured PII & Infrastructure Secrets (Tier-0 Fast Path): Emails, payment cards (Luhn), IBANs (Mod-97), regional national IDs (SSN, DNI/NIE, CUIT/CUIL, RUT), API keys, JWTs, PEM keys, and database URIs achieve near-zero false positives at ~100 Β΅s latency and < 15 MB RAM.

  • Unstructured Free-Text Names & Addresses (The Layered Defense Pattern): Rather than forcing 100% of traffic through heavy 500+ MB transformer models (which adds 50 ms of artificial lag and consumes massive GPU compute), enterprise teams use pii-veil as the Fast-Path Gatekeeper that eliminates 90%+ of structured risk, delegating only residual or flagged unstructured text to local quantized NER models (ONNX / Candle). See our architectural guide: Layered Defense & NER Architecture.

  • Encrypted Vaults & Stateless Scaling: Reversible restoration requires passing or persisting the encrypted .vault (e.g., in Redis or request-scoped memory) across distributed workers.


🏒 Enterprise & Commercial Support

Are you deploying LLMs or AI agents in production and need guaranteed compliance with GDPR, HIPAA, PCI-DSS, or SOC 2?

We offer enterprise licenses and dedicated infrastructure solutions:

  • On-Premise & Air-Gapped Deployments: Hardened Kubernetes Helm charts, high-availability sidecars, and zero-external-egress setups for banks, healthcare, and fintech.

  • Enterprise SIEM & Telemetry: Live audit streaming to Datadog, Splunk, AWS CloudWatch, and OpenTelemetry collector endpoints.

  • Custom DLP Detectors & Proprietary Rules: Tailored regex patterns, custom checksum algorithms, and domain-specific sensitive data classifications.

  • 24/7 SLA & Architecture Review: Priority engineering support, guaranteed response times, and LLM streaming pipeline benchmarking.

πŸ“© Need Enterprise On-Premise deployment, SOC 2 / HIPAA compliance logs, or custom rules? Contact us directly at: founder@glastor.es

Available Tools

4 tools
veil_redactB

Anonymizes PII and secrets in text (emails, credit cards, IBANs, API keys, DB URIs, national IDs) and stores reversible mappings in the session vault.

Inputs: text (required), mode.

veil_redact_jsonA

Sanitizes a JSON string while preserving structure, redacting both regex PII and sensitive keys (password, api_key, secret, cvv).

Inputs: json (required).

veil_restoreA

Restores placeholder tokens (e.g. [EMAIL_1], [CREDIT_CARD_1]) back to their original PII values using the active session vault or an explicit vault_json.

Inputs: text (required), vault_json.

veil_scanA

Audits text or code for PII and secrets without modifying it, returning detected spans.

Inputs: text (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 4 tools

    Disambiguation4/5

    Each tool has a distinct role: veil_redact (free text masking), veil_redact_json (structure-preserving JSON masking), veil_restore (reverse mapping), and veil_scan (read-only audit). The only mild overlap is veil_redact vs veil_redact_json, but the descriptions clearly delineate plain-text versus JSON input, so an agent can select correctly.

    Naming Consistency5/5

    All four tools share the veil_ prefix followed by snake_case verb or verb_noun forms (redact, restore, scan, redact_json). The pattern is predictable and readable, with no mixed casing or verb-style drift.

    Tool Count4/5

    Four tools map cleanly onto the redact/restore/scan lifecycle without redundancy, which suits a focused PII-masking server. It is on the lean sideβ€”there is no explicit vault-management toolβ€”but nothing feels padded or missing at the tool-count level.

    Completeness4/5

    The surface covers detection (scan), masking (text and JSON), and reversal (restore with session vault or explicit vault_json), which is the core lifecycle. Minor gaps remain: no tool to clear/list/inspect the session vault and no JSON-specific scan counterpart, but agents can work around these.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • -
      license
      Not graded
      quality
      B
      maintenance
      A Model Context Protocol server that provides read-only access to PostgreSQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.
      139,311 npm
      92,139
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that enables AI assistants to interact with GitHub via a fine-grained personal access token β€” pushing commits, managing branches, opening and merging PRs, creating issues, and reading repositories. It runs locally with no telemetry and supports a read-only mode.
      15
      1
      MIT