fix(#2873): write bidi codepoints as escapes, not literals

The invisible-Unicode scan flagged the compiled sanitizer: BIDI_RE in
install-shadow-report.cts carried literal U+202A-U+202E where its two
neighbouring regexes already used \u{...} escapes, so the module that
strips bidi controls was itself a carrier for them.

The prompt-injection-scan failure alongside it was the same defect rolling
up through the parent describe, not a second cause - verified by running
the scanner across every category it checks.

Test fixtures and property generators now name their codepoints (RLO, LRE,
PDI) instead of embedding invisible bytes, so a reviewer can see which
character is under test.

Refs #2873
This commit is contained in:
sim
2026-08-15 00:02:37 -04:00
parent 2d72577e07
commit d37e594ec8
3 changed files with 23 additions and 5 deletions

View File

@@ -173,7 +173,7 @@ const CONTROL_RE = /[\x00-\x1f\x7f-\x9f]/g;
/** Unicode bidi embedding/override controls (U+202A-U+202E) and bidi
* isolates (U+2066-U+2069) — the RTL-spoofing class the design doc's row
* #13 names. */
const BIDI_RE = /[‪-‮⁦-⁩]/g;
const BIDI_RE = /[\u{202A}-\u{202E}\u{2066}-\u{2069}]/gu;
/** Combining marks (U+0300-U+036F) — "zalgo" text. Stacked onto the
* preceding base character, an unbounded run visually overflows into