Skip to content
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

Draft
wants to merge 15 commits into
base: v15/dev
Choose a base branch
from

Conversation

madsrasmussen
Copy link
Contributor

No description provided.

</body>`;

popup.document.open();
popup.document.write(html);

Check failure

Code scanning / CodeQL

Client-side cross-site scripting High

Cross-site scripting vulnerability due to
user-provided value
.

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.

  1. Install the DOMPurify library.
  2. Import DOMPurify in the file.
  3. Use DOMPurify to sanitize the window.location.href before including it in the HTML string.
Suggested changeset 1
src/Umbraco.Web.UI.Client/src/packages/media/media/url/info-app/media-links-workspace-info-app.element.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/url/info-app/media-links-workspace-info-app.element.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/url/info-app/media-links-workspace-info-app.element.ts
--- a/src/Umbraco.Web.UI.Client/src/packages/media/media/url/info-app/media-links-workspace-info-app.element.ts
+++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/url/info-app/media-links-workspace-info-app.element.ts
@@ -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>`;
EOF
@@ -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>`;
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant