Skip to content

Commit 09aa888

Browse files
author
Martii
committed
*sanitize-html* now supports wildcard glob for allowedAttributes
* Alter affected JSON by transforming `all` to `*` and removing code pertaining to `all` Historical refs: * OpenUserJS#192 Tested on dev CI and referenced comment on local pro okay
1 parent 1c2546d commit 09aa888

File tree

3 files changed

+2
-16
lines changed

3 files changed

+2
-16
lines changed

libs/htmlWhitelistPost.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"itemscope",
7777
"itemtype"
7878
],
79-
"all": [
79+
"*": [
8080
"abbr",
8181
"accept",
8282
"accept-charset",

libs/markdown.js

-14
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,6 @@ var blockRenderers = [
1818
'paragraph',
1919
'table'
2020
];
21-
var allWhitelistAttrs = htmlWhitelistPost.allowedAttributes.all;
22-
23-
// Whitelist a bunch of attributes for all tags
24-
// Doing this until we have an upstream fix
25-
htmlWhitelistPost.allowedTags.forEach(function (aTag) {
26-
var otherAttrs = htmlWhitelistPost.allowedAttributes[aTag];
27-
28-
htmlWhitelistPost.allowedAttributes[aTag] = allWhitelistAttrs;
29-
if (otherAttrs) {
30-
htmlWhitelistPost.allowedAttributes[aTag] = htmlWhitelistPost
31-
.allowedAttributes[aTag].concat(otherAttrs);
32-
}
33-
});
34-
delete htmlWhitelistPost.allowedAttributes.all;
3521

3622
// Transform exact Github Flavored Markdown generated style tags to bootstrap custom classes
3723
// to allow the sanitizer to whitelist on th and td tags for table alignment

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"passport-yahoo": "0.3.0",
5353
"pegjs": "0.9.0",
5454
"request": "2.61.0",
55-
"sanitize-html": "1.9.0",
55+
"sanitize-html": "1.10.0",
5656
"select2": "3.5.2-browserify",
5757
"select2-bootstrap-css": "1.4.6",
5858
"serve-favicon": "2.3.0",

0 commit comments

Comments
 (0)