Skip to content

fix(platform): isolate email signing and provision gateway secrets - #333

Merged
Brooooooklyn merged 2 commits into
mainfrom
codex/email-signing-key
Sep 20, 2026
Merged

Brooooooklyn merged 2 commits into
mainfrom
codex/email-signing-key

Conversation

@Brooooooklyn

@Brooooooklyn Brooooooklyn commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

The first production email gateway deployment failed because its required signing secret was not provisioned when the Worker was created. Give email its own EMAIL_SIGNING_SECRET across the API, proxy and gateway, and upload that secret with each standard Worker deployment after a preflight that runs before migrations. Login sessions and project authentication retain JWT_SECRET.

Self-hosted email installations generate and checkpoint an independent key, preserve it across interrupted setup and upgrades, and require the original key when recovery state is missing. An interrupted email credential update cannot be replaced with unrelated credentials, including by an email-disable plan. Recovered email identity stays authoritative over conflicting environment input. Core-only installations and direct Cloudflare app deployments gain no new secret requirement.

Automatic deployment-key injection is restricted to the three known first-party Worker directories and standard deployment options. Alternate configs, entrypoints, targets and other custom options receive no automatic email key. Local platform setup, recovery guidance and the existing email design are updated.

Validation:

  • Full build, formatting, lint and 27-package typecheck passed; affected core packages rebuilt after the review fixes.
  • Final full suite with repository CI concurrency: 551 files, 10,437 passed and 20 skipped.
  • Packed consumer smoke passed for npm and pnpm.
  • Real Wrangler dry runs verified hidden-key injection; a non-network harness covered 32 default/custom-target variants, restricted file permissions, clean child environments and cleanup on success/failure.
  • Repeated independent GPT-5.6-sol xhigh reviews; verified findings fixed and reviewed again. GitHub review findings were checked against current source before action.

Deployment requires one stable EMAIL_SIGNING_SECRET in each GitHub deployment environment; production and staging use different values. The documented first cutover is coordinated across all three Workers without a JWT compatibility fallback. Remove any old JWT binding from the gateway after cutover while preserving API/proxy login keys.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-20T09:40:14.583018Z 2522b1e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4e8d63020e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread platform/packages/api/wrangler.jsonc Resolved
Comment thread platform/package.json Resolved
Comment thread platform/scripts/wrangler-deploy.ts Resolved
Comment thread docs/guide/self-hosted-platform.md Resolved
@Brooooooklyn
Brooooooklyn merged commit 7e39315 into main Sep 20, 2026
19 checks passed
@Brooooooklyn
Brooooooklyn deleted the codex/email-signing-key branch September 20, 2026 09:38

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2522b1eac3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +690 to +692
emailEnabled: plan.deployment.capabilities.email,
emailSigningSecret: process.env.VOID_PLATFORM_EMAIL_SIGNING_SECRET || '',
existingEmailEnabled: existing.deployment.capabilities.email,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Upload the email key when a resumed install enables email

When --resume targets an in-progress installation whose recorded deployment did not enable email, the planner explicitly permits adding the email capability, and this call generates a new signing key. However, it does not set updateExistingWorkers, so createPlatformInstallationSecrets discards the corresponding workerSecretUpdates; any API or proxy Worker created before the interruption is redeployed without EMAIL_SIGNING_SECRET, while the newly created gateway receives it. The resumed installation can therefore complete with email requests failing between Workers; enable existing-worker secret updates for this capability transition.

Useful? React with 👍 / 👎.

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