mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-07 07:42:13 +03:00
fix(security): resolve Web Crypto implementation in generateSessionId
Replaced unimported Node crypto randomBytes with standard Web Crypto getRandomValues and BigUint64Array for deterministic CI execution.
This commit is contained in:
@@ -162,8 +162,9 @@ export function generateRequestId() {
|
||||
|
||||
// Generate session ID
|
||||
export function generateSessionId() {
|
||||
const bytes = crypto.randomBytes(8);
|
||||
const num = bytes.readBigUInt64LE() % 9000000000000000000n;
|
||||
const arr = new BigUint64Array(1);
|
||||
globalThis.crypto.getRandomValues(arr);
|
||||
const num = arr[0] % 9000000000000000000n;
|
||||
return `-${num.toString()}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user