From 83b9295821c0adeb64a999e59a55f2b413cdcf95 Mon Sep 17 00:00:00 2001 From: Benjamin Peinhardt Date: Fri, 17 Jan 2025 21:22:57 +0000 Subject: [PATCH 1/3] properly escape . in host -> ssh conversion --- src/sshSupport.test.ts | 36 ++++++++++++++++++++++++++++++++++++ src/sshSupport.ts | 7 ++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/sshSupport.test.ts b/src/sshSupport.test.ts index c7feea8c..0c08aca1 100644 --- a/src/sshSupport.test.ts +++ b/src/sshSupport.test.ts @@ -68,3 +68,39 @@ Host coder-v?code--* ProxyCommand: '/tmp/coder --header="X-BAR=foo" coder.dev', }) }) + +it("properly escapes meaningful regex characters", () => { + const properties = computeSSHProperties( + "coder-vscode.dev.coder.com--matalfi--dogfood", + `Host * + StrictHostKeyChecking yes + +# ------------START-CODER----------- +# This section is managed by coder. DO NOT EDIT. +# +# You should not hand-edit this section unless you are removing it, all +# changes will be lost when running "coder config-ssh". +# +Host coder.* + StrictHostKeyChecking=no + UserKnownHostsFile=/dev/null + ProxyCommand /usr/local/bin/coder --global-config "/Users/matifali/Library/Application Support/coderv2" ssh --stdio --ssh-host-prefix coder. %h +# ------------END-CODER------------ + +# --- START CODER VSCODE dev.coder.com --- +Host coder-vscode.dev.coder.com--* + StrictHostKeyChecking no + UserKnownHostsFile=/dev/null + ProxyCommand "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/dev.coder.com/bin/coder-darwin-arm64" vscodessh --network-info-dir "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/net" --session-token-file "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/dev.coder.com/session" --url-file "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/dev.coder.com/url" %h +# --- END CODER VSCODE dev.coder.com ---% + +`, + ) + + expect(properties).toEqual({ + StrictHostKeyChecking: "yes", + ProxyCommand: + '"/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/dev.coder.com/bin/coder-darwin-arm64" vscodessh --network-info-dir "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/net" --session-token-file "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/dev.coder.com/session" --url-file "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/dev.coder.com/url" %h', + UserKnownHostsFile: "/dev/null", + }) +}) diff --git a/src/sshSupport.ts b/src/sshSupport.ts index 67966f5a..29433be6 100644 --- a/src/sshSupport.ts +++ b/src/sshSupport.ts @@ -47,7 +47,9 @@ export function computeSSHProperties(host: string, config: string): Record = [] + // biome-ignore lint/complexity/noForEach: config.split("\n").forEach((line) => { + // biome-ignore lint/style/noParameterAssign: line = line.trim() if (line === "") { return @@ -85,8 +87,11 @@ export function computeSSHProperties(host: string, config: string): Record Date: Fri, 17 Jan 2025 21:35:05 +0000 Subject: [PATCH 2/3] remove biome lint complaints --- src/sshSupport.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sshSupport.ts b/src/sshSupport.ts index 29433be6..42a7acaa 100644 --- a/src/sshSupport.ts +++ b/src/sshSupport.ts @@ -47,9 +47,7 @@ export function computeSSHProperties(host: string, config: string): Record = [] - // biome-ignore lint/complexity/noForEach: config.split("\n").forEach((line) => { - // biome-ignore lint/style/noParameterAssign: line = line.trim() if (line === "") { return From 6748739783a68431908518f9783450910d4ab637 Mon Sep 17 00:00:00 2001 From: Benjamin Peinhardt Date: Fri, 17 Jan 2025 21:37:36 +0000 Subject: [PATCH 3/3] changelog update --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ea8a74e..d7eaec39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Fix bug where checking for overridden properties incorrectly converted host name pattern to regular expression. + ## [v1.3.9](https://github.com/coder/vscode-coder/releases/tag/v1.3.9) (2024-12-12) - Only show a login failure dialog for explicit logins (and not autologins). pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy