-
Notifications
You must be signed in to change notification settings - Fork 535
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
CSRF Handler update doesn't work with context.reroute()
#2557
Comments
Found an issue with my change, sorry... |
Would be great to get this in soon if possible |
I think the CSRF handler should be protected from invocations of reroute, like the vertx-web/vertx-web/src/main/java/io/vertx/ext/web/handler/impl/SessionHandlerImpl.java Lines 280 to 286 in ce78ea0
That should solve the problem. Can you contribute the fix? |
Oh cool hadn't seen that pattern I did something else: #2558 |
I'll go ahead and update it so we can get the fix in 4.5.2 |
Fixed by #2560 |
Thanks @tsegismont ! we've got different fixes in master vs. Should we also include your fix in the master branch? |
Same fixes were applied in both branches |
Ah I see you merged my branch to master, merged your branch to 4.x and then yours into master, so the diffs on both are the same, but my original changes were undone, fine. Thanks! |
I did my best in order to keep the trace of your commit. Thank you for your contributions! |
Version
4.5.0, 4.5.1
Context
When upgrading to 4.5.1 in our application the CSRF handler check started failing saying the token was used or expired. This is because the app uses
context.reroute()
which sends the context back though theCSRFHandler
and as (after my last set of changes) the token is not added to the session until after the request completes, it thinks there is no token so generates a new one updates the request and adds a new end handler. then when the request does end it unwinds the end handlers in the reverse order, which means the wrong token (first one) is set into the session, and the second token is sent back on the response, so they now don't match and the client is broken.Do you have a reproducer?
No
Steps to reproduce
ctx.reroute()
to another route with CSRF handlingExtra
Lots of fix options for this:
ctx.get(headerName)
(I think this is better)The text was updated successfully, but these errors were encountered: