Repository navigation
Conversation
Member
|
Not at this time. The parser is intentionally more lenient than the serializer. |
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.
parseSetCookie() accepts Expires dates with UTC years 1500, 1600, and 10000 because JavaScript considers them valid dates. stringifySetCookie() rejects those same years after #290. A later invalid Expires attribute can also overwrite an earlier valid one.
Check the parsed UTC year against the existing serializer's 1601–9999 bounds before assigning expires. Invalid dates still get ignored, and parsing continues with the remaining attributes. This is a small date-validation fix; it does not replace the existing Date-based parser with a full cookie-date tokenizer.
Tests cover three rejected years, preservation of an earlier valid expiration, and the valid 1601/9999 boundaries. On unchanged master, six new cases fail and the two boundary controls pass.
Validation on Node 24.22.1: npm test passes — TypeScript build, Prettier, typecheck, 63,760 Vitest cases, and size-limit (1.27 kB under the 1.4 kB limit). git diff --check passes.
Reference: RFC 6265 sections 4.1.1 and 5.1.1: https://www.rfc-editor.org/rfc/rfc6265#section-5.1.1