Repository navigation
fix(audit): keep UUIDs intact in audit details - #14
Merged
Merged
Conversation
The PII filter ran over every string detail, and the phone-number pattern matches a UUID whose middle groups are all digits (01a137c3-6012-7345-8123-...), so a document id on record could become 01a137c3-[REDACTED:PHONE]-.... Canonical UUIDs now pass through unchanged; free text is still redacted. This is also what made test_search_is_audited_without_content_or_raw_pii fail at random (seen on #9). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Bug:
_sanitize_detailspasses every string throughredact(). The phone-number pattern matches a UUID whose middle groups are all digits, so a document id written to the HMAC-chained audit trail can come out as01a137c3-[REDACTED:PHONE]-3c51a221b759. With time-ordered UUIDs this happens at random. It is whytest_search_is_audited_without_content_or_raw_piifailed on #9, even though #9 only changescompose.yaml.Fix: values that are exactly a canonical UUID are recorded as they are. Any other text, including text that merely contains a UUID, is still redacted as before.
Tests:
tests/unit/test_audit_details.pypins a digit-only UUID, so the case no longer depends on chance. It also checks that phones and e-mails next to ids are still redacted. The fix was reproduced and verified againstcore/redaction.pybefore pushing.After this is merged, re-run the CI of #9.
🤖 Generated with Claude Code