CoreMVP
After launch

Rotate a secret

View as Markdown

Replace an expiring or exposed secret. Where the provider permits overlap, create the new value, update every consumer, check it, then revoke the old value. Check the provider’s rotation instructions first; overlap is not always available. If a leaked key is actively being used, revoke it immediately and restore affected consumers with a new key.

Give your agent this prompt
Plan rotation of <secret name> without printing its value.
Follow https://coremvp.com/en/docs/deployment/after-launch/rotate-a-secret.md and its prerequisites.
Finish planning with the consumers and checks identified; ask me before issuing, replacing or revoking credentials or deploying.
After approval, prove the affected deployment uses the replacement. For Stripe webhooks without receiver-side proof during overlap, check a fresh delivery after the old secret expires. For immediate revocation, restore consumers first and check recovery. Run ./coremvp prod e2e smoke https://<app-domain>.
Report what changed, the check results and anything you could not run.
SecretCreate the new one inSave it in
SUPABASE_SECRET_KEYSupabase API keys (create a new secret key)Your host
Database passwordSupabase Settings → Database → Reset passwordDATABASE_URL in your host, and on Cloudflare update Hyperdrive credentials
STRIPE_SECRET_KEY / STRIPE_SECRET_KEY_LIVEStripe Developers → API keys → Rotate key (guide)Your host
STRIPE_WEBHOOK_SECRETStripe webhook destination Roll secret (guide)Your host
POLAR_ACCESS_TOKENPolar Organization Access TokensYour host
POLAR_WEBHOOK_SECRETPolar webhook endpoint settingsYour host
RESEND_API_KEYResend API KeysYour host, and Supabase SMTP password

In live mode, the Stripe client uses STRIPE_SECRET_KEY_LIVE when configured, otherwise STRIPE_SECRET_KEY. Update the value actually used.

A database password reset can interrupt connections. Plan a maintenance window and update every consumer immediately; see Supabase’s reset guidance.

Save the new value

bunx vercel env update <NAME> production --sensitive

Update the value in .

Redeploy

On Vercel run bunx vercel deploy --prod; on Cloudflare run the build and deploy from Deploy to Cloudflare.

Revoke the old value

Once the deployment proves it uses the new value, revoke the old value with the owner's approval. For a Stripe webhook rotation without that proof during overlap, agree on the expiry time and recovery owner before rotating, and keep the window open until the post-expiry check below passes. If immediate revocation was required, proceed to the recovery check.

Check it works

Run ./coremvp prod e2e smoke https://<app-domain>. Exercise the affected feature on the updated deployment as well.

For Stripe webhooks, Stripe signs with both secrets during overlap. A successful delivery during that window can use either secret. If you cannot prove which secret the deployed receiver used, check a fresh delivery on that Stripe destination after the old secret expires. Check that the deployed endpoint returns success and that the app records the expected result for that event. If verification fails, immediately restore the new secret on the affected deployment, redeploy, and retry the failed deliveries once verification works. Keep the rotation open until this check passes. Use the endpoint's existing billing mode and get approval before generating any real billing event.

If replacement revoked the old credential immediately, restore all consumers with the new value and check the affected feature recovers. For a shared Resend key, check both configured consumers: a Supabase Auth sign-up email and an application purchase or onboarding email.

Was this page helpful?

On this page