feat(core): Use WebCrypto to generate all random numbers and strings (#9786)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-06-19 13:33:57 +02:00
committed by GitHub
parent cfc4db00e3
commit 65c5609ab5
49 changed files with 254 additions and 214 deletions

View File

@@ -7,7 +7,7 @@ import type {
INodeExecutionData,
GenericValue,
} from 'n8n-workflow';
import { ApplicationError, NodeOperationError } from 'n8n-workflow';
import { ApplicationError, NodeOperationError, randomInt } from 'n8n-workflow';
import get from 'lodash/get';
import isEqual from 'lodash/isEqual';
@@ -47,7 +47,7 @@ export const flattenKeys = (obj: IDataObject, path: string[] = []): IDataObject
export const shuffleArray = (array: any[]) => {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const j = randomInt(i + 1);
[array[i], array[j]] = [array[j], array[i]];
}
};