fix(voice-call): add timeout to guardedJsonApiRequest (#102884)

* fix(voice-call): add timeout to guardedJsonApiRequest

* fix(voice-call): bound provider JSON requests

---------

Co-authored-by: chengzhichao-xydt <chengzhichao-xydt@users.noreply.github.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
chengzhichao-xydt
2026-07-10 14:05:24 +08:00
committed by GitHub
parent 54009c15bb
commit 5b916cb319
2 changed files with 4 additions and 0 deletions

View File

@@ -66,6 +66,7 @@ describe("guardedJsonApiRequest", () => {
},
policy: { allowedHostnames: ["api.example.com"] },
auditContext: "voice-call:test",
timeoutMs: 30_000,
});
expect(release).toHaveBeenCalledTimes(1);
});

View File

@@ -8,6 +8,8 @@ import {
// Shared guarded JSON API client for voice-call providers.
const VOICE_CALL_PROVIDER_API_TIMEOUT_MS = 30_000;
/** Parameters for an SSRF-guarded provider JSON request. */
type GuardedJsonApiRequestParams = {
url: string;
@@ -33,6 +35,7 @@ export async function guardedJsonApiRequest<T = unknown>(
},
policy: { allowedHostnames: params.allowedHostnames },
auditContext: params.auditContext,
timeoutMs: VOICE_CALL_PROVIDER_API_TIMEOUT_MS,
});
try {