Skip to content

fix: parse Coder authorities with Punycode (xn--) domain labels#930

Merged
EhabY merged 2 commits intomainfrom
fix/parse-authority-punycode
May 6, 2026
Merged

fix: parse Coder authorities with Punycode (xn--) domain labels#930
EhabY merged 2 commits intomainfrom
fix/parse-authority-punycode

Conversation

@EhabY
Copy link
Copy Markdown
Collaborator

@EhabY EhabY commented May 4, 2026

Summary

parseRemoteAuthority (src/util.ts) splits the SSH host name on --, which breaks any domain containing a Punycode label (xn--{encoded}). After the existing split, the loop merges segment pairs back while the prefix ends in .xn (the cut landed inside an xn--... label). This covers mid-domain, apex (xn--p1ai), and consecutive Punycode labels.

The .xn check is structural: Punycode's ACE prefix is IANA-reserved. It does not depend on Coder's username, workspace, or agent character rules.

The parseRemoteAuthority describe block is refactored to it.each.

Closes

Closes #929. Builds on #917, extending the same idea to the apex case.

Scope

A deployment on a non-Punycode -- label (e.g. foo--bar.example.com) is not handled. Registries block -- outside xn-- at the TLD level, leaving operator-chosen subdomains as the only path. Supporting that case would require slug-shape validation of the tail, which couples this code to Coder's name rules.

@EhabY EhabY self-assigned this May 4, 2026
@EhabY EhabY requested a review from code-asher May 5, 2026 09:28
Comment thread src/util.ts
parseRemoteAuthority splits the SSH host name on "--", which breaks any
domain containing a Punycode/IDNA label (xn--{encoded}).  After the
existing split, walk the segments and merge each pair back together
while the prefix ends in ".xn" -- the cut landed inside an "xn--..."
label.  This covers mid-domain, apex, and consecutive Punycode labels.

Refactors the parseRemoteAuthority describe block to it.each.
@EhabY EhabY merged commit 21dceeb into main May 6, 2026
10 checks passed
@EhabY EhabY deleted the fix/parse-authority-punycode branch May 6, 2026 13:51
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.

parseRemoteAuthority misparses Punycode (xn--) domains in SSH host names

2 participants