Skip to content

Commit d00ca2f

Browse files
committed
fix: enhance XSS protection by adding video and source tag attributes (not xss still)
1 parent c104482 commit d00ca2f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adminforth/spa/src/utils/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,13 @@ export function protectAgainstXSS(value: string) {
233233
"ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn",
234234
"em", "i", "kbd", "mark", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp",
235235
"small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "caption",
236-
"col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", 'img'
236+
"col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", 'img', 'video', 'source'
237237
],
238238
allowedAttributes: {
239239
'li': [ 'data-list' ],
240240
'img': [ 'src', 'srcset', 'alt', 'title', 'width', 'height', 'loading' ],
241+
'video': [ 'src', 'controls', 'autoplay', 'loop', 'muted', 'poster', 'width', 'height', 'autoplay', 'playsinline' ],
242+
'source': [ 'src', 'type' ],
241243
// Allow markup on spans (classes & styles), and
242244
// generic data/aria/style attributes on any element. (e.g. for KaTeX-related previews)
243245
'span': [ 'class', 'style' ],

0 commit comments

Comments
 (0)