Skip to content

Commit 84a65dc

Browse files
committed
Cleanup
1 parent 286e54b commit 84a65dc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pkg/detectors/jwt/jwt.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
9898
// Does the URL's refer to a non-routing host?
9999
func isNonRoutingHost(url *url.URL) bool {
100100
h := url.Hostname()
101-
switch h {
102-
case "localhost", "::1":
101+
if h == "localhost" {
103102
return true
104103
}
105104

@@ -127,7 +126,7 @@ func parseRoutableHttpsUrl(urlString string) (*url.URL, error) {
127126
return url, nil
128127
}
129128

130-
func performHttpRequest(client *http.Client, ctx context.Context, method string, url string) (*http.Response, error) {
129+
func performHttpRequest(ctx context.Context, client *http.Client, method string, url string) (*http.Response, error) {
131130
req, err := http.NewRequestWithContext(ctx, method, url, nil)
132131
if err != nil {
133132
return nil, fmt.Errorf("failed to create request: %w", err)
@@ -169,7 +168,7 @@ func verifyMatch(ctx context.Context, client *http.Client, tokenString string) (
169168
}
170169

171170
// Fetch the OIDC discovery document
172-
resp, err := performHttpRequest(client, ctx, "GET", oidcDiscoveryURL.String())
171+
resp, err := performHttpRequest(ctx, client, "GET", oidcDiscoveryURL.String())
173172
if err != nil {
174173
return nil, fmt.Errorf("failed to perform OIDC discovery: %w", err)
175174
}
@@ -196,7 +195,7 @@ func verifyMatch(ctx context.Context, client *http.Client, tokenString string) (
196195
}
197196

198197
// Fetch the JWKS
199-
resp, err = performHttpRequest(client, ctx, "GET", discoveryDoc.JWKSUri)
198+
resp, err = performHttpRequest(ctx, client, "GET", discoveryDoc.JWKSUri)
200199
if err != nil {
201200
return nil, fmt.Errorf("failed to fetch JWKS: %w", err)
202201
}

0 commit comments

Comments
 (0)