From 34bfb57c084bc7364f9a7a0cbce3626ea67e090d Mon Sep 17 00:00:00 2001 From: AdamKorcz <44787359+AdamKorcz@users.noreply.github.com> Date: Tue, 5 Sep 2023 19:45:07 +0100 Subject: [PATCH] [Bug] Fix nil-dereference in pss validation (#8271) Signed-off-by: AdamKorcz --- pkg/engine/handlers/validation/validate_pss.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/engine/handlers/validation/validate_pss.go b/pkg/engine/handlers/validation/validate_pss.go index 96a86d4c0d..c9c3842310 100644 --- a/pkg/engine/handlers/validation/validate_pss.go +++ b/pkg/engine/handlers/validation/validate_pss.go @@ -110,6 +110,8 @@ func getSpec(resource unstructured.Unstructured) (podSpec *corev1.PodSpec, metad podSpec = &pod.Spec metadata = &pod.ObjectMeta return podSpec, metadata, nil + } else { + return nil, nil, fmt.Errorf("Could not find correct resource type") } if err != nil { return nil, nil, err