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(pki-sync): re-authorize host commands when their execution target changes
Carlos Monastyrski39412761c9ae
diff --git a/backend/src/services/pki-sync/pki-sync-service.ts b/backend/src/services/pki-sync/pki-sync-service.tsindex 969f8405e8..85b05288ec 100644--- a/backend/src/services/pki-sync/pki-sync-service.ts+++ b/backend/src/services/pki-sync/pki-sync-service.ts@@ -216,10 +216,12 @@ export const pkiSyncServiceFactory = ({currentCommand: unknown,pkiSync: { projectId: string; applicationId?: string | null; name: string },subscriberName: string | undefined,- actor: OrgServiceActor+ actor: OrgServiceActor,+ isExecutionTargetChanging: boolean) => {- if (nextCommand === currentCommand) return;- if (!nextCommand && !currentCommand) return;+ const isCommandChanging = nextCommand !== currentCommand && Boolean(nextCommand || currentCommand);+ const isCommandBeingRetargeted = Boolean(nextCommand) && isExecutionTargetChanging;+ if (!isCommandChanging && !isCommandBeingRetargeted) return;await $assertSyncAction(actions.project, actions.resource, pkiSync, subscriberName, actor);};@@ -242,9 +244,19 @@ export const pkiSyncServiceFactory = ({pkiSync: { projectId: string; applicationId?: string | null; name: string };subscriberName: string | undefined;actor: OrgServiceActor;+ isExecutionTargetChanging?: boolean;resolveConnection: () => Promise<{ gatewayId?: string | null; gatewayPoolId?: string | null } | undefined>;}) => {- const { destination, nextSyncOptions, storedSyncOptions, pkiSync, subscriberName, actor, resolveConnection } = args;+ const {+ destination,+ nextSyncOptions,+ storedSyncOptions,+ pkiSync,+ subscriberName,+ actor,+ isExecutionTargetChanging = false,+ resolveConnection+ } = args;await Promise.all(Object.entries(HOST_COMMAND_ACTIONS).map(([optionKey, actions]) =>@@ -254,7 +266,8 @@ export const pkiSyncServiceFactory = ({storedSyncOptions?.[optionKey],pkiSync,subscriberName,- actor+ actor,+ isExecutionTargetChanging)));@@ -578,6 +591,7 @@ export const pkiSyncServiceFactory = ({pkiSync,subscriberName: currentSubscriber?.name,actor,+ isExecutionTargetChanging: Boolean(effectiveConnection),resolveConnection: async () =>effectiveConnection ??appConnectionService.connectAppConnectionById(