mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(core): Use WebCrypto to generate all random numbers and strings (#9786)
This commit is contained in:
committed by
GitHub
parent
cfc4db00e3
commit
65c5609ab5
@@ -8,6 +8,7 @@ import type {
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { randomString } from 'n8n-workflow';
|
||||
|
||||
import * as mqtt from 'mqtt';
|
||||
import { formatPrivateKey } from '@utils/utilities';
|
||||
@@ -116,7 +117,7 @@ export class Mqtt implements INodeType {
|
||||
const brokerUrl = `${protocol}://${host}`;
|
||||
const port = (credentials.port as number) || 1883;
|
||||
const clientId =
|
||||
(credentials.clientId as string) || `mqttjs_${Math.random().toString(16).substr(2, 8)}`;
|
||||
(credentials.clientId as string) || `mqttjs_${randomString(8).toLowerCase()}`;
|
||||
const clean = credentials.clean as boolean;
|
||||
const ssl = credentials.ssl as boolean;
|
||||
const ca = formatPrivateKey(credentials.ca as string);
|
||||
@@ -189,8 +190,7 @@ export class Mqtt implements INodeType {
|
||||
const host = credentials.host as string;
|
||||
const brokerUrl = `${protocol}://${host}`;
|
||||
const port = (credentials.port as number) || 1883;
|
||||
const clientId =
|
||||
(credentials.clientId as string) || `mqttjs_${Math.random().toString(16).substr(2, 8)}`;
|
||||
const clientId = (credentials.clientId as string) || `mqttjs_${randomString(8).toLowerCase()}`;
|
||||
const clean = credentials.clean as boolean;
|
||||
const ssl = credentials.ssl as boolean;
|
||||
const ca = credentials.ca as string;
|
||||
|
||||
Reference in New Issue
Block a user