Skip to content

Commit 5a3b7bc

Browse files
authored
Merge pull request #2014 from 0xh3xa/master
Fix(RecipeWaiter): sanitize user input in addOperation to prevent XSS
2 parents 848660f + c83e1ac commit 5a3b7bc

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

package-lock.json

+17-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
"d3": "7.9.0",
124124
"d3-hexbin": "^0.2.2",
125125
"diff": "^5.2.0",
126+
"dompurify": "^3.2.5",
126127
"es6-promisify": "^7.0.0",
127128
"escodegen": "^2.1.0",
128129
"esprima": "^4.0.1",

src/web/waiters/RecipeWaiter.mjs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import HTMLOperation from "../HTMLOperation.mjs";
88
import Sortable from "sortablejs";
99
import Utils from "../../core/Utils.mjs";
1010
import {escapeControlChars} from "../utils/editorUtils.mjs";
11+
import DOMPurify from "dompurify";
1112

1213

1314
/**
@@ -435,7 +436,9 @@ class RecipeWaiter {
435436
const item = document.createElement("li");
436437

437438
item.classList.add("operation");
438-
item.innerHTML = name;
439+
const clean = DOMPurify.sanitize(name);
440+
item.innerHTML = clean;
441+
439442
this.buildRecipeOperation(item);
440443
document.getElementById("rec-list").appendChild(item);
441444

0 commit comments

Comments
 (0)