From e3da92e4e245f6da905efbba6636bb8d11061260 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Wed, 15 Jan 2025 20:30:16 -0800 Subject: [PATCH 1/2] Filter out wildcard patterns in `~/.ssh/config` for connections dropdown --- pkg/remote/conncontroller/conncontroller.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/remote/conncontroller/conncontroller.go b/pkg/remote/conncontroller/conncontroller.go index a7e9ac03a4..a7ab8e5946 100644 --- a/pkg/remote/conncontroller/conncontroller.go +++ b/pkg/remote/conncontroller/conncontroller.go @@ -877,6 +877,9 @@ func resolveSshConfigPatterns(configFiles []string) ([]string, error) { // for each host, find the first good alias for _, hostPattern := range host.Patterns { hostPatternStr := hostPattern.String() + if hostPatternStr == "" || strings.Contains(hostPatternStr, "*") { + continue + } normalized := remote.NormalizeConfigPattern(hostPatternStr) if !strings.Contains(hostPatternStr, "*") && !strings.Contains(hostPatternStr, "?") && !strings.Contains(hostPatternStr, "!") && !alreadyUsed[normalized] { discoveredPatterns = append(discoveredPatterns, normalized) From 0e7d268bed142c6a471f234a6296576066b60c7e Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Wed, 15 Jan 2025 20:33:21 -0800 Subject: [PATCH 2/2] move more checks --- pkg/remote/conncontroller/conncontroller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/remote/conncontroller/conncontroller.go b/pkg/remote/conncontroller/conncontroller.go index a7ab8e5946..c817f503c3 100644 --- a/pkg/remote/conncontroller/conncontroller.go +++ b/pkg/remote/conncontroller/conncontroller.go @@ -877,11 +877,11 @@ func resolveSshConfigPatterns(configFiles []string) ([]string, error) { // for each host, find the first good alias for _, hostPattern := range host.Patterns { hostPatternStr := hostPattern.String() - if hostPatternStr == "" || strings.Contains(hostPatternStr, "*") { + if hostPatternStr == "" || strings.Contains(hostPatternStr, "*") || strings.Contains(hostPatternStr, "?") || strings.Contains(hostPatternStr, "!") { continue } normalized := remote.NormalizeConfigPattern(hostPatternStr) - if !strings.Contains(hostPatternStr, "*") && !strings.Contains(hostPatternStr, "?") && !strings.Contains(hostPatternStr, "!") && !alreadyUsed[normalized] { + if !alreadyUsed[normalized] { discoveredPatterns = append(discoveredPatterns, normalized) alreadyUsed[normalized] = true break