Skip to content

fix(lab-ops-hub): refuse DEL/C1/NBSP and WHATWG-forbidden hosts in container validator (#510) - #515

Merged
dezren39 merged 1 commit into
mainfrom
sweep/510-forbidden-host-chars
Oct 22, 2026
Merged

dezren39 merged 1 commit into
mainfrom
sweep/510-forbidden-host-chars

Conversation

@dezren39

@dezren39 dezren39 commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Fixes #510

Problem

PR #508 (#507) added an up-front host check to the container crawler's validate_crawl_url (pkgs/lab-ops-hub/container/app.py), but it stopped at ord(c) <= 0x20 — C0 controls and space only. The rest of the WHATWG forbidden-host set still fell through and was certified as "a public DNS name", while the Worker's validateCrawlUrl refuses every one of them:

  • DEL (0x7F) — also one codepoint short of http.client's own disallowed set, so the crawl died deep inside the fetcher instead of at the validator
  • C1 controls (0x80–0x9F)
  • NBSP (0xA0)
  • <, >, ^, |

Reproduced on main 025794c8 by driving the real Python validator: all nine forms ALLOW, while Node's WHATWG URL parser (the TS validator's first step) rejects every one.

Solution

Extend the existing up-front check in validate_crawl_url to refuse a host containing any character with ord(c) <= 0x20, 0x7F <= ord(c) <= 0xA0, or one of <>^|, with a clear validator error. Nothing else changes: non-ASCII above NBSP (valid IDN hosts, e.g. examéple.com), exam_ple.com, ordinary DNS names, valid IPv6 literals and public targets are still accepted on both sides.

Verification

  • New regression test test_refuses_del_c1_nbsp_and_forbidden_host_characters covers each refused class (DEL, C1 low/NEL/high, NBSP, < > ^ |) plus IDN/underscore controls.
  • npm test in pkgs/lab-ops-hub: TS 19/19 + Python 14/14 pass.
  • Ablation: with only container/app.py reverted, the new test fails (ValueError not raised for the DEL host); restored, the suite is green.
  • Differential probe driving both real validators over the issue's full battery (every printable ASCII character, 0x7F–0xA0, é, a combining character, plus the control URLs): full TS/Python parity post-fix.
  • ruff format applied (the repo's treefmt Python formatter); diff is exactly the validator check + the new test.

Single-repo: the validator pair lives only in developing-today/code (per #510's cross-repo check).

Note: an extended probe beyond the issue's battery (Unicode space separators, bidi/format controls, U+FFFD) shows a further IDNA-class divergence — filed separately as a follow-up issue rather than expanding this fix.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…ntainer validator (#510)

The #507 check stopped at 0x20: DEL (0x7F), the C1 controls
(0x80-0x9F), NBSP (0xA0) and the WHATWG forbidden host codepoints
< > ^ | still fell through validate_crawl_url as 'a public DNS
name', while the Worker's validateCrawlUrl refuses every one.

Extend the up-front check to ord <= 0x20 or 0x7F <= ord <= 0xA0 or
one of <>^|. Non-ASCII above NBSP (valid IDN hosts) is untouched.

New regression test covers each refused class plus IDN/underscore
controls; it fails with only container/app.py reverted. Differential
probe over the issue's battery (printable ASCII + 0x7F-0xA0 + é +
combining char) now shows full TS/Python parity.
@dezren39
dezren39 requested a review from a team as a code owner October 22, 2026 00:11
@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 52 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9ed0f582-f28c-434a-8427-b446bab24234
📥 Commits

Reviewing files that changed from the base of the PR and between c7a00ee and 177d3c8.

📒 Files selected for processing: 2
  • pkgs/lab-ops-hub/container/app.py
  • pkgs/lab-ops-hub/test/test_container_validate.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T00:12:54.081620Z 177d3c8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit bf64228 into main Oct 22, 2026
5 checks passed
@dezren39
dezren39 deleted the sweep/510-forbidden-host-chars branch October 22, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lab-ops-hub: container validator still allows DEL/C1-control, NBSP and WHATWG-forbidden (<>^|) hosts the Worker validator refuses

1 participant