Skip to content

Conversation

@Lucurious
Copy link

While SvelteKit still depends on [email protected] (due to breaking changes discussed in sveltejs/kit#12767), this version of 'cookie' is affected by CVE-2024-47764.

As stated in the above PR, it may be advisable for some users to manually override the 'cookie' version to 0.7 or up. The recent release of [email protected], however, added strict checks to ensure maxAge-values are integers (using Number.isInteger), which breaks the current method of calculating the max-age for the session-cookie.

This PR ensures that the calculated max-age values are rounded before being used in setCookie.

To ensure that this update is mostly non-breaking, the 'expiresToMaxage' utility-function was also adapted to round the max-age when calculating from days, hours and minutes. When 'calculating' from seconds, no rounding is applied to match cookie's behavior.
While it is not advisable, this means that non-integer expiry-values (such as 0.5 days) are still valid, even when using [email protected].

@Lucurious Lucurious changed the title Compatibility with cookie@^1.0 Compatibility with [email protected] Oct 29, 2024
@pixelmund
Copy link
Owner

Thank you, i have integrated the changes into version 4.1.0!

@pixelmund pixelmund closed this Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants