Skip to content

Commit 104bfaf

Browse files
luismeyerclaude
andcommitted
refactor(flags): reduce signed overrides to what the toolbar ships
Keep the v4 cookie and public API unchanged and only route signed tokens through a small ES256 verifier, accepted alongside FLAGS_SECRET tokens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 4ab52c7 commit 104bfaf

10 files changed

Lines changed: 470 additions & 1235 deletions

File tree

‎.changeset/kms-signed-overrides.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"flags": minor
33
---
44

5-
Accept flag override tokens which Vercel signs, alongside tokens of the `FLAGS_SECRET`, so the Vercel Toolbar can override flags with tokens signed by Vercel.
5+
Accept flag overrides which the Vercel Toolbar signs with Vercel KMS, so overrides work on Vercel without a `FLAGS_SECRET`.
66

7-
- On Vercel, or with a linked project (`VERCEL` or `VERCEL_OIDC_TOKEN` is set), the SDK verifies signed tokens (JWS) in the `vercel-flag-overrides` cookie with the public keys of Vercel, whether or not a `FLAGS_SECRET` is set. The keys are cached in memory.
8-
- Tokens encrypted with the `FLAGS_SECRET` (JWE) keep working exactly as before.
9-
- Adds `verifyOverrides`, which accepts both kinds of tokens.
7+
On Vercel, or locally after `vercel env pull`, the SDK verifies signed override tokens with the public keys of Vercel, which it keeps in memory. Tokens encrypted with the `FLAGS_SECRET` keep working exactly as before. The cookie is still `vercel-flag-overrides`.

‎packages/flags/src/index.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export {
1010
verifyAccessProof,
1111
} from './lib/crypto';
1212
export { mergeProviderData } from './lib/merge-provider-data';
13-
export { verifyOverrides } from './lib/overrides';
1413
export { reportValue } from './lib/report-value';
1514
export { safeJsonStringify } from './lib/safe-json-stringify';
1615
export { setTracerProvider } from './lib/tracing';

0 commit comments

Comments
 (0)