Skip to content

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

Description

@EhabY

Problem

parseRemoteAuthority in src/util.ts extracts host, owner, workspace, and agent by splitting the SSH host name on --. Punycode labels (xn--{encoded}) legally contain -- at positions 3-4, so the split breaks any deployment on an internationalized domain.

Reproduction

Mid-domain Punycode (https://coder.xn--eckwd4c7cu47r2wf.jp/):

  • SSH host: coder-vscode.coder.xn--eckwd4c7cu47r2wf.jp--owner--workspace
  • Split: ["coder-vscode.coder.xn", "eckwd4c7cu47r2wf.jp", "owner", "workspace"]
  • The parser treats eckwd4c7cu47r2wf.jp as the owner; connection fails.

Apex Punycode (https://xn--p1ai/):

  • SSH host: coder-vscode.xn--p1ai--owner--ws
  • Split: ["coder-vscode.xn", "p1ai", "owner", "ws"]
  • Same misparse.

Background

First reported and partially fixed in #917. That fix handles mid-domain Punycode but misparses the apex case, where the merged-back fragment has no dot of its own.

Scope

Non-Punycode -- in DNS labels is permitted by RFC 5891 outside positions 3-4 but blocked at the TLD level by all major registries. A deployment on a subdomain like foo--bar.example.com is theoretically possible and not handled here.

Activity

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