Enable iron-session cookie chunking for go sessions - #943
Merged
Conversation
The go-session cookie holds two JWTs (access + refresh) plus PKCE and profile fields, and we are hitting the 4 KB per-cookie browser limit for some users. Iron-session 8.0.4 has no built-in workaround and the upstream fix is unreviewed (vvo/iron-session#937). Apply that PR as a patch-package patch against an exact-pinned iron-session@8.0.4 so chunking is available without forking, and enable it in getSessionOptions. With chunking on, iron-session keeps a single go-session cookie when the sealed value fits, and otherwise splits it into go-session.0, go-session.1, ... transparently on read. Letting CI fail on a future Dependabot bump is the intended signal to refresh or drop the patch when upstream merges. To reproduce the patch file (iron-session ships only compiled dist/*, so we cannot patch the source files referenced by PR #937 directly): # 1. Get the iron-session source at v8.0.4 with PR #937 applied. git clone https://github.com/vvo/iron-session.git cd iron-session git fetch origin pull/937/head:pr-937 git diff v8.0.4..pr-937 -- src/core.ts > /tmp/pr-937-core.diff git checkout v8.0.4 git apply /tmp/pr-937-core.diff # 2. Build dist/* with the upstream toolchain. npm install --ignore-scripts npx tsup # 3. Copy the built dist into this project's node_modules and let # patch-package capture the diff against the published 8.0.4. cp dist/* <dpl-web>/go/node_modules/iron-session/dist/ cd <dpl-web>/go npx patch-package iron-session This keeps the committed patch bit-for-bit faithful to what upstream would publish if PR #937 merged, rather than hand-translating TypeScript changes into compiled output. Assisted-by: Claude <noreply@anthropic.com>
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.
Link to issue
https://reload.atlassian.net/browse/DDF-348
Description
The go-session cookie holds two JWTs (access + refresh) plus PKCE and profile fields, and we are hitting the 4 KB per-cookie browser limit for some users. Iron-session 8.0.4 has no built-in workaround and the upstream fix is unreviewed (vvo/iron-session#937).
Apply that PR as a patch-package patch against an exact-pinned iron-session@8.0.4 so chunking is available without forking, and enable it in getSessionOptions. With chunking on, iron-session keeps a single go-session cookie when the sealed value fits, and otherwise splits it into go-session.0, go-session.1, ... transparently on read.
Letting CI fail on a future Dependabot bump is the intended signal to refresh or drop the patch when upstream merges.
To reproduce the patch file (iron-session ships only compiled dist/*, so we cannot patch the source files referenced by PR #937 directly):
This keeps the committed patch bit-for-bit faithful to what upstream would publish if PR #937 merged, rather than hand-translating TypeScript changes into compiled output.
Assisted-by: Claude noreply@anthropic.com