Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if len(parts) > 3 and len(parts[-1]) == 2: | ||
| return ".".join(parts[-3:]) |
There was a problem hiding this comment.
Avoid ccTLD fallback returning extra subdomain
The new ccTLD heuristic (len(parts[-1]) == 2) always returns the last three labels. For ccTLDs where registrable domains are directly under the TLD (e.g., example.de or example.co), a host like a.b.example.de will now return b.example.de instead of the true apex example.de. That makes _probe_subdomains build FQDNs against the wrong base (missing real subdomains and probing unrelated ones). This regression is introduced by the new rule; it should only apply when the public suffix is known to be two labels.
Useful? React with 👍 / 👎.
| if suffix2 in COMMON_PUBLIC_SUFFIX_2 and len(parts) >= 3: | ||
| return ".".join(parts[-3:]) | ||
| if len(parts) > 3 and len(parts[-1]) == 2: | ||
| return ".".join(parts[-3:]) |
There was a problem hiding this comment.
Incorrect apex domain for 2-char TLD direct registrations
The new heuristic assumes all 2-character TLDs require 3-part apex domains, but this is incorrect. For domains registered directly under country-code TLDs (like example.io, example.jp), the apex domain is just 2 parts, not 3. For input like deep.subdomain.example.io, this returns subdomain.example.io instead of the correct example.io. This affects the _probe_subdomains function which uses _apex_domain to determine where to probe for subdomains.
| return candidate | ||
| return host | ||
|
|
||
| return suffix2 |
There was a problem hiding this comment.
Returns public suffix for ccTLD domains not in list
The change from return host to return suffix2 breaks apex domain detection for country-code TLDs with public suffix structures not in COMMON_PUBLIC_SUFFIX_2. For a domain like "example.com.br" or "example.co.jp", the function now returns just "com.br" or "co.jp" (the public suffix itself) instead of the correct apex "example.com.br". This causes _probe_subdomains to probe completely unrelated domains like "www.com.br" instead of actual subdomains of the target.
Note
Adjusts apex domain detection used by subdomain probing and host normalization.
_apex_domainto return the last 3 labels when TLD length is 2 and there are >3 partshosttosuffix2(last two labels)Written by Cursor Bugbot for commit 5af2fb2. Configure here.