← Back to Pull requests

Fix SAN-extension policy bypass #915

Closed
unknown closed this pull request without merging on Jul 07, 2026 15:37 UTC
View on GitHub
unknown unknown commented on Jun 01, 2026 14:00 UTC
Author

TL;DR


A low-privileged tenant (create certificaterequests + RBAC use on a bound
CertificateRequestPolicy) could obtain a CA-signed certificate carrying SAN
identities the approver-policy gate never evaluated — e.g. a Microsoft UPN
otherName or a directoryName — and impersonate a privileged user to AD CS /
EAP-TLS / custom mTLS relying parties.

Root cause


allowed.Evaluate() matched SANs against Go's parsed slices
(DNSNames/IPAddresses/URIs/EmailAddresses), which only cover GeneralName
tags {1,2,6,7} and silently drop {0,3,4,5,8} (otherName, x400Address,
directoryName, ediPartyName, registeredID). cert-manager copies the raw SAN
extension into the issued cert, so those dropped entries shipped unseen by policy.

Fix


Parse the raw SAN extension (OID 2.5.29.17) directly and evaluate every
GeneralName — fail-closed:
  • tags {1,2,6,7} keep using the existing parsed-slice evaluators (unchanged);

  • otherName (tag 0) is denied unless its OID is opted in via the new additive

  • allowed.otherNames field (oid + values/required/validations);
  • tags {3,4,5,8} are always denied (no opt-in).
  • DNS/IP/URI/email-only CSRs evaluate exactly as before.

    The policy webhook also validates allowed.otherNames at admission (same as
    every other allowed. field): a required entry must declare values/
    validations, every CEL rule must compile, and each oid must be a valid,
    canonical dotted ASN.1 OID — so misconfigurations fail fast instead of producing
    confusing runtime denials.

    Migration impact


    | Scenario | After |
    |---|---|
    | DNS/IP/URI/email SANs only | works unchanged |
    | SAN UPN otherName (AD / EAP-TLS / smart-card) | denied by default — add allowed.otherNames: [{oid: "1.3.6.1.4.1.311.20.2.3", values: ["
    @tenant.example.com"]}] |
    | SAN directoryName/x400Address/ediPartyName/registeredID | always denied, no opt-in (rare for cert-manager; Istio/SPIFFE/CSI use URI SANs, unaffected) |

    Denied requests carry an Approved=False condition naming the offending SAN/OID
    and the denying policy; the existing
    certmanager_approverpolicy_certificaterequests_approval{status="denied"} metric
    flags an upgrade-induced rise.

    Diff: 281 lines (+210 / -71) across 3 files Reviewer: inteon Review duration: 51936m
    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 · 281 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.338
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #915"
    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.7% (MEDIUM) · Higher = larger blast radius
    39.7%
    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%