Просмотр исходного кода

make csruf ignore PUT method with default values

yohei0125 3 лет назад
Родитель
Сommit
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
   // 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
   // passport
   debug('initialize Passport');
   debug('initialize Passport');