gosec: handle every error #623
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#633 gosec: record why six rule classes stay excluded
sixfold-space/madtea
#759 epic: code and supply-chain security hardening
sixfold-space/madtea
Reference
sixfold-space/madtea#623
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
scripts/gosec.shexcludes seven rule classes: G104, G204, G301, G302, G304, G306, and G704. The reasons live only in the script header, with no decision record. A run with no exclusions reports 172 hits, all in those seven classes: G104 85, G304 46, G204 15, G306 12, G301 9, G302 3, and G704 2. Every rule outside the seven is clean.I do not ignore errors. So G104 comes out of the exclusion list, and every error gets handled.
Fix
_(_ = xorv, _ :=), and handle every dropped error among them. Not all are errors (a type assertionv, _ = x.(string)drops a bool), but many are, for examplekeyID, _ := strconv.ParseInt(...)andnewContent, _ := os.ReadFile(...)ininternal/docs/generate.go.internal/analytics/analytics.gocreates its private directory0700, not0755.-excludeinscripts/gosec.sh.Acceptance
gosec -confidence=high -exclude=G204,G301,G302,G304,G306,G704 ./...reports 0 issues.hexajon referenced this issue2026-09-24 18:15:16 +00:00
gosec: handle every error, and record why the other excluded rules are out of scopeto gosec: handle every error