Skip to content

Commit f991a5b

Browse files
cpcloudclaude
andcommitted
fix(documents): update vendorHash after rebase and fix gosec lint
Update vendorHash for the rebased dependency set. Suppress gosec G115 (integer overflow) on two conversions that are guarded: entity ID is validated positive before uint cast, and SizeBytes is clamped to non-negative before uint64 cast. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 51f09ba commit f991a5b

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
inherit version;
3030
src = ./.;
3131
subPackages = [ "cmd/micasa" ];
32-
vendorHash = pkgs.lib.fakeHash;
32+
vendorHash = "sha256-JkhY04nP3aWuk7YvF3dkK4ZfRxGfdv7hgK0YlX4Dg5w=";
3333
env.CGO_ENABLED = 0;
3434
preCheck = ''
3535
export HOME="$(mktemp -d)"

internal/app/forms.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,12 +728,12 @@ func (m *Model) parseDocumentFormData() (data.Document, string, error) {
728728
return data.Document{}, "", fmt.Errorf("linked record id is required")
729729
}
730730
parsed, err := data.ParseRequiredInt(entityIDText)
731-
if err != nil {
731+
if err != nil || parsed <= 0 {
732732
return data.Document{}, "", fmt.Errorf(
733733
"linked record id should be a positive whole number",
734734
)
735735
}
736-
id := uint(parsed)
736+
id := uint(parsed) //nolint:gosec // guarded by parsed > 0 above
737737
entityID = &id
738738
}
739739

internal/app/tables.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,10 @@ func documentRows(items []data.Document) ([]table.Row, []rowMeta, [][]cell) {
403403
{Value: d.FileName, Kind: cellText},
404404
{Value: displayDocumentKind(d.EntityKind), Kind: cellText},
405405
{Value: ref, Kind: cellText},
406-
{Value: humanize.IBytes(uint64(d.SizeBytes)), Kind: cellReadonly},
406+
{
407+
Value: humanize.IBytes(uint64(max(d.SizeBytes, 0))), //nolint:gosec // clamped
408+
Kind: cellReadonly,
409+
},
407410
},
408411
}
409412
})

0 commit comments

Comments
 (0)