Skip to content

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

misc: general improvements

Sheen Capadnganf7a9e1320920
diff --git a/backend/src/services/pki-subscriber/pki-subscriber-service.ts b/backend/src/services/pki-subscriber/pki-subscriber-service.ts
index 795371c763..5bedbd60cb 100644
--- a/backend/src/services/pki-subscriber/pki-subscriber-service.ts
+++ b/backend/src/services/pki-subscriber/pki-subscriber-service.ts
@@ -137,6 +137,15 @@ export const pkiSubscriberServiceFactory = ({
}
}
+ const ca = await certificateAuthorityDAL.findById(caId);
+ if (!ca) {
+ throw new NotFoundError({ message: `CA with ID '${caId}' not found` });
+ }
+
+ if (ca.projectId !== projectId) {
+ throw new BadRequestError({ message: "CA does not belong to the project" });
+ }
+
const newSubscriber = await pkiSubscriberDAL.create({
caId,
projectId,
@@ -245,6 +254,17 @@ export const pkiSubscriberServiceFactory = ({
}
}
+ if (caId) {
+ const ca = await certificateAuthorityDAL.findById(caId);
+ if (!ca) {
+ throw new NotFoundError({ message: `CA with ID '${caId}' not found` });
+ }
+
+ if (ca.projectId !== projectId) {
+ throw new BadRequestError({ message: "CA does not belong to the project" });
+ }
+ }
+
const updatedSubscriber = await pkiSubscriberDAL.updateById(subscriber.id, {
caId,
name,