Security fix - insecure randomness (#3293)

This commit is contained in:
Mykyta Maliarchuk
2023-06-22 13:21:36 +02:00
committed by GitHub
parent 733ca86c0a
commit a5083816fa

View File

@@ -29,6 +29,7 @@ import * as path from 'path';
import * as fs from 'fs'; import * as fs from 'fs';
const StreamZip = require('node-stream-zip'); const StreamZip = require('node-stream-zip');
const crypto = require('crypto');
export async function typeText(element: ElementFinder, text: string): Promise<void> { export async function typeText(element: ElementFinder, text: string): Promise<void> {
await element.clear(); await element.clear();
@@ -82,7 +83,7 @@ export class Utils {
lighter track cinema tread tick climate lend summit singer radical flower visual negotiation promises cooperative live'; lighter track cinema tread tick climate lend summit singer radical flower visual negotiation promises cooperative live';
static random(): string { static random(): string {
return Math.random().toString(36).substring(5, 10).toLowerCase(); return crypto.getRandomValues(new Uint32Array(1))[0].toString(36).substring(0, 5).toLowerCase();
} }
static async clearLocalStorage(): Promise<void> { static async clearLocalStorage(): Promise<void> {