Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…rcel-platform Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f487791 to
888794b
Compare
chriswdmr
left a comment
There was a problem hiding this comment.
Thanks! Three things to fix before merge:
- SvelteKit without a secret: a failure to load the key must not break the page render
- Add a timeout to the key set fetch
- Next.js middleware: remove the two new Edge Runtime build warnings
The other comments are suggestions and nits.
- Read env vars without a process global and from SvelteKit's $env - Memoize the OIDC decode and the .vercel/project.json read - No Edge Runtime warnings for process.getBuiltinModule / process.cwd - Load the key set with a 5s timeout - Rethrow framework control-flow errors instead of wrapping them - SvelteKit: render the page without flag values when encryption fails - Document that the fallback without a secret is silent Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
…an decrypt Note that decryptFlagValues, encryptFlagDefinitions and decryptFlagDefinitions work only with a FLAGS_SECRET. Co-Authored-By: Claude Code <noreply@anthropic.com>
chriswdmr
left a comment
There was a problem hiding this comment.
Thanks for the fixes! One thing to fix before merge:
- SvelteKit:
loadEnv()must not put all private environment variables into the server bundle
…ndle Read the Vercel variables from $env/dynamic/private, by name, instead of spreading $env/static/private. Co-Authored-By: Claude Code <noreply@anthropic.com>
…c keys Load the key set with the fetch which Next.js replaced. The fetch of Next.js made a static page dynamic for the no-store request, and failed the build of a page with dynamic = 'error'. Add a production build of a static Next.js page as a regression test. Co-Authored-By: Claude Code <noreply@anthropic.com>
After five minutes, the key cache waited for the key host (up to the timeout of five seconds) before it returned. It now returns the keys which it has, and loads the new ones for the next call. Only the first load and a refresh for a key which is not known wait. Co-Authored-By: Claude Code <noreply@anthropic.com>
Vercel removes an x-vercel-oidc-token header from each incoming request, so a visitor can not choose the project of the host. Also name the token of the request as a source of the project ID in the docs. Co-Authored-By: Claude Code <noreply@anthropic.com>
| pending ??= load().finally(() => { | ||
| pending = undefined; | ||
| }); | ||
| if (value !== undefined && !refresh) { |
There was a problem hiding this comment.
issue (non-blocking): No limit on the age of the keys in memory
get() now returns the keys in memory at once when they are older than 5 minutes. There is no limit on that age: in my test, the first call after 24 h with no calls got the 24 h old key. In this PR that is only an old encryption key. But #587 verifies signatures with keys.get(), so a revoked key passes on the first request after an idle time. You gave this reason on #587.
Could get() wait for the load when the keys are older than a limit, for example 10 minutes? Then a busy instance does not wait, and an idle instance does not use very old keys.
There was a problem hiding this comment.
Good catch, fixed in b636390: get() now waits for the load when the keys in memory are older than 10 minutes (staleMaxAgeMs). Between 5 and 10 minutes it still returns the keys in memory and reloads in the background, so a busy instance does not wait. The wait is at most the 5 s timeout, and a failed reload still keeps the keys in memory. Merged up the stack, so #587 and #589 verify with it too.
…han ten minutes Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
… not fail a build Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…of Vercel does not load (#604) * [flags] Return an empty value from encryptFlagValues when the public key of Vercel does not load Without a FLAGS_SECRET, a key host which is down, or a request which timed out, failed the build or the render of each page which encrypts flag values. The values are only for the Vercel Toolbar, so encryptFlagValues now warns and returns an empty string, and FlagValues renders nothing for it. Errors of the configuration still throw. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * [flags] say that the flag values are left out of the page The warning said "Could not encrypt the flag values", which reads as if they are written to the page in plaintext. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…-platform-encryption
Why
encryptFlagValuesthrows withoutFLAGS_SECRET, so a project needs a secret just to keep its flag values confidential.flags-explorer-api-decrypt).standardbranch ([flags] FlagValues: projectIds in the protected header, flags-keys JWKS #575) tomain, with the signature ofencryptFlagValuesunchanged.What
FLAGS_SECRET), nothing changes.encryptFlagValuesencrypts with the public key fromhttps://keys.vercel-flags.com/.well-known/jwks.json(ECDH-ES, A256GCM,projectIdsandkidin the protected header,pur: flag-values,ver: 1,aud: vercel:flag-values). This is the format that@api/flag-valuesdecrypts.VERCEL_PROJECT_ID, theVERCEL_OIDC_TOKENofvercel env pull, or.vercel/project.json.createHandleandencryptFlagValuesno longer require a secret. Without one, thedata-flag-valuesof a page use the public key, the overrides cookie is ignored,/.well-known/vercel/flagsresponds with 401, and precompute still requires a secret.vercel-marketing(vercel/front#98090), busy build workers reached the timeout, and the cooldown then failed all five prerender attempts of Next.js.Validation
flag-values-platform.test.tscover the token format, finding the project ID, key caching and rotation, the error cooldown, and that a setFLAGS_SECRETis still used.without-secret.test.tscovers SvelteKit'screateHandleandencryptFlagValueswithout a secret.🤖 Generated with Claude Code