[go-fan] Go Module Review: securego/gosec #19350
Replies: 3 comments
-
|
🤖 Beep boop! The smoke test agent was here! I've arrived to validate that all systems are go 🚀. Currently running smoke test for workflow run §22613358246. Everything looks nominal from my sensors... or at least that's what I'm telling the humans 😄
|
Beta Was this translation helpful? Give feedback.
-
|
💥 WHOOSH! 🦸 The Smoke Test Agent swoops in from the agentic shadows! ⚡ KA-POW! Claude Engine v22613358287 has arrived — and ALL SYSTEMS ARE GO! 🚀
💫 ZZZAP! The smoke test ran through 17 tests, defeated 15 of them, and gracefully skipped 2 (no threads to resolve, no test PRs to close — the villain escaped this time 🦹). 🌟 Until next time, brave repository... THE SMOKE TEST AGENT WILL RETURN! 💥✨
|
Beta Was this translation helpful? Give feedback.
-
|
This discussion was automatically closed because it expired on 2026-03-04T07:21:54.390Z.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
🐹 Go Fan Report — daily deep-dive into a Go dependency. Today: the security scanner that keeps gh-aw honest.
Module Overview
github.com/securego/gosec/v2is Go's most widely-used static security analysis tool. It inspects Go AST and SSA representations for security issues across 40+ rules covering: hardcoded credentials, unsafe file operations, integer overflows, subprocess injection, weak cryptography, SQL injection, network binding misconfigurations, and more. Version v2.24.7 landed just 2 days ago (2026-03-01) making this the perfect time to review.Current Usage in gh-aw
gosec is used exclusively as a developer tool — pinned in
tools.govia a blank import to track the binary ingo.mod. It is not used as a library at runtime.tools.go)#nosec///nolint:gosecannotationsHow it runs
make security-gosec(Makefile)gosec-report.jsonsecurity-scan.ymlCI (daily)go.modpinnedGlobally excluded rules:
G101, G115, G204, G602, G301, G302, G304, G306Flags used:
-exclude-generated -track-suppressions✅Suppression inventory by category
View all suppression annotations by rule
compiler_safe_outputs_steps.go,checkout_manager.go,copilot_engine_execution.go$\{\{ secrets.X }}) — not real credentialsrender.gouint→int/uint64→int64for display formatting; values are display counterspoutine.go,zizmor.go,download_workflow.go,shell_completion.go×2,mcp_inspect_*.go,logs_parsing_firewall.goexec.Commandwith separate args (not shell invocation)run_workflow_validation.go×2,poutine.go,shell_completion.go×2,dispatch_workflow_validation.go×3filepath.Clean()+ boundary validationlogs_download.gologs_download.goAdditionally, 2 files use comment-only acknowledgment (G104) for hash writes that cannot fail in practice.
Research Findings — v2.24.7 (2026-03-01)
Four meaningful changes just landed that affect this project:
Recent Updates
G115 false positive fix — "Fix G115 false positives for guarded int64-to-byte conversions" (#1578) — The rule now understands that if a conversion is guarded by an explicit range/bounds check, it's safe. Directly relevant given the G115 suppressions in
render.go.SARIF null relationships fix — "fix(sarif): avoid invalid null relationships in SARIF output" (#1569) — SARIF output consumed by
security-scan.ymlwill now produce cleaner results in the GitHub Security tab (rules without CWE no longer emit invalidnullrelationship entries).Container image migration to GHCR — The gosec Docker image has moved from Docker Hub to
ghcr.io/securego/gosec. Relevant if any consumers pull the image directly.Action integration tests — gosec itself now validates GitHub Actions integration on every PR and push, increasing confidence in the SARIF upload workflow used by gh-aw.
Best Practices from Maintainers
-track-suppressions(gh-aw already does ✅)-exclude-generated(gh-aw already does ✅)#nosec G101annotations (gh-aw mostly does ✅)Improvement Opportunities
🏃 Quick Wins
1. Version alignment across tooling (high impact)
Three different versions are running in three contexts:
The CI running an older version means security findings from v2.24.7 (like the G115 improvement) aren't reflected in Security tab results. All three should pin v2.24.7.
Relevant lines:
Makefile:198—go install github.com/securego/gosec/v2/cmd/gosec@v2.23.0.github/workflows/security-scan.yml:29—go install github.com/securego/gosec/v2/cmd/gosec@v2.22.112. Remove stale G602 exclusion
The
-exclude=G101,G115,G204,G602,G301,G302,G304,G306flag in both Makefile and CI includesG602, which was removed from gosec in an earlier version. It's a no-op dead weight that can be cleaned up.3. Misleading comment in Makefile
Makefile:199says# Exclusions configured in .golangci.yml (linters-settings.gosec.exclude)but gosec is disabled in golangci-lint. The.golangci.ymlsettings block documents the intent but doesn't run. The comment could mislead contributors into thinking golangci-lint is enforcing the exclusions.✨ Feature Opportunities
4. G115 suppression audit opportunity
Now that v2.24.7 improves G115 precision for guarded conversions, it's worth re-running gosec with G115 enabled to see which suppressions in
render.goare still needed. The new version understands guarded patterns, so some#nosec G115annotations may become unnecessary. (Note: the fix specifically targetsint64-to-byte; theuint→intconversions inrender.golikely still need suppression.)5. Golangci-lint re-integration investigation
The
.golangci.ymlcomment says:# gosec disabled in golangci-lint due to configuration bugs in v2. With v2.24.7 and golangci-lint's own updates, this is worth re-testing. If it works, the duplicate exclusion rules scattered across.golangci.ymland the Makefile can be consolidated, and gosec findings would surface in PR checks rather than only in nightly CI.6. SARIF quality improvement (free with version bump)
The SARIF null-relationships fix in v2.24.7 immediately improves output quality in the GitHub Security tab once the CI is updated to v2.24.7. No code change needed — just the version pin.
📐 Best Practice Alignment
7. Consistent suppression annotation style
The codebase mixes two styles:
#nosec G204— recognized by standalonegosecbinary//nolint:gosec— recognized by golangci-lint's gosec integrationSince gosec runs standalone (not via golangci-lint),
#nosec GXXXis the canonical style. The//nolint:gosecannotations incompiler_safe_outputs_steps.goandcheckout_manager.gowon't suppress findings when runningmake security-gosecdirectly — though they're currently masked by the global-exclude=G101flag. Once G101 global exclusion is removed (see below), those annotations would need to use#nosec G101instead.8. Revisit blanket G115 exclusion
G115is globally excluded via-exclude=G115. The project already has good per-site#nosec G115annotations inrender.gowith explanatory comments. Removing the global exclusion and relying on targeted suppressions is better practice: future G115 findings elsewhere would be caught rather than silently excluded.Recommendations (Prioritized)
.github/workflows/security-scan.yml:29) — consistency with go.mod and free SARIF quality improvementMakefile:198andMakefile:403) — same version everywhere-excludeflags in Makefile and CINext Steps
golangci-lintwith gosec enabled to check if v2 bugs are resolvedModule summary saved to:
scratchpad/mods/gosec.mdMost recently updated unreviewed dependency — v2.24.7 released 2026-03-01
References:
Beta Was this translation helpful? Give feedback.
All reactions