From d46a51cf6eec7ca05d3c646144150527ed8245ae Mon Sep 17 00:00:00 2001 From: wizardchen Date: Wed, 6 May 2026 16:35:21 +0800 Subject: [PATCH] fix(security): forbid through the sanitizer and apply as global CSS, squashing the entire app layout. Add 'style' to FORBID_TAGS so top-level style elements from document content are dropped regardless of the SVG profile. --- frontend/src/utils/security.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/utils/security.ts b/frontend/src/utils/security.ts index bf2187da..9aec0c8b 100644 --- a/frontend/src/utils/security.ts +++ b/frontend/src/utils/security.ts @@ -48,7 +48,7 @@ const DOMPurifyConfig = { // 允许的协议 ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|(?:local|minio|cos|tos|s3|oss|ks3):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i, // 禁止的标签和属性 - FORBID_TAGS: ['script', 'object', 'embed', 'form', 'input', 'button'], + FORBID_TAGS: ['script', 'style', 'object', 'embed', 'form', 'input', 'button'], FORBID_ATTR: ['onerror', 'onload', 'onclick', 'onmouseover', 'onfocus', 'onblur'], // 其他安全配置 KEEP_CONTENT: true,