-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merging master to test #587
base: test
Are you sure you want to change the base?
Conversation
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
if (!newSrc.includes("autoplay=1")) { | ||
newSrc = newSrc.includes("?") ? `${newSrc}&autoplay=1` : `${newSrc}?autoplay=1`; | ||
} | ||
mainVideo.setAttribute("src", newSrc); |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 2 months ago
To fix the problem, we need to ensure that the newSrc
value is properly sanitized before being used as the src
attribute of the mainVideo
element. One way to achieve this is by using a URL parser to validate and sanitize the URL. This will help prevent any malicious content from being executed.
We will:
- Parse the
newSrc
value using theURL
constructor to ensure it is a valid URL. - Extract and modify the query parameters as needed.
- Set the sanitized URL as the
src
attribute of themainVideo
element.
-
Copy modified lines R58-R65
@@ -57,7 +57,11 @@ | ||
let newSrc = this.getAttribute("data-video-src"); | ||
|
||
if (!newSrc.includes("autoplay=1")) { | ||
newSrc = newSrc.includes("?") ? `${newSrc}&autoplay=1` : `${newSrc}?autoplay=1`; | ||
try { | ||
let url = new URL(newSrc, window.location.origin); | ||
if (!url.searchParams.has("autoplay")) { | ||
url.searchParams.append("autoplay", "1"); | ||
} | ||
mainVideo.setAttribute("src", url.toString()); | ||
} catch (e) { | ||
console.error("Invalid video URL:", newSrc); | ||
} | ||
mainVideo.setAttribute("src", newSrc); | ||
let figcaption = this.parentElement.querySelector("figcaption"); |
Ritm1312357
Staging
Qsmo filter fix ogpweb 17415
Staging
Ogpweb 17899 grm
Staging
Ogpweb 17840
Staging
No description provided.