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

Rocky/web wallet #774

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Rocky/web wallet #774

wants to merge 3 commits into from

Conversation

tomiir
Copy link
Contributor

@tomiir tomiir commented Nov 18, 2024

No description provided.

Copy link

vercel bot commented Nov 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
appkit-react-ethersv5 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 6:38pm
appkit-react-wagmi-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 6:38pm
appkit-solana ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 6:38pm
smart-sessions-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 6:38pm
vue-web-examples ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 6:38pm
12 Skipped Deployments
Name Status Preview Comments Updated (UTC)
decentralized-relay-app ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 6:38pm
decentralized-relay-wallet ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 6:38pm
malicious-dapp-verify-simulation ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 6:38pm
react-auth-dapp ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 6:38pm
react-auth-wallet ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 6:38pm
react-dapp-v2 ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 6:38pm
react-dapp-v2-cosmos-provider ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 6:38pm
react-dapp-v2-with-ethers ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 6:38pm
react-dapp-v2-with-web3js ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 6:38pm
react-wallet-v2 ⬜️ Ignored (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 6:38pm
svelte-web3modal ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 6:38pm
vue-dapp-auth ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 6:38pm

Comment on lines +101 to +105
accounts: namespaceToUpdate.accounts.concat(
`${namespaceToUpdate.chains?.[0]}:${baseAddress}${Math.floor(
Math.random() * (9 - 1 + 1) + 0
)}`
) // generates random number between 0 and 9

Check failure

Code scanning / CodeQL

Insecure randomness High

This uses a cryptographically insecure random number generated at
Math.random()
in a security context.

Copilot Autofix AI 11 days ago

To fix the problem, we need to replace the use of Math.random() with a cryptographically secure random number generator. In the browser environment, we can use window.crypto.getRandomValues to generate a secure random number. This change will ensure that the generated account addresses are not predictable and thus more secure.

Suggested changeset 1
advanced/wallets/reown-web-wallet/src/pages/session.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/advanced/wallets/reown-web-wallet/src/pages/session.tsx b/advanced/wallets/reown-web-wallet/src/pages/session.tsx
--- a/advanced/wallets/reown-web-wallet/src/pages/session.tsx
+++ b/advanced/wallets/reown-web-wallet/src/pages/session.tsx
@@ -102,3 +102,3 @@
               `${namespaceToUpdate.chains?.[0]}:${baseAddress}${Math.floor(
-                Math.random() * (9 - 1 + 1) + 0
+                window.crypto.getRandomValues(new Uint32Array(1))[0] / (0xFFFFFFFF + 1) * (9 - 1 + 1) + 0
               )}`
EOF
@@ -102,3 +102,3 @@
`${namespaceToUpdate.chains?.[0]}:${baseAddress}${Math.floor(
Math.random() * (9 - 1 + 1) + 0
window.crypto.getRandomValues(new Uint32Array(1))[0] / (0xFFFFFFFF + 1) * (9 - 1 + 1) + 0
)}`
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
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