gosec: file-mode policy pass for G301/G306/G302 #43

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

Give every created directory and file a mode from its class: secret material (0700/0600), runtime state shared with the agent container (0750/0640), output published outside the daemon (0755/0644). G301/G306/G302 set an absolute ceiling of 0750 on a directory and 0600 on a file, so a site whose class requires a wider mode carries an inline nolint naming the class. Verify the agent container can still read every worktree and scratch file after the change.

Notes

Resolved without changing any mode. Every G306 site is either read by the agent container across a uid boundary (which needs 0644, not 0640) or is written into a worktree to be committed (git records the mode), so each carries an inline nolint naming its class rather than a tightened mode. The class table is written into docs/prds/static-analysis-gate.md Decision 4. Discovery recorded as a separate bead: G301 and G302 never reach the gate because golangci-lint's inherited legacy exclusion preset silences them, so only the file half of the ceiling is machine-enforced.
Reverted with the approach. The mode-class table lived in the deleted PRD and the mode annotations are removed. No modes were ever changed.

Close reason

Closed


Imported from beads archie-core-2ptu.1 · GitHub #1488 · type task · priority P3 · created 2026-10-02 · closed 2026-10-02

Give every created directory and file a mode from its class: secret material (0700/0600), runtime state shared with the agent container (0750/0640), output published outside the daemon (0755/0644). G301/G306/G302 set an absolute ceiling of 0750 on a directory and 0600 on a file, so a site whose class requires a wider mode carries an inline nolint naming the class. Verify the agent container can still read every worktree and scratch file after the change. ### Notes Resolved without changing any mode. Every G306 site is either read by the agent container across a uid boundary (which needs 0644, not 0640) or is written into a worktree to be committed (git records the mode), so each carries an inline nolint naming its class rather than a tightened mode. The class table is written into docs/prds/static-analysis-gate.md Decision 4. Discovery recorded as a separate bead: G301 and G302 never reach the gate because golangci-lint's inherited legacy exclusion preset silences them, so only the file half of the ceiling is machine-enforced. Reverted with the approach. The mode-class table lived in the deleted PRD and the mode annotations are removed. No modes were ever changed. ### Close reason Closed --- _Imported from beads `archie-core-2ptu.1` · GitHub #1488 · type task · priority P3 · created 2026-10-02 · closed 2026-10-02_
sam added the lowtask labels 2026-10-27 13:34:43 +00:00
sam self-assigned this 2026-10-27 13:34:43 +00:00
sam closed this issue 2026-10-27 13:34:43 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#43