feat: enforce workload authorization and pod delete permissions on AuthProxyWorkload - #796
Draft
hessjcg wants to merge 1 commit into
Draft
feat: enforce workload authorization and pod delete permissions on AuthProxyWorkload#796hessjcg wants to merge 1 commit into
hessjcg wants to merge 1 commit into
Conversation
…thProxyWorkload Validates that users creating or updating an AuthProxyWorkload resource have the necessary RBAC permissions on the targeted workload and pods: - Requires 'delete' verb on pods in the namespace when creating/updating AuthProxyWorkload. - Requires 'update' and 'patch' verbs on the specific workload resource (e.g. deployments, statefulsets, daemonsets, replicasets, jobs, cronjobs, or pods) when named or across the namespace when using label selectors. - Requires 'authproxyworkloads/containeroverride' subresource permission when specifying custom container image/commands/args. - Skips re-validation on metadata-only updates to permit controller finalizer management. - Adds missing batch/jobs and batch/cronjobs update and patch permissions to the operator ClusterRole.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements admission webhook authorization validation for
AuthProxyWorkloadresources. It addresses the security requirement ensuring that users creating or updating anAuthProxyWorkloadresource possess sufficient RBAC permissions to modify the targeted workload and pods.Changes
SubjectAccessReview (SAR) Authorization Check in Validating Webhook:
deleteverb oncore/podsin the target namespace.spec.workload.name): checksupdateandpatchpermissions on that specific named resource (deployments,statefulsets,daemonsets,replicasets,jobs,cronjobs, orpods).spec.workload.selector): checks namespace-wideupdateandpatchpermissions on the resource kind.createpermission on theauthproxyworkloads/containeroverridesubresource when specifying customauthProxyContainerimage/commands/args.ValidateUpdateifspecis unchanged (!reflect.DeepEqual(old.Spec, newObj.Spec)), allowing controller manager finalizer management without obstruction.RBAC & Controller Updates:
batch/jobsandbatch/cronjobs(update,patch) to the operatorClusterRole.authorization.k8s.io/subjectaccessreviews(create).Unit & E2E Tests: