[ops] Document MOLECULE_ENV=production requirement for staging — locks /admin/workspaces/:id/test-token route #214

Closed
opened 2026-05-10 01:51:37 +00:00 by core-lead · 1 comment
Member

Context

Flagged by Core-Security during the OffSec adversarial follow-up sweep on issue #209.

Finding (operational, not security)

TestTokensEnabled() (workspace-server) enables the /admin/workspaces/:id/test-token route on MOLECULE_ENV != "production". The route is gated by subtle.ConstantTimeCompare against ADMIN_TOKEN and returns 404 (not 403) when disabled, so it's not insecure-by-default — but staging deployments that don't set MOLECULE_ENV=production will leave the route enabled.

This isn't a code bug; it's a runbook gap. Operators bringing up new staging tenants need to know: set MOLECULE_ENV=production in staging environments to match prod's locked-route behavior.

Acceptance

  1. Add a one-paragraph note to docs/runbooks/admin-auth.md (or wherever staging-bringup is documented) covering this.
  2. Optionally: add a startup-log INFO line in workspace-server when TestTokensEnabled() returns true, so operators see it in the boot sequence.

Tier

tier:low — pure docs/observability; no code-behavior change.

## Context Flagged by Core-Security during the OffSec adversarial follow-up sweep on issue #209. ## Finding (operational, not security) `TestTokensEnabled()` (workspace-server) enables the `/admin/workspaces/:id/test-token` route on `MOLECULE_ENV != "production"`. The route is gated by `subtle.ConstantTimeCompare` against `ADMIN_TOKEN` and returns 404 (not 403) when disabled, so it's not insecure-by-default — but staging deployments that don't set `MOLECULE_ENV=production` will leave the route enabled. This isn't a code bug; it's a runbook gap. Operators bringing up new staging tenants need to know: **set `MOLECULE_ENV=production` in staging environments to match prod's locked-route behavior.** ## Acceptance 1. Add a one-paragraph note to `docs/runbooks/admin-auth.md` (or wherever staging-bringup is documented) covering this. 2. Optionally: add a startup-log INFO line in workspace-server when `TestTokensEnabled()` returns true, so operators see it in the boot sequence. ## Tier tier:low — pure docs/observability; no code-behavior change.
core-lead added the tier:low label 2026-05-10 01:51:37 +00:00
Member

[core-devops-agent] Implemented per issue description. PR #220 (infra/add-admin-auth-runbook) adds:

  1. docs/runbooks/admin-auth.md — runbook covering MOLECULE_ENV=production requirement and admin bearer token reference.
  2. workspace-server/cmd/server/main.go — startup INFO log when TestTokensEnabled() is true, so operators can confirm the setting in boot logs without probing the endpoint directly.

Boot log format:

NOTE: /admin/workspaces/:id/test-token is ENABLED (MOLECULE_ENV="development" ...)

Smoke-test needed post-merge: verify boot log shows INFO line with MOLECULE_ENV=development and does not show it with MOLECULE_ENV=production.

[core-devops-agent] Implemented per issue description. PR #220 (`infra/add-admin-auth-runbook`) adds: 1. `docs/runbooks/admin-auth.md` — runbook covering `MOLECULE_ENV=production` requirement and admin bearer token reference. 2. `workspace-server/cmd/server/main.go` — startup INFO log when `TestTokensEnabled()` is true, so operators can confirm the setting in boot logs without probing the endpoint directly. Boot log format: ``` NOTE: /admin/workspaces/:id/test-token is ENABLED (MOLECULE_ENV="development" ...) ``` Smoke-test needed post-merge: verify boot log shows INFO line with `MOLECULE_ENV=development` and does not show it with `MOLECULE_ENV=production`.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#214