-
Notifications
You must be signed in to change notification settings - Fork 619
v2.22.0 #1757
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
v2.22.0 #1757
Conversation
| <img | ||
| alt="print img" | ||
| ref={imageRef} | ||
| src={image.src} |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 8 months ago
To fix the issue, we need to sanitize or validate the e.target.value input before it is assigned to widgetValue and subsequently used in the DOM. A good approach is to use a library like DOMPurify to sanitize the input or validate the input to ensure it is a safe URL. This ensures that any potentially harmful content is removed before rendering.
The changes will involve:
- Importing
DOMPurifyfor sanitization. - Sanitizing
e.target.valuein thehandleOnchangeTextBoxfunction before assigning it towidgetValue.
-
Copy modified line R2 -
Copy modified lines R934-R935 -
Copy modified line R937
| @@ -1,2 +1,3 @@ | ||
| import React, { forwardRef, useEffect, useRef, useState } from "react"; | ||
| import DOMPurify from "dompurify"; | ||
| import ModalUi from "../../primitives/ModalUi"; | ||
| @@ -932,5 +933,6 @@ | ||
| setIsShowValidation(false); | ||
| setWidgetValue(e.target.value); | ||
| const sanitizedValue = DOMPurify.sanitize(e.target.value); | ||
| setWidgetValue(sanitizedValue); | ||
| onChangeInput( | ||
| e.target.value, | ||
| sanitizedValue, | ||
| currWidgetsDetails?.key, |
-
Copy modified lines R55-R56
| @@ -54,3 +54,4 @@ | ||
| "web-vitals": "^5.0.1", | ||
| "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz" | ||
| "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz", | ||
| "dompurify": "^3.2.6" | ||
| }, |
| Package | Version | Security advisories |
| dompurify (npm) | 3.2.6 | None |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
No description provided.