← Back to Pull requests

fix(tls): fail closed on denied reads and validate serving profiles #222

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 03, 2026 22:36 UTC
Author

Purpose of this PR

Proposed changes:

  • FetchTLSProfile fails closed: Forbidden/Unauthorized reads, unexpected API errors, and malformed profiles return errors, and both the controller and webhook startup paths exit before constructing the manager. The profile watcher triggers the restart path on fetch errors instead of retrying. Transient errors keep the documented Intermediate fallback with the watcher self-healing once the read recovers.

  • The cluster profile is honored under every tlsAdherence mode, preserving released behavior: current operators already honor it on the common paths, and LegacyAdheringComponentsOnly exists to keep that honoring in production. On supported OCP 4.x clusters spec.tlsAdherence is behind the platform's TLSAdherence feature gate and unset, so the profile remains the effective knob.

  • ParseTLSProfile resolves built-in profiles from the OpenShift profile definitions: Old applies its actual TLS 1.0 minimum and explicit suites (AES-GCM, CBC, 3DES) instead of the previous TLS 1.2 substitution with unrestricted Go defaults. Malformed Custom settings (missing block, unknown or empty minimum version, no ciphers below TLS 1.3) and unknown types return errors instead of silent Intermediate substitution.

  • Cipher names convert from OpenSSL aliases through library-go and validate against the running Go runtime: TLS 1.3-only suites are excluded below TLS 1.3, mixed lists keep the supported subset, and requests with no usable suite are rejected. Custom profiles additionally reject RC4, 3DES, and SHA-1 CBC suites, including lowercase and OpenSSL aliases; built-in profiles are always resolved verbatim.

  • Configured groups are applied as curve preferences. Profiles with a minimum below TLS 1.3 whose groups are all TLS 1.3-only ML-KEM hybrids are rejected, since such lists cannot negotiate a TLS 1.2 handshake; mixed lists keep their usable subset.

  • ALPN is derived from the effective configuration: h2 is advertised when the effective cipher list can serve HTTP/2 (an ECDHE AES-128-GCM suite, or an empty list meaning Go defaults).

  • All builders move to Go 1.26.10 (root Dockerfile, examples/openshift/Dockerfile.odh, and the module builder digest-pinned), clearing GO-2026-6607; the nested test/e2e modules align on go 1.26.0 with toolchain go1.26.10.

  • The Helm chart controller and webhook ClusterRoles gain config.openshift.io/apiservers read rules matching the bundled manifests; the new fail-closed reads would otherwise make chart installs fatal.
  • JIRA: https://redhat.atlassian.net/browse/RHOAIENG-96993

    Change Category

  • Bugfix (non-breaking change which fixes an issue)

  • Feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that could affect existing functionality)

  • Documentation update
  • Rationale

    Denied APIServer reads previously fell back to Intermediate and served a guessed posture indefinitely; the Old profile was silently replaced with TLS 1.2 and unrestricted cipher defaults; and unsupported Custom cipher lists degraded to Go defaults. All three violate the OpenShift centralized TLS configuration contract (invalid strict profiles fail closed; Old is honored exactly). Honoring semantics are unchanged from released operators: the profile applies under every adherence mode.

    Checklist

  • I have conducted a self-review of my own code.

  • I have updated documentation accordingly.

  • I have added tests that prove my changes are effective or that my feature works.

  • Existing unit tests pass locally with my changes.
  • Additional Notes

    Verification: full pkg/tls suite including the envtest integration test (KUBEBUILDER_ASSETS), go build ./..., go vet, gofmt, go mod tidy -diff, git diff --check; Helm chart rendered and YAML-validated with the new RBAC rules; reviewed with CodeRabbit locally over three rounds (the Helm rule indentation and the missing chart RBAC were found and fixed in rounds 1-2; round 3 returned zero findings). One follow-up observation, not addressed here: the chart/kustomize drift test explicitly skips OpenShift-specific RBAC, which is how the chart RBAC gap went unnoticed; lifting that skip could be a separate change.

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

    Summary by CodeRabbit

    New Features
    TLS settings now follow the cluster’s configured profile, including its minimum TLS version, cipher suites, and curve preferences.
    HTTP/2 is advertised only when supported by the TLS configuration; otherwise, connections use HTTP/1.1.
    OpenShift Intermediate, Modern, Old, and Custom TLS profiles are supported, with validation of versions, cipher suites, and named groups.
    Bug Fixes
    TLS profile lookup and invalid-profile errors are handled explicitly. Missing profiles and transient read failures retain fallback behavior.
    The operator stops startup when required TLS settings cannot be resolved.
    TLS profile lookup failures trigger the change callback without retrying reconciliation.
    Chores
    Updated permissions to allow operator components to read cluster API server configuration.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: RobuRishabh Review duration: 5651m
    All Vouch review confidence checks passed
    Residual risk 0.40 = Change Risk (0.75) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.75 · 650 lines diff across 8 files
    0.75
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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.388
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.075
    Real PR Conversation Timeline
    1 comments
    "Review active on #222"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 46.7% reviewed sensitive_module
    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: 75.2% (HIGH) · Higher = larger blast radius
    75.2%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 40.1% · Moderate risk
    40.1%