-
Notifications
You must be signed in to change notification settings - Fork 356
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
base: main
Are you sure you want to change the base?
Rocky/web wallet #774
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
12 Skipped Deployments
|
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
Math.random()
Show autofix suggestion
Hide autofix suggestion
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.
-
Copy modified line R103
@@ -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 | ||
)}` |
No description provided.