Skip to content

Remove wildcard permissions from knative-serving-core ClusterRole#16601

Open
wiz-abhi wants to merge 1 commit into
knative:mainfrom
wiz-abhi:fix-clusterrole-wildcards
Open

Remove wildcard permissions from knative-serving-core ClusterRole#16601
wiz-abhi wants to merge 1 commit into
knative:mainfrom
wiz-abhi:fix-clusterrole-wildcards

Conversation

@wiz-abhi
Copy link
Copy Markdown

@wiz-abhi wiz-abhi commented May 14, 2026

Fixes #16599

Proposed Changes

  • Replace * wildcards in knative-serving-core ClusterRole with explicit resource lists for Knative-owned API groups
  • Expand resources for serving.knative.dev, autoscaling.internal.knative.dev, and networking.internal.knative.dev apiGroups to include all CRDs and their /status and /finalizers subresources
  • Preserve apiGroups: ["*"] / resources: ["*/scale"] rule to maintain multi-type workload scaling support added in use the /scale subresource to when updating replica count #16540

Release Note

NONE

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 14, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: wiz-abhi / name: Wiz Abhi (b320fb2)

@knative-prow knative-prow Bot requested review from dsimansk and skonto May 14, 2026 20:22
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 14, 2026

Welcome @wiz-abhi! It looks like this is your first PR to knative/serving 🎉

@knative-prow knative-prow Bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 14, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 14, 2026

Hi @wiz-abhi. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 14, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wiz-abhi
Once this PR has been reviewed and has the lgtm label, please assign dprotaso for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@wiz-abhi wiz-abhi force-pushed the fix-clusterrole-wildcards branch from 7c9763a to b320fb2 Compare May 14, 2026 20:40
Comment thread config/core/200-roles/clusterrole.yaml Outdated
- apiGroups: ["*"]
resources: ["*/scale"]
- apiGroups: ["apps"]
resources: ["deployments/scale"]
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.

We recently allowed scaling other resources besides deployments that expose the scale API, see #16540

Considering this and that the proposed change above only changes permissions for knative's own CRDs I personally don't see a benefit in this change and don't consider this a security improvement.

Will need to wait for feedback from a maintainer though.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the review — good catch on #16540. You're absolutely right that changing apiGroups: [""] / resources: ["/scale"] to deployments/scale would regress the multi-type workload scaling support added there. I'll revert that part.
For the Knative-owned API groups, my intent was least-privilege hardening (avoiding * to prevent automatic access to future CRDs/subresources in those groups), but I agree the immediate practical security gain may be limited.
I'd like maintainer guidance on policy here:

  1. Keep wildcard for Knative API groups (lower maintenance), or
  2. Use explicit resource lists for stricter RBAC posture (with ongoing maintenance cost).
    I'm happy to align either way and update/close this PR accordingly.

@wiz-abhi wiz-abhi force-pushed the fix-clusterrole-wildcards branch from b320fb2 to 7e80dfa Compare May 15, 2026 10:42
Replace '*' wildcards in resources for Knative-owned API groups with explicit
resource lists to follow the principle of least privilege.

Changes:
- Expand resources for serving.knative.dev, autoscaling.internal.knative.dev,
  and networking.internal.knative.dev apiGroups to list all CRDs explicitly
  including their /status and /finalizers subresources.
- Preserve apiGroups: ['*'] / resources: ['*/scale'] to maintain multi-type
  workload scaling support added in knative#16540.

Fixes knative#16599
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClusterRole shouldnt use * wildcards in apiGroups, resources, or verbs

2 participants