Repository navigation
lab-ops-hub: judge U+0345 by its UTS-46 mapping in the container validator #610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -470,8 +470,18 @@ def _judge_idna_label(label, host): | |
| # interpreter's unicodedata is 15.0.0, so a few dozen codepoints | ||
| # assigned in later Unicode versions read as Cn here while the | ||
| # Worker's newer tables accept them (the same version skew PR | ||
| # #584 accepted for A-labels), and U+0345, which UTS-46 maps to | ||
| # a letter, reads as a leading mark here. | ||
| # #584 accepted for A-labels). | ||
| # UTS-46 mapping is not NFKC: U+0345 (combining Greek | ||
| # ypogegrammeni) maps to U+03B9 (ι, bidi class L), but NFKC | ||
| # leaves it unchanged (the mapping lives in the special-casing | ||
| # data), so the mapped host validate_crawl_url hands over still | ||
| # carries it as a combining mark (bidi NSM), legal mid-label in | ||
| # any context. Judge the UTS-46-mapped form: inside an RTL | ||
| # label the mapped letter makes the label R + L + R, a bidi | ||
| # violation the Worker refuses, while at label start the mapped | ||
| # letter is an ordinary first character, closing the former | ||
| # leading-mark over-refusal (#596). | ||
| label = label.translate({0x0345: "ι"}) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because this translation happens only inside the per-label validator, the earlier whole-host length check still measures the unmapped punycode. For example, four labels consisting of U+0345 followed by 54 Greek alphas encode to 251 characters before this mapping but 255 afterward; the container now accepts that raw host because every mapped label is individually 63 characters, whereas the Worker's explicit 253-character guard rejects its canonical hostname. Map the raw host before computing Useful? React with 👍 / 👎. |
||
| if any(_maps_to_label_separator(c) for c in label if ord(c) > 0x7F): | ||
| # A decoded A-label is judged unmapped, so the mapped-dot | ||
| # refusal in validate_crawl_url never sees this form. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_judge_idna_labelalso receives the decoded payload ofxn--labels, but UTS-46 mapping applies to raw U-label input, not after A-label decoding. Consequently, invalid A-labels such asxn--jua(decoding to U+0345) andxn--abc-blc(decoding to U+0345abc) are now translated to valid labels and accepted by the container, while Bun/WHATWG rejects both. Keep decoded A-labels on the unmapped validation path so redirects and initial requests cannot pass container validation with a hostname the Worker rejects.Useful? React with 👍 / 👎.