Skip to content

lab-ops-hub: container validator parses backslash authority differently from WHATWG (127.0.0.1\@example.com judged as example.com; example.com\@127.0.0.1 refused) #577

Closed

Description

@dezren39

Problem

The container crawl validator (pkgs/lab-ops-hub/container/app.py, validate_crawl_url, line 62) parses the URL authority with urllib.parse.urlparse, which treats \ as an ordinary netloc character (part of the userinfo). The Worker's WHATWG URL parser treats \ as a path delimiter for special schemes (http/https), i.e. it ends the authority. The two validators therefore disagree about which host a backslash-spelled URL names — in both directions.

Verified this run against current main (container validator imported directly; WHATWG via Node's new URL, inputs built with chr(92)/String.fromCharCode(92) so each URL contains exactly one backslash):

Input WHATWG host (Worker judges) urlparse host (container judges) Result
http://127.0.0.1\@example.com/ 127.0.0.1 example.com Worker refuses (non-public IPv4); container accepts
http://localhost\@example.com/ localhost example.com Worker refuses (blocked host); container accepts
http://example.com\@127.0.0.1/ example.com 127.0.0.1 Worker accepts; container refuses (non-public)
http:\\example.com/ example.com (none) Worker accepts; container refuses "url has no host"
http:/\example.com/ example.com (none) Worker accepts; container refuses "url has no host"

Why it matters

Note the percent-encoded form %5C is data, not a delimiter, in both parsers and must stay judged as today; only a raw \ is structural.

Acceptance criteria

  • validate_crawl_url judges the host the WHATWG parser names for raw-backslash spellings: http://127.0.0.1\@example.com/ and http://localhost\@example.com/ are refused as non-public/blocked; http://example.com\@127.0.0.1/ is accepted as example.com (and the URL actually fetched names example.com — the returned/validated form must not hand the fetcher a spelling whose urlparse host differs from the judged host).
  • http:\\example.com/ and http:/\example.com/ are handled the WHATWG way (host example.com) or explicitly refused with a test pinning the choice — but the two validators must not silently disagree.
  • New tests in pkgs/lab-ops-hub/test/test_container_validate.py cover the table above (Python suite stays green; TS suite untouched unless the fix changes Worker behavior).
  • Differential probe: a battery of backslash spellings (in host, userinfo, and authority-prefix positions) yields the same accept/refuse verdict and the same judged host in both validators.

Activity

  1. added 2 commits that reference this issue on Oct 22, 2026
  2. added a commit that references this issue on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions