Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: suppress gosec false positives blocking all PRs#30

Merged
alexei-led merged 1 commit into
masterfrom
fix/gosec-lint-false-positives
Mar 1, 2026
Merged

fix: suppress gosec false positives blocking all PRs#30
alexei-led merged 1 commit into
masterfrom
fix/gosec-lint-false-positives

Conversation

@alexei-led
Copy link
Copy Markdown
Owner

Problem

All open PRs (#24, #25, #26) are failing CI because golangci-lint with gosec reports false positives in the existing codebase:

  • cmd/spotinfo/main.go:288: G602 — slice index out of range (false positive; length is checked above)
  • internal/spot/data.go:53: G704 — SSRF via taint analysis (false positive; URL is a package-level constant, not user input)
  • internal/spot/data.go:63: G706 — Log injection via taint analysis (false positive; logged value is an integer HTTP status code)
  • internal/spot/data.go:114: G704 — same as above, for pricing data
  • internal/spot/data.go:124: G706 — same as above, for pricing data

Fix

Added //nolint:gosec directives with explanatory comments on each affected line. These are confirmed false positives:

  1. G602: The advices[0] access is guarded by if len(advices) == 1 — gosec doesn't track this invariant.
  2. G704: Both URLs (spotAdvisorJSONURL, spotPriceJSURL) are package-level constants pointing to AWS public endpoints — not user-provided input.
  3. G706: The logged values are int (HTTP status code) from a response to our own constant-URL request — no user data flows into the log.

Also includes a README fix: updated Homebrew tap path from alexei-led/spotinfo to alexei-led/tap.

Impact

Merging this PR will unblock CI for #24, #25, and #26.


🤖 Automated response by Marvin • alexei-led

- G602 in main.go: slice index is guarded by len() check above
- G704 in data.go: HTTP requests use package-level constant URLs,
  not user-provided input (false positive SSRF detection)
- G706 in data.go: logged status_code is an integer from HTTP
  response, not user-controlled input (false positive log injection)
- README: update Homebrew tap path to alexei-led/tap

All three issues are confirmed false positives in gosec's taint
analysis. The nolint directives include explanatory comments.

Co-authored-by: Marvin <[email protected]>
@alexei-led alexei-led merged commit ed8d6d0 into master Mar 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant