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

@@ -2,13 +2,12 @@ import type { DataSourceOptions, Repository } from '@n8n/typeorm';
import { DataSource as Connection } from '@n8n/typeorm';
import { Container } from 'typedi';
import type { Class } from 'n8n-core';
import { randomString } from 'n8n-workflow';
import config from '@/config';
import * as Db from '@/Db';
import { getOptionOverrides } from '@db/config';
import { randomString } from './random';
export const testDbPrefix = 'n8n_test_';
/**
@@ -16,7 +15,7 @@ export const testDbPrefix = 'n8n_test_';
*/
export async function init() {
const dbType = config.getEnv('database.type');
const testDbName = `${testDbPrefix}${randomString(6, 10)}_${Date.now()}`;
const testDbName = `${testDbPrefix}${randomString(6, 10).toLowerCase()}_${Date.now()}`;
if (dbType === 'postgresdb') {
const bootstrapPostgres = await new Connection(