Restrict konnector clusterrole and dynamically provision RBAC per binding#593
Open
alokkumardalei-wq wants to merge 1 commit into
Open
Restrict konnector clusterrole and dynamically provision RBAC per binding#593alokkumardalei-wq wants to merge 1 commit into
alokkumardalei-wq wants to merge 1 commit into
Conversation
…ding Signed-off-by: alokkumardalei-wq <alokkumardalei2@gmail.com>
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.
Fixes #303
What changed?
This PR removes the cluster-admin wildcard (*) access from the
kube-bind-konnectorand introduces a dynamic RBAC generation model.Previously, the konnector required apiGroups: "*" to sync arbitrary custom resources (e.g.
mangodbs.foo.bar). Now:ClusterRole(in both the CLI and Backend manifests) is strictly scoped to the absolute minimum it needs to function (core infrastructure,kube-bindCRDs, leases, etc.).kubectlbind, the CLI intercepts the APIServiceExportRequest and dynamically generates a highly specific ClusterRole granting access only to the exact API Groups and Resources being bound.Testing & Validation
cli/pkg/kubectl/bind-apiservice/plugin/deploy_konnector.goandbackend/kubernetes/resources/konnector.gonow explicitly whitelists "",kube-bind.io,apiextensions.k8s.io, andcoordination.k8s.iorather than using wildcards.cli/pkg/kubectl/bind-apiservice/plugin/rbac.gocorrectly iterates overrequest.Spec.Resourcesandrequest.Spec.PermissionClaimsto construct the RBAC policy when a binding is created.