vscode-remote-release
vscode-remote-release copied to clipboard
[Remote-SSH Bug]: Adding new host breaks ssh config file after VSCode update
Is there an existing issue for this bug?
- [X] I have searched the existing issues
Required Troubleshooting Steps
- [X] I have followed these troubleshooting steps
- [ ] I have tried both values of the
remote.SSH.useLocalServersetting
Connect Locally
It connects successfully
Bug Description
Hi Team,
After the most recent VSCode update on 06/18/2024, whenever I add a new host using RemoteSSH, the extension addes the new host but also heavily changes the configuration file which disrupts any future connections to all servers in the configuration file. Here is the current VSCode version where this issue occurs:
Version: 1.90.2 (user setup)
Commit: 5437499feb04f7a586f677b155b039bc2b3669eb
Date: 2024-06-18T22:34:26.404Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22631
Kindly note that the earlier VSCode version didn't have this issue. However, I found this old issue: #6197 with similar problem.
Current Behavior
Let's assume that I have tihs configuration file:
Host TMP-3PLogs
HostName YYYY
IdentityFile ~/.ssh/id_rsa
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
ProxyCommand ssh -i ~/.ssh/id_rsa -W %h:%p -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null XXX@ZZZ
User XXX
Now, let's add a new host using the following command in the Remote SSH + button, which basically adds the same host aleady in the configuration file (aka TMP-3PLogs).
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand="ssh -i ~/.ssh/id_rsa -W %h:%p -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null XXX@ZZZ" XXX@YYYY
Now, the configuration file changs to the following:
# the new host is added perfectly
Host ZZZ
HostName YYYY
IdentityFile ~/.ssh/id_rsa
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
ProxyCommand ssh -i ~/.ssh/id_rsa -W %h:%p -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null XXX@ZZZ
User XXX
# the old configuratoin changed (see comments below)
Host TMP-3PLogs
HostName YYYY
IdentityFile ~/.ssh/id_rsa
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null # <--- `=` has been added
ProxyCommand ssh -i ~/.ssh/id_rsa -W %h:%p -o StrictHostKeyChecking no -o UserKnownHostsFile /dev/null XXX@ZZZ # <-- all `=` have been removed
User XXX
This nasty bug wasted two days of my life I'm not getting back 😞
Sorry for the trouble, we did update the ssh-config parser in the last update and I'd guess this is somehow related to that. I can't repro this on Windows or mac though. Can you install the latest Remote-SSH pre-release extension and let me know if you still see it? Is there anything else in your config file besides what you posted above?
Hi @roblourens ,
So sorry about the late reply! I was out-of-office the past few days. Below is some information about what you've asked :
Can you install Remote-SSH pre-release extension and let me know if you still see it [the issue]?
Yes, I've installed VSCode Insiders and Remote-SSH pre-release and still see the issue. I even recorded my screen where the issue occurs real-time.
Is there anything else in your config file besides what you posted above?
No. However, if the configuration file is empty, there will be no issue since this bug changes the content of already-existing hosts in the configuration file as seen in the above recording. Also, the number of hosts in the configuration flie doesn't matter. I've tried one and many and both get affected by the bug.
Hope this helps!
Oh, I do see it removing = in the ProxyCommand. I just don't see it adding one to UserKnownHostsFile in the existing config. This is probably enough for me to investigate though.
Filed upstream: https://github.com/cyjake/ssh-config/issues/84
Any update about this issue?
The initial upstream (https://github.com/cyjake/ssh-config/issues/84) has been closed. I opened https://github.com/cyjake/ssh-config/issues/89 to ask a follow up
This should be fixed in tomorrow's pre-release build of the extension. If you have a sec, please let me know then if it helps
Testing:
The fix was a major update to the upstream parsing package. Confirm that both this bug is fixed and that your existing config is continuing to work as expected.