Skip to content

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

Address greptile comments

Carlos Monastyrskic0060c1d220b
diff --git a/backend/src/db/migrations/20251121124532_add-issuer-type-to-certificate-profiles.ts b/backend/src/db/migrations/20251121124532_add-issuer-type-to-certificate-profiles.ts
index d718d5c979..61dcdb12ee 100644
--- a/backend/src/db/migrations/20251121124532_add-issuer-type-to-certificate-profiles.ts
+++ b/backend/src/db/migrations/20251121124532_add-issuer-type-to-certificate-profiles.ts
@@ -24,8 +24,4 @@ export async function down(knex: Knex): Promise<void> {
t.dropColumn("issuerType");
});
}
-
- await knex.schema.alterTable(TableName.PkiCertificateProfile, (t) => {
- t.uuid("caId").notNullable().alter();
- });
}
diff --git a/backend/src/services/certificate-profile/certificate-profile-service.ts b/backend/src/services/certificate-profile/certificate-profile-service.ts
index 0d36ab101d..0ce3ca9b63 100644
--- a/backend/src/services/certificate-profile/certificate-profile-service.ts
+++ b/backend/src/services/certificate-profile/certificate-profile-service.ts
@@ -415,9 +415,7 @@ export const certificateProfileServiceFactory = ({
validateIssuerTypeConstraints(finalIssuerType, finalEnrollmentType, finalCaId ?? null, existingProfile.caId);
const updatedData =
- finalIssuerType === IssuerType.SELF_SIGNED && existingProfile.caId && data.issuerType === IssuerType.SELF_SIGNED
- ? { ...data, caId: null }
- : data;
+ finalIssuerType === IssuerType.SELF_SIGNED && existingProfile.caId ? { ...data, caId: null } : data;
const { estConfig, apiConfig, ...profileUpdateData } = updatedData;
diff --git a/backend/src/services/certificate-v3/certificate-v3-service.test.ts b/backend/src/services/certificate-v3/certificate-v3-service.test.ts
index f4c23616e4..93291b0517 100644
--- a/backend/src/services/certificate-v3/certificate-v3-service.test.ts
+++ b/backend/src/services/certificate-v3/certificate-v3-service.test.ts
@@ -1792,7 +1792,7 @@ describe("CertificateV3Service", () => {
certificateId: "cert-123",
...mockActor
})
- ).rejects.toThrow("Only certificates issued from a profile or self-signed certificates can be renewed");
+ ).rejects.toThrow("Only certificates issued from a profile can be renewed");
});
it("should reject renewal if certificate was issued from CSR (external private key)", async () => {
diff --git a/backend/src/services/certificate-v3/certificate-v3-service.ts b/backend/src/services/certificate-v3/certificate-v3-service.ts
index 81e3129de8..b4bad0f769 100644
--- a/backend/src/services/certificate-v3/certificate-v3-service.ts
+++ b/backend/src/services/certificate-v3/certificate-v3-service.ts
@@ -1191,10 +1191,9 @@ export const certificateV3ServiceFactory = ({
throw new NotFoundError({ message: "Certificate not found" });
}
- const isSelfSigned = !originalCert.profileId && !originalCert.caId && originalCert.certificateTemplateId === null;
- if (!originalCert.profileId && !originalCert.caId && !isSelfSigned) {
+ if (!originalCert.profileId) {
throw new ForbiddenRequestError({
- message: "Only certificates issued from a profile or self-signed certificates can be renewed"
+ message: "Only certificates issued from a profile can be renewed"
});
}
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
index df2a15a7c6..60057d40eb 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
@@ -49,7 +49,7 @@ export const ProfileRow = ({
}: Props) => {
const { permission } = useProjectPermission();
- const { data: caData } = useGetCaById(profile.caId || "");
+ const { data: caData } = useGetCaById(profile.caId ?? "");
const { popUp, handlePopUpToggle } = usePopUp(["issueCertificate"] as const);