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:
diegosouzapw
2026-04-08 01:45:28 -03:00
parent c04a7af39a
commit 39eb5a50ab

View File

@@ -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()}`;
}