← Back to Pull requests

fix: tighten API key checks and limit Prefect API responses #407

Closed
unknown closed this pull request without merging on Nov 23, 2026 21:27 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 21:01 UTC
Author

Related to #406

Follow-ups to #406 for API key checks, Prefect API requests, deletion, and the chart:

  • The api-key-permissions policy now checks any spec change to a PrefectWorkQueue, PrefectDeployment or PrefectAutomation, as workload-permissions already does. It used to check only changes to spec.server.

  • A work pool's settings can no longer set PREFECT_API_URL or PREFECT_API_KEY. Both come from spec.server, which is what the operator checks the key's prefect.io/allowed-api-urls annotation against.

  • remoteApiUrl must be an http or https URL with a host name, and no user information, query or fragment. The CRD checks new writes, and the client factory checks existing resources.

  • The client reads at most 8 MiB of a response body, measured after gzip decompression. Error messages written to the Synced condition keep the first 4 KiB of the body.

  • When the Prefect delete fails, the operator keeps the finalizer and retries every 30 seconds for an hour. It used to remove the finalizer at once, which left the object in Prefect.

  • The chart renders the operator's container security context. containerSecurityContext.enabled was unset, so the values were never applied.
  • The chart now requires Kubernetes 1.30, and golang.org/x/net goes to v0.63.0.

    Rollout caveats

  • breaking: changing any spec field of a PrefectWorkQueue, PrefectDeployment or PrefectAutomation now needs get on the Secret or ConfigMap that spec.server.apiKey.valueFrom names.

  • breaking: an existing resource whose remoteApiUrl has a query, fragment, user information or no host name gets Synced=False and stops syncing.

  • breaking: an existing work pool whose settings set PREFECT_API_URL or PREFECT_API_KEY gets Synced=False with reason InvalidSpec. The operator stops updating its worker Deployment.

  • breaking: the chart refuses to install on Kubernetes before 1.30.

  • watch: resources in Terminating. A resource whose Prefect delete fails now stays for up to an hour, with a DeleteFailed event every 30 seconds.

  • no-op: the operator container now drops all capabilities and disallows privilege escalation. Its distroless non-root image needs neither.
  • <details>
    <summary>Session context</summary>

    These came out of reviewing main after #406 merged. The policy doesn't check DELETE, because deleting a resource deletes its Prefect object by design. The one-hour delete window is a constant, not a chart value. Namespace-scoped RBAC for WATCH_NAMESPACES is left for a later PR.

    </details>

    🤖 Generated with Claude Code

    Diff: 326 lines (+244 / -82) across 4 files Reviewer: chrisguidry Review duration: 26m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 326 lines diff across 4 files
    0.42
    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.346
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #407"
    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: 42% (MEDIUM) · Higher = larger blast radius
    42%
    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: 16.6% · Safe to merge
    16.6%