From 90b5f6286c3ac773dda0090da8595387acb117cf Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Thu, 21 Apr 2022 17:29:27 -0700 Subject: [PATCH] cmd/tailscale: use double quotes in the ssh subcommands Single-quote escaping is insufficient apparently. Updates #3802 Signed-off-by: Maisem Ali --- cmd/tailscale/cli/ssh.go | 11 ++++------- cmd/tailscale/depaware.txt | 1 - go.mod | 1 - go.sum | 2 -- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/cmd/tailscale/cli/ssh.go b/cmd/tailscale/cli/ssh.go index d1f990d0d..e828763c4 100644 --- a/cmd/tailscale/cli/ssh.go +++ b/cmd/tailscale/cli/ssh.go @@ -18,7 +18,6 @@ import ( "strings" "syscall" - "github.com/alessio/shellescape" "github.com/peterbourgon/ff/v3/ffcli" "inet.af/netaddr" "tailscale.com/client/tailscale" @@ -81,15 +80,13 @@ func runSSH(ctx context.Context, args []string) error { ssh, // Only trust SSH hosts that we know about. - "-o", fmt.Sprintf("UserKnownHostsFile %s", - shellescape.Quote(knownHostsFile), - ), + "-o", fmt.Sprintf("UserKnownHostsFile %q", knownHostsFile), "-o", "UpdateHostKeys no", "-o", "StrictHostKeyChecking yes", - "-o", fmt.Sprintf("ProxyCommand %s --socket=%s nc %%h %%p", - shellescape.Quote(tailscaleBin), - shellescape.Quote(rootArgs.socket), + "-o", fmt.Sprintf("ProxyCommand %q --socket=%q nc %%h %%p", + tailscaleBin, + rootArgs.socket, ), // Explicitly rebuild the user@host argument rather than diff --git a/cmd/tailscale/depaware.txt b/cmd/tailscale/depaware.txt index f80bea3b2..ef1fac7d9 100644 --- a/cmd/tailscale/depaware.txt +++ b/cmd/tailscale/depaware.txt @@ -1,6 +1,5 @@ tailscale.com/cmd/tailscale dependencies: (generated by github.com/tailscale/depaware) - github.com/alessio/shellescape from tailscale.com/cmd/tailscale/cli W 💣 github.com/alexbrainman/sspi from github.com/alexbrainman/sspi/negotiate+ W github.com/alexbrainman/sspi/internal/common from github.com/alexbrainman/sspi/negotiate W 💣 github.com/alexbrainman/sspi/negotiate from tailscale.com/net/tshttpproxy diff --git a/go.mod b/go.mod index eeca2e4b9..a527e5161 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.18 require ( filippo.io/mkcert v1.4.3 github.com/akutz/memconn v0.1.0 - github.com/alessio/shellescape v1.4.1 github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74 github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be github.com/aws/aws-sdk-go-v2 v1.11.2 diff --git a/go.sum b/go.sum index 31c0171de..f633a591b 100644 --- a/go.sum +++ b/go.sum @@ -104,8 +104,6 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= -github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74 h1:Kk6a4nehpJ3UuJRqlA3JxYxBZEqCeOmATOvrbT4p9RA= github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4= github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw=