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 cookie should be refreshed on each request #36946

Closed
FroMage opened this issue Nov 8, 2023 · 4 comments · Fixed by #37725
Closed

CSRF cookie should be refreshed on each request #36946

FroMage opened this issue Nov 8, 2023 · 4 comments · Fixed by #37725
Assignees
Labels
area/security kind/bug Something isn't working
Milestone

Comments

@FroMage
Copy link
Member

FroMage commented Nov 8, 2023

Describe the bug

ATM the CSRF filter only sets a CSRF cookie for safe methods (like GET) if it does not exist, but it never refreshes it.

So, for example, what can happen, since the cookie expires after 10 minutes, is the following:

  • T + 0 minutes : GET, get a CSRF cookie, OK
  • T + 1 minute : GET, existing CSRF cookie sent in request, no new CSRF cookie in response, OK
  • T + 2 minutes : POST, existing CSRF cookie sent in request, no new CSRF cookie in response, OK
  • T + 9 minute : GET, existing CSRF cookie sent in request, no new CSRF cookie in response, OK
  • T + 11 minutes : POST, expired CSRF cookie NOT sent in request, FAIL

We should refresh the CSRF cookie on every request, safe or even POST. This has been reported by several users independently.

@FroMage FroMage added the kind/bug Something isn't working label Nov 8, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Nov 8, 2023

/cc @pedroigor (bearer-token), @sberyozkin (bearer-token,jwt,security)

@ia3andy
Copy link
Contributor

ia3andy commented Nov 8, 2023

Thanks @FroMage It looks like what I experienced 👍

@sberyozkin
Copy link
Member

sberyozkin commented Nov 8, 2023

@FroMage @ia3andy Do you mean that when the cookie has arrived and verified, it is then removed, and created again with the same value ?

@FroMage
Copy link
Member Author

FroMage commented Nov 8, 2023

Same value, and expired date renewed for X more time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants