Skip to content

ProxyCommand fails due to unescaped --url flag #479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
slushie opened this issue Sep 13, 2024 · 1 comment · Fixed by #480
Closed

ProxyCommand fails due to unescaped --url flag #479

slushie opened this issue Sep 13, 2024 · 1 comment · Fixed by #480
Labels
help wanted Extra attention is needed

Comments

@slushie
Copy link

slushie commented Sep 13, 2024

We received a report today of a user who is unable to connect to their Coder workspace due to their zsh shell failing to parse the ProxyCommand command line.

This issue appears to stem from the modifySSHConfig method calling escape() on the URL. The escape method seems to only surround an argument with quotes when it contains whitespace, but there is no support for other quoting other metacharacters that can cause shell parsing issues.

Here are the relevant logs from the user's JetBrains plugin:

2024-09-13 11:24:45,041 [ 858948]   INFO - CoderRemoteConnectionHandle - Connecting to remote worker on coder-jetbrains--someuser-python-dev.main--coder.prod.somecorp.net... (attempt 6)
2024-09-13 11:24:45,075 [ 858982]   INFO - net.schmizz.sshj.transport.random.JCERandom - Creating new SecureRandom.
2024-09-13 11:24:45,080 [ 858987]   INFO - #c.i.s.ProxyCommand - ProxyCommand for coder-jetbrains--someuser-python-dev.main--coder.prod.somecorp.net--bg:22: "/Users/someuser/Library/Application Support/coder-gateway/coder.prod.somecorp.net/coder-darwin-amd64" --global-config "/Users/someuser/Library/Application Support/coder-gateway/coder.prod.somecorp.net/config" --url https://coder.prod.somecorp.net/?workspace=someuser-python-dev&token=unused&agent=main ssh --stdio --disable-autostart --usage-app=disable someuser-python-dev.main
2024-09-13 11:24:45,087 [ 858994]   INFO - #c.i.s.ProxyCommand - Started ProxyCommand for coder-jetbrains--someuser-python-dev.main--coder.prod.somecorp.net--bg:22: Process[pid=67537, exitValue="not exited"]
2024-09-13 11:24:45,087 [ 858994]   INFO - #c.i.s.i.s.sshj - Client identity string: SSH-2.0-IntelliJ__Gateway_GW-242.20224.368__SSHJ_0.38.1_SNAPSHOT
2024-09-13 11:24:45,095 [ 859002]   WARN - #c.i.s.i.s.sshj - Received end of connection, but no identification received.
2024-09-13 11:24:45,095 [ 859002]   INFO - #c.i.s.ProxyCommand - End of Process[pid=67537, exitValue="not exited"] stderr:
zsh:1: parse error near `&'
2024-09-13 11:24:45,096 [ 859003]   WARN - #c.i.s.ProxyCommand - Process[pid=67537, exitValue=1] exited with code 1
2024-09-13 11:24:45,096 [ 859003] SEVERE - CoderRemoteConnectionHandle - Failed to connect (attempt 6; will retry in 153301 ms)
java.lang.Throwable: Failed to connect (attempt 6; will retry in 153301 ms)
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)

Note the zsh:1: parse error near &'causingexitValue=1`.

The command line is

ProxyCommand for coder-jetbrains--someuser-python-dev.main--coder.prod.somecorp.net--bg:22: "/Users/someuser/Library/Application Support/coder-gateway/coder.prod.somecorp.net/coder-darwin-amd64" --global-config "/Users/someuser/Library/Application Support/coder-gateway/coder.prod.somecorp.net/config" --url https://coder.prod.somecorp.net/?workspace=someuser-python-dev&token=unused&agent=main ssh --stdio --disable-autostart --usage-app=disable someuser-python-dev.main
@kylecarbs
Copy link
Member

Thanks for the detailed issue! PR attached and we'll do a release ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants