From 63a8862e28ceabcd28d7ed0b3a8f6a47d3328c31 Mon Sep 17 00:00:00 2001 From: Ushran Gouhar <43915259+ugouhar@users.noreply.github.com> Date: Wed, 15 Oct 2025 00:17:18 +0530 Subject: [PATCH] fix(ui): code scanning alert no. 1681: Insecure randomness #23886 (#23886) --- openmetadata-ui/src/main/resources/ui/src/utils/StringsUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/StringsUtils.ts b/openmetadata-ui/src/main/resources/ui/src/utils/StringsUtils.ts index e32edd9de71..0df3602c1b6 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/StringsUtils.ts +++ b/openmetadata-ui/src/main/resources/ui/src/utils/StringsUtils.ts @@ -258,7 +258,7 @@ export const formatJsonString = (jsonString: string, indent = '') => { export const replaceCallback = (character: string) => { // Generate a random number between 0 and 15 - const randomNumber = (Math.random() * 16) | 0; + const randomNumber = crypto.getRandomValues(new Uint8Array(1))[0] & 0xf; // If the character in the UUID template is 'x', use the random number. // Otherwise, use the random number ANDed with 0x3 (which gives a number between 0 and 3) ORed with 0x8