Skip to content

Commit 7292806

Browse files
Potential fix for pull request finding 'CodeQL / Insecure randomness'
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 3fe654a commit 7292806

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

apps/webapp/test/helpers/seedTestEnvironment.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import type { PrismaClient } from "@trigger.dev/database";
2+
import { randomBytes } from "crypto";
23

34
function randomHex(len = 12): string {
4-
return Math.random().toString(16).slice(2, 2 + len).padEnd(len, "0");
5+
return randomBytes(Math.ceil(len / 2)).toString("hex").slice(0, len);
56
}
67

78
export async function seedTestEnvironment(prisma: PrismaClient) {

0 commit comments

Comments
 (0)