fix(provisioner): send provider on CP deprovision (#2386) #2387
Reference in New Issue
Block a user
Delete Branch "fix/2386-send-provider-on-deprovision"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #2386
CP Deprovision now routes by
?provider=. Without it, a non-AWS workspace falls through to the AWS terminate path and leaks the box.Changes:
resolveProviderhelper (queriesworkspaces.compute->>provider).&provider=to the DELETE URL instopInternalwhen provider is non-empty.Test plan:
go test ./workspace-server/internal/provisioner/... -run TestStop_SendsProviderQueryParamgo test ./workspace-server/internal/provisioner/... -run TestStop_EmptyProviderOmitsQueryParamSOP Checklist
REQUEST_CHANGES: the fix is correctly scoped, but it currently fail-opens on provider lookup and builds the query unsafely.
In workspace-server/internal/provisioner/cp_provisioner.go, stopInternal does
provider, _ := resolveProvider(ctx, workspaceID). If the DB/provider lookup fails after instance_id resolves, a non-AWS workspace silently omitsprovider=and falls back to the current AWS terminate path — the exact leak #2386 is trying to prevent. This should return an error/fail closed, analogous to instance_id resolution.The DELETE URL appends
"&provider=" + providerraw. Even if today providers are expected to be simple slugs, this is a query param and should be encoded via url.Values / url.QueryEscape. Please add regression coverage for a provider containing query-special characters so this stays pinned.Scope looks narrow to cp_provisioner.go plus tests and I do not see registry/required-check/merge-control files touched. CI on head
82a22cadcurrently has Handlers Postgres + E2E API Smoke green; CI / Platform (Go) is pending/running and governance checks are red/advisory. Holding for the two correctness fixes above.82a22cad1eto179453c4ddApproved on current head
179453c4dd.Verified the prior RC blockers are fixed:
resolveProvidererrors now return before any CP DELETE is issued, so the deprovision path fails closed instead of silently omitting provider;provider/instance_id/pruneare built withurl.Valuesandq.Encode()rather than raw concatenation. Regression tests cover provider forwarding, empty-provider omission, lookup-error no-CP-call, and hostile query chars round-trip.Scope remains limited to cp_provisioner.go plus provisioner tests. Local test run unavailable in this container (
gonot installed); PR CI snapshot had Python, Canvas, Shellcheck, E2E API Smoke, and Handlers Postgres green, with Platform Go still running at review time.APPROVED molecule-core#2387 @179453c4dd861b09a6a488066217c6605fae8657. Fetched live current head before review. The deprovision path now resolves provider after instance_id and fails closed if provider lookup errors, avoiding silent omission of provider= and accidental AWS fallback for non-AWS workspaces. DELETE query construction uses url.Values/q.Encode for instance_id, provider, and prune, so provider values cannot corrupt or inject query parameters. Regression tests cover provider forwarding, empty-provider omission, lookup-error no-CP-call, and hostile query-character round trip. Scope is limited to workspace-server/internal/provisioner/cp_provisioner.go and provisioner tests. CI / Platform (Go) and CI / all-required are green on this head; aggregate core status remains red from unrelated E2E/review/SOP infrastructure gates.
Security pass: deprovision now resolves provider fail-closed and uses url.Values for instance_id/provider/prune. This reduces wrong-backend resource leak risk; no auth/gate/secret weakening found. Posted as authorized SOP-ceremony security-review trigger.
QA pass: scoped CP deprovision provider propagation fix with regression coverage; workspace lifecycle/provider correctness warrants SOP tier med. No QA blocker found.
ready-to-merge: 2-genuine approved (Researcher + CR2). A2A down — cannot ping PM via workspace.