Skip to content

Commit 24d326c

Browse files
committed
fix(security): replace Math.random() with crypto.randomUUID() for UI keys
1 parent 9edd571 commit 24d326c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Dashboard/frontend/src/components/ChatView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4196,7 +4196,7 @@ const allToolCalls = computed(() => {
41964196
// IMPORTANT: pass the original reference (no spread) so toggling
41974197
// tc.expanded in the template mutates the reactive source.
41984198
for (const c of streamCoolers.value) {
4199-
c._uid = c._uid || `cool-${Math.random()}`;
4199+
c._uid = c._uid || `cool-${crypto.randomUUID()}`;
42004200
order.push(c);
42014201
}
42024202
return order;
@@ -4853,7 +4853,7 @@ async function send() {
48534853
perSessionCoolers.set(streamingId, [...list]);
48544854
} else {
48554855
const cooler = {
4856-
_uid: `c-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
4856+
_uid: `c-${Date.now()}-${crypto.randomUUID().slice(0, 4)}`,
48574857
_key: key,
48584858
_isCooler: true,
48594859
tool: data.tool || "http",

0 commit comments

Comments
 (0)