Skip to content
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

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open

Feat/permissionless todo #1058

wants to merge 33 commits into from

Conversation

trungbach
Copy link
Contributor

No description provided.

trungbach and others added 20 commits December 1, 2024 15:52
Copy link

cloudflare-workers-and-pages bot commented Dec 5, 2024

Deploying beta-oraidex with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0dbfc4f
Status: ✅  Deploy successful!
Preview URL: https://797484e5.beta-oraidex.pages.dev
Branch Preview URL: https://develop-v3.beta-oraidex.pages.dev

View logs

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
is reinterpreted as HTML without escaping meta-characters.

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.

  1. Install the validator library if it is not already installed.
  2. Import the validator library in the file.
  3. Use the isURL method from the validator library to check if the tokenLogoUrl is a valid URL before setting it in the state.
  4. Only render the img tag if the tokenLogoUrl is a valid URL.
Suggested changeset 2
src/pages/Pools/NewTokenModal/NewTokenModal.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/pages/Pools/NewTokenModal/NewTokenModal.tsx b/src/pages/Pools/NewTokenModal/NewTokenModal.tsx
--- a/src/pages/Pools/NewTokenModal/NewTokenModal.tsx
+++ b/src/pages/Pools/NewTokenModal/NewTokenModal.tsx
@@ -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>
EOF
@@ -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>
package.json
Outside changed files

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/package.json b/package.json
--- a/package.json
+++ b/package.json
@@ -84,3 +84,4 @@
     "vite-tsconfig-paths": "^5.0.1",
-    "@ton/crypto": "^3.3.0"
+    "@ton/crypto": "^3.3.0",
+    "validator": "^13.12.0"
   },
EOF
@@ -84,3 +84,4 @@
"vite-tsconfig-paths": "^5.0.1",
"@ton/crypto": "^3.3.0"
"@ton/crypto": "^3.3.0",
"validator": "^13.12.0"
},
This fix introduces these dependencies
Package Version Security advisories
validator (npm) 13.12.0 None
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
vuonghuuhung and others added 5 commits December 13, 2024 11:29
…onality and styling, including search input integration and token logo handling
…ndling, including allowance management and multiple asset support
…kens for token selection and improve icon handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants