Skip to content

feat(secrets): resolve CLOUDFLARE_API_TOKEN through orun secrets (phase 1) - #31

Merged
ruehowl merged 2 commits into
mainfrom
feat/cf-token-via-orun-secrets
Jul 27, 2026
Merged

ruehowl merged 2 commits into
mainfrom
feat/cf-token-via-orun-secrets

Conversation

@ruehowl

@ruehowl ruehowl commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Moves the Cloudflare deploy credential from a GitHub Actions repo secret to an orun-managed brokered secret — minted fresh per run from the workspace's Cloudflare integration (workers-deploy template), stored as secret://lumen/lumen/<env>/CLOUDFLARE_API_TOKEN at the project rung, lease-bound resolved and log-redacted at run time.

Changes

  • stack-tectonic 0.13.0 → 0.14.0 (feat(profiles): CLOUDFLARE_API_TOKEN as an orun secretBinding on worker deploy profiles stack-tectonic#8): cloudflare-worker-turbo-deploy + cloudflare-workers-assets-turbo-deploy profiles declare the token as a secretBindings entry → all 14 worker deploy lanes resolve it; PR/verify lanes carry zero secret refs.
  • cloudflare-kv: component-level secretEnv (its terraform plan lanes hit the live CF API too, so every profile needs it).
  • CF terraform stacks (kv, hyperdrive, domain): drop variable "cloudflare_api_token" — the provider reads CLOUDFLARE_API_TOKEN from env natively; TF_VAR_cloudflare_api_token removed from CI.
  • orun v2.20.0 → v2.39.0: resolved-secret env delivery to gha step processes (#539) + the component-tree secretEnv round-trip fix (#573).

Deliberately kept (phase 2)

  • Ambient CLOUDFLARE_API_TOKEN remains only for cloudflare-hyperdrive (needs Workers Hyperdrive Write) and cloudflare-domain (needs DNS Write) — the workers-deploy broker template doesn't mint those scopes yet.
  • CLOUDFLARE_ACCOUNT_ID stays ambient: identifier, not a credential.

Verification

  • orun secrets list --env prod --chain shows the key serving from the project rung.
  • Synthetic push-main plan against the published 0.14.0 OCI artifact: 30 jobs carry the ref (14 deploys × 2 envs + kv × 2), verify lanes none.
  • This PR's own kv plan lane exercises the live mint→resolve→inject path.

🤖 Generated with Claude Code

varahul and others added 2 commits July 27, 2026 20:48
…se 1)

The Cloudflare deploy credential becomes an orun-managed brokered secret —
minted fresh per run from the Cloudflare integration (workers-deploy
template: Workers Scripts Write + Workers KV Storage Write + Account
Settings Read), stored as secret://lumen/lumen/<env>/CLOUDFLARE_API_TOKEN
at the project rung, lease-bound resolved and log-redacted at run time.

- stack-tectonic 0.13.0 → 0.14.0: the cloudflare-worker-turbo and
  cloudflare-workers-assets-turbo deploy profiles now declare the token as
  a secretBinding; PR/verify lanes carry no refs and resolve nothing.
- cloudflare-kv declares it via component secretEnv (its plan lanes hit
  the live Cloudflare API too, so all profiles need it).
- The three CF terraform stacks drop variable cloudflare_api_token and
  authenticate the provider from the env var natively — the token no
  longer transits Terraform variables; TF_VAR_cloudflare_api_token is
  removed from CI.
- orun v2.20.0 → v2.39.0: resolved-secret env delivery to gha steps
  (v2.35.0) + the component-tree secretEnv fix (#573).
- The ambient CLOUDFLARE_API_TOKEN GH secret remains ONLY for
  cloudflare-hyperdrive (needs Workers Hyperdrive Write) and
  cloudflare-domain (needs DNS Write) until the broker templates cover
  those scopes; CLOUDFLARE_ACCOUNT_ID stays ambient (identifier, not a
  credential).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e account

Surfaced by this PR's full fan-out (the stack pin bump replans every
component): cloudflare-domain had not planned in CI since the rebrand
fork, and its zone lookup can never succeed — lumen.app is parked at
dns.ws, not delegated to Cloudflare, and absent from the connected
account, so data.cloudflare_zone.existing fails with 'no zone found'
regardless of credentials. Unsubscribe it (no jobs) with restore
instructions inline; unrelated to the CF-token migration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ruehowl
ruehowl merged commit 4a3cf4d into main Jul 27, 2026
5 checks passed
@ruehowl
ruehowl deleted the feat/cf-token-via-orun-secrets branch July 27, 2026 15:31
ruehowl added a commit that referenced this pull request Jul 28, 2026
…nly GITHUB_TOKEN (#34)

* feat(secrets): all provider credentials via orun secrets — CI keeps only GITHUB_TOKEN (phase 2)

Completes the migration #31 started. Every provider credential now resolves
from orun secrets at the project rung, brokered from the workspace's
integrations:

- cloudflare-hyperdrive: CLOUDFLARE_API_TOKEN maps to the new
  CLOUDFLARE_HYPERDRIVE_TOKEN (hyperdrive-edit template — Workers Hyperdrive
  Write, which the workers-deploy token deliberately lacks).
- CLOUDFLARE_ACCOUNT_ID + TF_VAR_cloudflare_account_id: the account-id
  connection-fact template (non-secret custody anchor) — bound by the worker
  deploy profiles (stack-tectonic 0.15.0) and the kv/hyperdrive components.
- supabase: SUPABASE_ACCESS_TOKEN minted fresh per run (management-access);
  TF_VAR_supabaseOrgId from the org-id connection fact. SUPABASE_API_KEY
  aliasing is retired (the provider reads SUPABASE_ACCESS_TOKEN natively).
- db-migrate: SUPABASE_ACCESS_TOKEN via component secretEnv.
- ci.yml: the provider env block is gone — GITHUB_TOKEN (GitHub-issued,
  ephemeral) is the only credential CI holds.

Verified: a synthetic push-main plan against stack-tectonic 0.15.0 shows 36
jobs carrying refs — 14 worker deploys × 2 envs (token + account id),
kv/hyperdrive (token + account id + TF_VAR), supabase (token + org id),
db-migrate (token).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(secrets): worker runtime secrets wire-now-seed-later — AWS escrow retired (phase 3)

Every worker that had managed runtime secrets in the AWS Secrets Manager
escrow now declares them as optionalSecretEnv references (best-effort:
unseeded keys skip at resolve) plus a runtimeSecrets parameter naming what
the stack's secrets-live v2 step pushes via wrangler secret bulk after
deploy. Seeding a value in orun secrets makes the next deploy push it —
zero repo changes per secret:

- identity-worker: GITHUB_OAUTH_CLIENT_SECRET, GOOGLE_OAUTH_CLIENT_SECRET,
  OAUTH_STATE_SECRET
- billing-worker: POLAR_ACCESS_TOKEN, POLAR_WEBHOOK_SECRET
- config-worker + webhooks-worker: SECRET_ENCRYPTION_KEY (config-worker's
  generate-if-missing pre-deploy stays as the safety net; seed the CURRENT
  deployed value — a fresh key bricks stored data)
- integrations-worker: the deferred GitHub App set + INTEGRATIONS_STATE_SECRET
  + SECRET_ENCRYPTION_KEY — inert until seeded, exactly the point

tooling/secrets-sync/ and tests/secrets-sync/ are deleted (assemble/check/
sync, manifests, fixtures, escrow runbook), the lockfile regenerated, and
the blueprint module list updated. stack-tectonic 0.15.0 -> 0.16.0
(secrets-live v2), orun v2.39.0 -> v2.41.0 (optionalSecretEnv).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(blueprint): fold the bootstrap flows into the baseline

Every fork now carries flows/ (bootstrap-flow.yaml, create-secrets.sh,
batch.sh, park.mjs, README.md) via a new blueprint module in the workspace
phase. The files carry LUMEN's instance identity (lumen-api-edge URLs,
lumen.app zone note, org default "lumen") so the rebrand hook rewrites
them for a fork like every other file; the org default fails loudly at
preflight for any operator without access to the baseline workspace.

create-secrets.sh self-heals: a key whose integration connection was
revoked (health orphaned) is revoked and recreated against the current
ACTIVE connection.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat!: remove the AWS dependency — platform terraform state + lease-published job output secrets

Mirrors the nimbus flip (stack 0.18.0, orun v2.45.0, orun-cloud SB1 +
SEC-JOB), adapted to lumen's identity:

- terraform roots: backend http (runner TF_HTTP_*), aws provider and all
  aws_secretsmanager_* resources gone; supabase creds + wiring documents
  leave as OUTPUTS lease-published by the runner (secretOutputs param).
- consumers: hyperdrive TF_VARs, db-migrate runner env (no @aws-sdk),
  workers' WIRING_<COMP>_<ENV> secretEnv.
- bootstrap component DELETED (it existed to prove the S3 state bucket);
  blueprint module + phases regenerated; batch plan reordered
  (kv → supabase → db-migrate+hyperdrive → workers…).
- intent: stack 0.18.0, aws params dropped; ci.yml pins orun v2.45.0.

⚠ DO NOT MERGE before running tooling/migrations/tfstate-to-orun.sh
(S3 state pull → drop SM resources from state → push to the platform
backend; needs AWS read creds + an orun token). Without it, applies
against the empty http backend would plan to re-create live resources.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(blueprint): ignore rendered wrangler.jsonc per templated app, not globally

The global pattern also stripped the two legacy workers' COMMITTED
configs (policy-worker, web-console-next) from forks — their verify
lanes then failed test -f silently (hit live on nimbus workers-a).

* fix(ci): exec-id without the attempt suffix — reruns resume, not restart (mirrors nimbus)

* fix: mirror nimbus live-run fixes — supabase provider pin, orun v2.48.0 resume+retry CI

- supabase provider ~> 1.5.1: 1.6.0+ reads /billing/addons which rejects
  OAuth tokens — the exact credential the platform brokers
- ci.yml: orun v2.48.0, --retry (true resume with exec-id on
  gh run rerun --failed), max-parallel: 8 (resolve-herd stagger)

All three were found and proven live during the nimbus baseline deploy.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Rahul Varghese <rahul.varghese@sourceplane.ai>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
ruehowl added a commit that referenced this pull request Oct 21, 2026
…ut (#115)

* feat: read the workers.dev subdomain from the Cloudflare connection

The `subdomain` input was typed by hand, though it belongs to the Cloudflare
account the same way its id does and has exactly one right answer. A wrong
value surfaced only after deploy, in CORS, OAuth origins, smoke checks and
the verify URLs. Ported from cirrus-baseline #30.

- blueprint.yaml: `subdomain` declares
  `from: connection.cloudflare.workersSubdomain`; the bootstrap door fills it
  from the connection the build is bound to, so the console renders no field
- testing/manifest.test.sh: cirrus's block, byte for byte — accepts the source
  and requires its provider in spec.requires.integrations (mutation-checked)
- repo-blueprint.yaml, BOOTSTRAP.md, docs/phases/01-scaffold.md and
  docs/phases/README.md: a hand-run build still passes --set subdomain
- saas-bootstrap-factory IMPLEMENTATION-STATUS: dated record (Lumen has no
  BE3 note or risk #13 to supersede)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

* feat: remove the domain input — the custom-domain component lands in 06-console, parked

`07-domain` was the one conditional phase: off unless `--set domain=true`,
landing a single component that ships parked (`subscribe.environments: []`),
so its convergence was a green run with nothing in it. The switch turned on a
component that is already off. Ported from cirrus-baseline #31; Lumen keeps
its landings, so the component folds into 06-console, the last landing that
converges a deploy and the one that places web-console-next.

- repo-blueprint.yaml: the `domain` input, its values.json key and the
  07-domain phase are gone; cloudflare-domain joins 06-console's modules
- blueprint.yaml: the programme lists seven milestones
- docs/phases/07-domain.md and tasks/07-domain.TaskContract.yaml deleted; what
  is still true (parked, v5 fence, zone first, restore the subscribe block) is
  a section of docs/phases/06-console.md and a row in ai/context/operations.md
- 06-console's contract leaves cloudflare-domain out of `affects` (parked)
- tests: phases.test.sh expects cloudflare-domain in 06-console; leak and
  placement no longer force `domain` on (1103 files placed, the identical set);
  the phased sequence places 08-docs after 06-console
- tests/fixtures/acme.json drops "domain": false
- records: saas-bootstrap-factory IMPLEMENTATION-STATUS section; a "Since
  then" note in saas-baseline-tracking

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

---------

Co-authored-by: Claude <noreply@anthropic.com>
ruehowl added a commit that referenced this pull request Oct 22, 2026
* feat: read the workers.dev subdomain from the Cloudflare connection

The `subdomain` input was typed by hand, though it belongs to the Cloudflare
account the same way its id does and has exactly one right answer. A wrong
value surfaced only after deploy, in CORS, OAuth origins, smoke checks and
the verify URLs. Ported from cirrus-baseline #30.

- blueprint.yaml: `subdomain` declares
  `from: connection.cloudflare.workersSubdomain`; the bootstrap door fills it
  from the connection the build is bound to, so the console renders no field
- testing/manifest.test.sh: cirrus's block, byte for byte — accepts the source
  and requires its provider in spec.requires.integrations (mutation-checked)
- repo-blueprint.yaml, BOOTSTRAP.md, docs/phases/01-scaffold.md and
  docs/phases/README.md: a hand-run build still passes --set subdomain
- saas-bootstrap-factory IMPLEMENTATION-STATUS: dated record (Lumen has no
  BE3 note or risk #13 to supersede)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

* feat: remove the domain input — the custom-domain component lands in 06-console, parked

`07-domain` was the one conditional phase: off unless `--set domain=true`,
landing a single component that ships parked (`subscribe.environments: []`),
so its convergence was a green run with nothing in it. The switch turned on a
component that is already off. Ported from cirrus-baseline #31; Lumen keeps
its landings, so the component folds into 06-console, the last landing that
converges a deploy and the one that places web-console-next.

- repo-blueprint.yaml: the `domain` input, its values.json key and the
  07-domain phase are gone; cloudflare-domain joins 06-console's modules
- blueprint.yaml: the programme lists seven milestones
- docs/phases/07-domain.md and tasks/07-domain.TaskContract.yaml deleted; what
  is still true (parked, v5 fence, zone first, restore the subscribe block) is
  a section of docs/phases/06-console.md and a row in ai/context/operations.md
- 06-console's contract leaves cloudflare-domain out of `affects` (parked)
- tests: phases.test.sh expects cloudflare-domain in 06-console; leak and
  placement no longer force `domain` on (1103 files placed, the identical set);
  the phased sequence places 08-docs after 06-console
- tests/fixtures/acme.json drops "domain": false
- records: saas-bootstrap-factory IMPLEMENTATION-STATUS section; a "Since
  then" note in saas-baseline-tracking

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

* feat: the console asks for no domain — the domain is set later

The product answers on workers.dev from its first deploy and nothing in the
build needs a domain, so the console card no longer asks for one. Everything
that uses the domain stays where it is, carrying a placeholder until an owner
sets it. Ported from turso-starter #9.

- blueprint.yaml: no productdomain input, and no apibaseurl (it derived from
  {productdomain}; a card can only derive from inputs it declares)
- repo-blueprint.yaml: productdomain optional, default empty
- rebrand.mjs: productdomain no longer required; empty brands the reserved
  placeholder <reponame>.example.com where lumen.app stood (intent
  BASE_DOMAIN/CONSOLE_CUSTOM_DOMAIN, edge and identity origins, mail sender,
  billing success URLs); with no domain the CLI default is the prod edge,
  https://<brandSlug>-api-edge-prod.<subdomain>.workers.dev
- ai/context/operations.md: "Setting the domain later"
- render-deployment-docs.sh: the placeholder is no domain to probe
- tests: fixture carries no domain; placement checks the product's CLI
  default and placeholder instead of the card's derive; rebrand.test.sh
  covers no domain, an empty one and a given one; CI reads the blueprint
  with no domain
- docs: BOOTSTRAP.md, docs/phases; record in saas-bootstrap-factory
  (baseline-v30, with #115)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants