Fix XSS: escape userName in reply form insertAdjacentHTML template
showReplyForm() read userName from data-user attribute (decoded by the browser from HTML entities) and injected it unsanitized into insertAdjacentHTML() — any HTML special chars would be parsed as markup. Fix: wrap with lt.escHtml() before interpolation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -1269,7 +1269,7 @@ function showReplyForm(commentId, userName) {
|
|||||||
const replyFormHtml = `
|
const replyFormHtml = `
|
||||||
<div class="reply-form-container" data-parent-id="${commentId}">
|
<div class="reply-form-container" data-parent-id="${commentId}">
|
||||||
<div class="reply-header">
|
<div class="reply-header">
|
||||||
<span>Replying to <span class="replying-to">@${userName}</span></span>
|
<span>Replying to <span class="replying-to">@${lt.escHtml(userName)}</span></span>
|
||||||
<button type="button" class="close-reply-btn" data-action="close-reply">CANCEL</button>
|
<button type="button" class="close-reply-btn" data-action="close-reply">CANCEL</button>
|
||||||
</div>
|
</div>
|
||||||
<textarea id="replyText" placeholder="Write your reply..."></textarea>
|
<textarea id="replyText" placeholder="Write your reply..."></textarea>
|
||||||
|
|||||||
Reference in New Issue
Block a user