aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/csp.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/csp.ts')
-rw-r--r--server/middlewares/csp.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/server/middlewares/csp.ts b/server/middlewares/csp.ts
index 5fa9d1ab5..404e33b43 100644
--- a/server/middlewares/csp.ts
+++ b/server/middlewares/csp.ts
@@ -18,22 +18,20 @@ const baseDirectives = Object.assign({},
18 frameSrc: ["'self'"], // instead of deprecated child-src / self because of test-embed 18 frameSrc: ["'self'"], // instead of deprecated child-src / self because of test-embed
19 workerSrc: ["'self'", 'blob:'] // instead of deprecated child-src 19 workerSrc: ["'self'", 'blob:'] // instead of deprecated child-src
20 }, 20 },
21 CONFIG.SERVICES['CSP-LOGGER'] ? { reportUri: CONFIG.SERVICES['CSP-LOGGER'] } : {}, 21 CONFIG.CSP.REPORT_URI ? { reportUri: CONFIG.CSP.REPORT_URI } : {},
22 CONFIG.WEBSERVER.SCHEME === 'https' ? { upgradeInsecureRequests: true } : {} 22 CONFIG.WEBSERVER.SCHEME === 'https' ? { upgradeInsecureRequests: true } : {}
23) 23)
24 24
25const baseCSP = helmet.contentSecurityPolicy({ 25const baseCSP = helmet.contentSecurityPolicy({
26 directives: baseDirectives, 26 directives: baseDirectives,
27 browserSniff: false, 27 browserSniff: false,
28 reportOnly: true 28 reportOnly: CONFIG.CSP.REPORT_ONLY
29}) 29})
30 30
31const embedCSP = helmet.contentSecurityPolicy({ 31const embedCSP = helmet.contentSecurityPolicy({
32 directives: Object.assign(baseDirectives, { 32 directives: Object.assign({}, baseDirectives, { frameAncestors: ['*'] }),
33 frameAncestors: ['*']
34 }),
35 browserSniff: false, // assumes a modern browser, but allows CDN in front 33 browserSniff: false, // assumes a modern browser, but allows CDN in front
36 reportOnly: true 34 reportOnly: CONFIG.CSP.REPORT_ONLY
37}) 35})
38 36
39// --------------------------------------------------------------------------- 37// ---------------------------------------------------------------------------