Skip to content

Validate empty precompute results against the requested flag group - #592

Merged
luismeyer merged 1 commit into
mainfrom
luismeyer/exp-3758-validate-empty-precompute-results-against-the-requested-flag
Nov 5, 2026
Merged

luismeyer merged 1 commit into
mainfrom
luismeyer/exp-3758-validate-empty-precompute-results-against-the-requested-flag

Conversation

@luismeyer

Copy link
Copy Markdown
Member

Summary

deserialize currently returns {} for the __no_flags__ sentinel without checking whether the requested flags group is empty. That skips signature verification entirely: a non-empty group paired with '__no_flags__' silently resolves every flag to undefined, and callers fall back to their defaults.

Changes

  • Accept the __no_flags__ sentinel only when the flags group is empty.
  • Reject the reverse mismatch too: an empty group paired with a signed code for a non-empty group.
  • Applies the same validation to the Next.js and SvelteKit deserialize paths in precompute.ts.

Tests

  • packages/flags/src/next/precompute.test.ts
  • packages/flags/src/sveltekit/precompute.test.ts

Full suite: 156 tests passing. type-check and biome check clean.

Notes

This changes how mismatched precompute codes behave. I'm opening it without public security wording; please coordinate classification and any public messaging with Security (EXP-3687).

Reject mismatches between a precompute code and the flags group passed to deserialize. The __no_flags__ sentinel is now only accepted for an empty group, and a signed code is no longer accepted for an empty group.
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
flags-playground Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC
flags-sdk-dev Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC
flags-sdk-flagsmith Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC
flags-sdk-growthbook Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC
flags-sdk-launchdarkly Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC
flags-sdk-openfeature Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC
flags-sdk-posthog Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC
flags-sdk-reflag Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC
flags-sdk-snippets Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC
flags-sdk-statsig Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC
flags-sdk-sveltekit-snippets Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC
shirt-shop Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC
shirt-shop-api Ready Ready Preview, v0 Nov 4, 2026 2:57pm UTC

@luismeyer
luismeyer merged commit 9c5de4b into main Nov 5, 2026
31 checks passed
@luismeyer
luismeyer deleted the luismeyer/exp-3758-validate-empty-precompute-results-against-the-requested-flag branch November 5, 2026 11:22
@github-actions github-actions Bot mentioned this pull request Nov 5, 2026

This branch was successfully deployed

14 active deployments
Preview – flags-sdk-dev — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – flags-sdk-sveltekit-snippets — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – flags-sdk-vercel — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – flags-sdk-growthbook — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – shirt-shop — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – flags-sdk-launchdarkly — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – flags-sdk-snippets — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – flags-sdk-statsig — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – flags-sdk-openfeature — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – flags-playground — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – flags-sdk-flagsmith — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – flags-sdk-reflag — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – flags-sdk-posthog — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
Preview – shirt-shop-api — fc004b14 Deployed Nov 4, 2026 by vercel[bot]
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