From bf5bf6f00c75262ba9c82ab4151167c142aab512 Mon Sep 17 00:00:00 2001 From: Sylvie Crowe <107814465+oneirocosm@users.noreply.github.com> Date: Thu, 24 Oct 2024 10:58:31 -0700 Subject: [PATCH] fix: allow capital letters on host match (#1117) While matching [user@]host[:port], we previously did not allow capital letters in host. While this makes sense for a hostname, it does not make sense to make that restriction for a host. Since this can match on both, we must widen it to accept characters allowed in host. --- pkg/remote/connutil.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/remote/connutil.go b/pkg/remote/connutil.go index 5c224e880..61be2edcd 100644 --- a/pkg/remote/connutil.go +++ b/pkg/remote/connutil.go @@ -17,7 +17,7 @@ import ( "golang.org/x/crypto/ssh" ) -var userHostRe = regexp.MustCompile(`^([a-zA-Z0-9][a-zA-Z0-9._@\\-]*@)?([a-z0-9][a-z0-9.-]*)(?::([0-9]+))?$`) +var userHostRe = regexp.MustCompile(`^([a-zA-Z0-9][a-zA-Z0-9._@\\-]*@)?([a-zA-Z0-9][a-zA-Z0-9.-]*)(?::([0-9]+))?$`) func ParseOpts(input string) (*SSHOpts, error) { m := userHostRe.FindStringSubmatch(input)