Zero-width or bidirectional control characters
high
Zero-width spaces, joiners, bidi marks, no-break spaces or a mid-file BOM. They are invisible in editors but change what a string literal contains, so a pattern that looks right never matches.
Why it matters
dnsDomainIs(host, ".corp.example") with a U+200B inside the literal is a different string
from the visible one and matches nothing. The branch becomes dead code and the request
falls through to the default route. Bidi override characters (U+202E and friends) can also
make code read differently from how it executes. These characters arrive through
copy-paste from web pages, tickets and chat tools. In code position (outside strings and
comments) some of them are syntax errors; a no-break space (U+00A0) is valid whitespace in
JavaScript but still a sign of pasted text.
How to fix
Retype the affected literal; reject any byte outside 7-bit ASCII in CI (`LC_ALL=C grep -nP '[^\x00-\x7F]'`).
Examples
Bad
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, ".corp.example")) {
return "DIRECT";
}
return "PROXY proxy.corp.example:8080";
}
Open bad example in checkerGood
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, ".corp.example")) {
return "DIRECT";
}
return "PROXY proxy.corp.example:8080";
}
Open good example in checkerRelated rules
- File starts with a UTF-8 byte order mark PAC-E013
- Non-ASCII characters in code PAC-E014