-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Feature: workspace info app extension #18014
base: v15/dev
Are you sure you want to change the base?
Conversation
</body>`; | ||
|
||
popup.document.open(); | ||
popup.document.write(html); |
Check failure
Code scanning / CodeQL
Client-side cross-site scripting High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 8 hours ago
To fix the problem, we need to ensure that the window.location.href
value is properly sanitized or encoded before being used in the HTML string. The best way to fix this issue is to use a library like DOMPurify
to sanitize the URL. This will ensure that any potentially malicious content is removed before it is written to the document.
- Install the
DOMPurify
library. - Import
DOMPurify
in the file. - Use
DOMPurify
to sanitize thewindow.location.href
before including it in the HTML string.
-
Copy modified line R5 -
Copy modified line R46
@@ -4,2 +4,3 @@ | ||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; | ||
import DOMPurify from 'dompurify'; | ||
|
||
@@ -44,3 +45,3 @@ | ||
<img src="${imagePath}"/> | ||
<script>history.pushState(null, null, "${window.location.href}");</script> | ||
<script>history.pushState(null, null, "${DOMPurify.sanitize(window.location.href)}");</script> | ||
</body>`; |
No description provided.