Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Better broken chunk debug
x0322054e429e2c143e
diff --git a/frontend/src/hooks/api/pam/session-playback/decrypt.ts b/frontend/src/hooks/api/pam/session-playback/decrypt.tsindex 59afa500db..b3b3d4b202 100644--- a/frontend/src/hooks/api/pam/session-playback/decrypt.ts+++ b/frontend/src/hooks/api/pam/session-playback/decrypt.ts@@ -79,10 +79,21 @@ 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: chunk.presignedGetUrl ? "omit" : "include" });+ const resp = await fetch(url, { credentials: isExternal ? "omit" : "include" });if (!resp.ok) {- throw new Error(`fetch failed: ${resp.status}`);+ 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.");+ }+ 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);diff --git a/frontend/src/hooks/api/pam/session-playback/queries.tsx b/frontend/src/hooks/api/pam/session-playback/queries.tsxindex 6e1a824576..b79862dd9d 100644--- a/frontend/src/hooks/api/pam/session-playback/queries.tsx+++ b/frontend/src/hooks/api/pam/session-playback/queries.tsx@@ -43,7 +43,7 @@ export type PlaybackDecryptState = {loading: boolean;error?: string;events: unknown[];- brokenChunks: { chunkIndex: number; reason: string; message: string }[];+ brokenChunks: TBrokenChunkMarker[];missingChunks: number[];totalChunks: number;};@@ -145,7 +145,7 @@ export const useDecryptedSessionLogs = (__brokenChunk: true,chunkIndex: i,reason: "missing",- message: "This chunk was not found in the recording"+ message: `Chunk ${i} was not found in the recording`};events.push(marker);brokenChunks.push(marker);@@ -163,6 +163,7 @@ export const useDecryptedSessionLogs = (events.push(...r.events);if (events.length > PAM_PLAYBACK_MAX_TOTAL_EVENTS) {brokenChunks.push({+ __brokenChunk: true,chunkIndex: r.chunkIndex,reason: "limit",message: `Total event count exceeds playback limit of ${PAM_PLAYBACK_MAX_TOTAL_EVENTS}; remaining chunks skipped`diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/CommandLogView.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/CommandLogView.tsxindex a9418e48f7..00c03c3d4f 100644--- a/frontend/src/pages/pam/PamSessionsByIDPage/components/CommandLogView.tsx+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/CommandLogView.tsx@@ -94,12 +94,9 @@ export const CommandLogView = ({ logs, scrollToLogIndex }: Props) => {return (<divkey={`broken-${log.chunkIndex}`}- className="flex items-center gap-2 rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-xs text-warning"+ className="rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-xs text-warning">- <span>- Chunk {log.chunkIndex} is unavailable ({log.reason}). Some log entries may be- missing here.- </span>+ Chunk {log.chunkIndex} unavailable: {log.message}</div>);}diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/HttpEventView.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/HttpEventView.tsxindex 9403159985..e46529018d 100644--- a/frontend/src/pages/pam/PamSessionsByIDPage/components/HttpEventView.tsx+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/HttpEventView.tsx@@ -181,12 +181,9 @@ export const HttpEventView = ({ events }: Props) => {return (<divkey={`broken-${event.chunkIndex}`}- className="flex items-center gap-2 rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-xs text-warning"+ className="rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-xs text-warning">- <span>- Chunk {event.chunkIndex} is unavailable ({event.reason}). Some events may be- missing here.- </span>+ Chunk {event.chunkIndex} unavailable: {event.message}</div>);}diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/TerminalEventView.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/TerminalEventView.tsxindex f290e8c811..76a0cd83dd 100644--- a/frontend/src/pages/pam/PamSessionsByIDPage/components/TerminalEventView.tsx+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/TerminalEventView.tsx@@ -55,12 +55,13 @@ export const TerminalEventView = ({ events }: Props) => {<div className="flex grow flex-col gap-2 overflow-y-auto text-xs">{markers.length > 0 && (- <div className="flex items-center gap-2 rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-xs text-warning">- <span>- {markers.length} chunk(s) unavailable (- {Array.from(new Set(markers.map((m) => m.reason))).join(", ")}). Some terminal output- may be missing.- </span>+ <div className="flex flex-col gap-1 rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-xs text-warning">+ <span>Some terminal output may be missing due to unavailable chunks.</span>+ {markers.map((m) => (+ <span key={m.chunkIndex} className="text-warning/70">+ Chunk {m.chunkIndex}: {m.message}+ </span>+ ))}</div>)}{filteredEvents.length > 0 ? (