gosec: dispose of every G115 integer conversion #44

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

Each of the 17 G115 sites gets one disposition. A conversion whose source is external input gains a bound check (internal/forge/gitea.go converts a forge-reported uint64 line number to int). A conversion between a count and its 32-bit wire form is annotated inline, because the protocol limit bounds it. No blanket rule exclusion.

Notes

Done for shipped code: all 15 production G115 conversions disposed. Fixed: forge gitea line number now refuses a value past math.MaxInt (regression test TestGiteaListReviewCommentsRejectsLineNumberPastInt, verified red then green), and the tar mode masks to the permission bits before narrowing. Annotated: the int->int32 page-size and capped-counter narrowings (CallDepth and step Depth capped by workflow.MaxCallDepth=5; RemediationRounds by the round cap; limits by the caller's 32-bit parse or constant). Verified via golangci-lint --enable-only=gosec: zero G115 in shipped code. The two test-file G115 sites are deferred to 2ptu's _test.go exclusion decision.
Reopened as a record only: the G115 dispositions were part of the rejected gosec approach and are reverted. The two genuine fixes it produced survive as their own commits: the forge line-number bound (fix(forge)) and the tar mode mask (fix(storepkg)). The int-to-int32 wire-form annotations are gone with the approach.

Close reason

Closed


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

Each of the 17 G115 sites gets one disposition. A conversion whose source is external input gains a bound check (internal/forge/gitea.go converts a forge-reported uint64 line number to int). A conversion between a count and its 32-bit wire form is annotated inline, because the protocol limit bounds it. No blanket rule exclusion. ### Notes Done for shipped code: all 15 production G115 conversions disposed. Fixed: forge gitea line number now refuses a value past math.MaxInt (regression test TestGiteaListReviewCommentsRejectsLineNumberPastInt, verified red then green), and the tar mode masks to the permission bits before narrowing. Annotated: the int->int32 page-size and capped-counter narrowings (CallDepth and step Depth capped by workflow.MaxCallDepth=5; RemediationRounds by the round cap; limits by the caller's 32-bit parse or constant). Verified via golangci-lint --enable-only=gosec: zero G115 in shipped code. The two test-file G115 sites are deferred to 2ptu's _test.go exclusion decision. Reopened as a record only: the G115 dispositions were part of the rejected gosec approach and are reverted. The two genuine fixes it produced survive as their own commits: the forge line-number bound (fix(forge)) and the tar mode mask (fix(storepkg)). The int-to-int32 wire-form annotations are gone with the approach. ### Close reason Closed --- _Imported from beads `archie-core-2ptu.2` · GitHub #1487 · 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#44