fix(security): bound harness IDs to int and drop a summed map size hint

Clears the five open CodeQL alerts. harnessCredential parsed uid and gid
as 32-bit and os.Chown converted them to int, which wraps on a 32-bit
build; they are now parsed to 31 bits, so an out-of-range id is refused
where it is read. mergeMapping sized its map by len(base)+len(override);
it now hints len(base) and lets the map grow.
This commit is contained in:
sam committed 2026-09-28 02:20:25 +10:00
1 parent 621cfb30a0
commit 7bbb5b6f61
3 files changed
+9 -6

No files matched your search

@@ -185,7 +185,7 @@ func asMapping(value reflect.Value) (map[string]any, error) {
// else replaces, matching how the decode treats a struct field versus a scalar.
// It allocates rather than mutating either argument.
func mergeMapping(base, override map[string]any) map[string]any {
out := make(map[string]any, len(base)+len(override))
out := make(map[string]any, len(base))
maps.Copy(out, base)
for key, value := range override {
if over, ok := value.(map[string]any); ok {