Преглед изворни кода

make csruf ignore PUT method with default values

yohei0125 пре 3 година
родитељ
комит
3347bb80e2
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      packages/app/src/server/crowi/express-init.js

+ 2 - 1
packages/app/src/server/crowi/express-init.js

@@ -122,7 +122,8 @@ module.exports = function(crowi, app) {
   });
 
   // csurf should be initialized after express-session
-  app.use(csrf({ cookie: false }));
+  // default methods + PUT. See: https://expressjs.com/en/resources/middleware/csurf.html#ignoremethods
+  app.use(csrf({ ignoreMethods: ['GET', 'HEAD', 'OPTIONS', 'PUT'], cookie: false }));
 
   // passport
   debug('initialize Passport');