microsoft / microsoft/vscode-remote-release

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

Open
#8,795 2 comments 2 reactions 1 assignee View on GitHub

@roblourens is already working on this.

Since Aug 4, 2023.

bug ssh
Dominant language
Dockerfile
Stars
4.2k
Forks
470
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Is there an existing issue for this bug?
  • I have searched the existing issues
Required Troubleshooting Steps
  • I have followed these troubleshooting steps
  • I have tried both values of the remote.SSH.useLocalServer setting
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 (<anonymous>)
	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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.