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

Disable CSRF Token Reuse #123

Open
2 tasks done
raviroshanmehta opened this issue Feb 20, 2023 · 3 comments
Open
2 tasks done

Disable CSRF Token Reuse #123

raviroshanmehta opened this issue Feb 20, 2023 · 3 comments

Comments

@raviroshanmehta
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

Thanks for this great plug in.

I have one concern. Save CSRF token I can use multiple time for the verification. Is there any option where I can make sure that token is used only once.

@mcollina
Copy link
Member

thanks for reporting!

Save CSRF token I can use multiple time for the verification. Is there any option where I can make sure that token is used only once.

Unfortunately, not at this point. I never implemented this because I think it would be extremely hard to create useful applications with it: the amount of code on the frontend to handle that kind of update is significant and hard to make it refresh the token reliably.

@raviroshanmehta
Copy link
Author

Can you please guide how we can restrict this token with one time use only without loosing this awesome core plugin ? I really don't want to use any other module or custom code for adding layer of csrf security in my fastify project.

@mcollina
Copy link
Member

What you should do is to store your tokens in a database and then validate against that.
You'd need to send a PR for this feature. Essentially we would need to add a custom function to store the tokens and one to validate them / flag them as used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants