mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-01 21:02:12 +03:00
fix(security): replace Math.random with crypto.randomUUID in generateTaskId/ActivityId and fix URL hostname check in test (#2461) (#2489)
Co-authored-by: diegosouzapw <diego.souza.pw@gmail.com>
This commit is contained in:
committed by
GitHub
parent
4f70ef3d2a
commit
0ade48bd04
@@ -86,10 +86,10 @@ export abstract class CloudAgentBase {
|
||||
}
|
||||
|
||||
protected generateTaskId(): string {
|
||||
return `task_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
||||
return `task_${Date.now()}_${crypto.randomUUID().replace(/-/g, "").substring(0, 9)}`;
|
||||
}
|
||||
|
||||
protected generateActivityId(): string {
|
||||
return `act_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
||||
return `act_${Date.now()}_${crypto.randomUUID().replace(/-/g, "").substring(0, 9)}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ describe("ensureAntigravityProjectAssigned", () => {
|
||||
|
||||
const mockFetch = async (url: string, _init?: RequestInit): Promise<Response> => {
|
||||
hitUrls.push(url);
|
||||
if (url.includes("daily-cloudcode-pa.googleapis.com")) {
|
||||
if (new URL(url).hostname === "daily-cloudcode-pa.googleapis.com") {
|
||||
// First URL fails
|
||||
return new Response("not found", { status: 404 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user