We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
4.28.1
7.0.0
20.x
macOS
14.7
Only HTTP methods that make changes to resources should be protected.
Most frameworks (like Angular) do not send the csrf token in request headers for GET/HEAD/OPTIONS methods.
// protect the fastify instance fastify.addHook('onRequest', fastify.csrfProtection)
In this particular case (from the documentation), the instance is protected, GET and other methods may be denied.
Take a look here: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#javascript-automatically-including-csrf-tokens-as-an-ajax-request-header
Perhaps an option to define ignored methods (the ones mentioned by default) would be nice and less blocking.
The text was updated successfully, but these errors were encountered:
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.
Sorry, something went wrong.
No branches or pull requests
Prerequisites
Fastify version
4.28.1
Plugin version
7.0.0
Node.js version
20.x
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
14.7
Description
Only HTTP methods that make changes to resources should be protected.
Most frameworks (like Angular) do not send the csrf token in request headers for GET/HEAD/OPTIONS methods.
In this particular case (from the documentation), the instance is protected, GET and other methods may be denied.
Take a look here: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#javascript-automatically-including-csrf-tokens-as-an-ajax-request-header
Perhaps an option to define ignored methods (the ones mentioned by default) would be nice and less blocking.
The text was updated successfully, but these errors were encountered: