Skip to content

fix(ssh): double-quote ProxyCommand values for open-remote-ssh - #1156

Merged
EhabY merged 2 commits into
mainfrom
fix/vsc-36-proxycommand-quoting
Oct 15, 2026
Merged

EhabY merged 2 commits into
mainfrom
fix/vsc-36-proxycommand-quoting

Conversation

@EhabY

@EhabY EhabY commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1153

What's fixed

1.17.0 broke SSH connections from editors that use the open source Remote - SSH extension (open-remote-ssh), such as Positron and VSCodium. That extension splits the ProxyCommand itself instead of running it through a shell, so it parsed our line differently than OpenSSH does:

  • Single quotes: --url and --global-config were single-quoted. Positron passed the quotes to the CLI literally ('https://…'), and the CLI exited ("Premature close").
  • --token=: ssh-config@5 treats an unquoted = as a separator, so --token= --global-config reached the CLI as --token=--global-config.
  • Header commands: coder.headerCommand never worked with open-remote-ssh because it was always single-quoted.
  • Windows: a header command containing " was split into several arguments. escapeShellArg wrote " as "", but the Go CLI parses \".

How

  • escapeProxyCommandArg uses double quotes unless the value contains $, a backtick, \, % or a line break, which aren't literal inside double quotes. Those values keep the 1.17.0 single quotes, so nothing becomes less literal. The deployment URL can never contain these characters (validateDeploymentUrl).
  • escapeCommandArg quotes a leading, trailing or doubled =.
  • On Windows, escapeShellArg writes \" and doubles the backslashes before it (the standard Windows argument rule).

Tests pin the exact quoting. One native test runs a real ProxyCommand through sh -c on Unix and the Windows argument parser on Windows, so CI checks each platform. I also checked lines by hand against real OpenSSH (sh/bash/dash), Positron's @jeanp413/ssh-config@4.3.1, and upstream's ssh-config@5.3.0 + splitProxyCommand.

Not fixed here (upstream)


Generated by Coder Agents on behalf of @EhabY.

@linear-code

linear-code Bot commented Oct 15, 2026

Copy link
Copy Markdown

VSC-36

@EhabY
EhabY force-pushed the fix/vsc-36-proxycommand-quoting branch from 712cd87 to 1d2f34b Compare October 15, 2026 07:19

@Lisa-Fiander Lisa-Fiander left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

@EhabY
EhabY force-pushed the fix/vsc-36-proxycommand-quoting branch 6 times, most recently from f22f313 to 776af82 Compare October 15, 2026 09:53
@EhabY
EhabY force-pushed the fix/vsc-36-proxycommand-quoting branch from 776af82 to 9e48529 Compare October 15, 2026 10:00
@Lisa-Fiander
Lisa-Fiander self-requested a review October 15, 2026 10:10
@EhabY
EhabY force-pushed the fix/vsc-36-proxycommand-quoting branch from 9e48529 to ab11669 Compare October 15, 2026 10:10
@EhabY
EhabY merged commit 5c0ba1d into main Oct 15, 2026
13 checks passed
@EhabY
EhabY deleted the fix/vsc-36-proxycommand-quoting branch October 15, 2026 10: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.

v1.17.0 breaks Positron connections: single-quoted --url in ProxyCommand reaches the CLI literally ("Premature close")

2 participants