mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 19:30:38 +08:00
Restrict DOM sanitization to limited whitelist
This commit is contained in:
+46
-4
@@ -13,10 +13,52 @@ import { canonicalize, isUrl } from "@app/lib/utils";
|
|||||||
import { routeToPath } from "@app/lib/router";
|
import { routeToPath } from "@app/lib/router";
|
||||||
|
|
||||||
dompurify.setConfig({
|
dompurify.setConfig({
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
/* eslint-disable @typescript-eslint/naming-convention */
|
||||||
SANITIZE_DOM: false,
|
ALLOWED_ATTR: [
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
"align",
|
||||||
FORBID_TAGS: ["textarea", "style"],
|
"checked",
|
||||||
|
"class",
|
||||||
|
"href",
|
||||||
|
"id",
|
||||||
|
"name",
|
||||||
|
"target",
|
||||||
|
"text",
|
||||||
|
"title",
|
||||||
|
"src",
|
||||||
|
"type",
|
||||||
|
],
|
||||||
|
ALLOWED_TAGS: [
|
||||||
|
"a",
|
||||||
|
"blockquote",
|
||||||
|
"br",
|
||||||
|
"code",
|
||||||
|
"dd",
|
||||||
|
"div",
|
||||||
|
"dl",
|
||||||
|
"dt",
|
||||||
|
"em",
|
||||||
|
"h1",
|
||||||
|
"h2",
|
||||||
|
"h3",
|
||||||
|
"h4",
|
||||||
|
"h5",
|
||||||
|
"h6",
|
||||||
|
"hr",
|
||||||
|
"img",
|
||||||
|
"input",
|
||||||
|
"li",
|
||||||
|
"ol",
|
||||||
|
"p",
|
||||||
|
"pre",
|
||||||
|
"table",
|
||||||
|
"tbody",
|
||||||
|
"td",
|
||||||
|
"th",
|
||||||
|
"thead",
|
||||||
|
"tr",
|
||||||
|
"ul",
|
||||||
|
],
|
||||||
|
/* eslint-enable @typescript-eslint/naming-convention */
|
||||||
});
|
});
|
||||||
|
|
||||||
export class Renderer extends BaseRenderer {
|
export class Renderer extends BaseRenderer {
|
||||||
|
|||||||
Reference in New Issue
Block a user