mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: escape image alt text (#3896)
This commit is contained in:
+1
-1
@@ -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)}"`;
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<p><img src="https://example.com/404.jpg" alt="" onerror="alert('XSS')"" /></p>
|
||||
@@ -0,0 +1 @@
|
||||

|
||||
Reference in New Issue
Block a user