Skip to content

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

fix(pam): use raw table name in AD migration, type session playback events

bernie-gfb6209dd7a67
diff --git a/backend/src/db/migrations/20260603030053_pam-revamp.ts b/backend/src/db/migrations/20260603030053_pam-revamp.ts
index 6eb6a5fbd9..7f924c8ad9 100644
--- a/backend/src/db/migrations/20260603030053_pam-revamp.ts
+++ b/backend/src/db/migrations/20260603030053_pam-revamp.ts
@@ -187,7 +187,7 @@ export async function up(knex: Knex): Promise<void> {
for (const t of templates) {
templateMap[t.type] = t.id;
}
- await knex(TableName.PamAccount).where("accountType", "active-directory").update({ accountType: "windows" });
+ await knex("pam_accounts").where("accountType", "active-directory").update({ accountType: "windows" });
const oldPamProjects = await knex(TableName.Project)
.where({ orgId, type: ProjectType.PAM })
diff --git a/frontend/src/hooks/api/pam/session-playback/queries.tsx b/frontend/src/hooks/api/pam/session-playback/queries.tsx
index f69ba748f5..3e1ee1b95b 100644
--- a/frontend/src/hooks/api/pam/session-playback/queries.tsx
+++ b/frontend/src/hooks/api/pam/session-playback/queries.tsx
@@ -10,6 +10,7 @@ import {
PAM_PLAYBACK_MAX_CHUNKS,
PAM_PLAYBACK_MAX_TOTAL_EVENTS
} from "./decrypt";
+import { TSessionEvent } from "../types";
import { TBrokenChunkMarker, TPamSessionPlayback } from "./types";
export const pamPlaybackKeys = {
@@ -40,13 +41,13 @@ export const useGetPamSessionPlayback = (sessionId: string, enabled = true, isAc
export type DecryptedChunkRecord = {
chunkIndex: number;
- events: unknown[];
+ events: (TSessionEvent | TBrokenChunkMarker)[];
};
export type PlaybackDecryptState = {
loading: boolean;
error?: string;
- events: unknown[];
+ events: (TSessionEvent | TBrokenChunkMarker)[];
brokenChunks: TBrokenChunkMarker[];
missingChunks: number[];
totalChunks: number;
@@ -202,7 +203,7 @@ export const useDecryptedSessionLogs = (
setState({
loading: isActive && !playback.sessionComplete,
- events: orderedEvents,
+ events: orderedEvents as (TSessionEvent | TBrokenChunkMarker)[],
brokenChunks: [...accBrokenRef.current],
missingChunks,
totalChunks: sortedChunks.length,
@@ -211,7 +212,7 @@ export const useDecryptedSessionLogs = (
} else {
// Full path: decrypt all chunks with gap markers (completed sessions)
const missingSet = new Set(missingChunks);
- const events: unknown[] = [];
+ const events: (TSessionEvent | TBrokenChunkMarker)[] = [];
const brokenChunks: PlaybackDecryptState["brokenChunks"] = [];
let chunkIdx = 0;
@@ -247,7 +248,7 @@ export const useDecryptedSessionLogs = (
});
chunkIdx += 1;
if (r.ok) {
- events.push(...r.events);
+ events.push(...(r.events as TSessionEvent[]));
if (events.length > PAM_PLAYBACK_MAX_TOTAL_EVENTS) {
brokenChunks.push({
__brokenChunk: true,
diff --git a/frontend/src/pages/pam/PamSessionsPage/components/SessionDetailSheet.tsx b/frontend/src/pages/pam/PamSessionsPage/components/SessionDetailSheet.tsx
index be86662cbc..49ad34d453 100644
--- a/frontend/src/pages/pam/PamSessionsPage/components/SessionDetailSheet.tsx
+++ b/frontend/src/pages/pam/PamSessionsPage/components/SessionDetailSheet.tsx
@@ -38,7 +38,7 @@ import {
import { usePamAccountPermission } from "@app/hooks/api/pam/queries";
import { useDecryptedSessionLogs } from "@app/hooks/api/pam/session-playback/queries";
import { isBrokenChunkMarker } from "@app/hooks/api/pam/session-playback/types";
-import { TPamSession, TPamSessionLog } from "@app/hooks/api/pam/types";
+import { TPamSession, TPamSessionLog, TSessionEvent } from "@app/hooks/api/pam/types";
const RdpReplayView = lazy(() => import("./RdpReplayView/RdpReplayView"));
@@ -320,7 +320,7 @@ export const SessionDetailSheet = ({ sessionId, isOpen, onOpenChange, onTerminat
}
>
<RdpReplayView
- events={filteredEvents.filter((e) => !isBrokenChunkMarker(e))}
+ events={filteredEvents.filter((e): e is TSessionEvent => !isBrokenChunkMarker(e))}
isStreaming={isActive}
/>
</Suspense>