gosec G301 and G302 never reach the gate: the legacy exclusion preset silences them #1211

Closed
opened 2026-10-27 13:39:28 +00:00 by sam · 0 comments
Owner

The gate's file-mode ceiling is enforced for os.WriteFile (G306) but not for directories or os.OpenFile. golangci-lint's inherited legacy exclusion preset suppresses G301 and G302: with presets: [legacy] a 0o777 MkdirAll reports nothing, while G306 still reports a 0o644 WriteFile, so the run is loading the config and the silence is real. Removing legacy would re-enable both and widen the gate for every other linter the preset pacifies, so it is not a one-line change. Until then the directory-mode half of the class table in docs/prds/static-analysis-gate.md is review-enforced, not machine-enforced.

Notes

Moot: this described G301/G302 not reaching a gate that no longer runs gosec. The underlying tooling fact is still true and worth keeping for anyone who later runs gosec outside the gate: golangci-lint's legacy exclusion preset silences G301 and G302, so only file modes are reported.

Close reason

Closed


Imported from beads archie-core-9wcp · GitHub #1485 · type task · priority P3 · created 2026-10-02 · closed 2026-10-02

The gate's file-mode ceiling is enforced for os.WriteFile (G306) but not for directories or os.OpenFile. golangci-lint's inherited legacy exclusion preset suppresses G301 and G302: with presets: [legacy] a 0o777 MkdirAll reports nothing, while G306 still reports a 0o644 WriteFile, so the run is loading the config and the silence is real. Removing legacy would re-enable both and widen the gate for every other linter the preset pacifies, so it is not a one-line change. Until then the directory-mode half of the class table in docs/prds/static-analysis-gate.md is review-enforced, not machine-enforced. ### Notes Moot: this described G301/G302 not reaching a gate that no longer runs gosec. The underlying tooling fact is still true and worth keeping for anyone who later runs gosec outside the gate: golangci-lint's legacy exclusion preset silences G301 and G302, so only file modes are reported. ### Close reason Closed --- _Imported from beads `archie-core-9wcp` · GitHub #1485 · type task · priority P3 · created 2026-10-02 · closed 2026-10-02_
sam added the lowtask labels 2026-10-27 13:39:28 +00:00
sam self-assigned this 2026-10-27 13:39:28 +00:00
sam closed this issue 2026-10-27 13:39:28 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1211