Skip to content

Commit cdbe43c

Browse files
abhizipstackclaude
andcommitted
fix: add explicit DOMPurify allowlist for ANSI log rendering
Restrict allowed tags to span and br, attributes to style only. Tighter than DOMPurify defaults — guards against future version changes while preserving ANSI color spans. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 47f1e42 commit cdbe43c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎frontend/src/ide/editor/no-code-model/no-code-model.jsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,11 @@ function NoCodeModel({ nodeData }) {
359359
});
360360
updateSpec(newSpec);
361361
};
362-
const parseLog = (log) => DOMPurify.sanitize(ansiToHtml.toHtml(log));
362+
const parseLog = (log) =>
363+
DOMPurify.sanitize(ansiToHtml.toHtml(log), {
364+
ALLOWED_TAGS: ["span", "br"],
365+
ALLOWED_ATTR: ["style"],
366+
});
363367

364368
const hideGenAIAndTimeTravelTabs = true;
365369
const BOTTOM_TABS = [

0 commit comments

Comments
 (0)