Repository navigation
test: flip a byte of the decoded sealed cookie in the tamper test - #387
Merged
Merged
Conversation
Upd4ting
marked this pull request as ready for review
November 20, 2026 13:00
Upd4ting
enabled auto-merge
November 20, 2026 13:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wffd6e624-31: follow-up of Wffd6e624-13 (#385).
Summary
tests/server-modules-sealed.test.tstampered a sealed cookie by replacing its last two base64url characters withxx. When those characters already decoded to the same bytes (about once in 256 runs, the IV being random) the cookie stayed valid, opened, and the test failed (CI run 44666382646). The test now decodes the value and flips every bit of its last byte, so the cookie always differs.Proof
Before: the
xxreplacement leaves the decoded bytes unchanged on about 1 run in 256, so the test fails on those runs.After: 600 consecutive runs of
node --import tsx --test tests/server-modules-sealed.test.ts(twice: once in one loop of 600, once as 2 x 300):Follow-ups