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
fix(pki): keep acme ca edits when connection lists refresh
bernie-g58abd4c97dca
diff --git a/docs/documentation/platform/pki/ca/acme-ca.mdx b/docs/documentation/platform/pki/ca/acme-ca.mdxindex 9909497b93..848e8f7d2f 100644--- a/docs/documentation/platform/pki/ca/acme-ca.mdx+++ b/docs/documentation/platform/pki/ca/acme-ca.mdx@@ -169,7 +169,7 @@ In the following steps, we explore how to connect Infisical to an ACME-compatibl- Name: A slug-friendly name for the ACME-compatible CA such as `lets-encrypt-production`.- DNS App Connection: The App Connection from Step 1 used for Infisical to connect to your DNS provider and create/remove DNS records as part of the DNS-01 challenge in ACME.- - Zone / Zone ID: Enter the Zone / Zone ID for the domain(s) you'll be requesting certificates for. For Google Cloud DNS, select the **GCP Project** first, then the **Zone**.+ - Zone / Zone ID: Enter the Zone / Zone ID for the domain(s) you'll be requesting certificates for (for Google Cloud DNS, select the **GCP Project** first, then the **Zone**)- Directory URL: Enter the **ACME Directory URL** for your desired upstream ACME-compatible CA such as `https://acme-v02.api.letsencrypt.org/directory` for Let's Encrypt.- Account Email: The email address to associate with your ACME account. This email will receive important notifications about your certificates.- EAB Key Identifier (KID): (Optional) The Key Identifier (KID) provided by your ACME CA for External Account Binding (EAB). This is required by some ACME providers (e.g., ZeroSSL, DigiCert) to link your ACME account to an external account you've pre-registered with them.diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsxindex 2fb7e2ab4e..a661c49e0e 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx@@ -1,4 +1,4 @@-import { useEffect, useMemo, useState } from "react";+import { useEffect, useMemo, useRef, useState } from "react";import { Controller, useForm } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";import { ArrowLeftIcon, Loader2Icon, Lock, type LucideIcon, Search } from "lucide-react";@@ -552,15 +552,26 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {enabled: dnsProvider === AcmeDnsProvider.PowerDns && !!dnsAppConnection.id});- // Populate form with CA data when editing+ const prefilledCaIdRef = useRef<string | null>(null);++ // Prefill once per open: re-running on connection list refreshes would discard unsaved edits+ useEffect(() => {+ if (!popUp?.ca?.isOpen) prefilledCaIdRef.current = null;+ }, [popUp?.ca?.isOpen]);+useEffect(() => {- if (ca && !isCaLoading) {+ if (ca && !isCaLoading && !isPending && prefilledCaIdRef.current !== ca.id) {+ const prefill = (values: Parameters<typeof reset>[0]) => {+ reset(values);+ prefilledCaIdRef.current = ca.id;+ };+if (ca.type === CaType.ACME && availableConnections?.length) {const selectedConnection = availableConnections?.find((connection) => connection.id === ca.configuration.dnsAppConnectionId);- reset({+ prefill({type: ca.type,name: ca.name,status: ca.status,@@ -585,7 +596,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {(connection) => connection.id === ca.configuration.azureAdcsConnectionId);- reset({+ prefill({type: ca.type,name: ca.name,status: ca.status,@@ -601,7 +612,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {(connection) => connection.id === ca.configuration.appConnectionId);- reset({+ prefill({type: ca.type,name: ca.name,status: ca.status,@@ -618,7 +629,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {(connection) => connection.id === ca.configuration.appConnectionId);- reset({+ prefill({type: ca.type,name: ca.name,status: ca.status,@@ -636,7 +647,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {(connection) => connection.id === ca.configuration.appConnectionId);- reset({+ prefill({type: ca.type,name: ca.name,status: ca.status,@@ -661,7 +672,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {): undefined;- reset({+ prefill({type: ca.type,name: ca.name,status: ca.status,@@ -685,7 +696,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {(connection) => connection.id === ca.configuration.appConnectionId);- reset({+ prefill({type: ca.type,name: ca.name,status: ca.status,@@ -702,7 +713,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {(connection) => connection.id === ca.configuration.appConnectionId);- reset({+ prefill({type: ca.type,name: ca.name,status: ca.status,@@ -716,7 +727,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {});}}- }, [ca, availableConnections, reset, isCaLoading]);+ }, [ca, availableConnections, reset, isCaLoading, isPending]);const digicertConnectionId =caType === CaType.DIGICERT && configuration && "digicertConnection" in configuration