← Back to Pull requests

OCPBUGS-115749: Tighten operator RBAC to least privilege #1639

Closed
unknown closed this pull request without merging on Oct 07, 2026 13:45 UTC
View on GitHub
unknown unknown commented on Sep 22, 2026 14:34 UTC
Author

Remove over-broad rules from the operator ClusterRole that are not exercised by the code, moving namespace-scoped permissions to namespaced Roles:

- move daemonset and events access to a namespaced Role in openshift-cluster-node-tuning-operator
- move leases to the same namespaced Role, dropping the unused "patch" verb. The client-go lease lock only creates/gets/updates.
- drop the configmaps rule entirely. The MachineConfig ConfigMaps are managed through the management cluster identity in HyperShift, and the metrics client CA bundle is read from kube-system through its own read-only Role.
- add a read-only Role/RoleBinding in kube-system for the metrics client CA bundle
- add a Role/RoleBinding in the "default" namespace granting only create/patch on events as events for cluster-scoped objects are recorded in "default" namespace
- restrict securitycontextconstraints "use" to "restricted-v3", the SCC of the operator pod itself. The tuned DaemonSet pods remain "privileged" via the tuned ServiceAccount.
- narrow performance.openshift.io to performanceprofiles (+status/finalizers)
- drop the unused operators.coreos.com rule -- leftover from the PAO OLM-based deployment

Delete the unused clients.Core clientset, a leftover of the ConfigMap-based leader election that the controller-runtime lease lock replaced; its stale comment is what justified keeping the configmaps grant.

Add an e2e "security" suite (wired into the test-e2e target) that verifies the tightening.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

Summary by CodeRabbit

  • Security

  • - Restricted SCC usage to restricted-v3 and narrowed permissions for performance resources and cluster-wide operations.
    - Added namespace-specific permissions for daemonset, event, leader-election, and metrics configuration tasks, including read-only access to metrics configuration.
    - Added checks that verify unauthorized cross-namespace access and privileged actions are denied.

  • Tests

  • - Added end-to-end RBAC security coverage for the operator.
    - Included the security suite in the end-to-end test target.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 279 lines (+209 / -70) across 3 files Reviewer: jmencak Review duration: 21550m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 279 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.337
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1639"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.6% (MEDIUM) · Higher = larger blast radius
    39.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.7% · Safe to merge
    15.7%