itizawa %!s(int64=5) %!d(string=hai) anos
pai
achega
e49058cfa4
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      src/server/routes/attachment.js

+ 6 - 0
src/server/routes/attachment.js

@@ -226,6 +226,12 @@ module.exports = function(crowi, app) {
         'Content-Disposition': `attachment;filename*=UTF-8''${encodeURIComponent(attachment.originalName)}`,
         'Content-Disposition': `attachment;filename*=UTF-8''${encodeURIComponent(attachment.originalName)}`,
       });
       });
     }
     }
+    // prevent xss
+    else if (attachment.fileFormat === 'image/svg+xml') {
+      res.set({
+        'Content-Security-Policy': "connect-src 'none';",
+      });
+    }
     // reference
     // reference
     else {
     else {
       res.set('Content-Type', attachment.fileFormat);
       res.set('Content-Type', attachment.fileFormat);