Skip to content

Official Crawl4AI Cloud: a hosted web scraping, extraction, and search API for AI agents. Free API key, 1,000 credits a month, no card. Fully open source: this repo is the Apache-2.0 crawler that powers it, and you can self-host it.

fix(playground): remove innerHTML round-trip to prevent DOM-based XSS

ntohidi0213355db08a
diff --git a/deploy/docker/static/playground/index.html b/deploy/docker/static/playground/index.html
index ba368b76..49d27d43 100644
--- a/deploy/docker/static/playground/index.html
+++ b/deploy/docker/static/playground/index.html
@@ -1000,9 +1000,11 @@
// Save current scroll position (important for large code blocks)
const scrollTop = element.parentElement.scrollTop;
- // Reset the element
- const text = element.textContent;
- element.innerHTML = text;
+ // Reset highlight.js state. NOTE: do NOT round-trip through
+ // innerHTML here — the response text contains attacker-controlled
+ // crawled content and `element.innerHTML = element.textContent`
+ // re-parses it as live HTML (DOM-based XSS). highlight.js renders
+ // safely from textContent and emits escaped markup.
element.removeAttribute('data-highlighted');
// Reapply highlighting