fix(RecipeWaiter): sanitize user input in addOperation to prevent XSS

This commit is contained in:
heaprc 2025-04-05 00:18:54 +02:00
parent 848660f8e1
commit 857576dbe4
3 changed files with 22 additions and 8 deletions

View file

@ -8,6 +8,7 @@ import HTMLOperation from "../HTMLOperation.mjs";
import Sortable from "sortablejs";
import Utils from "../../core/Utils.mjs";
import {escapeControlChars} from "../utils/editorUtils.mjs";
import DOMPurify from 'dompurify';
/**
@ -435,7 +436,9 @@ class RecipeWaiter {
const item = document.createElement("li");
item.classList.add("operation");
item.innerHTML = name;
const clean = DOMPurify.sanitize(name);
item.innerHTML = clean;
this.buildRecipeOperation(item);
document.getElementById("rec-list").appendChild(item);