Skip to content

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

Merge remote-tracking branch 'origin/main' into feat/PKI-55

Carlos Monastyrskic26880c3b634
diff --cc backend/src/queue/queue-service.ts
index a7ed3a1709,57409d173b..f922918f97
--- a/backend/src/queue/queue-service.ts
+++ b/backend/src/queue/queue-service.ts
@@@ -61,9 -61,9 +61,10 @@@ export enum QueueName
SecretPushEventScan = "secret-push-event-scan",
UpgradeProjectToGhost = "upgrade-project-to-ghost",
DynamicSecretRevocation = "dynamic-secret-revocation",
+ DynamicSecretLeaseRevocationFailedEmail = "dynamic-secret-lease-revocation-failed-email",
CaCrlRotation = "ca-crl-rotation",
CaLifecycle = "ca-lifecycle", // parent queue to ca-order-certificate-for-subscriber
+ CertificateIssuance = "certificate-issuance",
SecretReplication = "secret-replication",
SecretSync = "secret-sync", // parent queue to push integration sync, webhook, and secret replication
PkiSync = "pki-sync",
diff --cc backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts
index 2e1eafbbe9,bfd3d45f61..b48b1076f4
--- a/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts
+++ b/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts
@@@ -45,62 -44,9 +46,63 @@@ import
TUpdateAcmeCertificateAuthorityDTO
} from "./acme-certificate-authority-types";
import { cloudflareDeleteTxtRecord, cloudflareInsertTxtRecord } from "./dns-providers/cloudflare";
+ import { dnsMadeEasyDeleteTxtRecord, dnsMadeEasyInsertTxtRecord } from "./dns-providers/dns-made-easy";
import { route53DeleteTxtRecord, route53InsertTxtRecord } from "./dns-providers/route54";
+const parseTtlToDays = (ttl: string): number => {
+ const match = ttl.match(new RE2("^(\\d+)([dhm])$"));
+ if (!match) {
+ throw new BadRequestError({ message: `Invalid TTL format: ${ttl}` });
+ }
+
+ const [, value, unit] = match;
+ const num = parseInt(value, 10);
+
+ switch (unit) {
+ case "d":
+ return num;
+ case "h":
+ return Math.ceil(num / 24);
+ case "m":
+ return Math.ceil(num / (24 * 60));
+ default:
+ throw new BadRequestError({ message: `Invalid TTL unit: ${unit}` });
+ }
+};
+
+const calculateRenewalThreshold = (
+ profileRenewBeforeDays: number | undefined,
+ certificateTtlInDays: number
+): number | undefined => {
+ if (profileRenewBeforeDays === undefined) {
+ return undefined;
+ }
+
+ if (profileRenewBeforeDays >= certificateTtlInDays) {
+ return Math.max(1, certificateTtlInDays - 1);
+ }
+
+ return profileRenewBeforeDays;
+};
+
+const calculateFinalRenewBeforeDays = (
+ profile: { apiConfig?: { autoRenew?: boolean; renewBeforeDays?: number } } | undefined,
+ ttl: string
+): number | undefined => {
+ if (!profile?.apiConfig?.autoRenew || !profile.apiConfig.renewBeforeDays) {
+ return undefined;
+ }
+
+ const certificateTtlInDays = parseTtlToDays(ttl);
+ const renewBeforeDays = calculateRenewalThreshold(profile.apiConfig.renewBeforeDays, certificateTtlInDays);
+
+ if (!renewBeforeDays) {
+ return undefined;
+ }
+
+ return renewBeforeDays;
+};
+
type TAcmeCertificateAuthorityFnsDeps = {
appConnectionDAL: Pick<TAppConnectionDALFactory, "findById">;
appConnectionService: Pick<TAppConnectionServiceFactory, "validateAppConnectionUsageById">;
diff --cc backend/src/services/certificate-authority/certificate-authority-service.ts
index 132e8b148c,b9b3b8d42e..be53f08ce1
--- a/backend/src/services/certificate-authority/certificate-authority-service.ts
+++ b/backend/src/services/certificate-authority/certificate-authority-service.ts
@@@ -492,48 -677,15 +682,51 @@@ export const certificateAuthorityServic
});
};
+ const getCaById = async ({
+ caId,
+ actor,
+ actorId,
+ actorAuthMethod,
+ actorOrgId
+ }: {
+ caId: string;
+ actor: OrgServiceActor["type"];
+ actorId: string;
+ actorAuthMethod: OrgServiceActor["authMethod"];
+ actorOrgId?: string;
+ }) => {
+ const ca = await certificateAuthorityDAL.findByIdWithAssociatedCa(caId);
+ if (!ca) {
+ throw new NotFoundError({ message: "CA not found" });
+ }
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: ca.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Read,
+ ProjectPermissionSub.CertificateAuthorities
+ );
+
+ return ca;
+ };
+
return {
createCertificateAuthority,
- findCertificateAuthorityByNameAndProjectId,
+ findCertificateAuthorityById,
listCertificateAuthoritiesByProjectId,
+ findCertificateAuthorityByNameAndProjectId,
updateCertificateAuthority,
deleteCertificateAuthority,
getAzureAdcsTemplates,
- getCaById
++ getCaById,
+ deprecatedUpdateCertificateAuthority,
+ deprecatedDeleteCertificateAuthority
};
};
diff --cc frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
index 1373c9fed9,f8fc8090ba..b719c58aae
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
@@@ -123,18 -120,13 +121,15 @@@ export const ProfileRow = (
</Td>
<Td className="text-start">{getEnrollmentTypeBadge(profile.enrollmentType)}</Td>
<Td className="text-start">
- <div className="flex items-center gap-2">
- <span className="text-sm text-mineshaft-300">
- {profile.issuerType === IssuerType.SELF_SIGNED
- ? "Self-signed"
- : profile.certificateAuthority?.isExternal
- ? profile.certificateAuthority.name
- : caData?.friendlyName ||
- caData?.commonName ||
- profile.certificateAuthority?.name ||
- profile.caId}
- </span>
- </div>
+ <span className="text-sm text-mineshaft-300">
+ {profile.issuerType === IssuerType.SELF_SIGNED
+ ? "Self-signed"
- : caData?.configuration.friendlyName ||
- caData?.configuration.commonName ||
- profile.caId}
++ : profile.certificateAuthority?.isExternal
++ ? profile.certificateAuthority.name
++ : caData?.configuration.friendlyName ||
++ caData?.configuration.commonName ||
++ profile.caId}
+ </span>
</Td>
<Td>
<span className="text-sm text-mineshaft-300">