Fix email redaction before trailing periods#4
Draft
cursor[bot] wants to merge 3 commits into
Draft
Conversation
Co-authored-by: Andre Schu <Art.Int.Interface@gmail.com>
Co-authored-by: Andre Schu <Art.Int.Interface@gmail.com>
Co-authored-by: Andre Schu <Art.Int.Interface@gmail.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.
Summary
scp_mask_secretsso emails followed by a sentence-ending period are redacted instead of leaked.alice@example.com.punctuation handling.Bug and Impact
The recent linear email masker treated a trailing
.as part of the domain, then rejected the whole span because it ended in an empty label. Common prose likeContact alice@example.com.was returned unredacted, leaking PII through the LLM06 masking path.Root Cause
The domain scanner consumed every
.while scanning, including punctuation after the TLD. Validation later rejectedexample.com.as an invalid domain instead of maskingexample.comand leaving the period outside the email span.Fix
Stop scanning the domain when a
.is not followed by a valid domain-label character, preserving the punctuation while redacting the email span.Validation
PYTHONPATH=src python3 -m pytest tests/test_security_regressions.py::test_mask_email_before_sentence_periodPYTHONPATH=src python3 -m pytest