From f3d05e8e90198e1d4823cf4e8cb36ad490df8677 Mon Sep 17 00:00:00 2001 From: Emmanuel T Odeke Date: Sat, 5 Nov 2022 03:02:00 -0700 Subject: [PATCH] rules/sdk: exempt "core", "runtime" from map iteration checks Noticed in a bunch of cosmos-sdk patterns that "runtime" is a package that heavily uses maps for proto and file descriptor manipulation so let's excuse it from map range checks; same thing for "core" --- rules/sdk/iterate_over_maps.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/sdk/iterate_over_maps.go b/rules/sdk/iterate_over_maps.go index 113946f..bc854f0 100644 --- a/rules/sdk/iterate_over_maps.go +++ b/rules/sdk/iterate_over_maps.go @@ -41,7 +41,7 @@ func (mr *mapRanging) ID() string { // so return true if we detect such. func pkgExcusedFromMapRangingChecks(ctx *gosec.Context) bool { switch pkg := ctx.Pkg.Name(); pkg { - case "gogoreflection", "simapp", "simulation", "testutil": + case "core", "gogoreflection", "proto", "runtime", "simapp", "simulation", "testutil": return true default: return false