From 9269aac84dc9e4938a97011b00b4b32dcc1d57fd Mon Sep 17 00:00:00 2001 From: Giancarlo Cordero Ortiz <46171897+giancorderoortiz@users.noreply.github.com> Date: Tue, 15 Oct 2024 08:32:49 -0400 Subject: [PATCH] Fix code scanning alert no. 49: Insecure randomness Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- feature-libs/cart/base/core/facade/multi-cart.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/feature-libs/cart/base/core/facade/multi-cart.service.ts b/feature-libs/cart/base/core/facade/multi-cart.service.ts index b8f8ff00d46..7592a717dc6 100644 --- a/feature-libs/cart/base/core/facade/multi-cart.service.ts +++ b/feature-libs/cart/base/core/facade/multi-cart.service.ts @@ -85,7 +85,9 @@ export class MultiCartService implements MultiCartFacade { * Simple random temp cart id generator */ protected generateTempCartId(): string { - const pseudoUuid = Math.random().toString(36).substring(2, 11); + const array = new Uint32Array(1); + window.crypto.getRandomValues(array); + const pseudoUuid = array[0].toString(36).substring(2, 11); return `temp-${pseudoUuid}`; }