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

CSRF token sometimes invalid until refresh #1232

Closed
leth opened this issue May 25, 2017 · 5 comments
Closed

CSRF token sometimes invalid until refresh #1232

leth opened this issue May 25, 2017 · 5 comments
Labels
bug broken end user functionality; not working as the developers intended it

Comments

@leth
Copy link

leth commented May 25, 2017

I just visited https://cloud.weave.works/ and POSTs to /api/metrics were failing with HTTP400 due to CSRF token validation.

A refresh fixed it, but is obviously non-ideal.

@leth leth added the bug broken end user functionality; not working as the developers intended it label May 25, 2017
@leth
Copy link
Author

leth commented May 25, 2017

My hunch is that this is a client-side issue around redirect handling.
I sometimes see something similar when running a local UI against a local minikube deployment.

I've looked into the CSRF handling a little for the UI development proxy; I'm not sure if this is the issue, but it might be a good place to start:
The nosurf request handler contains logic to issue an updated csrf token + cookie pair if needed.

Currently AFAIK the token is embedded in the HTML page, and then used in the client-side code.
If a new pair is issued for a non-html request; the cookie will be sent in the headers, but the token will be sent nowhere.
The browser will pick up the new cookie, but not the new token, leading to a mismatch.

@leth
Copy link
Author

leth commented Aug 8, 2017

@awh
Copy link

awh commented Aug 10, 2017

@jml
Copy link

jml commented Aug 16, 2017

Also, the user-visible failure mode can be "This looks like it worked, but when you go to a different page and go back, your edits actually had no effect. Psych!"

@dlespiau
Copy link

dlespiau commented Oct 3, 2017

We haven't seen this issue for 11 days after #1380, closing. Do re-open if needed.

@dlespiau dlespiau closed this as completed Oct 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug broken end user functionality; not working as the developers intended it
Projects
None yet
Development

No branches or pull requests

4 participants