Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.use((req, res, next) => {
if (
// req.path === '/api/v1' ||
req.path === '/api' ||
RegExp('/api/.*').test(req.path) ||
process.env.NODE_ENV === 'test'
) {
// Multer multipart/form-data handling needs to occur before the Lusca CSRF check.
// eslint-disable-next-line no-underscore-dangle
res.locals._csrf = '';
next();
} else {
lusca.referrerPolicy('same-origin');
lusca.csrf()(req, res, next);
}
});
/**