Skip to content

Commit 93d54c8

Browse files
Fix linter errors
Co-authored-by: Georgi Sabev <georgethebeatle@gmail.com>
1 parent f13878d commit 93d54c8

File tree

6 files changed

+6
-8
lines changed

6 files changed

+6
-8
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ vet: ## Run go vet against code.
4747
lint: fmt vet gosec staticcheck golangci-lint
4848

4949
gosec: bin/gosec
50-
gosec --exclude=G101,G304,G401,G404,G505 --exclude-dir=tests ./...
50+
gosec --exclude=G101,G304,G401,G404,G505,G117 --exclude-dir=tests ./...
5151

5252
staticcheck: bin/staticcheck
5353
staticcheck ./...
@@ -120,4 +120,4 @@ clean-bin:
120120
find . -wholename '*/bin/*' -delete
121121

122122
vendir-update-dependencies: bin/vendir
123-
vendir sync --chdir tests
123+
vendir sync --chdir tests

api/actions/manifest/normalizer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func (n Normalizer) configureRandomRoute(appName string) payloads.ManifestRoute
135135
}
136136

137137
func generateRandomRoute() string {
138-
suffix := string('a'+rune(rand.Intn(26))) + string('a'+rune(rand.Intn(26)))
138+
suffix := string('a'+rune(rand.Int31n(26))) + string('a'+rune(rand.Int31n(26)))
139139
return adjectives[rand.Intn(len(adjectives))] + "-" + nouns[rand.Intn(len(nouns))] + "-" + suffix
140140
}
141141

api/handlers/stats/gauges.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (c *impersonatingHttpClient) Do(req *http.Request) (*http.Response, error)
5050
authInfo, _ := authorization.InfoFromContext(req.Context())
5151
req.Header.Set("Authorization", authInfo.RawAuthHeader)
5252

53-
return c.httpClient.Do(req)
53+
return c.httpClient.Do(req) //#nosec G704 - this is an http client wrapper, SSRF protection should be handled elsewhere
5454
}
5555

5656
func (c *LogCacheGaugesCollector) CollectProcessGauges(ctx context.Context, appGUID, processGUID string) ([]ProcessGauges, error) {

api/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ func wireGaugeCollector(cfg *config.APIConfig) (*url.URL, handlers.GaugesCollect
625625

626626
func loadCA(caPathEnv string) *x509.CertPool {
627627
caPath := os.Getenv(caPathEnv)
628-
caPEM, err := os.ReadFile(filepath.Join(caPath, "ca.crt"))
628+
caPEM, err := os.ReadFile(filepath.Join(caPath, "ca.crt")) //#nosec G703 - the env var is controlled by the helm chart (i.e. the k8s operator), path traversal is not possbile
629629
if err != nil {
630630
ctrl.Log.Error(err, "could not read CA bundle from file", "path", caPath)
631631
os.Exit(1)

controllers/controllers/services/osbapi/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ func (r *brokerRequester) sendRequest(ctx context.Context, requestPath string, m
403403
}
404404
req.Header.Add("Authorization", authHeader)
405405

406-
resp, err := r.httpClient.Do(req)
406+
resp, err := r.httpClient.Do(req) //#nosec G704 - all the parameters of the request are controlled by our osbapi client implementation so SSRF is not possible
407407
if err != nil {
408408
return 0, nil, fmt.Errorf("failed to execute HTTP request: %w", err)
409409
}

controllers/webhooks/networking/security_groups/validator_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ var _ = Describe("CFSecurityGroupValidatingWebhook", func() {
438438
))
439439
})
440440
})
441-
442441
})
443442

444443
Describe("ValidateDelete", func() {
@@ -468,5 +467,4 @@ var _ = Describe("CFSecurityGroupValidatingWebhook", func() {
468467
})
469468
})
470469
})
471-
472470
})

0 commit comments

Comments
 (0)