Skip to content

feat(console): WorkOS API key from the Secrets Store, and a deploy workflow - #18

Merged
Bryan Fawcett (bryanfawcett) merged 3 commits into
stagingfrom
feat/console-secrets-store
Oct 16, 2026
Merged

Bryan Fawcett (bryanfawcett) merged 3 commits into
stagingfrom
feat/console-secrets-store

Conversation

@bryanfawcett

Copy link
Copy Markdown
Member

Slice 2 for the StationKit console (follows #17).

WorkOS from the Secrets Store

  • API key: Secrets Store secret CONSOLE_WORKOS_API_KEY, bound under the same name (secrets_store_secrets, placeholder store_id REPLACE_WITH_SECRETS_STORE_ID, marked OWNER ACTION), read with await env.CONSOLE_WORKOS_API_KEY.get() on each request.
  • WORKOS_CLIENT_ID=client_01KQBBSMQTSMTBN7HEC9KQBJC0 and WORKOS_REDIRECT_URI are plain vars. WORKOS_COOKIE_PASSWORD stays a separate Worker secret (wrangler secret put); no value invented.
  • @workos/authkit-astro reads build-time astro:env strings (its injected middleware calls configureAuthKit from them), which cannot take a Secrets Store binding. So the console owns the routes (/auth/signin, /callback, /auth/logout) and a middleware that resolves the settings at runtime (src/auth/workos-config.ts) and then runs the package's own authkitMiddleware. Importing the package root needs a build stub for astro/config, documented in astro.config.mjs. @workos/authkit-session is pinned as a direct dependency.
  • Fail closed: bad or missing config gives a JSON 500 for /api/* (with the security headers) and no session elsewhere; the sign-in routes error. Never logs a value; failure output names settings only.

Deploy workflow

.github/workflows/deploy.yml: dispatch or push to main only (never on PRs), production environment, contents: read, full checks first, cloudflare/wrangler-action pinned to a commit, post-deploy smoke (scripts/post-deploy-smoke.mjs: 200 landing, security headers, CSP, anonymous /api/stations is 401, no secret in output). Reads only: secret CLOUDFLARE_API_TOKEN; vars CLOUDFLARE_ACCOUNT_ID, CONSOLE_SECRETS_STORE_ID, CONSOLE_SMOKE_URL (optional). No route or custom domain is added (the Worker stays unreachable until cutover).

Not verified

The happy path with a real Secrets Store key cannot run in a local preview; it is covered by unit tests of resolveWorkosConfig and by the post-deploy smoke. Not deployed.


Generated by Claude Code

…rkflow

- The API key is the Secrets Store secret CONSOLE_WORKOS_API_KEY, bound under
  the same name (placeholder store_id for the owner), read with
  env.CONSOLE_WORKOS_API_KEY.get() on each request and handed to AuthKit.
  The package's own integration reads build-time astro:env strings, so the
  console owns the routes and a runtime-config middleware instead. Fails
  closed (JSON 500 for /api, no session elsewhere); never logs a value.
- WORKOS_CLIENT_ID (client_01KQBBSMQTSMTBN7HEC9KQBJC0) and the redirect URI
  are plain vars; WORKOS_COOKIE_PASSWORD stays a separate Worker secret.
- deploy.yml: dispatch or push to main only, production environment,
  pinned cloudflare/wrangler-action, post-deploy smoke.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WnTa759tUrAwMiSoif5g6w
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WnTa759tUrAwMiSoif5g6w
Replace library env source, per-request config flag, key cache,
reject string key in prod, POST-only logout, fixed callback message,
smoke Accept headers, store id validation.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WnTa759tUrAwMiSoif5g6w
@bryanfawcett
Bryan Fawcett (bryanfawcett) marked this pull request as ready for review October 16, 2026 23:43

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@bryanfawcett
Bryan Fawcett (bryanfawcett) merged commit 7494b44 into staging Oct 16, 2026
19 checks passed
@bryanfawcett
Bryan Fawcett (bryanfawcett) deleted the feat/console-secrets-store branch October 16, 2026 23:44
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