mirror of
https://github.com/kjanat/livegraphs-django.git
synced 2026-01-16 12:32:10 +01:00
Potential fix for code scanning alert no. 3: DOM text reinterpreted as HTML
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
@ -299,6 +299,15 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function createToast(messageText, messageTags) {
|
function createToast(messageText, messageTags) {
|
||||||
|
function escapeHtml(unsafe) {
|
||||||
|
return unsafe
|
||||||
|
.replace(/&/g, "&")
|
||||||
|
.replace(/</g, "<")
|
||||||
|
.replace(/>/g, ">")
|
||||||
|
.replace(/"/g, """)
|
||||||
|
.replace(/'/g, "'");
|
||||||
|
}
|
||||||
|
|
||||||
let toastClass = "";
|
let toastClass = "";
|
||||||
let autohide = true;
|
let autohide = true;
|
||||||
let delay = 5000;
|
let delay = 5000;
|
||||||
@ -329,7 +338,7 @@
|
|||||||
<button type="button" class="btn-close ${toastClass.includes("text-white") ? "btn-close-white" : ""}" data-bs-dismiss="toast" aria-label="Close"></button>
|
<button type="button" class="btn-close ${toastClass.includes("text-white") ? "btn-close-white" : ""}" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="toast-body">
|
<div class="toast-body">
|
||||||
${messageText}
|
${escapeHtml(messageText)}
|
||||||
</div>
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user