mirror of
https://github.com/community-scripts/ProxmoxVE-Local.git
synced 2026-04-24 20:25:50 +03:00
[PR #396] [MERGED] fix for code scanning alert no. 4: Insecure randomness #416
Labels
No labels
bug
enhancement
enhancement
feature
in progress
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ProxmoxVE-Local#416
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/community-scripts/ProxmoxVE-Local/pull/396
Author: @MickLesk
Created: 12/12/2025
Status: ✅ Merged
Merged: 12/12/2025
Merged by: @MickLesk
Base:
main← Head:alert-autofix-4📝 Commits (1)
a91986dfix for code scanning alert no. 4: Insecure randomness📊 Changes
1 file changed (+10 additions, -1 deletions)
View changed files
📝
src/app/_components/VersionDisplay.tsx(+10 -1)📄 Description
Potential fix for https://github.com/community-scripts/ProxmoxVE-Local/security/code-scanning/4
To fix the issue, we need to replace the insecure use of
Math.random()with a cryptographically secure random number generator. Since this code runs in the browser (it's a React component and there's no Node-only syntax), we should use the Web Crypto API'scrypto.getRandomValues. This can be used to generate secure random bytes and convert them to a random string for session ID use. Specifically, we can generate random bytes (or integers), encode them in base36 or hex, and splice that into the session ID in place of the current usage ofMath.random().toString(36).substr(2, 9). We should add a helper function within this file to handle secure random string generation, and update line 423 to use it. No new imports are necessary, as the globalcryptoobject is available in modern browsers.Suggested fixes powered by Copilot Autofix. Review carefully before merging.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.