[cherry-pick: release-v0.3.x] fix(rbac): harden ClusterRole to least-privilege - #416
Merged
Merged
Conversation
Remove unused Knative boilerplate RBAC that granted permissions the
controller and webhook never exercise, reducing post-compromise blast
radius.
- Namespace: reduce from full CRUD to get/list/watch; remove
namespaces/finalizers (never referenced in code)
- Webhook configs: remove mutatingwebhookconfigurations entirely
(no mutating webhook exists); scope validatingwebhookconfigurations
to resourceNames + get/update only
- Secrets: remove cluster-wide get/list/watch (namespaced Role in
tekton-pipelines already covers it); switch webhook secret informer
from cluster-scoped to namespace-scoped import
Signed-off-by: Shubham Bhardwaj <shubbhar@redhat.com>
8 tasks
Member
|
/retest |
Member
|
/kind misc |
Member
|
/kind misc |
Author
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: infernus01 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
This is a cherry-pick of #391
Changes
The ClusterRole
tekton-pruner-controller-cluster-accesscontainedKnative boilerplate RBAC rules that grant permissions the code never
uses. This tightens every rule to match actual runtime behavior:
get/list/watchonly. Thenamespaces/finalizersrule is removed — no code path referencesnamespace finalizers.
mutatingwebhookconfigurationsremovedentirely (no mutating webhook exists).
validatingwebhookconfigurationsscoped to
resourceNames: [validation.webhook.pruner.tekton.dev]with only
getandupdate(the two verbs used inpkg/webhook/configmapvalidation.go).get/list/watchremoved. The namespacedRole in
tekton-pipelinesalready grants secret access. The webhook'ssecret informer import is switched from the cluster-scoped factory
(
knative.dev/pkg/client/injection/kube/informers/core/v1/secret)to the namespace-scoped factory
(
knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret),which is the same one the certificate controller already uses.
Why
A compromised pruner pod could use these unused permissions to delete
arbitrary namespaces, read secrets from any namespace, or register
malicious mutating webhooks. These are hardening issues — not directly
exploitable without prior pod compromise — but reducing the blast
radius is standard least-privilege hygiene.
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes
/kind misc