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
address reviews and remove test from discovery
x9f6c8eeb380e
diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.tsindex 9e001ca7e5..4a716bf69f 100644--- a/backend/src/ee/services/pam-account/pam-account-service.ts+++ b/backend/src/ee/services/pam-account/pam-account-service.ts@@ -337,6 +337,7 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>gatewayPoolId,recordingConnectionId,settingsOverrides,+ skipConnectionTest,...ctx}: TCreatePamAccountDTO & TActorContext) => {const { permission } = await checkFolder(folderId, projectId, ctx);@@ -380,12 +381,15 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>const validatedCredentials = validateCredentials(accountType, credentials);assertPasswordMeetsRequirements(validatedCredentials, template.settings);- await assertConnectionOk(accountType, validatedConnectionDetails, validatedCredentials, {- gatewayId,- gatewayPoolId,- templateGatewayId: template.gatewayId,- templateGatewayPoolId: template.gatewayPoolId- });+ // discovery import creates accounts in bulk from a scan that already reached them, so it skips the test+ if (!skipConnectionTest) {+ await assertConnectionOk(accountType, validatedConnectionDetails, validatedCredentials, {+ gatewayId,+ gatewayPoolId,+ templateGatewayId: template.gatewayId,+ templateGatewayPoolId: template.gatewayPoolId+ });+ }const encryptedConnectionDetails = await encrypt(projectId, validatedConnectionDetails);const encryptedCredentials = await encrypt(projectId, validatedCredentials);@@ -592,12 +596,10 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>const effectiveConnectionDetails = connectionDetails? validateConnectionDetails(accountType, connectionDetails): validateConnectionDetails(accountType, await decrypt(projectId, existing.encryptedConnectionDetails));- const existingCredentials = await decrypt(projectId, existing.encryptedCredentials);- const effectiveCredentials = validateCredentials(- accountType,- credentials ? { ...existingCredentials, ...credentials } : existingCredentials- );- await assertConnectionOk(accountType, effectiveConnectionDetails, effectiveCredentials, {++ // only test with credentials supplied in this request to prevent exfiltration+ const testCredentials = credentials ? validateCredentials(accountType, credentials) : {};+ await assertConnectionOk(accountType, effectiveConnectionDetails, testCredentials, {gatewayId: gatewayId !== undefined ? gatewayId : existing.gatewayId,gatewayPoolId: gatewayPoolId !== undefined ? gatewayPoolId : existing.gatewayPoolId,templateGatewayId: template ? template.gatewayId : existing.templateGatewayId,diff --git a/backend/src/ee/services/pam-account/pam-account-types.ts b/backend/src/ee/services/pam-account/pam-account-types.tsindex 9e1c1ea446..c3a3a5e660 100644--- a/backend/src/ee/services/pam-account/pam-account-types.ts+++ b/backend/src/ee/services/pam-account/pam-account-types.ts@@ -14,6 +14,7 @@ export type TCreatePamAccountDTO = {gatewayPoolId?: string;recordingConnectionId?: string;settingsOverrides?: TPamAccountSettingsOverrides | null;+ skipConnectionTest?: boolean;};export type TUpdatePamAccountDTO = {diff --git a/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts b/backend/src/ee/services/pam-discovery/pam-discovery-source-service.tsindex bcd22e8d85..bec39fe08b 100644--- a/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts+++ b/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts@@ -598,6 +598,8 @@ export const pamDiscoverySourceServiceFactory = (deps: TPamDiscoverySourceServictemplateId: item.templateId,connectionDetails: details.connectionDetails,credentials: details.credentials,+ // the scan already reached these accounts; skip the per-account connection test+ skipConnectionTest: true,...ctx});