-
Notifications
You must be signed in to change notification settings - Fork 9
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
10.0.0-beta1 #971
base: main
Are you sure you want to change the base?
10.0.0-beta1 #971
Conversation
Many fixes plus router
…aused fatal errors.
…king through the new server creation error.
…od_proclaim # Conflicts: # admin/src/Helper/Cwmparams.php
New mod_proclaimicon for Admin View.
$.find(targetImage).show() | ||
} | ||
|
||
$.find(targetImage).attr('src', activeDir.join('/') + '/' + $(this).val()) |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 2 days ago
To fix the problem, we need to ensure that the value retrieved from $(this).val()
is properly sanitized or escaped before being used to set the src
attribute of the image element. This can be achieved by using a function that escapes any potentially dangerous characters in the value.
The best way to fix this without changing existing functionality is to use a utility function to escape the value before concatenating it with the rest of the URL. We can use a well-known library like lodash
for this purpose, which provides a method _.escape
to escape HTML characters.
-
Copy modified line R1 -
Copy modified line R107
@@ -1 +1,2 @@ | ||
import _ from 'lodash'; | ||
/** | ||
@@ -105,3 +106,3 @@ | ||
|
||
$.find(targetImage).attr('src', activeDir.join('/') + '/' + $(this).val()) | ||
$.find(targetImage).attr('src', activeDir.join('/') + '/' + _.escape($(this).val())) | ||
}, |
-
Copy modified line R31 -
Copy modified lines R38-R39
@@ -30,4 +30,3 @@ | ||
"comments": false, | ||
"ignore": [ | ||
] | ||
"ignore": [] | ||
}, | ||
@@ -38,3 +37,4 @@ | ||
"@hapi/hoek": "<=9.2.1", | ||
"less": "^4.1.2" | ||
"less": "^4.1.2", | ||
"lodash": "^4.17.21" | ||
} |
Package | Version | Security advisories |
lodash (npm) | 4.17.21 | None |
|
||
if (sE && (url = sE.options[sE.selectedIndex].value)) | ||
{ | ||
location.href = url |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 2 days ago
To fix the problem, we need to ensure that the url
value is properly validated before it is used to set location.href
. This can be done by checking that the url
value is a valid and safe URL. We can use a regular expression to validate the URL format or use the URL
constructor to ensure it is a valid URL.
The best way to fix the problem without changing existing functionality is to add a validation step before setting location.href
. We will use the URL
constructor to validate the URL.
-
Copy modified lines R205-R210
@@ -204,3 +204,8 @@ | ||
{ | ||
location.href = url | ||
try { | ||
new URL(url); | ||
location.href = url; | ||
} catch (e) { | ||
console.error('Invalid URL:', url); | ||
} | ||
} |
const newmp4 = videolink.attr('data-src') | ||
const player = $('#' + videoID) | ||
player.get(0).pause() | ||
player.attr('src', newmp4) |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 2 days ago
To fix the problem, we need to ensure that the value extracted from the data-src
attribute is properly sanitized before being used. One way to achieve this is by using a library like DOMPurify to sanitize the URL. This will help prevent any malicious content from being executed.
- Import the DOMPurify library.
- Sanitize the
newmp4
value before assigning it to thesrc
attribute of the video element.
-
Copy modified line R1 -
Copy modified line R9
@@ -1 +1,2 @@ | ||
import DOMPurify from 'dompurify'; | ||
(function (window, document, $) { | ||
@@ -7,3 +8,3 @@ | ||
const videolink = $('#' + contentPanelId) | ||
const newmp4 = videolink.attr('data-src') | ||
const newmp4 = DOMPurify.sanitize(videolink.attr('data-src')) | ||
const player = $('#' + videoID) |
-
Copy modified line R31 -
Copy modified lines R38-R39
@@ -30,4 +30,3 @@ | ||
"comments": false, | ||
"ignore": [ | ||
] | ||
"ignore": [] | ||
}, | ||
@@ -38,3 +37,4 @@ | ||
"@hapi/hoek": "<=9.2.1", | ||
"less": "^4.1.2" | ||
"less": "^4.1.2", | ||
"dompurify": "^3.2.2" | ||
} |
Package | Version | Security advisories |
dompurify (npm) | 3.2.2 | None |
# Conflicts: # site/helpers/media.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved!
First Beta release for public testing.