mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: add xss filter to id attribute (#232)
This commit is contained in:
1 parent
c5f20af2f1
commit
88d6ecb816
1 file changed
+12
-8
@@ -24,17 +24,17 @@ const xss = new Xss.FilterXSS({
|
|||||||
dd: [],
|
dd: [],
|
||||||
del: ['datetime'],
|
del: ['datetime'],
|
||||||
details: ['open'],
|
details: ['open'],
|
||||||
div: ['class'],
|
div: ['id','class'],
|
||||||
dl: [],
|
dl: [],
|
||||||
dt: [],
|
dt: [],
|
||||||
em: [],
|
em: [],
|
||||||
font: ['color', 'size', 'face'],
|
font: ['color', 'size', 'face'],
|
||||||
h1: [],
|
h1: ['id'],
|
||||||
h2: ['class'],
|
h2: ['id','class'],
|
||||||
h3: [],
|
h3: ['id'],
|
||||||
h4: [],
|
h4: ['id'],
|
||||||
h5: [],
|
h5: ['id'],
|
||||||
h6: [],
|
h6: ['id'],
|
||||||
header: [],
|
header: [],
|
||||||
hr: [],
|
hr: [],
|
||||||
i: [],
|
i: [],
|
||||||
@@ -52,7 +52,7 @@ const xss = new Xss.FilterXSS({
|
|||||||
sub: [],
|
sub: [],
|
||||||
summary: [],
|
summary: [],
|
||||||
sup: [],
|
sup: [],
|
||||||
strong: [],
|
strong: ['id'],
|
||||||
table: ['width', 'border', 'align', 'valign'],
|
table: ['width', 'border', 'align', 'valign'],
|
||||||
tbody: ['align', 'valign'],
|
tbody: ['align', 'valign'],
|
||||||
td: ['width', 'rowspan', 'colspan', 'align', 'valign', 'bgcolor'],
|
td: ['width', 'rowspan', 'colspan', 'align', 'valign', 'bgcolor'],
|
||||||
@@ -66,6 +66,10 @@ const xss = new Xss.FilterXSS({
|
|||||||
var: [],
|
var: [],
|
||||||
video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width'],
|
video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width'],
|
||||||
},
|
},
|
||||||
|
safeAttrValue(tag, name, value) {
|
||||||
|
if (name === 'id') return `xss-id-${value}`;
|
||||||
|
return value;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function xssProtector(md) {
|
function xssProtector(md) {
|
||||||
|
|||||||
Reference in new issue
Block a user