Skip to content

Node.js based forum software built for the modern web

fix: sanitize-html configuration passed in src/posts/parse.js

Julian Lamdb30834ebc0c
diff --git a/src/posts/parse.js b/src/posts/parse.js
index f36013dd77..a29668edb5 100644
--- a/src/posts/parse.js
+++ b/src/posts/parse.js
@@ -27,13 +27,10 @@ let sanitizeConfig = {
source: ['type', 'src', 'srcset', 'sizes', 'media', 'height', 'width'],
embed: ['height', 'src', 'type', 'width'],
},
- globalAttributes: ['accesskey', 'class', 'contenteditable', 'dir',
+ nonBooleanAttributes: ['accesskey', 'class', 'contenteditable', 'dir',
'draggable', 'dropzone', 'hidden', 'id', 'lang', 'spellcheck', 'style',
- 'tabindex', 'title', 'translate', 'aria-expanded', 'data-*',
+ 'tabindex', 'title', 'translate', 'aria-*', 'data-*',
],
- allowedClasses: {
- ...sanitize.defaults.allowedClasses,
- },
};
module.exports = function (Posts) {
@@ -121,7 +118,7 @@ module.exports = function (Posts) {
sanitizeConfig.allowedTags.forEach((tag) => {
sanitizeConfig.allowedAttributes[tag] = _.union(
sanitizeConfig.allowedAttributes[tag],
- sanitizeConfig.globalAttributes
+ sanitizeConfig.nonBooleanAttributes
);
});