Skip to content

chore: update flake inputs and fix new gosec findings#728

Merged
cpcloud merged 5 commits intomainfrom
chore/flake-update-gosec
Mar 9, 2026
Merged

chore: update flake inputs and fix new gosec findings#728
cpcloud merged 5 commits intomainfrom
chore/flake-update-gosec

Conversation

@cpcloud
Copy link
Copy Markdown
Collaborator

@cpcloud cpcloud commented Mar 9, 2026

Summary

  • Update nixpkgs (2026-03-09) and git-hooks (2026-03-07) flake inputs
  • Add ignore entries for GO-2026-4601 (url.Parse IPv6 flaw; only caller parses user config) and GO-2026-4602 (os.ReadDir traversal via Root; micasa never uses os.OpenRoot)
  • Fix gosec G118 in all test files with t.Cleanup(cancel) instead of nolint; keep nolint in extraction.go where cancel is stored in struct field
  • Suppress false-positive gosec G602 (slice bounds proven equal by construction) and G703 (WriteFile paths use tmpDir + constant filenames)

cpcloud and others added 3 commits March 9, 2026 09:12
Update nixpkgs (2026-03-09) and git-hooks (2026-03-07).

Add ignore entries for GO-2026-4601 (url.Parse IPv6 host flaw; only
caller parses user's own config, not attacker input) and GO-2026-4602
(os.ReadDir traversal via Root-constrained File; micasa uses plain
os.ReadDir, never os.OpenRoot).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The flake update pulled a newer golangci-lint with new gosec rules:
- G118: cancel stored in struct field, called later (not leaked)
- G602: specs and natural slices have equal length by construction
- G703: WriteFile paths are tmpDir + constant filename, not tainted

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use t.Cleanup(cancel) so the context is always cancelled at test end,
replacing the nolint suppression. The extraction.go case genuinely
cannot be restructured (cancel stored in struct, called on close).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 15.78947% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.33%. Comparing base (0c22d7a) to head (48fdb5d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
internal/app/extraction.go 0.00% 7 Missing ⚠️
internal/app/chat.go 0.00% 4 Missing ⚠️
internal/extract/ocr.go 0.00% 0 Missing and 2 partials ⚠️
internal/extract/ocr_progress.go 0.00% 0 Missing and 2 partials ⚠️
internal/extract/text.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
internal/app/table.go 75.48% <100.00%> (+0.03%) ⬆️
internal/extract/text.go 89.09% <0.00%> (ø)
internal/extract/ocr.go 83.58% <0.00%> (ø)
internal/extract/ocr_progress.go 72.54% <0.00%> (ø)
internal/app/chat.go 72.47% <0.00%> (-0.14%) ⬇️
internal/app/extraction.go 70.71% <0.00%> (-0.23%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

cpcloud and others added 2 commits March 9, 2026 09:30
- G118: add t.Cleanup(cancel) to all test context.WithCancel calls so
  the cancel function is always invoked at test end
- G602: nolint on table.go slice access where specs and natural have
  equal length by construction
- G703: nolint on WriteFile calls where path is tmpDir + constant
  filename (no tainted components)
- Keep nolint on extraction.go production code where cancel is stored
  in struct field and called on extraction close

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gosec reports issues on the opening line of multi-line expressions,
so nolint comments must appear on or before that line — not on the
closing paren where golines would place them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cpcloud cpcloud merged commit 8ae9b82 into main Mar 9, 2026
17 of 18 checks passed
@cpcloud cpcloud deleted the chore/flake-update-gosec branch March 9, 2026 14:35
cpcloud added a commit that referenced this pull request Mar 19, 2026
## Summary

- Update nixpkgs (2026-03-09) and git-hooks (2026-03-07) flake inputs
- Add ignore entries for GO-2026-4601 (url.Parse IPv6 flaw; only caller
parses user config) and GO-2026-4602 (os.ReadDir traversal via Root;
micasa never uses os.OpenRoot)
- Fix gosec G118 in all test files with `t.Cleanup(cancel)` instead of
nolint; keep nolint in extraction.go where cancel is stored in struct
field
- Suppress false-positive gosec G602 (slice bounds proven equal by
construction) and G703 (WriteFile paths use tmpDir + constant filenames)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant