|
|
@@ -2,7 +2,7 @@ module.exports = function(crowi) {
|
|
|
var mongoose = require('mongoose')
|
|
|
, debug = require('debug')('growi:models:config')
|
|
|
, uglifycss = require('uglifycss')
|
|
|
- , RecommendedXSSWhiteList = require('../util/RecommendedXSSWhiteList')
|
|
|
+ , RecommendedXssWhiteList = require('../util/RecommendedXssWhiteList')
|
|
|
, configSchema
|
|
|
, Config
|
|
|
|
|
|
@@ -102,12 +102,12 @@ module.exports = function(crowi) {
|
|
|
|
|
|
function getDefaultMarkdownConfigs() {
|
|
|
return {
|
|
|
- 'markdown:XSS:isPrevented': false,
|
|
|
- 'markdown:XSS:option': 2,
|
|
|
- 'markdown:XSS:tagWhiteList': [],
|
|
|
- 'markdown:XSS:attrWhiteList': [],
|
|
|
+ 'markdown:xss:isPrevented': false,
|
|
|
+ 'markdown:xss:option': 2,
|
|
|
+ 'markdown:xss:tagWhiteList': [],
|
|
|
+ 'markdown:xss:attrWhiteList': [],
|
|
|
'markdown:isEnabledLinebreaks': false,
|
|
|
- 'markdown:isEnabledPreventXSS': false,
|
|
|
+ 'markdown:isEnabledPreventXss': false,
|
|
|
'markdown:isEnabledLinebreaksInComments': true,
|
|
|
};
|
|
|
}
|
|
|
@@ -340,8 +340,8 @@ module.exports = function(crowi) {
|
|
|
return config.markdown[key];
|
|
|
};
|
|
|
|
|
|
- configSchema.statics.isXSSPrevented = function(config) {
|
|
|
- const key = 'markdown:XSS:isPrevented';
|
|
|
+ configSchema.statics.isXssPrevented = function(config) {
|
|
|
+ const key = 'markdown:xss:isPrevented';
|
|
|
|
|
|
// return default value if undefined
|
|
|
if (undefined === config.markdown || undefined === config.markdown[key]) {
|
|
|
@@ -351,8 +351,8 @@ module.exports = function(crowi) {
|
|
|
return config.markdown[key];
|
|
|
};
|
|
|
|
|
|
- configSchema.statics.XSSOption = function(config) {
|
|
|
- const key = 'markdown:XSS:option';
|
|
|
+ configSchema.statics.xssOption = function(config) {
|
|
|
+ const key = 'markdown:xss:option';
|
|
|
|
|
|
// return default value if undefined
|
|
|
if (undefined === config.markdown || undefined === config.markdown[key]) {
|
|
|
@@ -363,20 +363,20 @@ module.exports = function(crowi) {
|
|
|
};
|
|
|
|
|
|
configSchema.statics.tagWhiteList = function(config) {
|
|
|
- const key = 'markdown:XSS:tagWhiteList';
|
|
|
+ const key = 'markdown:xss:tagWhiteList';
|
|
|
|
|
|
// return default value if undefined
|
|
|
if (undefined === config.markdown || undefined === config.markdown[key]) {
|
|
|
return getDefaultMarkdownConfigs[key];
|
|
|
}
|
|
|
|
|
|
- if (this.isXSSPrevented(config)) {
|
|
|
- switch (this.XSSOption(config)) {
|
|
|
+ if (this.isXssPrevented(config)) {
|
|
|
+ switch (this.xssOption(config)) {
|
|
|
case 1: // ignore all: use default option
|
|
|
return [];
|
|
|
|
|
|
case 2: // recommended
|
|
|
- return RecommendedXSSWhiteList.tags;
|
|
|
+ return RecommendedXssWhiteList.tags;
|
|
|
|
|
|
case 3: // custom white list
|
|
|
return config.markdown[key];
|
|
|
@@ -392,20 +392,20 @@ module.exports = function(crowi) {
|
|
|
};
|
|
|
|
|
|
configSchema.statics.attrWhiteList = function(config) {
|
|
|
- const key = 'markdown:XSS:attrWhiteList';
|
|
|
+ const key = 'markdown:xss:attrWhiteList';
|
|
|
|
|
|
// return default value if undefined
|
|
|
if (undefined === config.markdown || undefined === config.markdown[key]) {
|
|
|
return getDefaultMarkdownConfigs[key];
|
|
|
}
|
|
|
|
|
|
- if (this.isXSSPrevented(config)) {
|
|
|
- switch (this.XSSOption(config)) {
|
|
|
+ if (this.isXssPrevented(config)) {
|
|
|
+ switch (this.xssOption(config)) {
|
|
|
case 1: // ignore all: use default option
|
|
|
return [];
|
|
|
|
|
|
case 2: // recommended
|
|
|
- return RecommendedXSSWhiteList.attrs;
|
|
|
+ return RecommendedXssWhiteList.attrs;
|
|
|
|
|
|
case 3: // custom white list
|
|
|
return config.markdown[key];
|
|
|
@@ -559,8 +559,8 @@ module.exports = function(crowi) {
|
|
|
layoutType: Config.layoutType(config),
|
|
|
isEnabledLinebreaks: Config.isEnabledLinebreaks(config),
|
|
|
isEnabledLinebreaksInComments: Config.isEnabledLinebreaksInComments(config),
|
|
|
- isXSSPrevented: Config.isXSSPrevented(config),
|
|
|
- XSSOption: Config.XSSOption(config),
|
|
|
+ isXssPrevented: Config.isXssPrevented(config),
|
|
|
+ xssOption: Config.xssOption(config),
|
|
|
tagWhiteList: Config.tagWhiteList(config),
|
|
|
attrWhiteList: Config.attrWhiteList(config),
|
|
|
highlightJsStyleBorder: Config.highlightJsStyleBorder(config),
|