1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-11 00:08:30 +01:00
unleash.unleash/lib/middleware/helmet.js
Ivar Conradi Østhus a870c12138 fix: add optional helmet security headers
Allow users to enable the helmet middleware to enable
security headers by default.

https://github.com/helmetjs/helmet
2020-09-01 21:21:26 +02:00

23 lines
561 B
JavaScript

const helmet = require('helmet');
module.exports = function(config) {
if (config.enableHelmet) {
return helmet({
contentSecurityPolicy: {
directives: {
defaultSrc: [
"'self'",
'fonts.googleapis.com',
'fonts.gstatic.com',
'data:',
'gravatar.com',
],
},
},
});
}
return (req, res, next) => {
next();
};
};