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
Client-side maximums on chunk
x03220508df21bc6121
diff --git a/frontend/src/hooks/api/pam/session-playback/decrypt.ts b/frontend/src/hooks/api/pam/session-playback/decrypt.tsindex d5f2bf1d59..59afa500db 100644--- a/frontend/src/hooks/api/pam/session-playback/decrypt.ts+++ b/frontend/src/hooks/api/pam/session-playback/decrypt.ts@@ -15,6 +15,11 @@ import { TPamPlaybackChunk, TPamRecordingStorageBackend } from "./types";const PAM_RECORDING_AAD_VERSION = "v1";+export const PAM_PLAYBACK_MAX_CHUNK_BYTES = 256 * 1024 * 1024;+export const PAM_PLAYBACK_MAX_EVENTS_PER_CHUNK = 50_000;+export const PAM_PLAYBACK_MAX_CHUNKS = 10_000;+export const PAM_PLAYBACK_MAX_TOTAL_EVENTS = 500_000;+const base64ToBytes = (b64: string): Uint8Array => {const bin = atob(b64);const out = new Uint8Array(bin.length);@@ -98,6 +103,15 @@ export const decryptOneChunk = async ({sessionId,fallbackUrlBuilder}: DecryptChunkInput): Promise<DecryptedChunkResult> => {+ if (chunk.ciphertextBytes > PAM_PLAYBACK_MAX_CHUNK_BYTES) {+ return {+ ok: false,+ chunkIndex: chunk.chunkIndex,+ reason: "size",+ message: `declared ciphertextBytes ${chunk.ciphertextBytes} exceeds limit ${PAM_PLAYBACK_MAX_CHUNK_BYTES}`+ };+ }+let body: Uint8Array;try {body = await fetchCiphertext(chunk, fallbackUrlBuilder);@@ -189,6 +203,14 @@ export const decryptOneChunk = async ({message: "plaintext is not a JSON array"};}+ if (parsed.length > PAM_PLAYBACK_MAX_EVENTS_PER_CHUNK) {+ return {+ ok: false,+ chunkIndex: chunk.chunkIndex,+ reason: "json",+ message: `chunk contains ${parsed.length} events, exceeds limit ${PAM_PLAYBACK_MAX_EVENTS_PER_CHUNK}`+ };+ }events = parsed;} catch (err) {return {diff --git a/frontend/src/hooks/api/pam/session-playback/queries.tsx b/frontend/src/hooks/api/pam/session-playback/queries.tsxindex 6ec5114c07..6e1a824576 100644--- a/frontend/src/hooks/api/pam/session-playback/queries.tsx+++ b/frontend/src/hooks/api/pam/session-playback/queries.tsx@@ -3,7 +3,13 @@ import { useQuery } from "@tanstack/react-query";import { apiRequest } from "@app/config/request";-import { decryptOneChunk, detectChunkGaps, importSessionKeyFromBase64 } from "./decrypt";+import {+ decryptOneChunk,+ detectChunkGaps,+ importSessionKeyFromBase64,+ PAM_PLAYBACK_MAX_CHUNKS,+ PAM_PLAYBACK_MAX_TOTAL_EVENTS+} from "./decrypt";import { TBrokenChunkMarker, TPamPlaybackBundle } from "./types";export const pamPlaybackKeys = {@@ -110,6 +116,18 @@ export const useDecryptedSessionLogs = (const projectId = bundle.projectId ?? "";const sortedChunks = [...bundle.chunks].sort((a, b) => a.chunkIndex - b.chunkIndex);++ if (sortedChunks.length > PAM_PLAYBACK_MAX_CHUNKS) {+ if (!cancelled) {+ setState((s) => ({+ ...s,+ loading: false,+ error: `Session has ${sortedChunks.length} chunks, exceeds playback limit of ${PAM_PLAYBACK_MAX_CHUNKS}`+ }));+ }+ return;+ }+const missingChunks = detectChunkGaps(sortedChunks);const missingSet = new Set(missingChunks);@@ -143,6 +161,14 @@ export const useDecryptedSessionLogs = (chunkIdx += 1;if (r.ok) {events.push(...r.events);+ if (events.length > PAM_PLAYBACK_MAX_TOTAL_EVENTS) {+ brokenChunks.push({+ chunkIndex: r.chunkIndex,+ reason: "limit",+ message: `Total event count exceeds playback limit of ${PAM_PLAYBACK_MAX_TOTAL_EVENTS}; remaining chunks skipped`+ });+ break;+ }} else {const marker: TBrokenChunkMarker = {__brokenChunk: true,