|
@@ -101,7 +101,10 @@ module.exports = function(crowi) {
|
|
|
|
|
|
|
|
function getDefaultMarkdownConfigs() {
|
|
function getDefaultMarkdownConfigs() {
|
|
|
return {
|
|
return {
|
|
|
- 'markdown:isEnabledPreventXSS': false,
|
|
|
|
|
|
|
+ 'markdown:XSS:isPrevented': false,
|
|
|
|
|
+ 'markdown:XSS:option': 2,
|
|
|
|
|
+ 'markdown:XSS:tagWhiteList': [],
|
|
|
|
|
+ 'markdown:XSS:attrWhiteList': [],
|
|
|
'markdown:isEnabledLinebreaks': false,
|
|
'markdown:isEnabledLinebreaks': false,
|
|
|
'markdown:isEnabledLinebreaksInComments': true,
|
|
'markdown:isEnabledLinebreaksInComments': true,
|
|
|
};
|
|
};
|
|
@@ -335,8 +338,41 @@ module.exports = function(crowi) {
|
|
|
return config.markdown[key];
|
|
return config.markdown[key];
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.isEnabledPreventXSS = function(config) {
|
|
|
|
|
- const key = 'markdown:isEnabledPreventXSS';
|
|
|
|
|
|
|
+ configSchema.statics.isXSSPrevented = function(config) {
|
|
|
|
|
+ const key = 'markdown:XSS:isPrevented';
|
|
|
|
|
+
|
|
|
|
|
+ // return default value if undefined
|
|
|
|
|
+ if (undefined === config.markdown || undefined === config.markdown[key]) {
|
|
|
|
|
+ return getDefaultMarkdownConfigs[key];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return config.markdown[key];
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ configSchema.statics.XSSOption = function(config) {
|
|
|
|
|
+ const key = 'markdown:XSS:option';
|
|
|
|
|
+
|
|
|
|
|
+ // return default value if undefined
|
|
|
|
|
+ if (undefined === config.markdown || undefined === config.markdown[key]) {
|
|
|
|
|
+ return getDefaultMarkdownConfigs[key];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return config.markdown[key];
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ configSchema.statics.tagWhiteList = function(config) {
|
|
|
|
|
+ const key = 'markdown:XSS:tagWhiteList';
|
|
|
|
|
+
|
|
|
|
|
+ // return default value if undefined
|
|
|
|
|
+ if (undefined === config.markdown || undefined === config.markdown[key]) {
|
|
|
|
|
+ return getDefaultMarkdownConfigs[key];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return config.markdown[key];
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ configSchema.statics.attrWhiteList = function(config) {
|
|
|
|
|
+ const key = 'markdown:XSS:attrWhiteList';
|
|
|
|
|
|
|
|
// return default value if undefined
|
|
// return default value if undefined
|
|
|
if (undefined === config.markdown || undefined === config.markdown[key]) {
|
|
if (undefined === config.markdown || undefined === config.markdown[key]) {
|
|
@@ -486,6 +522,10 @@ module.exports = function(crowi) {
|
|
|
layoutType: Config.layoutType(config),
|
|
layoutType: Config.layoutType(config),
|
|
|
isEnabledLinebreaks: Config.isEnabledLinebreaks(config),
|
|
isEnabledLinebreaks: Config.isEnabledLinebreaks(config),
|
|
|
isEnabledLinebreaksInComments: Config.isEnabledLinebreaksInComments(config),
|
|
isEnabledLinebreaksInComments: Config.isEnabledLinebreaksInComments(config),
|
|
|
|
|
+ isXSSPrevented: Config.isXSSPrevented(config),
|
|
|
|
|
+ XSSOption: Config.XSSOption(config),
|
|
|
|
|
+ tagWhiteList: Config.attrWhiteList(config),
|
|
|
|
|
+ attrWhiteList: Config.tagWhiteList(config),
|
|
|
highlightJsStyleBorder: Config.highlightJsStyleBorder(config),
|
|
highlightJsStyleBorder: Config.highlightJsStyleBorder(config),
|
|
|
isSavedStatesOfTabChanges: Config.isSavedStatesOfTabChanges(config),
|
|
isSavedStatesOfTabChanges: Config.isSavedStatesOfTabChanges(config),
|
|
|
env: {
|
|
env: {
|