← Back to Pull requests

Prevent unvalidated cross-namespace dashboard RBAC grants #10716

Closed
unknown closed this pull request without merging on Nov 25, 2026 18:46 UTC
View on GitHub
unknown unknown commented on Nov 12, 2026 14:19 UTC
Author

Fixes: https://redhat.atlassian.net/browse/RHOAIENG-98918

Problem

The Dashboard CR can name arbitrary namespaces for notebooks and model-registry integration. The dashboard operator then grants its service account access to secrets and other namespaced resources in those targets without first establishing that the namespace consented to the grant.

Solution

  • Add opt-in enforcement for dashboard.opendatahub.io/allow-namespaced-rbac=true, gated by the explicit --enforce-namespaced-rbac-consent migration flag.

  • Preserve legacy grants until enforcement is enabled. The webhook keeps its existing admission contract in this mode and a separate informational NamespacedRBACConsentEnforced=False condition reports the transition without masking workload health.

  • Persist a protected enforcement latch when the migration flag is first enabled. Controller and admission policy continue fail-closed if a later deployment accidentally drops the flag.

  • Protect Dashboard target fields and consent grants with a validating webhook. Trusted platform identities may grant consent; any namespace updater may revoke it.

  • Protect the grant inventory and enforcement latch as controller-only Dashboard annotations. Corrupt or truncated inventory is rebuilt from independently observable ownership before validation and cleanup.

  • Use API-server match conditions so unrelated Dashboard and Namespace updates, including finalizer work, do not depend on webhook availability. Namespace subresources are excluded.

  • Perform a one-time label-selected migration for older grants; steady-state reconciliation uses direct Role reads and namespace-scoped RoleBinding lists.

  • On revocation, empty the Role rules first, delete every binding to the reserved Role (including replacement names), delete the Role, and retain inventory until fresh API reads confirm cleanup. Finalizers cannot retain effective access or let Dashboard deletion finish before cleanup.

  • Run revocation before other Managed, Removed, or deletion work and persist Ready=False / Degraded=True with reason NamespacedRBACFailed on failures.
  • Rollout contract

    The platform operator change that enables enforcement must update its chart configuration and RELATED_IMAGE_ODH_DASHBOARD_OPERATOR_IMAGE together. A new image with older configuration remains in bounded legacy transition mode; enabling the new flag requires a compatible image, webhook, and at least one trusted writer. Once enabled, durable state prevents downgrade.

    Companion platform-operator PR: https://github.com/opendatahub-io/opendatahub-operator/pull/4329

    Evidence

  • make test (controller coverage 84.1%, webhook coverage 85.9%)

  • make lint (0 issues)

  • make test-integration (race-enabled, 122.785s; includes a real Kubernetes 1.31 API-server test of the rendered ValidatingWebhookConfiguration and CEL match conditions)

  • GOCACHE=/private/tmp/rhoaieng-98918-gocache make chart-validate

  • Built BuildConfig run 12 and deployed commit a0347c66 as digest sha256:beb44b577a45ca3c53c6688670bbcb0b3472ab1f143c821ecf380e14390b5f85 to the local OpenShift 4.21 / RHOAI 3.5 cluster. Run 11 was cancelled after Docker Hub rate-limited its external builder-image pull; run 12 reused the internal Build 10 base and replaced the manager with the statically compiled binary from the exact commit.

  • Verified legacy mode with no writer list allows the existing target-update contract, creates the legacy grant, keeps Ready=True and Degraded=False/NoDegradation, and reports the separate informational transition condition.

  • Verified enabling enforcement persists the latch and creates grants only after trusted consent and target writes.

  • Verified removing the deployment flag afterward does not downgrade policy: an ordinary user remained unable to change target fields or controller annotations.

  • Deliberately corrupted the inventory as the controller identity, then removed consent as an ordinary authorized namespace updater. The controller repaired inventory, removed Role and RoleBinding, changed secret access to no, retained the enforcement latch, and reported NamespacedRBACFailed while the configured target lacked consent.

  • Verified finalizer-held Role and RoleBinding cleanup separately: permissions are neutralized first, retry inventory remains until deletion is confirmed, and the Dashboard finalizer cannot complete early.

  • Restored the cluster to its parent-managed baseline: parent operator 3/3, dashboard operator 1/1, Dashboard Ready, no configured target, latch, consent, or test RBAC resources, and no dashboard secret access.
  • Diff: 576 lines (+432 / -144) across 7 files Reviewer: lucferbux Review duration: 18987m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 576 lines diff across 7 files
    0.50
    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.380
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #10716"
    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: 49.8% (MEDIUM) · Higher = larger blast radius
    49.8%
    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: 19.7% · Safe to merge
    19.7%