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
ensure adServerResourceId is in the same project as resource
x0322056f1eb81d538d
diff --git a/backend/src/ee/services/pam-resource/pam-resource-service.ts b/backend/src/ee/services/pam-resource/pam-resource-service.tsindex 8012d85526..30ef3094c0 100644--- a/backend/src/ee/services/pam-resource/pam-resource-service.ts+++ b/backend/src/ee/services/pam-resource/pam-resource-service.ts@@ -142,6 +142,15 @@ export const pamResourceServiceFactory = ({kmsService});+ if (adServerResourceId) {+ const adResource = await pamResourceDAL.findById(adServerResourceId);+ if (!adResource)+ throw new NotFoundError({ message: `AD Server resource with ID '${adServerResourceId}' not found` });+ if (adResource.projectId !== projectId) {+ throw new BadRequestError({ message: "AD Server resource must belong to the same project" });+ }+ }+let encryptedRotationAccountCredentials: Buffer | null = null;if (rotationAccountCredentials) {@@ -214,6 +223,14 @@ export const pamResourceServiceFactory = ({}if (adServerResourceId !== undefined) {+ if (adServerResourceId) {+ const adResource = await pamResourceDAL.findById(adServerResourceId);+ if (!adResource)+ throw new NotFoundError({ message: `AD Server resource with ID '${adServerResourceId}' not found` });+ if (adResource.projectId !== resource.projectId) {+ throw new BadRequestError({ message: "AD Server resource must belong to the same project" });+ }+ }updateDoc.adServerResourceId = adServerResourceId;}