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
Then each route will need to receive the csrfProtection variable. We'll need to document examples in the Roosevelt docs. Here's some examples from malibu:
// this lets you acquire CSRF token on response bodyapp.get('/',csrfProtection,(req,res)=>{res.status(200).json({token: req.csrfToken()})})// you may only access this if you give a previously acquired CSRF tokenapp.post('/',csrfProtection,(req,res)=>{res.status(200).json({message: 'hello'})})
I'm assuming that if a route omits csrfProtection then it simply won't populate req.csrfToken and that isn't necessary to modify every route declaration to include the middleware unless the user decides they want CSRF protection on that route. That assumption needs to be tested.
The text was updated successfully, but these errors were encountered:
Some general interesting info on the topic:
After due consideration, we've decided to adopt malibu at the framework level.
Will also need to add express-session as a dependency as well.
From malibu docs:
Import deps:
Load the middleware:
Note
app
will already be defined by roosevelt.Then each route will need to receive the
csrfProtection
variable. We'll need to document examples in the Roosevelt docs. Here's some examples from malibu:I'm assuming that if a route omits
csrfProtection
then it simply won't populatereq.csrfToken
and that isn't necessary to modify every route declaration to include the middleware unless the user decides they want CSRF protection on that route. That assumption needs to be tested.The text was updated successfully, but these errors were encountered: