Skip to content

Commit cb845b8

Browse files
Potential fix for code scanning alert no. 13: DOM text reinterpreted as HTML
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent a37b3c0 commit cb845b8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

saltgui/static/scripts/Documentation.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,15 @@ export class Documentation {
310310

311311
switch (concreteModules.length) {
312312
case 0:
313-
html += "<p>'" + cmd[1] + "' is an unknown module name. We'll just assume it actually exists. The links below (if any) might not work.</p>";
313+
html += "<p>'" + Documentation._escapeHtml(cmd[1]) + "' is an unknown module name. We'll just assume it actually exists. The links below (if any) might not work.</p>";
314314
break;
315315
case 1:
316316
// simple modules case
317317
// wheel/runners cases are always simple
318318
if (cmd[0] !== "modules") {
319-
html += "<p>Module-name '" + cmd[0] + "." + cmd[1] + "' cannot be verified. We'll just assume it actually exists. The links below might not work.</p>";
319+
html += "<p>Module-name '" + Documentation._escapeHtml(cmd[0]) + "." + Documentation._escapeHtml(cmd[1]) + "' cannot be verified. We'll just assume it actually exists. The links below might not work.</p>";
320320
} else if (cmd[1] !== concreteModules[0]) {
321-
html += "<p>The internal name for '" + cmd[1] + "' is '" + concreteModules[0] + "'.</p>";
321+
html += "<p>The internal name for '" + Documentation._escapeHtml(cmd[1]) + "' is '" + Documentation._escapeHtml(concreteModules[0]) + "'.</p>";
322322
}
323323
break;
324324
default:
@@ -426,7 +426,7 @@ export class Documentation {
426426
}
427427

428428
const output = document.querySelector(".run-command pre");
429-
output.innerHTML = html;
429+
output.innerHTML = html; // Ensure all concatenated strings are escaped.
430430
}
431431

432432
static _manualRunMenuBeaconNamePrepare () {

0 commit comments

Comments
 (0)