Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
update mpc remote signer for sms
| 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 Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 year ago
To fix the problem, we need to ensure that any untrusted data written to the HTML is properly sanitized or escaped to prevent XSS attacks. The best way to fix this issue is to use a library like DOMPurify to sanitize the HTML content before writing it to the DOM. This will ensure that any potentially dangerous characters are neutralized.
- Install the
dompurifylibrary. - Import the
dompurifylibrary in the file. - Use
DOMPurify.sanitizeto sanitize the content before setting it toinnerHTML.
Suggested changeset
2
mpc-core-kit-web/quick-starts/mpc-core-kit-react-remote-sign/src/App.tsx
| @@ -3,2 +3,3 @@ | ||
| import "./App.css"; | ||
| import DOMPurify from 'dompurify'; | ||
| import { tssLib as dklsLib } from "@toruslabs/tss-dkls-lib"; | ||
| @@ -445,3 +446,3 @@ | ||
| if (el) { | ||
| el.innerHTML = JSON.stringify(args || {}, null, 2); | ||
| el.innerHTML = DOMPurify.sanitize(JSON.stringify(args || {}, null, 2)); | ||
| } |
mpc-core-kit-web/quick-starts/mpc-core-kit-react-remote-sign/package.json
Outside changed files
| @@ -32,3 +32,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.
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:
Description
How has this been tested?
Screenshots (if appropriate):
Types of changes
Checklist: