2 ms·
What's needed is to impose on programming languages, outside of comments, checks similar to the checks made for domain names. There is a draft standard for thi
by Animats 5y ago
What's needed is to impose on programming languages, outside of comments, checks similar to the checks made for domain names.
There is a draft standard for this.[1] It references RFC 5893 and some other documents. Some of the rules:
- All code points in a single label must be taken from the same script as determined by the Unicode Standard Annex #24: Script Names. Exceptions to this guideline are permissible for languages with established orthographies and conventions that require the commingled use of multiple scripts. (Like mixing kanji and romaji in Japanese.)
- The "Bidi rules" of RFC 5893, which define allowed right to left and left to right modes, must be enforced. These are complicated, because of such things as the Arabic and Hebrew convention of right to left text with left to right numeric digits in numbers. But they are well-defined.
- Only code points allowed by IDNA 2008 are allowed. This eliminates such things as the non-breaking zero width space, the expansion areas for future use, and such.
The domain name people have been banging on this problem since 2003, and by now, there's a rough consensus of what to disallow. So start putting checks for that in compilers. If you find violations of those rules, it's more likely to be a typo than something useful, anyway.
So that's a way out of this.
[1] https://www.icann.org/en/system/files/files/draft-idn-guidelines-03mar17-en.pdf https://www.icann.org/en/system/files/files/draft-idn-guidel...
- varajelle 5y ago> What's needed is to impose on programming languages, outside of comments, checks similar to the checks made for domain names. But this attack works by placing characters inside comments and srings. So these checks would not help preventing this particular attack.
- Animats 5y agoThey say that, but don't really justify that claim. That's more about string literals that do something other than just display, such as URLs.