fix(lint): use explicit safe type conversions for gosec
Use separate variables with explicit else branches to make type conversions safe and satisfy gosec integer overflow checks.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user