Skip to content

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

Fix authorization check in certificate renewal path

bernie-g7bed3acd0ae5
diff --git a/backend/src/services/certificate-v3/certificate-v3-service.ts b/backend/src/services/certificate-v3/certificate-v3-service.ts
index db6fcbea08..568ade7598 100644
--- a/backend/src/services/certificate-v3/certificate-v3-service.ts
+++ b/backend/src/services/certificate-v3/certificate-v3-service.ts
@@ -2333,18 +2333,19 @@ export const certificateV3ServiceFactory = ({
const projectId = profile?.projectId || originalCert.projectId;
if (originalCert.applicationId) {
- const { permission } = await permissionService.getResourcePermission({
- actor,
- actorId,
- projectId,
- resourceType: ResourceType.CertificateApplication,
- resourceId: originalCert.applicationId,
- actorAuthMethod,
- actorOrgId
- });
- ForbiddenError.from(permission).throwUnlessCan(
- ResourcePermissionCertificateActions.Create,
- ResourcePermissionSub.Certificates
+ if (!profile) {
+ throw new NotFoundError({ message: "Certificate profile not found" });
+ }
+ await $resolveApplicationIdForProfile(
+ profile,
+ originalCert.applicationId,
+ {
+ actor,
+ actorId,
+ actorAuthMethod,
+ actorOrgId
+ },
+ EnrollmentType.API
);
} else if (profile) {
const { permission } = await permissionService.getProjectPermission({