-
Notifications
You must be signed in to change notification settings - Fork 887
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
replace check_csrf with require_csrf #2367
Comments
👍 |
Should |
Could we allow |
well... here's what I didn't mention yet that will influence my answer here: Because of issues like this, the view deriver will probably not be added to your app by default but rather just another thing people can use if they want, similar to the default session factories etc. For example: config.add_view_deriver(`require_csrf`, `pyramid.session.require_csrf_view`) If you want something that can do totally custom logic at the point of view declaration then you probably just want |
I think that the CSRF view derivation that we ship with core should come with seat-belts enabled. If you load it, CSRF checking is mandatory for all
I am a -1 on knobs. |
Good point about PUT/DELETE that I hadn't considered. It's easy to forget the exact attack vectors that CSRF is protecting against. |
If we |
The
check_csrf
view predicate as it currently stands is not considered useful because it behaves as a predicate. Thus if the CSRF check fails the normal scenario is that aPredicateMismatch
is raised and results in a 404.In 1.7 with the introduction of view derivations in #2021 we can add a new
require_csrf
derivation that properly raisesBadCSRFToken
which can be caught and handled in an exception view. Thecheck_csrf
can be deprecated at this point and potentially removed in the future.The text was updated successfully, but these errors were encountered: