Skip to content

Commit 9a9ff38

Browse files
committed
chore: escape command also
1 parent 42a7512 commit 9a9ff38

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

cli/configssh.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,17 @@ func (r *RootCmd) configSSH() *clibase.Cmd {
249249
return xerrors.Errorf("escape coder binary for ssh failed: %w", err)
250250
}
251251

252+
escapedHeaderCommand := ""
253+
254+
if r.headerCommand != "" {
255+
headerCommand, err := sshConfigExecEscape(coderBinary, forceUnixSeparators)
256+
if err != nil {
257+
return xerrors.Errorf("escape header command for ssh failed: %w", err)
258+
}
259+
260+
escapedHeaderCommand = headerCommand
261+
}
262+
252263
root := r.createConfig()
253264
escapedGlobalConfig, err := sshConfigExecEscape(string(root), forceUnixSeparators)
254265
if err != nil {
@@ -389,8 +400,8 @@ func (r *RootCmd) configSSH() *clibase.Cmd {
389400

390401
if !skipProxyCommand {
391402
rootFlags := fmt.Sprintf("--global-config %s", escapedGlobalConfig)
392-
if r.headerCommand != "" {
393-
rootFlags += fmt.Sprintf(" --header-command %s", r.headerCommand)
403+
if escapedHeaderCommand != "" {
404+
rootFlags += fmt.Sprintf(" --header-command %s", escapedHeaderCommand)
394405
}
395406

396407
flags := ""

0 commit comments

Comments
 (0)