-
Notifications
You must be signed in to change notification settings - Fork 89
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
Enhancement Requests: Configurable duration and reusable tokens #68
Comments
@jimmy-p123 answers:
Now if you want to make it per session token: you need to alter these methods |
I made a post on stackoverflow that explains the problem, but I didn't explain it as well as I could have. I thought there would be a way around it that didn't involve modifying your library, but nobody had any ideas. Since you obviously understand your own library, let me just pose a simple question to you, to see if you can understand where the race condition occurs. Assume that Two requests come into the server from the same session at or near the same time. Request 1 is received first but takes longer to respond than request 2 because it's more computationally intensive. From which request would you expect the values A) in the cookie client side and B) in the I'm finding that A) the cookie is the value set by the first request, but B) the |
Here's a more concrete example:
Request #4 will be blocked. |
@jimmy-p123 : for the cookie duration (1st part of it), could you resend a PR? As for other, amazing example. I get the issue: if there is a causality inconsistency between the server and client the model fails. Will try to find a solution for this, in existing model. |
@jimmy-p123 it is an interesting problem. Can you try replacing |
It appears to be fixed using variations of the example I provided. I'll apply it to where I initially found the problem and get back to you if I find any problems there. |
@jimmy-p123 status? |
I found one instance where we're sending three requests at the same time, and then a fourth request that starts shortly after the first three start, but finishes before any of the others finish, gets blocked. I'm still working on how to simplify the problem, as it seems to be slightly more complicated than that. I'll try to get that pull request sent over today as well. |
I'm still getting blocks on requests number 7 and 8 in the following example, but only sometimes. I have to refresh the page a few times to get it to happen:
|
#78 closed, will send a new PR with corresponding changes. |
I have two requests for enhancements that would suit my needs quite nicely.
Could you possibly make the duration of the cookie configurable? My site has a setting that gives some elevated users the option to change the duration of their session, so it would be nice to have the duration of the CSRFP cookie match the duration of the user session.
Could you make it possible to reuse the same token for the entire duration of the session? Everything I've read on the subject says that using one token per session is adequate, and having tokens that change every request has caused me a lot of headache. I can elaborate if you need, but I've essentially encountered a race condition where the expected token in the
SESSION
array doesn't match the token in the cookie, even when it should, and having one token per session would fix the problem.The text was updated successfully, but these errors were encountered: