mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-04 21:15:22 +02:00
feat: Expanded safe HTML tags and attributes (#2248)
* expanded safe html tags and attrs * removed style attr * add note on sources of safe elements --------- Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
This commit is contained in:
parent
d2134b27ba
commit
a025996b94
1 changed files with 12 additions and 3 deletions
|
@ -25,9 +25,18 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
const sanitized = DOMPurify.sanitize(rawHtml, {
|
const sanitized = DOMPurify.sanitize(rawHtml, {
|
||||||
// TODO: some more thought could be put into what is allowed and what isn't
|
// List based on
|
||||||
ALLOWED_TAGS: ["img", "div", "p", "iframe"],
|
// https://support.zendesk.com/hc/en-us/articles/4408824584602-Allowing-unsafe-HTML-in-help-center-articles
|
||||||
ADD_ATTR: ["src", "alt", "height", "width", "class", "allow", "title", "allowfullscreen", "frameborder", "scrolling"],
|
ALLOWED_TAGS: [
|
||||||
|
"strong", "em", "b", "i", "u", "p", "code", "pre", "samp", "kbd", "var", "sub", "sup", "dfn", "cite",
|
||||||
|
"small", "address", "hr", "br", "id", "div", "span", "h1", "h2", "h3", "h4", "h5", "h6",
|
||||||
|
"ul", "ol", "li", "dl", "dt", "dd", "abbr", "a", "img", "blockquote", "iframe",
|
||||||
|
"del", "ins", "table", "thead", "tbody", "tfoot", "tr", "th", "td", "colgroup",
|
||||||
|
],
|
||||||
|
ADD_ATTR: [
|
||||||
|
"href", "src", "alt", "height", "width", "class", "allow", "title", "allowfullscreen", "frameborder",
|
||||||
|
"scrolling", "cite", "datetime", "name", "abbr", "target", "border",
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
return sanitized;
|
return sanitized;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue