From ba0acc6b048897ded25d5cb43fae6893e222d46c Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Sun, 2 Jul 2023 02:06:26 -0400 Subject: [PATCH] Backport pull request #4657 from jellyfin/release-10.8.z Fix xss in custom subtitles element Original-merge: 5cc91f2ee03d06f1fc3eda3e924b3e25c6f95170 Merged-by: Bill Thornton Backported-by: Bill Thornton --- src/plugins/htmlVideoPlayer/plugin.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js index e0a30cb6b..0ec83d636 100644 --- a/src/plugins/htmlVideoPlayer/plugin.js +++ b/src/plugins/htmlVideoPlayer/plugin.js @@ -1,3 +1,5 @@ +import DOMPurify from 'dompurify'; + import browser from '../../scripts/browser'; import { appHost } from '../../components/apphost'; import loading from '../../components/loading/loading'; @@ -1535,7 +1537,8 @@ export class HtmlVideoPlayer { } if (selectedTrackEvent && selectedTrackEvent.Text) { - subtitleTextElement.innerHTML = normalizeTrackEventText(selectedTrackEvent.Text, true); + subtitleTextElement.innerHTML = DOMPurify.sanitize( + normalizeTrackEventText(selectedTrackEvent.Text, true)); subtitleTextElement.classList.remove('hide'); } else { subtitleTextElement.classList.add('hide');