fix csrf path so that it's valid only for current path and not whole (sub)domain

This commit is contained in:
zadam 2019-03-24 23:03:30 +01:00
parent 6c7e2f0aa1
commit 001bd1d004

View File

@ -40,7 +40,10 @@ const sql = require('../services/sql');
const protectedSessionService = require('../services/protected_session');
const csurf = require('csurf');
const csrfMiddleware = csurf({ cookie: true });
const csrfMiddleware = csurf({
cookie: true,
path: '' // nothing so cookie is valid only for current path
});
function apiResultHandler(req, res, result) {
// if it's an array and first element is integer then we consider this to be [statusCode, response] format