Skip to content

Security: Stored XSS via unsanitized rich HTML rendering#172

Open
tuanaiseo wants to merge 2 commits intoMrXujiang:masterfrom
tuanaiseo:contribai/fix/security/stored-xss-via-unsanitized-rich-html-ren
Open

Security: Stored XSS via unsanitized rich HTML rendering#172
tuanaiseo wants to merge 2 commits intoMrXujiang:masterfrom
tuanaiseo:contribai/fix/security/stored-xss-via-unsanitized-rich-html-ren

Conversation

@tuanaiseo
Copy link
Copy Markdown

Problem

User-controlled content is rendered with dangerouslySetInnerHTML without sanitization. An attacker can inject scripts/event handlers (for example via stored page content) and execute arbitrary JavaScript in visitors' browsers.

Severity: high
File: src/materials/base/RichText/index.tsx

Solution

Sanitize HTML before rendering (e.g., DOMPurify with a strict allowlist) and strip dangerous tags/attributes (script, on*, javascript: URLs). Prefer rendering structured rich-text data instead of raw HTML where possible.

Changes

  • src/materials/base/RichText/index.tsx (modified)
  • src/materials/shop/ZhuanLan/index.tsx (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

User-controlled `content` is rendered with `dangerouslySetInnerHTML` without sanitization. An attacker can inject scripts/event handlers (for example via stored page content) and execute arbitrary JavaScript in visitors' browsers.

Affected files: index.tsx, index.tsx

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
User-controlled `content` is rendered with `dangerouslySetInnerHTML` without sanitization. An attacker can inject scripts/event handlers (for example via stored page content) and execute arbitrary JavaScript in visitors' browsers.

Affected files: index.tsx, index.tsx

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant