You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request motivated by a concrete problem? Please describe.
I'm attempting to extend rocket_csrf with the ability to automatically check whether valid CSRF tokens are provided in headers. If an invalid token is provided for a write request, I would like the fairing to respond with a permission denied error, but the API does not allow this.
I understand that the philosophy is to respond to requests via request guards or response callbacks, however I believe fairings are the right place for this functionality since this needs to be run on every request. Otherwise, users would need to remember to add request guards to every request and failure to do so would be a security issue.
Why this feature can't or shouldn't live outside of Rocket
The Fairing trait does not give us the ability to abort requests via on_request.
Ideal Solution
Update on_request to give us the ability to respond to requests. Maybe the return type should be something like Option<rocket::request::Outcome>.
Alternatives Considered
The only other approach I've seen to do this is to modify the request to point to a handler defined by the fairing. I'll probably do this for now, but it seems like a hack.
The text was updated successfully, but these errors were encountered:
Is your feature request motivated by a concrete problem? Please describe.
I'm attempting to extend rocket_csrf with the ability to automatically check whether valid CSRF tokens are provided in headers. If an invalid token is provided for a write request, I would like the fairing to respond with a permission denied error, but the API does not allow this.
I understand that the philosophy is to respond to requests via request guards or response callbacks, however I believe fairings are the right place for this functionality since this needs to be run on every request. Otherwise, users would need to remember to add request guards to every request and failure to do so would be a security issue.
Why this feature can't or shouldn't live outside of Rocket
The
Fairing
trait does not give us the ability to abort requests viaon_request
.Ideal Solution
Update
on_request
to give us the ability to respond to requests. Maybe the return type should be something likeOption<rocket::request::Outcome>
.Alternatives Considered
The only other approach I've seen to do this is to modify the request to point to a handler defined by the fairing. I'll probably do this for now, but it seems like a hack.
The text was updated successfully, but these errors were encountered: