Expanded config for more options
This commit is contained in:
parent
affb9f5a0d
commit
4b35c9fe09
@ -5,6 +5,10 @@
|
||||
# script-src 'self' example.com;object-src 'none';
|
||||
# upgrade-insecure-requests"
|
||||
# Note: embedded single quotes are required
|
||||
xFrameOptions: SAMEORIGIN
|
||||
contentSecurityPolicy:
|
||||
useDefaults: false
|
||||
directives:
|
||||
default-src: [ "'self'" ]
|
||||
base-uri: [ "'self'" ]
|
||||
font-src:
|
||||
|
||||
@ -7,11 +7,5 @@ module.exports = (path) => {
|
||||
const csppolicy = fs.readFileSync(path, 'utf8')
|
||||
const csp = YAML.parse(csppolicy)
|
||||
|
||||
return helmet({
|
||||
contentSecurityPolicy: {
|
||||
useDefaults: false,
|
||||
directives: csp,
|
||||
},
|
||||
xFrameOptions: 'SAMEORIGIN',
|
||||
})
|
||||
return helmet(csp)
|
||||
}
|
||||
|
||||
@ -19,6 +19,8 @@ describe('Rapid configurable Content Security Policy middleware', () => {
|
||||
fs.writeFileSync(
|
||||
customPolicyPath,
|
||||
`
|
||||
contentSecurityPolicy:
|
||||
directives:
|
||||
default-src: ["'self'"]
|
||||
script-src: ["'self'", "https://cdn.example.com"]
|
||||
`,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user