ninadphalak/LLM-Shield-Proxy: v1.3.0: Stateless Cryptography, MCP Governance, Air-Gapped Egress, and System Hardening
Authors/Creators
Description
Response-side PII redaction
Until now this proxy redacted the request path and, on the way back, restored its own placeholders and forwarded everything else. A value the model produced was never in the request, so it was never in the vault, and nothing redacted it.
The streaming conformance profile in benchmarks/ measured that as LeakRate 1.00 in
both fragmentation conditions.
ENABLE_RESPONSE_PII_REDACTION (default false) scans the response for PII that did
not come from the caller and redacts it, while still restoring the caller's own values.
| 1.6.0 | FidelityRate | LeakRate (1 chunk) | LeakRate (adversarial) |
| :--- | ---: | ---: | ---: |
| response redaction off | 1.00 | 1.00 | 1.00 |
| response redaction on | 1.00 | 0.08 | 0.25 |
| ... of which delta.content | 1.00 | 0.00 | 0.00 |
| ... of which sibling JSON fields | 1.00 | 0.50 | 0.50 |
Why it is off by default
It changes what callers receive. A value the model rephrases rather than quotes will not match a vault token, so it is redacted and not restored. That is a real trade against egressing model-originated PII, and it is the operator's decision. Request-path redaction is unaffected either way.
New settings
| Variable | Default | Purpose |
| :--- | :--- | :--- |
| ENABLE_RESPONSE_PII_REDACTION | false | Redact PII the model produced before the response reaches the client. |
| RESPONSE_PII_SCAN_WINDOW | 64 | Characters held back at the emit boundary so a value cannot straddle two chunks and escape a chunk-local scan. |
The window is bounded on purpose. An unbounded one is whole-response buffering, which removes the leak by removing streaming.
Sibling event fields are now scanned
Previously only choices[0].delta.content was processed, so a value carried in any other
field of the SSE event JSON reached the client untouched. This is the response-path
counterpart of the deep request walk added in 1.5.1.
Known limit, stated plainly: sibling fields are scanned chunk-locally. A value split
across two events, half in each event's sibling field, is not reassembled the way delta
content is, because sibling fields are not an ordered stream. The profile reports this as
LeakRate 0.50 on that carrier. Closing it needs one event of look-ahead, which is a
latency decision rather than a bug fix.
Behaviour on scanner failure
Response scanning does not fail closed, unlike the request path. Failing closed here would mean emitting nothing to the client, breaking the response for a scanner error rather than for a leak. The text is forwarded and the failure is logged.
Upgrading
No action required. The default preserves 1.5.x behaviour exactly. Set
ENABLE_RESPONSE_PII_REDACTION=true to opt in, and test against your own traffic first:
the trade described above is real.
Notes
Files
ninadphalak/LLM-Shield-Proxy-v1.6.0.zip
Additional details
Related works
- Is supplement to
- Software: https://github.com/ninadphalak/LLM-Shield-Proxy/tree/v1.6.0 (URL)
Software
- Repository URL
- https://github.com/ninadphalak/LLM-Shield-Proxy