Skip to content

Replace wildcard RBAC markers with explicit resource lists - #672

Open
zhiqiangf wants to merge 2 commits into
openshift:mainfrom
zhiqiangf:fix/find-003-replace-rbac-wildcards
Open

Replace wildcard RBAC markers with explicit resource lists#672
zhiqiangf wants to merge 2 commits into
openshift:mainfrom
zhiqiangf:fix/find-003-replace-rbac-wildcards

Conversation

@zhiqiangf

Copy link
Copy Markdown
Contributor

Summary

  • Replace resources=* and verbs=* in kubebuilder RBAC markers with explicit resource and verb lists to follow least-privilege best practices
  • The operator's manager-role ClusterRole previously used wildcards that granted broader access than needed; this tightens permissions to only the resources the controllers actually use
  • Regenerate config/rbac/role.yaml via make manifests and CSV via make bundle

Changes

  • dpuoperatorconfig_controller.go: replace resources=* marker with explicit resources (configmaps, serviceaccounts, services, secrets, pods, nodes, persistentvolumeclaims, persistentvolumes, events); replace verbs=* on remaining resources with explicit verbs
  • dataprocessingunit_controller.go: replace verbs=* with explicit verb lists
  • Regenerated config/rbac/role.yaml, bundle CSV, and manifests/stable CSV

Note: make bundle also picked up the DpuNetwork CRD entries that were not regenerated after PR #636 — these appear in the CSV diff as a separate commit.

Test plan

  • make manifests produces no diff (generated role.yaml matches markers)
  • make bundle produces no diff (CSV matches role.yaml)
  • Operator can still reconcile all resources with the updated RBAC
  • oc get clusterrole manager-role -o yaml shows no wildcards after deployment

🤖 Generated with Claude Code

zhiqiangf and others added 2 commits August 6, 2026 13:36
The operator's manager-role ClusterRole used resources: ['*'] on the
core API group and verbs: ['*'] on several resources, granting
effectively cluster-admin level access. Replace the kubebuilder RBAC
markers with explicit resource and verb lists covering only what the
operator actually needs.

Changes:
- dpuoperatorconfig_controller.go: replace resources=* marker with
  explicit resources (configmaps, serviceaccounts, services, secrets,
  pods, nodes, persistentvolumeclaims, persistentvolumes, events);
  replace verbs=* on mutatingwebhookconfigurations with explicit verbs
- dataprocessingunit_controller.go: replace verbs=* with explicit
  verb lists on pods, secrets, services, persistentvolumeclaims,
  persistentvolumes
- Regenerate config/rbac/role.yaml via controller-gen

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Run make bundle to regenerate the ClusterServiceVersion. This picks up
the RBAC wildcard removal from the previous commit and also syncs the
DpuNetwork CRD entries that were missing after PR openshift#636.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci
openshift-ci Bot requested review from bn222 and vrindle August 6, 2026 17:42
@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zhiqiangf
Once this PR has been reviewed and has the lgtm label, please assign wizhaoredhat 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

@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown

@zhiqiangf: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/make-e2e-test dc07046 link true /test make-e2e-test
ci/prow/make-e2e-test-ptl dc07046 link true /test make-e2e-test-ptl
ci/prow/make-e2e-test-marvell dc07046 link true /test make-e2e-test-marvell

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant