fix: escape image alt text (#3896)

This commit is contained in:
Tony Brix
2026-02-17 13:03:25 -07:00
committed by GitHub
parent eb8ba2be8d
commit 909fe442aa
3 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -182,7 +182,7 @@ export class _Renderer<ParserOutput = string, RendererOutput = string> {
}
href = cleanHref;
let out = `<img src="${href}" alt="${text}"`;
let out = `<img src="${href}" alt="${escape(text)}"`;
if (title) {
out += ` title="${escape(title)}"`;
}
+1
View File
@@ -0,0 +1 @@
<p><img src="https://example.com/404.jpg" alt="&quot; onerror=&quot;alert('XSS')&quot;" /></p>
+1
View File
@@ -0,0 +1 @@
![" onerror="alert('XSS')"](https://example.com/404.jpg)