Skip to content

Release 0.187.2#3700

Merged
odlbot merged 11 commits intoreleasefrom
release-candidate
Nov 13, 2025
Merged

Release 0.187.2#3700
odlbot merged 11 commits intoreleasefrom
release-candidate

Conversation

@odlbot
Copy link
Contributor

@odlbot odlbot commented Nov 10, 2025

Areeb Sajjad

renovate[bot]

renovate bot and others added 11 commits October 29, 2025 08:19
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* chore(deps): lock file maintenance

* test: fix failing tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Muhammad Anas <muhammad.anas@arbisoft.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…rity] (#3699)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* fix: add explicit referrer policy on video embeds

* style: linting fix

* fix: watch now home video

* style: prettier errors

if (youtubeVideoHtml) {
const tempDiv = document.createElement("div");
tempDiv.innerHTML = youtubeVideoHtml;

Check failure

Code scanning / CodeQL

DOM text reinterpreted as HTML High

DOM text
is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix

AI 4 months ago

To fix the problem, ensure that the value extracted from the data-href attribute is never interpreted as HTML unless it is first properly sanitized. Since the purpose is to extract an iframe's src attribute, there is no need to parse an HTML string at all—just store the URL directly as the value of data-href and use it.

Best fix:

  • Change code to expect the actual video URL in data-href instead of an HTML string.
  • Remove the usage of innerHTML and DOM parsing.
  • Use the value of data-href directly as the YouTube video source.

Files/lines to change:

  • In openVideoLightBox() in static/js/hero.js, lines 9–27:
    • Instead of parsing an HTML fragment, get the URL directly from data-href.
    • Set youtubeVideoSrc to youtubeVideoHtml (now the URL directly).
    • Remove creation of tempDiv, innerHTML, and querySelector("iframe").
    • Adjust code logic accordingly.

What is needed:

  • Remove unsafe HTML interpretation entirely.
  • No extra dependencies are needed.

Suggested changeset 1
static/js/hero.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/static/js/hero.js b/static/js/hero.js
--- a/static/js/hero.js
+++ b/static/js/hero.js
@@ -6,25 +6,16 @@
 const promoVideoSel = "#promo-video";
 
 function openVideoLightBox() {
-  const youtubeVideoHtml = $("#tv-light-box-yt-video").attr("data-href");
+  const youtubeVideoSrc = $("#tv-light-box-yt-video").attr("data-href");
   const hlsAboutVideoEl = $("video#tv-light-box-video");
-  if (!youtubeVideoHtml && hlsAboutVideoEl.length === 0) {
+  if (!youtubeVideoSrc && hlsAboutVideoEl.length === 0) {
     console.error("We do not have any supported video elements available."); // eslint-disable-line no-console
     return;
   }
 
   let backgroundVideo = null;
-  let youtubeVideoSrc = null;
 
-  if (youtubeVideoHtml) {
-    const tempDiv = document.createElement("div");
-    tempDiv.innerHTML = youtubeVideoHtml;
-    const iframe = tempDiv.querySelector("iframe");
-    if (iframe) {
-      youtubeVideoSrc =
-        iframe.getAttribute("data-src") || iframe.getAttribute("src");
-    }
-  }
+  // No HTML parsing needed: data-href should contain the direct video URL.
 
   const fancyBoxArgs = $.extend(
     {},
EOF
@@ -6,25 +6,16 @@
const promoVideoSel = "#promo-video";

function openVideoLightBox() {
const youtubeVideoHtml = $("#tv-light-box-yt-video").attr("data-href");
const youtubeVideoSrc = $("#tv-light-box-yt-video").attr("data-href");
const hlsAboutVideoEl = $("video#tv-light-box-video");
if (!youtubeVideoHtml && hlsAboutVideoEl.length === 0) {
if (!youtubeVideoSrc && hlsAboutVideoEl.length === 0) {
console.error("We do not have any supported video elements available."); // eslint-disable-line no-console
return;
}

let backgroundVideo = null;
let youtubeVideoSrc = null;

if (youtubeVideoHtml) {
const tempDiv = document.createElement("div");
tempDiv.innerHTML = youtubeVideoHtml;
const iframe = tempDiv.querySelector("iframe");
if (iframe) {
youtubeVideoSrc =
iframe.getAttribute("data-src") || iframe.getAttribute("src");
}
}
// No HTML parsing needed: data-href should contain the direct video URL.

const fancyBoxArgs = $.extend(
{},
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants