GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(cookies): ignore finite numeric expires that wrap in unsigned long long by vtxe02023274 · Pull Request #6124 · nodejs/undici

Conversation

@vtxe02023274

@vtxe02023274 vtxe02023274 commented Nov 1, 2026

Copy link
Copy Markdown

This relates to...

Fixes #6123

Rationale

setCookie ignores a numeric expires outside the Date range (#5832), but a finite number such as 2 ** 64 first goes through the unsigned long long conversion in the Cookie dictionary converter, which wraps it modulo 2^64 to 0. The invalid expiry then serializes as Expires=Thu, 01 Jan 1970 00:00:00 GMT.

Changes

In the expires converter, a finite number whose absolute value is above the maximum Date time value now returns null before the integer conversion, so no Expires attribute is written. NaN and the infinities still go through the conversion and keep their current behavior, as the existing tests expect.

Added 2 ** 64, -(2 ** 64), Number.MAX_VALUE and -Number.MAX_VALUE to the out-of-range cases in test/cookie/cookies.js.

npm run lint and npm run test:cookies pass on a fork CI run (93 tests).

Features

N/A

Bug Fixes

Finite numeric expires values that wrap in the unsigned long long conversion are now ignored.

Breaking Changes and Deprecations

N/A

Status

  • I have read and agreed to the Developer's Certificate of Origin
  • Tested
  • Benchmarked (optional)
  • Documented
  • Review ready
  • In review
  • Merge ready

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vtxe02023274
fix(cookies): ignore finite numeric expires that wrap in unsigned lon…
0de53d9
…g long

Refs nodejs#6123
@waw666waw666 waw666waw666 mentioned this pull request Nov 21, 2026
fix(cookies): do not serialize a finite maxAge outside the long long range #6244
Open
3 of 7 tasks

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

setCookie turns finite out-of-range expires values into a Unix-epoch expiry

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@vtxe02023274
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.