← Back to Pull requests

fix: validate in-cluster server names and refuse link-local addresses #410

Closed
unknown closed this pull request without merging on Nov 24, 2026 22:20 UTC
View on GitHub
unknown unknown commented on Nov 24, 2026 00:34 UTC
Author

GetAPIURL builds the in-cluster URL from spec.server.name and spec.server.namespace, and nothing checked them. A name such as elsewhere.example.com/x? sent the operator's requests to elsewhere.example.com.

  • The CRD now requires both to be DNS labels. ValidateAPIURL, renamed from ValidateRemoteAPIURL, checks them in Go for resources written before the rule.

  • The in-cluster URL ends with the cluster domain and a dot, as in http://prefect.team-b.svc.cluster.local.:4200/api, so the host doesn't depend on the resolver's search domains. The operator reads the domain from /etc/resolv.conf. --cluster-domain and the chart's operator.clusterDomain override it.

  • prefect.io/allowed-api-urls entries match with or without the dot. The operator doesn't use a proxy for in-cluster servers, because NO_PROXY entries such as .cluster.local don't match a host that ends with a dot.

  • The Prefect client's dialer refuses link-local addresses and the AWS and Google Cloud IPv6 metadata addresses, fd00:ec2::254 and fd20:ce::254, after DNS resolution. When the operator uses an HTTP proxy, the client refuses a remoteApiUrl with one of those IP addresses. The proxy resolves host names, so the permissions guide says to block the addresses there too.

  • Loopback and private addresses stay allowed. The operator port-forwards to 127.0.0.1 when it runs outside the cluster, and self-hosted servers often have private addresses.
  • The permissions guide now lists what remoteApiUrl lets someone who writes a resource do.

    Rollout caveats

  • action: upper-case letters in spec.server.name or spec.server.namespace are rejected, and an existing resource with them gets Synced False. DNS ignores case, so they worked before.

  • restart: PREFECT_API_URL changes on the workers of in-cluster servers, so their pods are replaced once. On process work pools, that interrupts the flow runs in progress.

  • action: workers and flow runs with HTTP_PROXY need .svc.cluster.local., with the dot, in NO_PROXY. Without it, they send API requests to the proxy in plain HTTP.

  • action: Istio sidecars on workers and flow runs must be 1.27 or later. Earlier ones don't route a host that ends with a dot to the Service.

  • watch: allowed-api-urls entries that end at .svc, such as http://prefect.team-b.svc:4200, no longer match. No release has the annotation yet.

  • watch: clusters whose domain isn't cluster.local. The operator logs the domain it uses at startup.

  • watch: Synced False on resources whose remoteApiUrl resolves to a link-local address. The message names the address.
  • <details>
    <summary>Session context</summary>

    Found while reviewing how resources choose which Prefect API the operator calls. I tested the cluster domain on a kind cluster with the domain k8s.example.internal: the operator detected it, and a work pool, a deployment, and a flow run used it. I repeated that with the default domain and a wildcard search domain on the node. With Istio 1.30 sidecars and strict mutual TLS, requests to the host with the dot succeeded.

    </details>

    🤖 Generated with Claude Code

    Diff: 395 lines (+296 / -99) across 4 files Reviewer: chrisguidry Review duration: 1306m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.43) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 395 lines diff across 4 files
    0.43
    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%
    56%
    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.358
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #410"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 43.2% (MEDIUM) · Higher = larger blast radius
    43.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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 18.7% · Safe to merge
    18.7%