Created
October 5, 2018 01:15
-
-
Save rigelk/54b798bf8098fde431330b3868db133f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Security middleware | |
app.use(helmet({ | |
frameguard: { | |
action: 'deny' // we only allow it for /videos/embed, see server/controllers/client.ts | |
}, | |
hsts: false, | |
contentSecurityPolicy: { | |
directives: { | |
defaultSrc: ['*'], // by default, not specifying default-src = '*' | |
mediaSrc: ["'self'"], | |
fontSrc: ["'self' data:"], | |
imgSrc: ["'self' data:"], | |
scriptSrc: ["'self' 'unsafe-inline'"], | |
styleSrc: ["'self' 'unsafe-inline'"], | |
objectSrc: ["'none'"], | |
pluginTypes: ["'none'"], | |
manifestSrc: ["'self'"], | |
frameSrc: ["'none'"], // instead of deprecated child-src | |
workerSrc: ["'self'"], // instead of deprecated child-src | |
upgradeInsecureRequests: true, | |
reportUri: '<your_report_url' | |
}, | |
reportOnly: true, | |
browserSniff: false // assumes a modern browser, but allows CDN in front | |
}, | |
referrerPolicy: { | |
policy: 'strict-origin-when-cross-origin' | |
} | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment