Skip to content

Commit

Permalink
fix: sanitize-html configuration passed in src/posts/parse.js
Browse files Browse the repository at this point in the history
Cursory review of sanitize-html documentation suggests that the currently-used `globalAttributes` property no longer exists, but was replaced with `nonBooleanAttributes`, likely because the attribute allow-list explicitly applies only to "non-boolean" attributes (e.g. not `checked` or `selected`).

Either way it does not likely affect us but is mainly here for future-proofing purposes.
  • Loading branch information
julianlam committed May 23, 2024
1 parent 598c10c commit ed3a8da
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/posts/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ed3a8da

Please sign in to comment.