fix(lint): use explicit safe type conversions for gosec
Some checks failed
CI / Test (pull_request) Successful in 51s
CI / Lint (pull_request) Failing after 26s
CI / Build (pull_request) Successful in 38s
CI / Format Check (pull_request) Failing after 2s

Use separate variables with explicit else branches to make type
conversions safe and satisfy gosec integer overflow checks.
This commit is contained in:
2025-11-07 09:37:53 +01:00
parent e673fcae6f
commit 31e8ca7ce9
6 changed files with 35 additions and 14 deletions

View File

@@ -120,11 +120,14 @@ func (s *Server) Query(ctx context.Context, req *auditv1.QueryRequest) (*auditv1
}
total := len(protoEntries)
var totalInt32 int32
if total > math.MaxInt32 {
total = math.MaxInt32
totalInt32 = math.MaxInt32
} else {
totalInt32 = int32(total)
}
return &auditv1.QueryResponse{
Entries: protoEntries,
Total: int32(total), // Note: This is a simplified total, actual total would require a count query
Total: totalInt32, // Note: This is a simplified total, actual total would require a count query
}, nil
}