]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/csp.ts
Refractor videojs player
[github/Chocobozzz/PeerTube.git] / server / middlewares / csp.ts
index a0ed3710b525e4716c545374ba6111a6548ac1db..5fa9d1ab547d13c9a00bc3cea9179b25a7057ed7 100644 (file)
@@ -8,19 +8,18 @@ const baseDirectives = Object.assign({},
     mediaSrc: ["'self'", 'https:', 'blob:'],
     fontSrc: ["'self'", 'data:'],
     imgSrc: ["'self'", 'data:'],
-    scriptSrc: ["'self' 'unsafe-inline'"],
+    scriptSrc: ["'self' 'unsafe-inline' 'unsafe-eval'"],
     styleSrc: ["'self' 'unsafe-inline'"],
-    // objectSrc: ["'none'"], // only define to allow plugins, else let defaultSrc 'none' block it
+    objectSrc: ["'none'"], // only define to allow plugins, else let defaultSrc 'none' block it
     formAction: ["'self'"],
     frameAncestors: ["'none'"],
     baseUri: ["'self'"],
-    pluginTypes: ["'none'"],
     manifestSrc: ["'self'"],
     frameSrc: ["'self'"], // instead of deprecated child-src / self because of test-embed
-    workerSrc: ["'self'"], // instead of deprecated child-src
-    upgradeInsecureRequests: true
+    workerSrc: ["'self'", 'blob:'] // instead of deprecated child-src
   },
-  (CONFIG.SERVICES['CSP-LOGGER'] != null) ? { reportUri: CONFIG.SERVICES['CSP-LOGGER'] } : {}
+  CONFIG.SERVICES['CSP-LOGGER'] ? { reportUri: CONFIG.SERVICES['CSP-LOGGER'] } : {},
+  CONFIG.WEBSERVER.SCHEME === 'https' ? { upgradeInsecureRequests: true } : {}
 )
 
 const baseCSP = helmet.contentSecurityPolicy({