@@ -68,3 +68,39 @@ Host coder-v?code--*
6868 ProxyCommand : '/tmp/coder --header="X-BAR=foo" coder.dev' ,
6969 } )
7070} )
71+
72+ it ( "properly escapes meaningful regex characters" , ( ) => {
73+ const properties = computeSSHProperties (
74+ "coder-vscode.dev.coder.com--matalfi--dogfood" ,
75+ `Host *
76+ StrictHostKeyChecking yes
77+
78+ # ------------START-CODER-----------
79+ # This section is managed by coder. DO NOT EDIT.
80+ #
81+ # You should not hand-edit this section unless you are removing it, all
82+ # changes will be lost when running "coder config-ssh".
83+ #
84+ Host coder.*
85+ StrictHostKeyChecking=no
86+ UserKnownHostsFile=/dev/null
87+ ProxyCommand /usr/local/bin/coder --global-config "/Users/matifali/Library/Application Support/coderv2" ssh --stdio --ssh-host-prefix coder. %h
88+ # ------------END-CODER------------
89+
90+ # --- START CODER VSCODE dev.coder.com ---
91+ Host coder-vscode.dev.coder.com--*
92+ StrictHostKeyChecking no
93+ UserKnownHostsFile=/dev/null
94+ 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
95+ # --- END CODER VSCODE dev.coder.com ---%
96+
97+ ` ,
98+ )
99+
100+ expect ( properties ) . toEqual ( {
101+ StrictHostKeyChecking : "yes" ,
102+ ProxyCommand :
103+ '"/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' ,
104+ UserKnownHostsFile : "/dev/null" ,
105+ } )
106+ } )
0 commit comments