sou 7 лет назад
Родитель
Сommit
00cdb147ef
3 измененных файлов с 16 добавлено и 6 удалено
  1. 4 5
      lib/util/xss.js
  2. 9 0
      lib/util/xssOption.js
  3. 3 1
      resource/js/util/PreProcessor/XssFilter.js

+ 4 - 5
lib/util/xss.js

@@ -1,12 +1,11 @@
 export default class Xss {
 
-  constructor(crowi) {
+  constructor(xssOption) {
     const xss = require('xss');
 
-    const config = crowi.config;
-    const isXssPrevented = config.isXssPrevented;
-    const tagWhiteList = config.tagWhiteList;
-    const attrWhiteList = config.attrWhiteList;
+    const isXssPrevented = xssOption.isXssPrevented;
+    const tagWhiteList = xssOption.tagWhiteList;
+    const attrWhiteList = xssOption.attrWhiteList;
 
     let whiteListContent = {};
 

+ 9 - 0
lib/util/xssOption.js

@@ -0,0 +1,9 @@
+export default class XssOption {
+
+  constructor(config) {
+    this.isXssPrevented = config.isXssPrevented;
+    this.tagWhiteList = config.tagWhiteList;
+    this.attrWhiteList = config.attrWhiteList;
+  }
+
+}

+ 3 - 1
resource/js/util/PreProcessor/XssFilter.js

@@ -1,9 +1,11 @@
 import Xss from '../../../../lib/util/xss';
+import xssOption from '../../../../lib/util/xssOption';
 
 export default class XssFilter {
 
   constructor(crowi) {
-    this.xss = new Xss(crowi);
+    this.xssOption = new xssOption(crowi.config);
+    this.xss = new Xss(this.xssOption);
   }
 
   process(markdown) {