Skip to content

Commit

Permalink
fix: check permissions for validate.cel subrules only (kyverno#10829)
Browse files Browse the repository at this point in the history
Signed-off-by: Mariam Fahmy <[email protected]>
Co-authored-by: Jim Bugwadia <[email protected]>
  • Loading branch information
MariamFahmy98 and JimBugwadia authored Aug 13, 2024
1 parent b8a69a7 commit 3a69702
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/validation/policy/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func validateActions(idx int, rule *kyvernov1.Rule, client dclient.Interface, mo
}

// In case generateValidatingAdmissionPolicy flag is set to true, check the required permissions.
if toggle.FromContext(context.TODO()).GenerateValidatingAdmissionPolicy() {
if rule.HasValidateCEL() && toggle.FromContext(context.TODO()).GenerateValidatingAdmissionPolicy() {
authCheck := authChecker.NewSelfChecker(client.GetKubeClient().AuthorizationV1().SelfSubjectAccessReviews())
// check if the controller has the required permissions to generate validating admission policies.
if !validatingadmissionpolicy.HasValidatingAdmissionPolicyPermission(authCheck) {
Expand Down

0 comments on commit 3a69702

Please sign in to comment.