-
Notifications
You must be signed in to change notification settings - Fork 0
Filter style fixes #23
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
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 14a7d27.
…/ag-grid-table-plugin
* Theme consolidation commit 1 * Components & Renderers styles * Table styles consolidation * Delete hook
* Theme consolidation commit 1 * Components & Renderers styles * Table styles consolidation * Delete hook * Styles * Feature flag
| const paragraphConfig = { rows: 1, width: 150 }; | ||
|
|
||
| const AnchorLink: FC<LinkProps> = ({ to, children }) => ( | ||
| <a href={to}>{children}</a> |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 5 months ago
To fix the issue, we need to ensure that the url value passed to the to prop of the AnchorLink component is properly sanitized or escaped to prevent XSS vulnerabilities. The best approach is to use a utility function to validate and sanitize the url before it is used. This function should ensure that the url is a valid and safe URL.
- Add a utility function,
sanitizeUrl, to validate and sanitize theurlvalue. This function can use theURLconstructor to parse and validate the URL. - Update the
AnchorLinkcomponent to sanitize thetoprop before using it in thehrefattribute. - Ensure that all instances where
urlis passed toAnchorLinkor similar components are sanitized.
-
Copy modified lines R137-R146 -
Copy modified line R148
| @@ -136,4 +136,14 @@ | ||
|
|
||
| const sanitizeUrl = (url: string): string => { | ||
| try { | ||
| const parsedUrl = new URL(url, window.location.origin); | ||
| return parsedUrl.href; | ||
| } catch (e) { | ||
| console.error('Invalid URL:', url); | ||
| return '#'; | ||
| } | ||
| }; | ||
|
|
||
| const AnchorLink: FC<LinkProps> = ({ to, children }) => ( | ||
| <a href={to}>{children}</a> | ||
| <a href={sanitizeUrl(to)}>{children}</a> | ||
| ); |
-
Copy modified line R20 -
Copy modified lines R28-R29
| @@ -19,2 +19,3 @@ | ||
| import { applicationRoot } from 'src/utils/getBootstrapData'; | ||
| import { sanitizeUrl } from 'src/utils/sanitizeUtils'; | ||
|
|
||
| @@ -26,3 +27,4 @@ | ||
| export function ensureAppRoot(path: string): string { | ||
| return `${applicationRoot()}${path.startsWith('/') ? path : `/${path}`}`; | ||
| const sanitizedPath = path.startsWith('/') ? path : `/${path}`; | ||
| return sanitizeUrl(`${applicationRoot()}${sanitizedPath}`); | ||
| } |
SUMMARY
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION