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
fix(pam): fix TS narrowing for projectId in checkAndExpireSessionIfNeeded and lint fixes
bernie-gd0f87a5efd87
diff --git a/backend/src/ee/services/pam-session/pam-session-ai-summary-queue.ts b/backend/src/ee/services/pam-session/pam-session-ai-summary-queue.tsindex 7e6923a90e..3b0c918634 100644--- a/backend/src/ee/services/pam-session/pam-session-ai-summary-queue.ts+++ b/backend/src/ee/services/pam-session/pam-session-ai-summary-queue.ts@@ -151,7 +151,9 @@ export const pamSessionAiSummaryServiceFactory = ({type: KmsDataKey.SecretManager,projectId});- summaryConfig = JSON.parse(decryptor({ cipherTextBlob: encryptedConfig }).toString()) as TSessionSummaryConfig;+ summaryConfig = JSON.parse(+ decryptor({ cipherTextBlob: encryptedConfig }).toString()+ ) as TSessionSummaryConfig;} catch (err) {logger.error({ sessionId, err },@@ -220,7 +222,10 @@ export const pamSessionAiSummaryServiceFactory = ({while (hasMoreBatches && contentChars < MAX_LOG_CHARS) {// eslint-disable-next-line no-await-in-loop- const page = await pamSessionEventBatchDAL.findBySessionIdPaginated(sessionId, { offset, limit: PAGE_SIZE });+ const page = await pamSessionEventBatchDAL.findBySessionIdPaginated(sessionId, {+ offset,+ limit: PAGE_SIZE+ });if (page.length === 0) break;for (const batch of page) {const plain = decryptor({ cipherTextBlob: batch.encryptedEventsBlob });@@ -233,7 +238,7 @@ export const pamSessionAiSummaryServiceFactory = ({if (isSsh) {const termEvent = event as TTerminalEvent;if (termEvent.eventType === "input")- contentChars += termEvent.data ? Buffer.from(termEvent.data, "base64").length : 0;+ contentChars += termEvent.data ? Buffer.from(termEvent.data, "base64").length : 0;} else {const cmdLog = event as TPamSessionCommandLog;contentChars += (cmdLog.input?.length ?? 0) + (cmdLog.output?.length ?? 0);diff --git a/backend/src/ee/services/pam-session/pam-session-service.ts b/backend/src/ee/services/pam-session/pam-session-service.tsindex f1841963ef..a5920313e6 100644--- a/backend/src/ee/services/pam-session/pam-session-service.ts+++ b/backend/src/ee/services/pam-session/pam-session-service.ts@@ -73,10 +73,11 @@ export const pamSessionServiceFactory = ({if (isActive && isExpired) {const updated = await pamSessionDAL.expireSessionById(session.id);if (updated > 0) {- if (session.projectId) {+ const { projectId } = session;+ if (projectId) {void (async () => {try {- await pamSessionAiSummaryService.queueAiSummary(session.id, session.projectId);+ await pamSessionAiSummaryService.queueAiSummary(session.id, projectId);} catch (err) {logger.error({ sessionId: session.id, err },diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamSessionRecordingModal.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamSessionRecordingModal.tsxindex 9d9d6cc9e9..8f8b2375b5 100644--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamSessionRecordingModal.tsx+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamSessionRecordingModal.tsx@@ -258,7 +258,10 @@ export const PamSessionRecordingModal = ({ isOpen, onOpenChange, config, onSaveawait onSave(null);onOpenChange(false);} catch {- createNotification({ type: "error", text: "Failed to disable session recording" });+ createNotification({+ type: "error",+ text: "Failed to disable session recording"+ });}}}>diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/PamSessionByIDPage.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/PamSessionByIDPage.tsxindex c3afc2e1ad..f5506848d8 100644--- a/frontend/src/pages/pam/PamSessionsByIDPage/PamSessionByIDPage.tsx+++ b/frontend/src/pages/pam/PamSessionsByIDPage/PamSessionByIDPage.tsx@@ -33,7 +33,7 @@ const Page = () => {});const { data: session } = useGetPamSessionById(sessionId, {refetchInterval: (query) => {- const data = query.state.data;+ const { data } = query.state;if (!data) return false;if (data.aiInsightsStatus === "pending") return 3000;// Also poll briefly after a session ends to catch the null → pending transition,