Skip to content

Commit 7b838d3

Browse files
committed
fix: replace Math.random() with crypto.getRandomValues() for secure session ID generation
1 parent 5fbb743 commit 7b838d3

File tree

1 file changed

+4
-1
lines changed
  • src/integrations/claude-code

1 file changed

+4
-1
lines changed

src/integrations/claude-code/run.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ function runProcess({ systemPrompt, messages, path, modelId }: ClaudeCodeOptions
124124
role: "user",
125125
content: prompt,
126126
},
127-
session_id: `roo-${Date.now()}-${Math.random().toString(36).substring(7)}`,
127+
session_id: `roo-${Date.now()}-${Array.from(crypto.getRandomValues(new Uint8Array(4)))
128+
.map((b) => b.toString(36))
129+
.join("")
130+
.substring(0, 7)}`,
128131
}
129132

130133
let actualClaudePath = claudePath

0 commit comments

Comments
 (0)