Skip to content

Commit 1723f77

Browse files
committed
fix: remove wrong reference
1 parent b8b42d8 commit 1723f77

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,8 @@ func addSecurityContext(clientset *kubernetes.Clientset) Result {
450450

451451
deploy, err := clientset.AppsV1().Deployments(expectedNamespace).Get(context.TODO(), expectedDeploymentName, metav1.GetOptions{})
452452

453-
passed := deploy.Spec.Template.Spec.Containers[0].SecurityContext != nil &&
454-
*deploy.Spec.Template.Spec.Containers[0].SecurityContext.AllowPrivilegeEscalation == expectedPrivilegeEscalation
453+
passed := err == nil || (deploy.Spec.Template.Spec.Containers[0].SecurityContext != nil &&
454+
deploy.Spec.Template.Spec.Containers[0].SecurityContext.AllowPrivilegeEscalation != nil)
455455

456456
return Result{
457457
TestName: "Question 18 - Prevent privilege escalation in the deployment mark42",
@@ -550,7 +550,7 @@ func createIngressYellow(clientset *kubernetes.Clientset) Result {
550550
ingressSpec := &ingress.Spec
551551
rules := ingressSpec.Rules
552552

553-
passed := len(rules) > 0 &&
553+
passed := err == nil && len(rules) > 0 &&
554554
expectedHost == rules[0].Host &&
555555
len(rules[0].HTTP.Paths) > 0 &&
556556
expectedPath == rules[0].HTTP.Paths[0].Path &&

0 commit comments

Comments
 (0)