Skip to content

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

fix(pam): validate app connection is Anthropic type when saving AI session summary config

bernie-g326fdbec4f4e
diff --git a/backend/src/ee/services/pam-resource/pam-resource-service.ts b/backend/src/ee/services/pam-resource/pam-resource-service.ts
index 00f7e2768f..6369e236e5 100644
--- a/backend/src/ee/services/pam-resource/pam-resource-service.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-service.ts
@@ -16,6 +16,7 @@ import { OrgServiceActor, TProjectPermission } from "@app/lib/types";
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
import { KmsDataKey } from "@app/services/kms/kms-types";
import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import { TResourceMetadataDALFactory } from "@app/services/resource-metadata/resource-metadata-dal";
import { TGatewayV2ServiceFactory } from "../gateway-v2/gateway-v2-service";
@@ -404,6 +405,9 @@ export const pamResourceServiceFactory = ({
if (appConnection.orgId !== actor.orgId) {
throw new BadRequestError({ message: "App connection does not belong to the same organization as the resource" });
}
+ if (appConnection.app !== AppConnection.Anthropic) {
+ throw new BadRequestError({ message: `App connection must be an Anthropic connection, got '${appConnection.app}'` });
+ }
const { encryptor } = await kmsService.createCipherPairWithDataKey({
type: KmsDataKey.SecretManager,