microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.61k stars 275 forks source link

[Remote-SSH Bug]: assertValidHost rejects ssh hosts with % #8795

Open jmcrawford45 opened 1 year ago

jmcrawford45 commented 1 year ago

Is there an existing issue for this bug?

Required Troubleshooting Steps

Connect Locally

It connects successfully

->

No response

Expected Behavior

I would expect either the validation would be delayed until the hostname is resolved (all match hosts exec etc have been applied), or I would expect the ability to bypass this check via a setting.

Steps To Reproduce

I have custom ssh configs that allow for delegating hostname resolution via Match Host rules. For example, a call to ssh %app is configured to exec / eval a remote service call that returns the current IP of app in its datastore. Here's a minimal directive from the config

Match Host %app exec "bash -c 'cmd=$(echo 1.2.3.4) && eval $cmd'"

Remote-SSH Log

Remote-SSH Log

``` [18:35:06.381] Log Level: 2 [18:35:06.386] SSH Resolver called for "ssh-remote+%app", attempt 1 [18:35:06.386] "remote.SSH.useLocalServer": true [18:35:06.386] "remote.SSH.path": undefined [18:35:06.386] "remote.SSH.configFile": /Users/jaredcrawford/.ssh/ssh.config [18:35:06.386] "remote.SSH.useFlock": true [18:35:06.386] "remote.SSH.lockfilesInTmp": false [18:35:06.386] "remote.SSH.localServerDownload": auto [18:35:06.386] "remote.SSH.remoteServerListenOnSocket": false [18:35:06.386] "remote.SSH.showLoginTerminal": false [18:35:06.387] "remote.SSH.defaultExtensions": [] [18:35:06.387] "remote.SSH.loglevel": 2 [18:35:06.387] "remote.SSH.enableDynamicForwarding": true [18:35:06.387] "remote.SSH.enableRemoteCommand": false [18:35:06.387] "remote.SSH.serverPickPortsFromRange": {} [18:35:06.387] "remote.SSH.serverInstallPath": {} [18:35:06.389] VS Code version: 1.80.1 [18:35:06.389] Remote-SSH version: remote-ssh@0.102.0 [18:35:06.389] darwin arm64 [18:35:06.390] SSH Resolver called for host: %app [18:35:06.390] Setting up SSH remote "%app" [18:35:06.393] Resolver error: Error: SSH host name cannot include the character % at m.Create (/Users/jaredcrawford/.vscode/extensions/ms-vscode-remote.remote-ssh-0.102.0/out/extension.js:1:584145) at /Users/jaredcrawford/.vscode/extensions/ms-vscode-remote.remote-ssh-0.102.0/out/extension.js:1:672800 at Array.forEach () at t.assertValidHost (/Users/jaredcrawford/.vscode/extensions/ms-vscode-remote.remote-ssh-0.102.0/out/extension.js:1:672736) at I.resolve (/Users/jaredcrawford/.vscode/extensions/ms-vscode-remote.remote-ssh-0.102.0/out/extension.js:1:720615) at async i.$resolveAuthority (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:113:18025) [18:35:06.396] ------ ```

Anything else?

No response

llamafilm commented 11 months ago

I'd like to add a vote for this issue. As a workaround, I've been editing extension.js to remove the % symbol from the restricted characters list like this:

Screenshot 2023-10-09 at 12 39 26 PM