Skip to content

Removed

The admin secret editor (route, UI, broker client, tests, ADMIN_SECRETS_BROKER_* catalog entries) was removed end to end in #771, merged 2026-10-11. Secrets now live only in the Cloudflare Secrets Store. See Secrets and envs. This page is kept for history.

Admin Secrets (write-only) ​

Path: apps/admin (Secrets UI + routes) · infra/secrets/{management,broker} · Pulumi secrets-broker
Status: Landed in #184 (merged 2026-10-01). Rollout incomplete: broker/Lambda resources still need Pulumi apply + CD deploy; local fixture demos do not prove live IAM or Worker fan-out.
ADR: docs/decisions/admin-secrets.md

Staging and production admin each get a Secrets page so staff can see configuration gaps and replace external secrets without a direct AWS edit plus a separate Worker sync. Existing values have no read API; replacement values never appear in responses, caches, audit metadata, or errors.

What staff see ​

SurfaceBehaviour
ListCatalog name, configured / not set / optional / managed, consumers, source bundle, notes. Search matches name, consumer, or source.
ReplaceEmpty masked New value field with no reveal. Requires audit reason; production also requires typing prod. Bundle version captured when the editor opens.
Save vs applySave writes Secrets Manager only. Workers pick up the value after secrets-sync.yml (auto-dispatch if configured, otherwise manual with the reviewed VersionId). A queued sync is not proof Workers already have the new value.

Managed (read-only) rows: signing/encryption keys, computed settings, Pulumi-owned Auth0 / broker values (Bedrock metadata removed by #634, 2026-10-08), and the five permission-authority keys from brilliant/<env>/permission-keys (#541). Unknown names are denied — prefix families do not make unknown members editable.

Editable allowlist ​

Only external catalog entries whose source is the env base blob brilliant/<env> are editable. Composio auth-config ids (COMPOSIO_AUTH_CONFIG_<PROVIDER>_{READ,FULL}) moved to the admin Config page / CONFIG_KV overlay in #290 (merged) — prefer Admin Config for those edits; a Config value overrides the Secrets path. Allowlist for remaining secret writes lives in infra/secrets/management.ts (admin-secret-write-allowlist).

Write gates ​

  1. Staff role; staging or prod admin only (local/side-env returns unavailable).
  2. Fresh OIDC auth_time within 10 minutes (prompt=login + max_age=0 for reauth; recycling an old SSO session cookie does not refresh the write window).
  3. Audit reason + current bundle VersionId; production confirmation prod.
  4. Control-plane audit (admin.secret.update) must succeed before the broker mutates. Audit metadata: actor, env, name, expected version, reason — never the value.
  5. Content-Type JSON; replacement size bounded (request UTF-8 ≤ 65,536 bytes).

Broker architecture ​

Admin has no AWS credentials and no GetSecretValue. It calls a Pulumi-managed Node.js Lambda broker with a short-lived assertion (≈60s) that binds env, request body, and a unique request id. Shared assertion key lives only on that env’s admin (brilliant/<env>/admin-secrets).

  • Broker IAM: read its env’s base / Auth0 / Bedrock / broker config; write only the base bundle.
  • One concurrent invocation serializes writes; VersionId rejects stale editors; assertion UUID is the AWS idempotency token.
  • Unrelated JSON keys in the bundle are preserved. Values never leave the broker except the full replacement written back to Secrets Manager.
  • Emergency direct AWS writers must not race the broker (Secrets Manager has no compare-and-swap).

Optional auto-dispatch: Actions-write token in Pulumi-owned brilliant/<env>/admin-secrets-dispatch — never exposed to admin or the UI.

Worker sync ​

Workflow: .github/workflows/secrets-sync.yml

  • Inputs: environment (staging | production) + reviewed VersionId (no secret values in inputs).
  • Shares deploy concurrency lock deploy-<environment>; production keeps GitHub Environment approval.
  • Rejects a bundle that changed since the requested version; runs bun run secrets:push --env … --expected-version ….
  • secrets:push remains the only writer of Worker secrets.
  • A conductor push (including a sync from here) resets every WorkspaceDO and stops running turns. The idle wait #217 added was removed by #488 (merged 2026-10-05), so the push no longer fails on a busy env — see Secrets & environments.

Contracts / security notes ​

  • @cc admin-secret-write-allowlist — editable names are explicit; generated/Pulumi values stay read-only.
  • @cc admin-secret-updates-are-write-only — fresh auth, editable name, audit-before-mutation, no values in responses/audit.
  • Admin routes set Cache-Control: no-store.
  • Dialog keyboard: Tab/Shift+Tab contained; busy Escape guarded; focus restored to the invoking control (shared Dialog.tsx).

Rollout checklist (from ADR) ​

  1. Pulumi apply staging + prod broker resources.
  2. Deploy admin + control-plane audit via normal CD.
  3. Controlled save of an external setting → approve/run pinned secrets-sync → exercise the consuming Worker.
  4. Confirm HTTP/audit contain no values; capture desktop + phone screenshots of the deployed UI.

Prod-infra row 10 → Secrets Store write path (#697, merged) ​

#697 (merged 2026-10-09 08:05 IDT by yoni-monday, merge c798fe44; docs-only ADR amendment) updates prod-infra row 10: until the Secrets Store switch completes, admin writes still go through the isolated AWS broker described above; when the switch completes, writes move to the account's Secrets Store write-only API and the broker is deleted with the rest of AWS in wave 5 (#625). The admin still holds no AWS or store-read credentials. Worker application becomes /sync through reviewed CD (secrets:push during the switch). See Neon migration plan · Secrets & environments.