Skip to content

fix(security): exempt emoji subdivision-flag tag sequences from unicode_steganography (#4135) - #4144

Merged
squid-protocol merged 1 commit into
mainfrom
fix/4135-emoji-tag-flags
Oct 2, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/4135-emoji-tag-flags

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Fixes #4135

What changed

sec_unicode_steganography ("Invisible Unicode Payload Smuggling", gitgalaxy/security/security_lens.py) fired on emoji subdivision flags: England/Scotland/Wales are U+1F3F4 + TAG letters (gbeng/gbsct/gbwls) + U+E007F CANCEL TAG, a run of six Tags-block codepoints.

The regex now skips exactly one shape: a run that

  • starts immediately after U+1F3F4,
  • holds 3-7 tags from U+E0061-E007A / U+E0030-E0039 only (a CLDR subdivision id: 2-letter/3-digit region + 1-4 alphanumerics),
  • ends at U+E007F (optionally followed by one VS16), and
  • is not followed by any further invisible codepoint.

Everything else still fires on the whole run: tags with no flag base, uppercase or punctuation tags, an overlong id, a missing CANCEL TAG, or a payload trailing a real flag. A leading negative lookbehind keeps every match anchored at the start of a run, so a skipped flag can't match again from its second codepoint. The old greedy {3,} with finditer never matched mid-run either, so counts for every other input are unchanged. The signature's prefilter gate stays None, as it was.

Tests

tests/security_auditing/test_security_lens.py:

  • Negative: the three flags (bare, in a list, with a trailing VS16, and next to usca) read 0.
  • Positive: 11 smuggling shapes still count 1. A benign flag next to a separate tag payload counts only the payload.
  • Before the fix, the 3 flag cases and the flag-plus-payload case fail. After it, all pass.

Verification

  • pytest tests/security_auditing tests/tools_recorders/test_record_keeper.py: 377 passed
  • pytest tests/extraction/test_unicode_identifiers.py tests/core_engine/test_galaxyscope.py: 107 passed
  • python tests/tools/audit_check.py: all clear (ruff/format, mypy, dead-key, ast-accuracy)
  • python tests/tools/crucible_check.py (both modes): PASS, no golden-master diff. That is expected. The pinned crucible is v1.6.0, which predates language-crucible#36, so no pinned file has a tag sequence. The 4 chore(deps): bump werkzeug from 3.1.5 to 3.1.8 #36 files score 0 under the new rule (old rule: 1 hit each, from 1-5 flag runs per file).

Cross-repo

  • Companion: Re-label invisible-Unicode examples as negative controls (gitgalaxy#4135) language-crucible#38. It re-labels the 4 chore(deps): bump werkzeug from 3.1.5 to 3.1.8 #36 examples (V8 regexp-unicode-sets.js, excalidraw textWrapping.ts, flutter InputConnectionAdaptorTest.java, symfony emoji-ccp.php) as negative controls that must read 0. It changes only SOURCES.md text; no data/ file changes.
  • Merge order: this PR first. The crucible PR is docs-only and can merge any time after. Its labels describe this engine behavior.
  • After both land: the next crucible release plus the gitgalaxy pin bump (docs/self_scan/BUMPING_THE_CRUCIBLE_PIN.md) re-blesses the golden masters. Invisible Unicode Payload Smuggling should read 0 on those 4 files, not 1.

🤖 Generated with Claude Code

…de_steganography (#4135)

sec_unicode_steganography fired on the England/Scotland/Wales flags
(U+1F3F4 + TAG letters + U+E007F CANCEL TAG), a benign run of six
Tags-block codepoints. The rule now skips exactly one shape: a run that
starts right after U+1F3F4, holds 3-7 lowercase-letter/digit tags, ends
at U+E007F (optionally one VS16) and is followed by no further invisible
codepoint. Tags with no flag base, uppercase/punctuation tags, overlong
ids, a missing CANCEL TAG, or payload codepoints trailing a real flag
still fire on the whole run. A leading negative lookbehind keeps matches
anchored at a run's start so a skipped flag can't re-match mid-run.

Fixes #4135

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 583c3fa into main Oct 2, 2026
32 checks passed
@squid-protocol
squid-protocol deleted the fix/4135-emoji-tag-flags branch October 2, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unicode payload smuggling fires on emoji flag tag sequences (England/Scotland/Wales)

1 participant