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
Address PR comments
Carlos Monastyrskif13cda65527e
diff --git a/backend/src/db/migrations/20260218180000_add-ca-signing-configs.ts b/backend/src/db/migrations/20260218175924_add-ca-signing-configs.tssimilarity index 86%rename from backend/src/db/migrations/20260218180000_add-ca-signing-configs.tsrename to backend/src/db/migrations/20260218175924_add-ca-signing-configs.tsindex cd195fb4cb..3dcf9da77f 100644--- a/backend/src/db/migrations/20260218180000_add-ca-signing-configs.ts+++ b/backend/src/db/migrations/20260218175924_add-ca-signing-configs.ts@@ -1,4 +1,4 @@-/* eslint-disable no-await-in-loop */+/* eslint-disable no-await-in-loop, no-continue */import { Knex } from "knex";import { TableName } from "../schemas";@@ -22,25 +22,14 @@ export async function up(knex: Knex): Promise<void> {await createOnUpdateTrigger(knex, TableName.CaSigningConfig);- const internalCas = await knex(TableName.InternalCertificateAuthority).select("id", "type", "parentCaId");+ const internalCas = await knex(TableName.InternalCertificateAuthority).select("id", "type");for (const ca of internalCas) {- let signingType: string;- let parentCaId: string | null = null;-- if (ca.type === "root") {- signingType = "internal";- } else if (ca.parentCaId) {- signingType = "internal";- parentCaId = ca.parentCaId;- } else {- signingType = "manual";- }+ if (ca.type === "root") continue;await knex(TableName.CaSigningConfig).insert({caId: ca.id,- type: signingType,- parentCaId+ type: "manual"});}}diff --git a/backend/src/server/routes/v1/certificate-authority-routers/internal-certificate-authority-router.ts b/backend/src/server/routes/v1/certificate-authority-routers/internal-certificate-authority-router.tsindex dc087c3502..b933ed993d 100644--- a/backend/src/server/routes/v1/certificate-authority-routers/internal-certificate-authority-router.ts+++ b/backend/src/server/routes/v1/certificate-authority-routers/internal-certificate-authority-router.ts@@ -745,7 +745,7 @@ export const registerInternalCertificateAuthorityRouter = async (server: FastifycaId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_SIGNING_CONFIG.caId)}),response: {- 200: CaSigningConfigsSchema+ 200: CaSigningConfigsSchema.nullable()}},handler: async (req) => {diff --git a/backend/src/services/app-connection/venafi/index.ts b/backend/src/services/app-connection/venafi/index.tsindex bfeac2218a..b59513af11 100644--- a/backend/src/services/app-connection/venafi/index.ts+++ b/backend/src/services/app-connection/venafi/index.ts@@ -1,4 +1,4 @@-export * from "./venafi-connection-enum";+export * from "./venafi-connection-enums";export * from "./venafi-connection-fns";export * from "./venafi-connection-schema";export * from "./venafi-connection-service";diff --git a/backend/src/services/app-connection/venafi/venafi-connection-enum.ts b/backend/src/services/app-connection/venafi/venafi-connection-enums.tssimilarity index 100%rename from backend/src/services/app-connection/venafi/venafi-connection-enum.tsrename to backend/src/services/app-connection/venafi/venafi-connection-enums.tsdiff --git a/backend/src/services/app-connection/venafi/venafi-connection-fns.ts b/backend/src/services/app-connection/venafi/venafi-connection-fns.tsindex 1dffe8c1a3..6902bce32b 100644--- a/backend/src/services/app-connection/venafi/venafi-connection-fns.ts+++ b/backend/src/services/app-connection/venafi/venafi-connection-fns.ts@@ -4,7 +4,7 @@ import { request } from "@app/lib/config/request";import { BadRequestError } from "@app/lib/errors";import { AppConnection } from "@app/services/app-connection/app-connection-enums";-import { VenafiConnectionMethod, VenafiRegion } from "./venafi-connection-enum";+import { VenafiConnectionMethod, VenafiRegion } from "./venafi-connection-enums";import { TVenafiConnection, TVenafiConnectionConfig } from "./venafi-connection-types";type TVenafiCredentials = {diff --git a/backend/src/services/app-connection/venafi/venafi-connection-schema.ts b/backend/src/services/app-connection/venafi/venafi-connection-schema.tsindex 22f8fb6b57..a6e7b1a76f 100644--- a/backend/src/services/app-connection/venafi/venafi-connection-schema.ts+++ b/backend/src/services/app-connection/venafi/venafi-connection-schema.ts@@ -9,7 +9,7 @@ import {} from "@app/services/app-connection/app-connection-schemas";import { APP_CONNECTION_NAME_MAP } from "../app-connection-maps";-import { VenafiConnectionMethod, VenafiRegion } from "./venafi-connection-enum";+import { VenafiConnectionMethod, VenafiRegion } from "./venafi-connection-enums";export const VenafiConnectionApiKeyCredentialsSchema = z.object({apiKey: z.string().trim().min(1, "API key required").max(256, "API key cannot exceed 256 characters"),diff --git a/backend/src/services/certificate-authority/ca-auto-renewal-queue.ts b/backend/src/services/certificate-authority/ca-auto-renewal-queue.tsindex ba7f7ac913..5b4cbd1b95 100644--- a/backend/src/services/certificate-authority/ca-auto-renewal-queue.ts+++ b/backend/src/services/certificate-authority/ca-auto-renewal-queue.ts@@ -255,23 +255,7 @@ export const caAutoRenewalQueueFactory = ({continue;}- const signingConfig = await caSigningConfigDAL.findByCaId(internalCa.id);- if (!signingConfig) {- logger.warn(`CA ${internalCa.caId}: no signing config found, skipping auto-renewal`);- continue;- }-- if (signingConfig.type === CaSigningConfigType.Manual) {- logger.warn(`CA ${internalCa.caId}: manual signing config does not support auto-renewal`);- await internalCertificateAuthorityDAL.updateById(internalCa.id, {- autoRenewalEnabled: false,- lastRenewalStatus: CaRenewalStatus.FAILED,- lastRenewalMessage: "Auto-renewal is not supported for manual signing configuration"- });- continue;- }-- if (signingConfig.type === CaSigningConfigType.Internal) {+ if (internalCa.type === "root") {if (!internalCa.notBefore) {throw new Error("Cannot auto-renew: certificate has no notBefore date");}@@ -281,15 +265,43 @@ export const caAutoRenewalQueueFactory = ({notBefore: new Date(internalCa.notBefore),notAfter: expiryDate});- } else if (signingConfig.type === CaSigningConfigType.Venafi) {- await processVenafiCertificateIssuance({- caId: internalCa.caId,- internalCaId: internalCa.id- });+ } else {+ const signingConfig = await caSigningConfigDAL.findByCaId(internalCa.id);+ if (!signingConfig) {+ logger.warn(`CA ${internalCa.caId}: no signing config found, skipping auto-renewal`);+ continue;+ }++ if (signingConfig.type === CaSigningConfigType.Manual) {+ logger.warn(`CA ${internalCa.caId}: manual signing config does not support auto-renewal`);+ await internalCertificateAuthorityDAL.updateById(internalCa.id, {+ autoRenewalEnabled: false,+ lastRenewalStatus: CaRenewalStatus.FAILED,+ lastRenewalMessage: "Auto-renewal is not supported for manual signing configuration"+ });+ continue;+ }++ if (signingConfig.type === CaSigningConfigType.Internal) {+ if (!internalCa.notBefore) {+ throw new Error("Cannot auto-renew: certificate has no notBefore date");+ }+ await processInternalCaRenewal({+ caId: internalCa.caId,+ internalCaId: internalCa.id,+ notBefore: new Date(internalCa.notBefore),+ notAfter: expiryDate+ });+ } else if (signingConfig.type === CaSigningConfigType.Venafi) {+ await processVenafiCertificateIssuance({+ caId: internalCa.caId,+ internalCaId: internalCa.id+ });+ }}totalRenewed += 1;- logger.info(`CA ${internalCa.caId}: successfully auto-renewed (${signingConfig.type})`);+ logger.info(`CA ${internalCa.caId}: successfully auto-renewed`);} catch (error) {totalFailed += 1;const errorMessage = error instanceof Error ? error.message : "Unknown error";diff --git a/backend/src/services/certificate-authority/ca-signing-config/ca-signing-config-service.ts b/backend/src/services/certificate-authority/ca-signing-config/ca-signing-config-service.tsindex 42f2209f46..75a31c791f 100644--- a/backend/src/services/certificate-authority/ca-signing-config/ca-signing-config-service.ts+++ b/backend/src/services/certificate-authority/ca-signing-config/ca-signing-config-service.ts@@ -53,25 +53,12 @@ export const caSigningConfigServiceFactory = ({}};- const getOrCreateLegacySigningConfig = async (internalCaId: string, caType: string, parentCaId?: string | null) => {- const existing = await caSigningConfigDAL.findByCaId(internalCaId);- if (existing) return existing;-- const isRoot = caType === InternalCaType.ROOT;- const hasInternalParent = !!parentCaId;-- if (isRoot || hasInternalParent) {- return caSigningConfigDAL.create({- caId: internalCaId,- type: CaSigningConfigType.Internal,- parentCaId: hasInternalParent ? parentCaId : undefined- });+ const getSigningConfigByCaId = async (internalCaId: string) => {+ const config = await caSigningConfigDAL.findByCaId(internalCaId);+ if (!config) {+ throw new NotFoundError({ message: "No signing configuration found for this CA" });}-- return caSigningConfigDAL.create({- caId: internalCaId,- type: CaSigningConfigType.Manual- });+ return config;};const createSigningConfig = async ({@@ -110,9 +97,8 @@ export const caSigningConfigServiceFactory = ({const internalCa = await internalCertificateAuthorityDAL.findOne({ caId });if (!internalCa) throw new NotFoundError({ message: `Internal CA with caId ${caId} not found` });- // Root CAs can only have internal signing- if (internalCa.type === InternalCaType.ROOT && type !== CaSigningConfigType.Internal) {- throw new BadRequestError({ message: "Root CAs can only use internal signing configuration" });+ if (internalCa.type === InternalCaType.ROOT) {+ throw new BadRequestError({ message: "Root CAs are self-signed and do not require a signing configuration" });}// If a config already exists with a different type (e.g., auto-created "manual"), replace it@@ -184,7 +170,11 @@ export const caSigningConfigServiceFactory = ({const internalCa = await internalCertificateAuthorityDAL.findOne({ caId });if (!internalCa) throw new NotFoundError({ message: `Internal CA with caId ${caId} not found` });- const config = await getOrCreateLegacySigningConfig(internalCa.id, internalCa.type, internalCa.parentCaId);+ if (internalCa.type === InternalCaType.ROOT) {+ return { config: null, ca: { id: ca.id, dn: ca.internalCa?.dn ?? "", projectId: ca.projectId } };+ }++ const config = await getSigningConfigByCaId(internalCa.id);return { config, ca: { id: ca.id, dn: ca.internalCa?.dn ?? "", projectId: ca.projectId } };};@@ -346,8 +336,30 @@ export const caSigningConfigServiceFactory = ({});}- if (autoRenewalEnabled) {- const signingConfig = await getOrCreateLegacySigningConfig(internalCa.id, internalCa.type, internalCa.parentCaId);+ const effectiveDaysBeforeExpiry = autoRenewalDaysBeforeExpiry ?? internalCa.autoRenewalDaysBeforeExpiry;++ if (effectiveDaysBeforeExpiry !== undefined && effectiveDaysBeforeExpiry !== null) {+ const MAX_DAYS_BEFORE_EXPIRY = 30;+ if (effectiveDaysBeforeExpiry > MAX_DAYS_BEFORE_EXPIRY) {+ throw new BadRequestError({+ message: `autoRenewalDaysBeforeExpiry cannot exceed ${MAX_DAYS_BEFORE_EXPIRY} days`+ });+ }++ if (internalCa.notBefore && internalCa.notAfter) {+ const ttlDays = Math.floor(+ (new Date(internalCa.notAfter).getTime() - new Date(internalCa.notBefore).getTime()) / (1000 * 60 * 60 * 24)+ );+ if (effectiveDaysBeforeExpiry >= ttlDays) {+ throw new BadRequestError({+ message: `autoRenewalDaysBeforeExpiry (${effectiveDaysBeforeExpiry}) must be less than the certificate's TTL (${ttlDays} days)`+ });+ }+ }+ }++ if (autoRenewalEnabled && internalCa.type !== InternalCaType.ROOT) {+ const signingConfig = await getSigningConfigByCaId(internalCa.id);if (signingConfig.type === CaSigningConfigType.Manual) {throw new BadRequestError({@@ -428,7 +440,7 @@ export const caSigningConfigServiceFactory = ({const internalCa = await internalCertificateAuthorityDAL.findOne({ caId });if (!internalCa) throw new NotFoundError({ message: `Internal CA with caId ${caId} not found` });- const signingConfig = await getOrCreateLegacySigningConfig(internalCa.id, internalCa.type, internalCa.parentCaId);+ const signingConfig = await getSigningConfigByCaId(internalCa.id);if (signingConfig.type !== CaSigningConfigType.Venafi) {throw new BadRequestError({ message: "CA signing config is not configured for Venafi" });diff --git a/backend/src/services/certificate-authority/ca-signing-config/venafi-signing-fns.ts b/backend/src/services/certificate-authority/ca-signing-config/venafi-signing-fns.tsindex 147243e630..527df19775 100644--- a/backend/src/services/certificate-authority/ca-signing-config/venafi-signing-fns.ts+++ b/backend/src/services/certificate-authority/ca-signing-config/venafi-signing-fns.ts@@ -4,7 +4,7 @@ import { AxiosError } from "axios";import { request } from "@app/lib/config/request";import { BadRequestError } from "@app/lib/errors";import { logger } from "@app/lib/logger";-import { VenafiRegion } from "@app/services/app-connection/venafi/venafi-connection-enum";+import { VenafiRegion } from "@app/services/app-connection/venafi/venafi-connection-enums";import { getVenafiBaseUrl, getVenafiHeaders } from "@app/services/app-connection/venafi/venafi-connection-fns";import { TVenafiDestinationConfig } from "./ca-signing-config-types";diff --git a/docs/documentation/platform/pki/ca/external-ca.mdx b/docs/documentation/platform/pki/ca/external-ca.mdxindex 4accec1918..dce40b8979 100644--- a/docs/documentation/platform/pki/ca/external-ca.mdx+++ b/docs/documentation/platform/pki/ca/external-ca.mdx@@ -39,7 +39,7 @@ Infisical currently supports the following External CA types out of the box:- [ACME CA](/documentation/platform/pki/ca/acme-ca): An ACME-compatible CA that supports the ACME protocol, such as Let's Encrypt, ZeroSSL, Buypass, DigiCert, Sectigo, etc.- [Azure ADCS](/documentation/platform/pki/ca/azure-adcs): A Microsoft Active Directory Certificate Services (ADCS) that supports the ADCS protocol.- [AWS Private CA](/documentation/platform/pki/ca/aws-pca): An AWS Private Certificate Authority (PCA) for cloud-native private certificate management.-- [Venafi TLS Protect Cloud](/documentation/platform/pki/ca/venafi): Use Venafi TLS Protect Cloud as an external CA to sign internal intermediate CAs, with support for auto-renewal.+- [Venafi TLS Protect Cloud](/documentation/platform/pki/ca/venafi): Automate the signing and renewal of internal intermediate CA certificates through Venafi TLS Protect Cloud.If you don’t see a specific external CA listed here or need a dedicated integration guide, please reach out to [email protected] and we’ll help you set up the integration for your external CA.diff --git a/docs/documentation/platform/pki/ca/private-ca.mdx b/docs/documentation/platform/pki/ca/private-ca.mdxindex b1ae32b890..8ad362e0f1 100644--- a/docs/documentation/platform/pki/ca/private-ca.mdx+++ b/docs/documentation/platform/pki/ca/private-ca.mdx@@ -76,7 +76,7 @@ consisting of an (optional) root CA and an intermediate CA.- Next, press the **Install Certificate** option on the intermediate CA.+ Next, press the **Install CA Certificate** option on the intermediate CA.@@ -88,7 +88,7 @@ consisting of an (optional) root CA and an intermediate CA.<Tab title="Infisical CA">Select **Infisical CA** and press **Continue**. This option chains the intermediate CA to a root or intermediate CA managed by Infisical.- Set the **Parent CA** to the root CA created in step 1 and configure the intended **Valid Until** and **Path Length** fields on the intermediate CA; feel free to use the prefilled values.+ Set the **Parent CA** to the root CA created in step 1 (or any other existing root or intermediate CA) and configure the intended **Valid Until** and **Path Length** fields on the intermediate CA; feel free to use the prefilled values.diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.tsindex ddbe66464b..00e0f97dd1 100644--- a/frontend/src/helpers/appConnections.ts+++ b/frontend/src/helpers/appConnections.ts@@ -194,6 +194,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])case LaravelForgeConnectionMethod.ApiToken:case DbtConnectionMethod.ApiToken:case CircleCIConnectionMethod.ApiToken:+ return { name: "API Token", icon: faKey };case VenafiConnectionMethod.ApiKey:return { name: "API Key", icon: faKey };case PostgresConnectionMethod.UsernameAndPassword:diff --git a/frontend/src/hooks/api/ca/queries.tsx b/frontend/src/hooks/api/ca/queries.tsxindex 7c5b60f785..5a3e1d1ee7 100644--- a/frontend/src/hooks/api/ca/queries.tsx+++ b/frontend/src/hooks/api/ca/queries.tsx@@ -232,7 +232,7 @@ export const useGetCaSigningConfig = (caId: string, options?: { enabled?: booleareturn useQuery({queryKey: caKeys.getCaSigningConfig(caId),queryFn: async () => {- const { data } = await apiRequest.get<TCaSigningConfig>(+ const { data } = await apiRequest.get<TCaSigningConfig | null>(`/api/v1/cert-manager/ca/internal/${caId}/signing-config`);return data;diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/CaInstallCertModal.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/CaInstallCertModal.tsxindex a9e0925d51..4362ec8df7 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/CaInstallCertModal.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/CaInstallCertModal.tsx@@ -52,7 +52,7 @@ const SIGNING_METHOD_OPTIONS: TSigningMethodOption[] = [value: SigningMethod.Automated,name: "External CA (Automated)",description:- "Connect to a third-party CA provider. Certificate signing and renewal are handled automatically via API.",+ "Connect to a third-party CA provider. Infisical automatically handles certificate signing and renewal through the provider's API.",icon: LinkIcon}];@@ -192,7 +192,13 @@ export const CaInstallCertModal = ({ popUp, handlePopUpToggle }: Props) => {))}</div><div className="mt-6 flex items-center justify-end gap-2">- <Button variant="outline" onClick={() => handlePopUpToggle("installCaCert", false)}>+ <Button+ variant="outline"+ onClick={() => {+ resetState();+ handlePopUpToggle("installCaCert", false);+ }}+ >Cancel</Button><Button variant="neutral" isDisabled={!selectedMethod} onClick={handleContinue}>