detached bc5b3f7

fix(lint): G703/G704/G705 annotate taint analysis false positives with justifications

commit
bc5b3f7cc7956f071917a51631bdafcd5aa4b67e
author
bnema · · 2026-02-25 02:06 UTC
parent
b5f59d8
signature
unsigned
4 files · +6 -5
M internal/adapters/in/cli/remote/client.go +1 -1
@@ -914,7 +914,7 @@ func (c *Client) streamLogs(ctx context.Context, path string) (<-chan string, er
914914 streamClient := &http.Client{
915915 Transport: c.httpClient.Transport,
916916 }
917- resp, err := streamClient.Do(req)
917+ resp, err := streamClient.Do(req) //nolint:gosec // G704: CLI outbound request to user-configured remote, not server-side SSRF
918918 if err != nil {
919919 return nil, fmt.Errorf("failed to connect: %w", err)
920920 }
@@ -914,7 +914,7 @@ func (c *Client) streamLogs(ctx context.Context, path string) (<-chan string, er
914 streamClient := &http.Client{914 streamClient := &http.Client{
915 Transport: c.httpClient.Transport,915 Transport: c.httpClient.Transport,
916 }916 }
917- resp, err := streamClient.Do(req)917+ resp, err := streamClient.Do(req) //nolint:gosec // G704: CLI outbound request to user-configured remote, not server-side SSRF
918 if err != nil {918 if err != nil {
919 return nil, fmt.Errorf("failed to connect: %w", err)919 return nil, fmt.Errorf("failed to connect: %w", err)
920 }920 }
M internal/adapters/in/http/registry/handler.go +2 -1
@@ -279,10 +279,11 @@ func (h *Handler) handleGetManifest(w http.ResponseWriter, r *http.Request) {
279279
280280 w.Header().Set("Content-Type", manifestData.ContentType)
281281 w.Header().Set("Content-Length", strconv.Itoa(len(manifestData.Data)))
282+ w.Header().Set("X-Content-Type-Options", "nosniff")
282283 w.WriteHeader(http.StatusOK)
283284
284285 if r.Method == "GET" {
285- _, _ = w.Write(manifestData.Data)
286+ _, _ = w.Write(manifestData.Data) //nolint:gosec // G705: OCI manifest bytes with explicit media type header, not HTML content
286287 }
287288 }
288289
@@ -279,10 +279,11 @@ func (h *Handler) handleGetManifest(w http.ResponseWriter, r *http.Request) {
279 279
280 w.Header().Set("Content-Type", manifestData.ContentType)280 w.Header().Set("Content-Type", manifestData.ContentType)
281 w.Header().Set("Content-Length", strconv.Itoa(len(manifestData.Data)))281 w.Header().Set("Content-Length", strconv.Itoa(len(manifestData.Data)))
282+ w.Header().Set("X-Content-Type-Options", "nosniff")
282 w.WriteHeader(http.StatusOK)283 w.WriteHeader(http.StatusOK)
283 284
284 if r.Method == "GET" {285 if r.Method == "GET" {
285- _, _ = w.Write(manifestData.Data)286+ _, _ = w.Write(manifestData.Data) //nolint:gosec // G705: OCI manifest bytes with explicit media type header, not HTML content
286 }287 }
287 }288 }
288 289
M internal/adapters/out/httpprober/prober.go +1 -1
@@ -79,7 +79,7 @@ func (p *Prober) Probe(ctx context.Context, url string) (int, int64, error) {
7979 // Set a reasonable user agent
8080 req.Header.Set("User-Agent", "Gordon-HealthCheck/1.0")
8181
82- resp, err := p.client.Do(req)
82+ resp, err := p.client.Do(req) //nolint:gosec // G704: probe URL sourced from route configuration, not from user HTTP request
8383 if err != nil {
8484 elapsed := time.Since(start).Milliseconds()
8585 return 0, elapsed, fmt.Errorf("request failed: %w", err)
@@ -79,7 +79,7 @@ func (p *Prober) Probe(ctx context.Context, url string) (int, int64, error) {
79 // Set a reasonable user agent79 // Set a reasonable user agent
80 req.Header.Set("User-Agent", "Gordon-HealthCheck/1.0")80 req.Header.Set("User-Agent", "Gordon-HealthCheck/1.0")
81 81
82- resp, err := p.client.Do(req)82+ resp, err := p.client.Do(req) //nolint:gosec // G704: probe URL sourced from route configuration, not from user HTTP request
83 if err != nil {83 if err != nil {
84 elapsed := time.Since(start).Milliseconds()84 elapsed := time.Since(start).Milliseconds()
85 return 0, elapsed, fmt.Errorf("request failed: %w", err)85 return 0, elapsed, fmt.Errorf("request failed: %w", err)
M internal/usecase/proxy/service.go +2 -2
@@ -551,7 +551,7 @@ func (s *Service) proxyToTarget(w http.ResponseWriter, r *http.Request, target *
551551 Str(zerowrap.FieldEntityID, target.ContainerID).
552552 Msg("proxying request")
553553
554- proxy.ServeHTTP(w, r)
554+ proxy.ServeHTTP(w, r) //nolint:gosec // G704: proxy target resolved from validated route config, not from incoming request
555555 }
556556
557557 func (s *Service) trackInFlight(containerID string) func() {
@@ -630,7 +630,7 @@ func (s *Service) proxyToRegistry(w http.ResponseWriter, r *http.Request) {
630630
631631 log.Debug().Str("target", targetURL.String()).Msg("proxying request to registry")
632632
633- proxy.ServeHTTP(w, r)
633+ proxy.ServeHTTP(w, r) //nolint:gosec // G704: proxy target resolved from validated route config, not from incoming request
634634 }
635635
636636 func (s *Service) isRunningInContainer() bool {
@@ -551,7 +551,7 @@ func (s *Service) proxyToTarget(w http.ResponseWriter, r *http.Request, target *
551 Str(zerowrap.FieldEntityID, target.ContainerID).551 Str(zerowrap.FieldEntityID, target.ContainerID).
552 Msg("proxying request")552 Msg("proxying request")
553 553
554- proxy.ServeHTTP(w, r)554+ proxy.ServeHTTP(w, r) //nolint:gosec // G704: proxy target resolved from validated route config, not from incoming request
555 }555 }
556 556
557 func (s *Service) trackInFlight(containerID string) func() {557 func (s *Service) trackInFlight(containerID string) func() {
@@ -630,7 +630,7 @@ func (s *Service) proxyToRegistry(w http.ResponseWriter, r *http.Request) {
630 630
631 log.Debug().Str("target", targetURL.String()).Msg("proxying request to registry")631 log.Debug().Str("target", targetURL.String()).Msg("proxying request to registry")
632 632
633- proxy.ServeHTTP(w, r)633+ proxy.ServeHTTP(w, r) //nolint:gosec // G704: proxy target resolved from validated route config, not from incoming request
634 }634 }
635 635
636 func (s *Service) isRunningInContainer() bool {636 func (s *Service) isRunningInContainer() bool {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 106

↑↓ moveenter openesc close