Skip to content

Commit

Permalink
authorization: rm anonymous user test cases
Browse files Browse the repository at this point in the history
With AUTH 509, we are removing unauthenticed user group from every role
binding, making it impossible for system:anonymous to make a SelfAccessReview
  • Loading branch information
ibihim committed Apr 3, 2024
1 parent 568217e commit e6db344
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions test/extended/authorization/authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ var _ = g.Describe("[sig-auth][Feature:OpenShiftAuthorization] authorization", f
AddUserAdminToProject(oc, malletProjectName, markName)
// TODO should be done by mark
edgarEditRoleBindingName := AddUserEditToProject(oc, malletProjectName, edgarName)
anonEditRoleBindingName := AddUserEditToProject(oc, hammerProjectName, "system:anonymous")
// anonEditRoleBindingName := AddUserEditToProject(oc, hammerProjectName, "system:anonymous")
dannyViewRoleBindingName := AddUserViewToProject(oc, "default", dannyName)

g.By("creating clients")
Expand Down Expand Up @@ -727,17 +727,6 @@ var _ = g.Describe("[sig-auth][Feature:OpenShiftAuthorization] authorization", f
Namespace: hammerProjectName,
},
}.run(t)
subjectAccessReviewTest{
description: "system:anonymous told he can create pods in project hammer-project",
localInterface: anonymousAuthorizationClient.LocalSubjectAccessReviews(hammerProjectName),
localReview: askCanICreatePods,
kubeAuthInterface: anonymousSARGetter,
response: authorizationv1.SubjectAccessReviewResponse{
Allowed: true,
Reason: `RBAC: allowed by RoleBinding "` + anonEditRoleBindingName + `/` + hammerProjectName + `" of ClusterRole "edit" to User "system:anonymous"`,
Namespace: hammerProjectName,
},
}.run(t)

// test checking self permissions when denied
subjectAccessReviewTest{
Expand All @@ -751,17 +740,6 @@ var _ = g.Describe("[sig-auth][Feature:OpenShiftAuthorization] authorization", f
Namespace: malletProjectName,
},
}.run(t)
subjectAccessReviewTest{
description: "system:anonymous told he cannot create pods in project mallet-project",
localInterface: anonymousAuthorizationClient.LocalSubjectAccessReviews(malletProjectName),
localReview: askCanICreatePods,
kubeAuthInterface: anonymousSARGetter,
response: authorizationv1.SubjectAccessReviewResponse{
Allowed: false,
Reason: "",
Namespace: malletProjectName,
},
}.run(t)

// test checking self-permissions doesn't leak whether namespace exists or not
// We carry a patch to allow this
Expand All @@ -776,17 +754,6 @@ var _ = g.Describe("[sig-auth][Feature:OpenShiftAuthorization] authorization", f
Namespace: "nonexistent-project",
},
}.run(t)
subjectAccessReviewTest{
description: "system:anonymous told he cannot create pods in project nonexistent-project",
localInterface: anonymousAuthorizationClient.LocalSubjectAccessReviews("nonexistent-project"),
localReview: askCanICreatePods,
kubeAuthInterface: anonymousSARGetter,
response: authorizationv1.SubjectAccessReviewResponse{
Allowed: false,
Reason: "",
Namespace: "nonexistent-project",
},
}.run(t)

askCanICreatePolicyBindings := &authorizationv1.LocalSubjectAccessReview{
Action: authorizationv1.Action{Verb: "create", Resource: "policybindings"},
Expand Down

0 comments on commit e6db344

Please sign in to comment.