Skip to content

fix(security): tenant CPProvisioner sends CP bearer on provision / stop / status - #981

Merged
HongmingWang-Rabbit merged 1 commit into
stagingfrom
fix/security-tenant-cpprovisioner-bearer
Apr 19, 2026
Merged

fix(security): tenant CPProvisioner sends CP bearer on provision / stop / status#981
HongmingWang-Rabbit merged 1 commit into
stagingfrom
fix/security-tenant-cpprovisioner-bearer

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Summary

Completes the C1 integration (molecule-controlplane PR #50). CP now requires `Authorization: Bearer <PROVISION_SHARED_SECRET>` on every `/cp/workspaces/*` call and refuses to mount the routes when the env var is unset. Without this change, the tenant platform's outbound `Start` / `Stop` / `IsRunning` calls all 401 (or 404 when CP routes don't mount), and every SaaS-tenant workspace provision silently fails.

Reads `MOLECULE_CP_SHARED_SECRET`, falling back to `PROVISION_SHARED_SECRET` so operators can use a single env-var name on both sides. Empty value is a no-op — self-hosted deployments keep working.

Test plan

  • `go build ./...` clean
  • Staging tenant: once `MOLECULE_CP_SHARED_SECRET` is set, confirm workspace provision POST reaches CP with bearer, CP responds 201, workspace EC2 spins up
  • Staging tenant: without the env var set, confirm the existing self-hosted / no-CP path still works

🤖 Generated with Claude Code

Completes the C1 integration (PR #50 on molecule-controlplane). The CP
now requires Authorization: Bearer <PROVISION_SHARED_SECRET> on all
three /cp/workspaces/* endpoints; without this change the tenant-side
Start/Stop/IsRunning calls would all 401 (or 404 when the CP's routes
refused to mount) and every workspace provision from a SaaS tenant
would silently fail.

Reads MOLECULE_CP_SHARED_SECRET, falling back to PROVISION_SHARED_SECRET
so operators can use one env-var name on both sides of the wire. Empty
value is a no-op: self-hosted deployments with no CP or a CP that
doesn't gate /cp/workspaces/* keep working as before.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@HongmingWang-Rabbit
HongmingWang-Rabbit merged commit ea5cb88 into staging Apr 19, 2026
9 checks passed
molecule-ai Bot pushed a commit that referenced this pull request Apr 21, 2026
…ioner-bearer

fix(security): tenant CPProvisioner sends CP bearer on provision / stop / status
@HongmingWang-Rabbit
HongmingWang-Rabbit deleted the fix/security-tenant-cpprovisioner-bearer branch April 24, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant