-
Notifications
You must be signed in to change notification settings - Fork 20
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
Feat/permissionless todo #1058
base: main
Are you sure you want to change the base?
Feat/permissionless todo #1058
Conversation
…mon in various components
…ports for btcTokens
…hboard link in Sidebar
Deploying beta-oraidex with Cloudflare Pages
|
…ved consistency and usability
…, and update styles in NewTokenModal
onChange={(e) => setTokenLogoUrl(e?.target?.value)} | ||
placeholder="(Optional) https://orai.io" | ||
/> | ||
{tokenLogoUrl && <img src={tokenLogoUrl} alt="Logo" width={150} height={150}/>} |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 7 hours ago
To fix the problem, we need to ensure that the tokenLogoUrl
is properly sanitized before being used in the img
tag. This can be achieved by validating the URL to ensure it is a safe and well-formed URL. We can use a library like validator
to perform this validation.
- Import the
validator
library. - Use the
isURL
method from thevalidator
library to check if thetokenLogoUrl
is a valid URL. - Only set the
tokenLogoUrl
if it passes the validation.
-
Copy modified line R22 -
Copy modified lines R327-R335
@@ -21,2 +21,3 @@ | ||
import { FC, useRef, useState } from 'react'; | ||
import validator from 'validator'; | ||
import NumberFormat from 'react-number-format'; | ||
@@ -325,3 +326,11 @@ | ||
}} | ||
onChange={(e) => setTokenLogoUrl(e?.target?.value)} | ||
onChange={(e) => { | ||
const url = e?.target?.value; | ||
if (validator.isURL(url)) { | ||
setTokenLogoUrl(url); | ||
} else { | ||
setTokenLogoUrl(''); | ||
displayToast(TToastType.TOAST_ERROR, 'Invalid URL'); | ||
} | ||
}} | ||
placeholder="(Optional) https://orai.io" |
-
Copy modified lines R85-R86
@@ -84,3 +84,4 @@ | ||
"vite-tsconfig-paths": "^5.0.1", | ||
"@ton/crypto": "^3.3.0" | ||
"@ton/crypto": "^3.3.0", | ||
"validator": "^13.12.0" | ||
}, |
Package | Version | Security advisories |
validator (npm) | 13.12.0 | None |
…onality and styling, including search input integration and token logo handling
…n in SelectToken component
No description provided.