Closed
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| function uiConsole(...args: any): void { | ||
| const el = document.querySelector("#console>p"); | ||
| if (el) { | ||
| el.innerHTML = JSON.stringify(args || {}, null, 2); |
Check warning
Code scanning / CodeQL
Exception text reinterpreted as HTML
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 year ago
To fix the problem, we need to ensure that any user-controlled input is properly escaped before being written to the HTML. This can be achieved by using a library like DOMPurify to sanitize the input or by manually escaping HTML meta-characters.
The best way to fix the problem without changing existing functionality is to use DOMPurify to sanitize the input before setting it to the innerHTML property. This approach ensures that any potentially harmful content is removed, preventing XSS attacks.
Suggested changeset
2
mpc-core-kit-web/mpc-core-kit-bitcoin-taproot/src/App.tsx
| @@ -21,2 +21,3 @@ | ||
| import { Loading, BlurredLoading } from "./Loading"; | ||
| import DOMPurify from 'dompurify'; | ||
|
|
||
| @@ -300,3 +301,3 @@ | ||
| if (el) { | ||
| el.innerHTML = JSON.stringify(args || {}, null, 2); | ||
| el.innerHTML = DOMPurify.sanitize(JSON.stringify(args || {}, null, 2)); | ||
| } |
mpc-core-kit-web/mpc-core-kit-bitcoin-taproot/package.json
Outside changed files
| @@ -29,3 +29,4 @@ | ||
| "vite": "^5.4.8", | ||
| "web3": "^4.13.0" | ||
| "web3": "^4.13.0", | ||
| "dompurify": "^3.2.4" | ||
| }, |
This fix introduces these dependencies
| Package | Version | Security advisories |
| dompurify (npm) | 3.2.4 | None |
Copilot is powered by AI and may make mistakes. Always verify output.
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Jira Link: https://toruslabs.atlassian.net/jira/software/projects/DEVREL/boards/15?selectedIssue=DEVREL-1142
Description
How has this been tested?
Screenshots (if appropriate):
Types of changes
Checklist: