Skip to content

Commit

Permalink
Less control over cluster webhooks
Browse files Browse the repository at this point in the history
Following https://kubernetes.io/docs/concepts/security/rbac-good-practices/#control-admission-webhooks
We know the names of our validating/mutating webhooks upfront,
so we can only allow update/delete on those.

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
  • Loading branch information
akalenyu committed Aug 27, 2023
1 parent cda6296 commit 1971de3
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion pkg/operator/resources/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,45 @@ func getClusterPolicyRules() []rbacv1.PolicyRule {
"mutatingwebhookconfigurations",
},
Verbs: []string{
"*",
"create",
"list",
"watch",
},
},
{
APIGroups: []string{
"admissionregistration.k8s.io",
},
Resources: []string{
"validatingwebhookconfigurations",
},
ResourceNames: []string{
"cdi-api-dataimportcron-validate",
"cdi-api-populator-validate",
"cdi-api-datavolume-validate",
"cdi-api-validate",
"objecttransfer-api-validate",
},
Verbs: []string{
"get",
"update",
"delete",
},
},
{
APIGroups: []string{
"admissionregistration.k8s.io",
},
Resources: []string{
"mutatingwebhookconfigurations",
},
ResourceNames: []string{
"cdi-api-datavolume-mutate",
},
Verbs: []string{
"get",
"update",
"delete",
},
},
{
Expand Down

0 comments on commit 1971de3

Please sign in to comment.