Harden cookie attribute validation - #6763
Conversation
🦋 Changeset detectedLatest commit: 9b65523 The changes in this PR will be included in the next version bump. This PR includes changesets to release 29 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — a focused hardening of cookie attribute validation, extracting shared validation and tightening regexes to reject ; delimiters in names, domains, and paths, then applying that same validation at serialization time.
- RFC 6265 token name validation —
cookieNameRegExpreplaces the overly permissivefieldContentRegExpfor cookie names, correctly rejecting separators and control characters. - Domain/path delimiter rejection —
cookieDomainRegExp/cookiePathRegExpexcludeU+003B(;), blocking attribute injection in domain and path values. - Shared
validateCookie— extracted frommakeCookieand also called inserializeCookie, so invalid cookies are caught at serialization time regardless of how they entered theCookiescollection. - Tests — rejection of
;in names, domains, and paths; valid RFC 6265 token names and legitimate domains/paths; and thetoSetCookieHeadersthrow path for cookies inserted viasetCookieandfromIterable.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|

Summary
Testing
pnpm --filter effect test --run test/unstable/http/Cookies.test.tspnpm lintpnpm checkCloses EFF-210