diff --git a/web/__tests__/xss-prevention.test.tsx b/web/__tests__/xss-prevention.test.tsx
index 064c6e08de..065d4f7b96 100644
--- a/web/__tests__/xss-prevention.test.tsx
+++ b/web/__tests__/xss-prevention.test.tsx
@@ -10,6 +10,7 @@ import { cleanup, render } from '@testing-library/react'
import '@testing-library/jest-dom'
import BlockInput from '../app/components/base/block-input'
import SupportVarInput from '../app/components/workflow/nodes/_base/components/support-var-input'
+import { sanitizeMarkdownContent } from '../app/components/base/markdown'
// Mock styles
jest.mock('../app/components/app/configuration/base/var-highlight/style.module.css', () => ({
@@ -71,6 +72,18 @@ describe('XSS Prevention - Block Input and Support Var Input Security', () => {
expect(scriptElements).toHaveLength(0)
})
})
+
+ describe('Markdown Sanitization', () => {
+ it('strips dangerous attributes and protocols from raw HTML blocks', () => {
+ const jsProtocol = 'java' + 'script:alert(1)'
+ const malicious = `
click`
+ const sanitized = sanitizeMarkdownContent(malicious)
+ expect(sanitized).not.toContain('onerror')
+ expect(sanitized).not.toContain('