feat(cookie): add RFC 6265 compliant cookie deduplication#4576
Open
luojiyin1987 wants to merge 7 commits intohonojs:mainfrom
Open
feat(cookie): add RFC 6265 compliant cookie deduplication#4576luojiyin1987 wants to merge 7 commits intohonojs:mainfrom
luojiyin1987 wants to merge 7 commits intohonojs:mainfrom
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (54.41%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #4576 +/- ##
==========================================
- Coverage 91.56% 91.12% -0.45%
==========================================
Files 172 172
Lines 11255 11391 +136
Branches 3265 3289 +24
==========================================
+ Hits 10306 10380 +74
- Misses 948 1010 +62
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Add tests for setSignedCookie deduplication with secure/host prefixes - Add tests for domain case-insensitivity per RFC 6265 - Add tests for getSetCookies fallback when getSetCookie unavailable - Add tests for getSignedCookie with secure/host prefixes - Add edge case tests for cookies with different domains/paths - Improve patch coverage from 54.41% to 99.47%
- Remove risky Headers.prototype mock tests (race condition in parallel) - Add cookie name case-sensitivity test - Add tests for flags (HttpOnly/Secure/SameSite) not affecting identity - Add tests for MaxAge not affecting identity - Add tests for prefix vs no-prefix not being deduped - Add tests for __Secure- vs __Host- prefix not being deduped - Add complex combination and special character tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add helper functions: readSetCookies, cookieNameValue, responseCookies - Add createStubContext() to avoid modifying global Headers.prototype - Add expectCookieSetEqual() for order-independent cookie comparison - Replace string assertions with array-based cookie assertions - Improve type safety with HeadersWithSetCookie type 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <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.
Summary
Fixes #4445
Changes
parseSetCookieHeader: Parse Set-Cookie string to extract name/domain/pathgetSetCookies: Get all Set-Cookie headers (with fallback for older environments)isSameCookie: Compare cookie identity using composite keyreplaceSetCookieHeaders: Remove existing cookies with matching identitysetCookieandsetSignedCookieto dedupe before settingTest plan
🤖 Generated with Claude Code