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.
While SvelteKit still depends on cookie@0.6 (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 cookie@1.0, 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 cookie@1.0.