From b28f1e55b7010c1e8754f48a43e85b03afd34059 Mon Sep 17 00:00:00 2001 From: m-Bilal Date: Sat, 27 Nov 2021 19:53:49 +0530 Subject: [PATCH] fixes 4240; added null check on namespace when resource is a RoleBinding --- api/resmap/reswrangler.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/resmap/reswrangler.go b/api/resmap/reswrangler.go index 31bfe1fee..5a462a6db 100644 --- a/api/resmap/reswrangler.go +++ b/api/resmap/reswrangler.go @@ -436,7 +436,9 @@ func getNamespacesForRoleBinding(r *resource.Resource) map[string]bool { if ns, ok1 := subject["namespace"]; ok1 { if kind, ok2 := subject["kind"]; ok2 { if kind.(string) == "ServiceAccount" { - result[ns.(string)] = true + if n, ok3 := ns.(string); ok3 { + result[n] = true + } } } }