Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validation issue for maxAge greater than 2^31 #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

manu-st
Copy link

@manu-st manu-st commented Jan 18, 2017

If you have a cookie with the maxAge to a value larger than 2^31 it causes the SQL queries updating the expiration date to not validate properly. Now we convert the duration in seconds before passing it to the query.

If you have a cookie with the maxAge to a value larger than 2^31 it causes the SQL queries updating the expiration date to not validate properly. Now we convert the duration in seconds before passing it to the query.
@mcartoixa
Copy link
Owner

Sorry for the delay.

So the value oneDay was also incorrect: thanks for fixing that. But if the maxAge of a cookie can be larger than 2^31ms, why can't it be larger than 2^31s too? Do you think you can find a way to fix the code in order to prevent overflows altogether?

@manu-st
Copy link
Author

manu-st commented Jan 25, 2017

We would need to change the way the function dateadd is used so that we perform the add operation in two steps but I feel this will be too much. Before the fix, the maximum date age was just 24.8 days, now we have 68 years, so this is unlikely to be a problem in practice.

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