feat(pii): restore request-scoped pseudonyms - #11272
feat(pii): restore request-scoped pseudonyms#11272localai-org-maint-bot wants to merge 2 commits into
Conversation
|
I think the name could be better. Something like "reversible redactions" or there may be a common term in usage for this already. In the docs I think we should note that doing this makes it easier for a third party to reverse the redactions as well. |
|
markers like EMAIL_001 are very likely to collide with other text in the model output like [REDACTED:EMAIL_001] or similar won't, although the model may choose to remove the REDACTED part. Wrapping the ID with a prefix and postfix should probably be config options. |
Replace masked request values with unique per-request tokens when response restoration is enabled, then restore them across JSON and SSE write boundaries. Document the opt-in model setting and expose it in config metadata.\n\nAssisted-by: Codex:gpt-5
Use configurable token delimiters to avoid restoring ordinary model text that happens to match an internal identifier. Rename the option and document the confidentiality tradeoff. Assisted-by: Codex:gpt-5
54e7666 to
625ca71
Compare
|
Addressed both review points in 625ca71: the option is now named |
Description
Closes #9535.
Adds opt-in
pii.reverse_in_responsehandling to the existing detector-driven PII middleware. Masked request values become unique, deterministic pseudonyms within the request (EMAIL_001,EMAIL_002) and are restored if the backend returns them. Restoration works for normal JSON and SSE tokens split across response writes; substitution maps remain request-local and are never persisted.The model config metadata and middleware documentation expose the new toggle. Existing irreversible
[REDACTED:...]behavior remains the default.Notes for Reviewers
go test ./core/services/routing/pii ./core/config/metago vet ./core/services/routing/pii ./core/config/metacore/configsuite reaches 433/434 specs; its pre-existing remote-config validation spec fails becauseraw.githubusercontent.comreturns HTTP 403 in this runner.Signed commits