Title: lab-ops-hub: container validator's overlong-name check counts characters, not IDNA-encoded length — IDN labels/names over the RFC 1035 limits still pass in Python while the Worker refuses them · Issue #517 · developing-today/code · GitHub
Open Graph Title: lab-ops-hub: container validator's overlong-name check counts characters, not IDNA-encoded length — IDN labels/names over the RFC 1035 limits still pass in Python while the Worker refuses them · Issue #517 · developing-today/code
X Title: lab-ops-hub: container validator's overlong-name check counts characters, not IDNA-encoded length — IDN labels/names over the RFC 1035 limits still pass in Python while the Worker refuses them · Issue #517 · developing-today/code
Description: Summary PR #514 (fix for #513) added the RFC 1035 §2.3.4 length check to both lab-ops-hub crawl validators, but the container check in pkgs/lab-ops-hub/container/app.py counts characters of the raw host, while the Worker's check in pkgs/...
Open Graph Description: Summary PR #514 (fix for #513) added the RFC 1035 §2.3.4 length check to both lab-ops-hub crawl validators, but the container check in pkgs/lab-ops-hub/container/app.py counts characters of the raw...
X Description: Summary PR #514 (fix for #513) added the RFC 1035 §2.3.4 length check to both lab-ops-hub crawl validators, but the container check in pkgs/lab-ops-hub/container/app.py counts characters of the raw...
Opengraph URL: https://github.com/developing-today/code/issues/517
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"lab-ops-hub: container validator's overlong-name check counts characters, not IDNA-encoded length — IDN labels/names over the RFC 1035 limits still pass in Python while the Worker refuses them","articleBody":"## Summary\n\nPR #514 (fix for #513) added the RFC 1035 §2.3.4 length check to both lab-ops-hub crawl validators, but the container check in `pkgs/lab-ops-hub/container/app.py` counts **characters of the raw host**, while the Worker's check in `pkgs/lab-ops-hub/src/lib.ts` counts the **punycode (IDNA-encoded) form**, because `u.hostname` there is already punycode. For non-ASCII (IDN) hosts the two lengths differ, so the container validator still certifies IDN names that are over the limits — exactly the hosts #513's acceptance criteria said must be refused \"with any label > 63 (**encoded**) characters\", with both validators \"matching each other's verdicts\".\n\nThe Python code's own comment states the gap's safe half only: character length is a lower bound on the encoded length, so the check can never *over*-refuse. It can and does *under*-refuse: an IDN label whose characters fit in 63 but whose punycode exceeds 63 octets passes the container validator as \"a public DNS name\" and then fails deep inside the fetcher when the IDNA encoder rejects it — the lazy-failure shape #513/#502/#507 exist to eliminate. Python's own `str.encode(\"idna\")` raises `UnicodeError: label empty or too long` for the probe label below.\n\n## Evidence (verified on current main `bf642287`, driving both real validators)\n\nContainer `validate_crawl_url` (`pkgs/lab-ops-hub/container/app.py`, overlong check at lines 69–74, comment at 60–68):\n\n```python\nif \":\" not in host and (\n len(host) > 253 or any(len(label) > 63 for label in host.split(\".\"))\n):\n```\n\n`host` here is `urlparse(...).hostname.lower()` — the raw spelling, never IDNA-encoded anywhere in the validator.\n\nProbes (label = consecutive CJK codepoints U+4E00, U+4E01, …):\n\n| Host form | Char length | IDNA-encoded length | TS Worker | Python container |\n| --- | --- | --- | --- | --- |\n| `http://\u003c42-char CJK label>.com/` | label 42 | label 65 | **BLOCK** (overlong) | **ALLOW** |\n| `http://\u003c5 labels × 40 CJK chars>/` | name 204 | name 309 | **BLOCK** (overlong) | **ALLOW** |\n\nControls that must stay allowed on both sides: a 63-char ASCII label, a 253-char ASCII name (both pinned by PR #514's own tests), valid IDN hosts within the encoded limits (e.g. `examéple.com/`, and a 40-char CJK label whose IDNA form is 61 chars — ALLOW/ALLOW today).\n\n- PR: https://github.com/developing-today/code/pull/514, commit `f7311bb1e609d196a8f521738096973361c3f7a7`, merged as `c7a00eee8323e11e0fe545bf6c80d7f026c190b5`.\n- Origin issue #513 (CLOSED by #514) acceptance: \"Both validators refuse a host with any label > 63 (encoded) characters and a host whose full name is > 253 characters … matching each other's verdicts.\"\n- Distinct from open #516, which is about IDNA-**disallowed characters** (space separators, bidi/format controls, U+FFFD), not encoded length.\n- Cross-repo: the validator pair lives only in developing-today/code (the #510/#513 cross-repo checks found no twin in the opencode, openchamber or dezren39/nix clones), so this is a single-repo issue.\n\n## Why it matters\n\nThe container validator is the defence-in-depth re-check on the component that actually fetches (#441), and the parity premise of #468/#502/#505/#507/#510/#513 is that where the two validators disagree, the effective policy is the weaker one. For IDN hosts the container's length check is materially weaker: over-limit names are certified as public DNS names and die inside the fetcher's IDNA/resolver step with a low-level `UnicodeError` instead of the validator's clear up-front refusal.\n\n## Acceptance criteria\n\n- `validate_crawl_url` refuses, up front with the existing overlong-name error, a host whose **IDNA-encoded** label exceeds 63 octets or whose IDNA-encoded full name exceeds 253 characters (e.g. by judging the labels after per-label `idna`/punycode encoding, treating an encoding failure for length as a refusal).\n- Controls unchanged: 63-char ASCII label / 253-char ASCII name still accepted; valid IDN hosts within the encoded limits (including a 40-char CJK label, IDNA length 61) still accepted on both sides.\n- A regression test in `pkgs/lab-ops-hub/test/test_container_validate.py` covers the encoded-overlong label and encoded-overlong name cases plus an at-encoded-limit IDN control, and fails with only `container/app.py`'s length check reverted to character counting (ablation).\n- `npm test` in `pkgs/lab-ops-hub` passes (TS + Python), and a differential probe over ASCII at/over-limit and IDN at/over-encoded-limit hosts shows TS/Python verdict parity.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-22T00:30:04Z","url":"https://github.com/developing-today/code/issues/517"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:66c10744-7302-2e12-462e-062997923c27 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC02:395268:867660:AE02C1:6B062C66 |
| html-safe-nonce | b8db3aa17eb7140b97ee7837147cfd0c0b1bfeda220378b1022b81a413815989 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzAyOjM5NTI2ODo4Njc2NjA6QUUwMkMxOjZCMDYyQzY2IiwidmlzaXRvcl9pZCI6IjkxNDY4NDA1MTQ2MTkxMjQ4MzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ffad90055ad251131bc13601fb95ce13e7de27ff3fa9841ef4cb0744cc252cfc |
| hovercard-subject-tag | issue:5970770800 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/517/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7181e6df73931a2bdc5884af8fa3ef6bfc9767bb3cdce1520c3feda499faedaf/developing-today/code/issues/517 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7181e6df73931a2bdc5884af8fa3ef6bfc9767bb3cdce1520c3feda499faedaf/developing-today/code/issues/517 |
| og:image:alt | Summary PR #514 (fix for #513) added the RFC 1035 §2.3.4 length check to both lab-ops-hub crawl validators, but the container check in pkgs/lab-ops-hub/container/app.py counts characters of the raw... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7f961de5dd5c5d4aca24d33f8b3ffb3fb8b2ef53d0a4f32f01f0a790e512f6d3 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 494ea0bb1e0feef734a83e2628697647755e8864 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width