Skip to content

Commit

Permalink
#541 feat: Add DOMPurify to sanitize URL in playQueue.html
Browse files Browse the repository at this point in the history
  • Loading branch information
kagemomiji committed Jul 16, 2024
1 parent 4690937 commit 5523ca0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion airsonic-main/src/main/resources/templates/playQueue.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<script th:src="@{/script/mediaelement/plugins/speed/speed-i18n.js}"></script>
<script th:src="@{/script/mediaelement/plugins/chromecast/chromecast.min.js}"></script>
<script th:src="@{/script/mediaelement/plugins/chromecast/chromecast-i18n.js}"></script>
<script type="text/javascript" th:src="@{/script/purify-3.1.6.min.js}"></script>
<link rel="stylesheet" th:href="@{/script/mediaelement/plugins/speed/speed.min.css}">
<link rel="stylesheet" th:href="@{/script/mediaelement/plugins/chromecast/chromecast.min.css}">

Expand Down Expand Up @@ -59,7 +60,7 @@
if (elt.hasAttribute("class")) node.setAttribute("class", elt.getAttribute("class"));

if (newState) {
if (elt.hasAttribute("data-href")) node.setAttribute("href", elt.getAttribute("data-href"));
if (elt.hasAttribute("data-href")) node.setAttribute("href", DOMPurify.sanitize(elt.getAttribute("data-href")));
node.classList.remove("disabled");
node.removeAttribute("aria-disabled");
} else {
Expand Down

0 comments on commit 5523ca0

Please sign in to comment.