feat(pii): restore request-scoped pseudonyms - #11272
Open
localai-org-maint-bot wants to merge 1 commit into
Open
feat(pii): restore request-scoped pseudonyms#11272localai-org-maint-bot wants to merge 1 commit into
localai-org-maint-bot wants to merge 1 commit into
Conversation
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
Collaborator
|
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. |
Collaborator
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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