feat(ui): fix ssrf

This commit is contained in:
pedrooot committed 2026-07-06 12:35:29 +02:00
1 parent 464793cf72
commit 64fa8782d5
1 file changed
+8 -1
+8 -1
View File
@@ -339,8 +339,15 @@ export const getCrossProviderCompliancePdf = async (
taskId: string,
): Promise<ScanBinaryResult> => {
const headers = await getAuthHeaders({ contentType: false });
// ``taskId`` reaches the URL path, so constrain it to the task-id charset
// (UUIDs) before interpolating — this closes the SSRF vector of a value
// smuggling ``/``, ``..`` or a host into the request path.
const safeTaskId = taskId.trim();
if (!/^[A-Za-z0-9_-]+$/.test(safeTaskId)) {
return { error: "Invalid task identifier." };
}
const url = new URL(
`${apiBaseUrl}/cross-provider-compliance-overviews/generate-pdf/${taskId}/download`,
`${apiBaseUrl}/cross-provider-compliance-overviews/generate-pdf/${encodeURIComponent(safeTaskId)}/download`,
);
try {