-
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 18 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 done 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.
- Install the
validator
library if it is not already installed. - Import the
validator
library in the file. - Use the
isURL
method from thevalidator
library to check if thetokenLogoUrl
is a valid URL before setting it in the state. - Only render the
img
tag if thetokenLogoUrl
is a valid URL.
-
Copy modified line R22 -
Copy modified lines R327-R334 -
Copy modified line R337
@@ -21,2 +21,3 @@ | ||
import { FC, useRef, useState } from 'react'; | ||
import validator from 'validator'; | ||
import NumberFormat from 'react-number-format'; | ||
@@ -325,6 +326,13 @@ | ||
}} | ||
onChange={(e) => setTokenLogoUrl(e?.target?.value)} | ||
onChange={(e) => { | ||
const url = e?.target?.value; | ||
if (validator.isURL(url)) { | ||
setTokenLogoUrl(url); | ||
} else { | ||
setTokenLogoUrl(''); | ||
} | ||
}} | ||
placeholder="(Optional) https://orai.io" | ||
/> | ||
{tokenLogoUrl && <img src={tokenLogoUrl} alt="Logo" width={150} height={150} />} | ||
{tokenLogoUrl && validator.isURL(tokenLogoUrl) && <img src={tokenLogoUrl} alt="Logo" width={150} height={150} />} | ||
</div> |
-
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
…ndling, including allowance management and multiple asset support
…/oraiswap-frontend into feat/permissionless-todo
…kens for token selection and improve icon handling
…oken icon handling in WithdrawLiquidityModal
…inspection logic with address handling and balance retrieval
…token icon handling in modals
…r improved icon management in PoolV3
…ta retrieval for token inspection
No description provided.