add chunking for cookies#497
Open
jollyekb wants to merge 2 commits intoskyhook-io:mainfrom
Open
Conversation
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.
Description
Add chunked cookie support for large session cookies to prevent browser rejection when OIDC ID tokens exceed the 4KB cookie size limit.
Problem
Solution
X-Forwarded-Protoheader*http.Cookie)Technical details
_chunk_Nsuffix_chunksmeta-cookie to track number of chunksParseSessionCookieType of change
How has this been tested?
Test cases:
TestCreateSessionCookie_NormalSize- verifies normal cookies (<4KB) work unchangedTestCreateSessionCookie_LargeToken- verifies ID token dropping when too largeTestCreateSessionCookie_Chunking- verifies chunking for extremely large payloadsTestParseSessionCookie_Chunked- verifies chunk reassembly works correctlyTestParseSessionCookie_ChunkedWithSecurePrefix- tests Secure cookie name handlingTestOIDCCallback_SetsCookie- end-to-end test with actual OIDC flowManual testing:
Checklist
Related issues
Fixes #(issue number if exists)
Additional Notes
Breaking changes
CreateSessionCookienow returns*http.Cookie(unchanged) but may set multiple cookies via the same*http.Cookieinstance with internal chunking metadatahttp.SetCookiefor each chunk (handled automatically by the returned cookie's internal state)Migration
No changes required for existing callers. The API remains backward compatible.
Performance impact