-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add a form to allow panorama uploads to Pano #90
base: main
Are you sure you want to change the base?
Conversation
src={URL.createObjectURL( | ||
formSubmission.dropzoneImages.find( | ||
(file: File) => file.name === k, | ||
), | ||
)} |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 29 days ago
To fix the problem, we need to ensure that any data used in the DOM is properly sanitized or validated. Specifically, we should:
- Validate the file objects in
formSubmission.dropzoneImages
before using them withURL.createObjectURL
. - Ensure that URLs in the
possibleDuplicates
array are sanitized before being used in the DOM.
We can use a library like DOMPurify
to sanitize URLs and ensure that they do not contain any malicious content.
-
Copy modified line R2 -
Copy modified line R63 -
Copy modified line R65 -
Copy modified lines R98-R99
@@ -1,2 +1,3 @@ | ||
import * as React from "react"; | ||
import DOMPurify from "dompurify"; | ||
import Button from "@mui/material/Button"; | ||
@@ -61,5 +62,5 @@ | ||
src={URL.createObjectURL( | ||
formSubmission.dropzoneImages.find( | ||
DOMPurify.sanitize(formSubmission.dropzoneImages.find( | ||
(file: File) => file.name === k, | ||
), | ||
)), | ||
)} | ||
@@ -96,4 +97,4 @@ | ||
/> | ||
<a href={new URL(v).origin + new URL(v).pathname}> | ||
{new URL(v).origin + new URL(v).pathname} | ||
<a href={DOMPurify.sanitize(new URL(v).origin + new URL(v).pathname)}> | ||
{DOMPurify.sanitize(new URL(v).origin + new URL(v).pathname)} | ||
</a> |
-
Copy modified lines R36-R37
@@ -35,3 +35,4 @@ | ||
"typescript": "5.3.3", | ||
"zod": "^3.22.4" | ||
"zod": "^3.22.4", | ||
"dompurify": "^3.1.7" | ||
}, |
Package | Version | Security advisories |
dompurify (npm) | 3.1.7 | None |
Adding a form to allow panorama uploads to pano: https://github.com/willNilges/pano