Skip to content

Commit

Permalink
fix: remove wrong reference
Browse files Browse the repository at this point in the history
  • Loading branch information
miltlima committed Apr 28, 2024
1 parent b8b42d8 commit 1723f77
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,8 @@ func addSecurityContext(clientset *kubernetes.Clientset) Result {

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

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

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

passed := len(rules) > 0 &&
passed := err == nil && len(rules) > 0 &&
expectedHost == rules[0].Host &&
len(rules[0].HTTP.Paths) > 0 &&
expectedPath == rules[0].HTTP.Paths[0].Path &&
Expand Down

0 comments on commit 1723f77

Please sign in to comment.