feat(redact): validate predicate + extraSensitiveKeys seam#6
Merged
Conversation
Lets a consumer fully express its domain PII scrub as config instead of a forked redactor: a per-pattern `validate` predicate (e.g. Luhn over a card-number candidate, so a Luhn-invalid 16-digit string is left alone) and `extraSensitiveKeys` for key names the defaults miss (e.g. snake_case `api_key`). Both additive; no-options behavior is byte-identical.
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.
Widens
@tangle-network/agent-app/redactso a consumer can express its full domain PII scrub as config, not a forked redactor.RedactionPattern.validate?: (match: string) => boolean— a per-pattern predicate; the pattern fires only on a match that passes. Lets a card-number candidate be Luhn-checked, so a Luhn-invalid 16-digit string (e.g. an order id) is left alone. Honored in bothredactForIngestion(one-way) anddetectSpans(the reversible/UI path).RedactForIngestionOptions.extraSensitiveKeys?: readonly string[]— extra object-key names (case-insensitive) for keys the defaults miss, e.g. snake_caseapi_key.Both additive: with no options the output is byte-identical to before. 157 tests pass (+3 covering the Luhn predicate, the invalid-passthrough, and the extra key).
Unblocks deleting the hand-rolled card/key scrubbers in the consumers (they collapse to a single config call).
🤖 Generated with Claude Code