Skip to content

Conversation

@zeelsheladiya
Copy link
Contributor

Pull Request

This PR addresses a critical Stored Cross-Site Scripting (XSS) vulnerability in the Markdown parser. Previously, the parser rendered raw HTML without sanitization, allowing arbitrary JavaScript execution via crafted Markdown content.

Description

  • Added dompurify and @types/dompurify dependencies to handle HTML sanitization.
  • Modified src/features/editor/markdown/parser.ts to sanitize the parsed HTML string using DOMPurify.sanitize() before returning it.
  • This ensures that unsafe HTML attributes (like onerror events) are stripped out while preserving legitimate Markdown formatting and secure HTML elements.

Screenshots/Videos

Before:

before.mp4

After:

after.mp4

@zeelsheladiya zeelsheladiya changed the title Fix/markdown xss Fix markdown xss Dec 29, 2025
@mehmetozguldev mehmetozguldev self-requested a review December 29, 2025 15:01
Copy link
Member

@mehmetozguldev mehmetozguldev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mehmetozguldev mehmetozguldev merged commit 30b1907 into athasdev:master Dec 29, 2025
2 checks passed
@zeelsheladiya zeelsheladiya deleted the fix/markdown-xss branch December 29, 2025 15:17
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.

2 participants