This repository was archived by the owner on Oct 29, 2021. It is now read-only.
This repository was archived by the owner on Oct 29, 2021. It is now read-only.
CSRF gets reset too often causing race condition in browser #71
Open
Description
When CSRF is enabled, servant-auth-server will set the cookie on every response. The following will happen in the browser with concurrent requests:
- Request A is performed by the browser with token=t1
- Request B is constructed in JavaScript with token=t1
- Response A is received by the browser, sets the cookie to token=t2
- Request B gets sent by the browser with t1 in the XSRF header and t2 in the Cookie header
- Request B gets rejected even though it is legitimate
This may be more or less of a problem depending on the JavaScript technology used. The context switching by GHCJS probably makes this even more likely than otherwise, but Angular may also suffer from this race condition.