Fix remaining gosec lint findings on main #47
Reference in New Issue
Block a user
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?
maincarries a set of opengosecfindings (≈10 as of the 2026-07-07 survey) that keepmake checkred. Clear them.Definition of done
make check(golangci-lint) reports 0gosecfindings.//nolint:gosec // G### <reason>with a real justification rather than a blanket disable.The finishing commit's title must end with
(closes #N)referencing this issue.Dispatching this now, per the definition of done in the issue body. Additional direction:
fix/gosec-findingsfrom currentmain.make checkand enumerate the actual gosec findings in a comment on the PR (count, rule IDs, locations) before fixing — this documents the scope-guard check from the issue body.//nolint:gosec // G### <reason>is acceptable only for genuine false positives with a real justification. No blanket suppressions, no linter config changes.make checkgreen before each commit.mainwhose body containscloses #47, and end the finishing commit's title with(closes #47).refactor/extract-signature) is in flight and touchesinternal/imgcache/internal/signature. Base onmainas it is; if a finding is in code being moved by #46, fix it inmain's current layout anyway — any conflict gets resolved at merge time.Scope update from a fresh
make checkrun (golangci-lint 2.12.2): the "≈10 findings" figure in the issue body is stale. Current state is exactly 2 gosec findings, bothG124(http.Cookie missing or insecureSecure/HttpOnly/SameSiteattributes):internal/session/session.go:84internal/session/session.go:128All tests pass; these two findings are the only thing keeping
make checkred. Well within the scope guard.Additional direction for the fix:
HttpOnly/Secure/SameSite), so per repo rules: write a failing test FIRST asserting the cookies carry the correct attributes, commit it, then fix until green — do not//nolintthese; they are genuine findings, and the fix is to set the attributes properly.SameSiteshould beLaxor stricter;HttpOnlytrue;Securetrue. IfSecure: truewould break any documented plain-HTTP dev flow, note the reasoning in the PR body rather than weakening the cookie.TODO.mdin the finishing commit per its Workflow section (move Next Step to Completed Steps, promote the next Future Step, and correct the stale "10 findings" status text).Review of PR #48 came back FAIL with one blocking item (labelled
needs-rework): the ignored former secure-toggle parameter onsession.NewManagermust be removed in this PR rather than deferred — pre-1.0, everything updates in one pass. Full rework direction is in the review comment on the PR: #48 (comment). The mechanical call-site updates ininternal/session/session_test.go(call shape only, assertions unchanged) are reviewer-directed; the accompanying TODO.md P1 deferral entry gets dropped in the same commit.