Skip to content

Comments

Adjust apex domain derivation#27

Merged
Victor-Dixon merged 1 commit intomainfrom
codex/fix-apex-domain-handling
Jan 1, 2026
Merged

Adjust apex domain derivation#27
Victor-Dixon merged 1 commit intomainfrom
codex/fix-apex-domain-handling

Conversation

@Victor-Dixon
Copy link
Owner

@Victor-Dixon Victor-Dixon commented Jan 1, 2026

Note

Adjusts apex domain detection used by subdomain probing and host normalization.

  • Updates _apex_domain to return the last 3 labels when TLD length is 2 and there are >3 parts
  • Changes fallback return from full host to suffix2 (last two labels)
  • Retains existing handling for common public suffixes and common host prefixes

Written by Cursor Bugbot for commit 5af2fb2. Configure here.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +41 to +42
if len(parts) > 3 and len(parts[-1]) == 2:
return ".".join(parts[-3:])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@Victor-Dixon Victor-Dixon merged commit ddd9b73 into main Jan 1, 2026
2 checks passed
@Victor-Dixon Victor-Dixon deleted the codex/fix-apex-domain-handling branch January 1, 2026 08:25
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:])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

return candidate
return host

return suffix2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

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.

1 participant