Skip to content

[cherry-pick: release-v0.3.x] fix(rbac): harden ClusterRole to least-privilege - #416

Merged
tekton-robot merged 1 commit into
release-v0.3.xfrom
cherry-pick-391-to-release-v0.3.x
Sep 8, 2026
Merged

[cherry-pick: release-v0.3.x] fix(rbac): harden ClusterRole to least-privilege#416
tekton-robot merged 1 commit into
release-v0.3.xfrom
cherry-pick-391-to-release-v0.3.x

Conversation

@tekton-robot

Copy link
Copy Markdown

This is a cherry-pick of #391


Changes

The ClusterRole tekton-pruner-controller-cluster-access contained
Knative boilerplate RBAC rules that grant permissions the code never
uses. This tightens every rule to match actual runtime behavior:

  • Namespaces: full CRUD → get/list/watch only. The
    namespaces/finalizers rule is removed — no code path references
    namespace finalizers.
  • Webhook configurations: mutatingwebhookconfigurations removed
    entirely (no mutating webhook exists). validatingwebhookconfigurations
    scoped to resourceNames: [validation.webhook.pruner.tekton.dev]
    with only get and update (the two verbs used in
    pkg/webhook/configmapvalidation.go).
  • Secrets: cluster-wide get/list/watch removed. The namespaced
    Role in tekton-pipelines already grants secret access. The webhook's
    secret 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:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

/kind misc

  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>
@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label Sep 8, 2026
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 8, 2026
@infernus01

Copy link
Copy Markdown
Member

/retest

@infernus01

Copy link
Copy Markdown
Member

/kind misc

@infernus01 infernus01 removed the kind/misc Categorizes issue or PR as a miscellaneuous one. label Sep 8, 2026
@infernus01

Copy link
Copy Markdown
Member

/kind misc

@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label Sep 8, 2026

@infernus01 infernus01 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 8, 2026
@tekton-robot

Copy link
Copy Markdown
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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 8, 2026
@tekton-robot
tekton-robot merged commit 2d0dc92 into release-v0.3.x Sep 8, 2026
16 of 24 checks passed
@tekton-robot
tekton-robot deleted the cherry-pick-391-to-release-v0.3.x branch September 8, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/misc Categorizes issue or PR as a miscellaneuous one. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants