fix(agent): allow ZWJ emoji sequences in threat scanner (#59492) - #59701
Closed
webtecnica wants to merge 1 commit into
Closed
fix(agent): allow ZWJ emoji sequences in threat scanner (#59492)#59701webtecnica wants to merge 1 commit into
webtecnica wants to merge 1 commit into
Conversation
…#59492) U+200D (zero-width joiner) in INVISIBLE_CHARS was causing false positives for legitimate emoji ZWJ sequences like 🐈⬛ and 👨💻 in SOUL.md / AGENTS.md context files. - Add _is_extended_pictographic() helper checking Unicode category "So" + Variation Selectors + Regional Indicators - Replace blind set-based flagging of U+200D with a context-aware scan that only flags ZWJ when it does NOT join two emoji - U+200D between non-emoji characters or at boundaries is still flagged (preserving the injection-detection signal) - All 46 existing tests pass; 6 new tests added for ZWJ emoji sequences
Collaborator
Duplicate of #59503 — both make |
Contributor
Author
|
Closing as duplicate — the sweeper identified this as already covered by another PR. Thanks for the contribution! |
This was referenced Jul 28, 2026
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
U+200D (zero-width joiner) in INVISIBLE_CHARS was causing false positives for legitimate emoji ZWJ sequences (e.g. ZWJ emoji sequences) in SOUL.md / AGENTS.md context files. This PR makes the threat scanner context-aware for ZWJ: it only flags U+200D when it does not join two Extended_Pictographic (emoji) characters.
Root cause
tools/threat_patterns.py lists U+200D in INVISIBLE_CHARS, and scan_for_threats() flags any occurrence via set-intersection. The set-based approach loses position information, so legitimate ZWJ emoji sequences are indistinguishable from ZWJ-based injection tactics.
Fix
Changes
Closes #59492