Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

use auth for non-bucket fallback

x0322051a4a50e7d690
diff --git a/frontend/src/hooks/api/pam/session-playback/decrypt.ts b/frontend/src/hooks/api/pam/session-playback/decrypt.ts
index b3b3d4b202..7a6918f1c3 100644
--- a/frontend/src/hooks/api/pam/session-playback/decrypt.ts
+++ b/frontend/src/hooks/api/pam/session-playback/decrypt.ts
@@ -11,6 +11,8 @@
//
// Any failure renders a placeholder for that chunk in the player UI
+import { apiRequest } from "@app/config/request";
+
import { TPamPlaybackChunk, TPamRecordingStorageBackend } from "./types";
const PAM_RECORDING_AAD_VERSION = "v1";
@@ -79,24 +81,24 @@ const fetchCiphertext = async (
chunk: TPamPlaybackChunk,
fallbackUrlBuilder: (chunkIndex: number) => string
): Promise<Uint8Array> => {
- const isExternal = Boolean(chunk.presignedGetUrl);
- const url = chunk.presignedGetUrl ?? fallbackUrlBuilder(chunk.chunkIndex);
- const resp = await fetch(url, { credentials: isExternal ? "omit" : "include" });
- if (!resp.ok) {
- if (isExternal && resp.status === 404) {
- throw new Error("Chunk data was not found in the external storage bucket.");
- }
- if (isExternal && resp.status === 403) {
- throw new Error("Access denied when fetching chunk from external storage bucket.");
+ if (chunk.presignedGetUrl) {
+ const resp = await fetch(chunk.presignedGetUrl, { credentials: "omit" });
+ if (!resp.ok) {
+ if (resp.status === 404) {
+ throw new Error("Chunk data was not found in the external storage bucket.");
+ }
+ if (resp.status === 403) {
+ throw new Error("Access denied when fetching chunk from external storage bucket.");
+ }
+ throw new Error(`Failed to fetch chunk from external storage bucket (HTTP ${resp.status})`);
}
- throw new Error(
- isExternal
- ? `Failed to fetch chunk from external storage bucket (HTTP ${resp.status})`
- : `Failed to fetch chunk from server (HTTP ${resp.status})`
- );
+ const buf = await resp.arrayBuffer();
+ return new Uint8Array(buf);
}
- const buf = await resp.arrayBuffer();
- return new Uint8Array(buf);
+
+ const url = fallbackUrlBuilder(chunk.chunkIndex);
+ const { data } = await apiRequest.get<ArrayBuffer>(url, { responseType: "arraybuffer" });
+ return new Uint8Array(data);
};
export type DecryptChunkInput = {