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
feat(pki): add support for csr based certificate issuance from web ui (#5308)
Saif Ur Rahman0583265a7841
diff --git a/docs/docs.json b/docs/docs.jsonindex c7ab56ee28..10b1a81eb5 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -686,6 +686,7 @@"pages": ["documentation/platform/pki/guides/request-cert-agent","documentation/platform/pki/guides/request-cert-api",+ "documentation/platform/pki/guides/request-cert-csr","documentation/platform/pki/guides/request-cert-acme","documentation/platform/pki/guides/certificate-approvals"]diff --git a/docs/documentation/platform/pki/certificates/certificates.mdx b/docs/documentation/platform/pki/certificates/certificates.mdxindex 2f400d6016..e9733d3537 100644--- a/docs/documentation/platform/pki/certificates/certificates.mdx+++ b/docs/documentation/platform/pki/certificates/certificates.mdx@@ -51,7 +51,34 @@ To [issue a certificate](/documentation/platform/pki/concepts/certificate-lifecy- Self-Signed Certificates: To issue a [self-signed certificate](https://en.wikipedia.org/wiki/Self-signed_certificate), you must configure the certificate profile to use the `Self-Signed` issuer type. You can then use the [API enrollment method](/documentation/platform/pki/enrollment-methods/api) to request a self-signed certificate against it.- CA-Issued Certificates: To issue a certificate from a certificate authority, you must configure the certificate profile to use the `Certificate Authority` issuer type and select the [issuing CA](/documentation/platform/pki/ca/overview) to use. You can then use one of the [enrollment methods](/documentation/platform/pki/enrollment-methods/overview) to request a certificate against it.-Refer to the documentation for each [enrollment method](/documentation/platform/pki/enrollment-methods/overview) to learn more about how to issue certificates using it.+<Tabs>+ <Tab title="Infisical UI">+ <Steps>+ <Step title="Issue a certificate">+ To issue a certificate, navigate to your Project > Certificates > Certificate Requests and click **Request**.++ ++ Select the certificate profile and choose the **Request Method**:+ - **Managed**: Infisical generates and manages the private key for you. Fill out the subject attributes, SANs, algorithms, and other certificate details.+ - **CSR (Certificate Signing Request)**: Provide your own CSR when you need to manage your private key externally. The certificate will be issued using the subject information and public key contained in your CSR. See [Issue a Certificate with CSR](/documentation/platform/pki/guides/request-cert-csr) for more details.++ ++ When using the **CSR** method, paste your PEM-encoded Certificate Signing Request into the text area and specify the TTL:++ ++ <Note>+ When using a CSR, the subject attributes, subject alternative names, and key algorithm are extracted from your CSR. You only need to specify the TTL for the certificate. The CSR must be a valid PEM-encoded PKCS#10 request.+ </Note>+ </Step>+ </Steps>+ </Tab>+ <Tab title="API">+ To issue certificates via API, refer to the [API enrollment method](/documentation/platform/pki/enrollment-methods/api) documentation.+ </Tab>+</Tabs>## Guide to Renewing Certificatesdiff --git a/docs/documentation/platform/pki/enrollment-methods/api.mdx b/docs/documentation/platform/pki/enrollment-methods/api.mdxindex 72762cdb4b..2838e56d4d 100644--- a/docs/documentation/platform/pki/enrollment-methods/api.mdx+++ b/docs/documentation/platform/pki/enrollment-methods/api.mdx@@ -27,7 +27,7 @@ In the following steps, we explore how to issue a X.509 certificate using the AP</Step><Step title="Issue a certificate">- To create a certificate, head to your Project > Certificates > Certificates and press **Issue**.+ To create a certificate, head to your Project > Certificates > Certificate Requests and press **Request**.diff --git a/docs/documentation/platform/pki/guides/request-cert-csr.mdx b/docs/documentation/platform/pki/guides/request-cert-csr.mdxnew file mode 100644index 0000000000..0c560e87d6--- /dev/null+++ b/docs/documentation/platform/pki/guides/request-cert-csr.mdx@@ -0,0 +1,274 @@+---+title: "Issue a Certificate with CSR"+description: "Learn how to issue certificates using a Certificate Signing Request (CSR) to maintain control of your private keys"+---++import RequestCertSetup from "/snippets/documentation/platform/pki/guides/request-cert-setup.mdx";++The [API enrollment method](/documentation/platform/pki/enrollment-methods/api) supports issuing certificates using a Certificate Signing Request (CSR). This allows you to manage your own private key externally while having Infisical sign the certificate.++## When to Use CSR-Based Issuance++CSR-based certificate issuance is recommended when:++- You need to maintain control of your private key+- Your security policy requires keys to be generated on the target system+- You're integrating with Hardware Security Modules (HSMs)+- You want to use a specific key that already exists+- You're working with systems that generate their own CSRs (e.g., load balancers, network appliances)++## Generating a CSR++Prior to requesting a certificate, a Certificate Signing Request (CSR) must be generated. While multiple tools and workflows are available, the example below illustrates how to generate a CSR using OpenSSL.++### Generate a New Key and CSR++```bash+# Generate a new RSA private key and CSR+openssl req -new -newkey rsa:2048 -nodes \+ -keyout private.key \+ -out request.csr \+ -subj "/CN=service.example.com/O=My Organization/C=US"+```++### Generate CSR from Existing Key++```bash+# Generate CSR from an existing private key+openssl req -new -key private.key -out request.csr \+ -subj "/CN=service.example.com"+```++### Generate CSR with Subject Alternative Names++```bash+# Generate CSR with SANs+openssl req -new -newkey rsa:2048 -nodes \+ -keyout private.key \+ -out request.csr \+ -subj "/CN=service.example.com" \+ -addext "subjectAltName=DNS:service.example.com,DNS:www.service.example.com,IP:192.168.1.1"+```++### Generate CSR with ECDSA Key++```bash+# Generate ECDSA P-256 key and CSR+openssl ecparam -genkey -name prime256v1 -out private.key+openssl req -new -key private.key -out request.csr \+ -subj "/CN=service.example.com"+```++### Verify Your CSR++Before submitting, verify your CSR contents:++```bash+openssl req -in request.csr -noout -text+```++## CSR Format Requirements++Your CSR must meet the following requirements:++- **Format**: PEM-encoded PKCS#10 Certificate Signing Request+- **Required header**: `-----BEGIN CERTIFICATE REQUEST-----`+- **Required footer**: `-----END CERTIFICATE REQUEST-----`++### Supported Key Algorithms++| Algorithm | Supported Sizes/Curves |+|-----------|------------------------|+| RSA | 2048, 3072, 4096 bits |+| ECDSA | P-256, P-384, P-521 |++### Supported Signature Algorithms++| Key Type | Supported Hash Algorithms |+|----------|---------------------------|+| RSA | SHA-256, SHA-384, SHA-512 |+| ECDSA | SHA-256, SHA-384, SHA-512 |++## Guide++<Steps>+ <RequestCertSetup />+ <Step title="Create a certificate profile">+ Next, follow the guide [here](/documentation/platform/pki/certificates/profiles#guide-to-creating-a-certificate-profile) to create a [certificate profile](/documentation/platform/pki/certificates/profiles)+ that will be referenced when requesting a certificate.++ The certificate profile specifies which certificate policy and issuing CA should be used to validate an incoming certificate request and issue a certificate.+ You should specify the certificate policy from Step 2, the issuing CA from Step 1, and the **API** option in the **Enrollment Method** dropdown when creating the certificate profile.++ <Note>+ CSR-based issuance requires a Certificate Authority. Self-signed certificates are not supported when using a CSR.+ </Note>+ </Step>+ <Step title="Issue a certificate with your CSR">+ <Tabs>+ <Tab title="Infisical UI">+ To issue a certificate using your CSR, navigate to your Project > Certificates > Certificate Requests and click **Request**.++ ++ Select **CSR (Certificate Signing Request)** as the **Request Method**, then choose your certificate profile.++ ++ Paste your PEM-encoded CSR into the text area and specify the TTL for the certificate.++ ++ <Note>+ When using a CSR, the subject attributes, subject alternative names, and key algorithm are extracted from your CSR. You only need to specify the TTL for the certificate.+ </Note>+ </Tab>+ <Tab title="API">+ To issue a certificate with a CSR, make an API request to the [Issue Certificate](/api-reference/endpoints/certificates/create-certificate) API endpoint with your PEM-encoded CSR.++ ### Sample request++ ```bash Request+ curl --location --request POST 'https://app.infisical.com/api/v1/cert-manager/certificates' \+ --header 'Authorization: Bearer <access-token>' \+ --header 'Content-Type: application/json' \+ --data-raw '{+ "profileId": "<certificate-profile-id>",+ "csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIICvDCCAaQCAQAwdzELMAkGA1UEBhMCVVMxDTALBgNVBAgMBE9oaW8xEDAOBgNV\nBAcMB0NvbHVtYnMxFzAVBgNVBAoMDk15IE9yZ2FuaXphdGlvbjEcMBoGA1UEAwwT\nc2VydmljZS5leGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC\nggEBAK...\n-----END CERTIFICATE REQUEST-----",+ "attributes": {+ "ttl": "365d"+ }+ }'+ ```++ ### Sample response++ ```bash Response+ {+ "certificate": {+ "certificate": "-----BEGIN CERTIFICATE-----\nMIIEpDCCAowCCQD...\n-----END CERTIFICATE-----",+ "certificateChain": "-----BEGIN CERTIFICATE-----\nMIIEpDCCAowCCQD...\n-----END CERTIFICATE-----",+ "issuingCaCertificate": "-----BEGIN CERTIFICATE-----\nMIIEpDCCAowCCQD...\n-----END CERTIFICATE-----",+ "serialNumber": "123456789012345679",+ "certificateId": "990i4567-e29b-41d4-a716-446655440004"+ },+ "certificateRequestId": "..."+ }+ ```++ <Note>+ No private key is returned when using CSR-based issuance since you manage your own key externally.+ </Note>++ When sending the CSR via API:+ - Replace actual newlines in the PEM content with `\n` in the JSON string+ - Include the full PEM headers (`-----BEGIN CERTIFICATE REQUEST-----`) and footers (`-----END CERTIFICATE REQUEST-----`)+ </Tab>+ </Tabs>+ </Step>+</Steps>++<Tip>+ Your CSR must comply with the [certificate policy](/documentation/platform/pki/certificates/policies) attached to the profile. The policy validates subject attributes, SANs, key algorithms, signature algorithms, key usages, and basic constraints. If your CSR doesn't comply with the policy, you'll receive an error message indicating which constraint was violated.+</Tip>++## FAQ++<AccordionGroup>+ <Accordion title="When should I use Managed vs CSR?">+ **Use Managed (recommended for most cases)** when:+ - You want Infisical to handle key generation and storage+ - You need server-side auto-renewal capabilities+ - You're deploying certificates via certificate syncs to cloud providers+ - You want the simplest setup with minimal configuration+ - You don't have specific requirements for key custody++ **Use CSR** when:+ - Your security policy requires private keys to be generated on the target system+ - You're using a Hardware Security Module (HSM) that generates and stores keys+ - You need to reuse an existing private key+ - You have compliance requirements that mandate key generation in a specific location+ - You're integrating with systems that generate their own CSRs (e.g., load balancers, appliances)++ <Note>+ Certificates issued via CSR are **not eligible for server-side auto-renewal** since Infisical doesn't have access to the private key. You'll need to handle renewal by generating a new CSR and requesting a new certificate.+ </Note>+ </Accordion>++ <Accordion title="How do I renew a certificate issued via CSR?">+ Certificates issued via CSR cannot be automatically renewed by Infisical since the private key is managed externally. To renew:++ 1. Generate a new CSR using your existing private key (or generate a new key pair if desired)+ 2. Request a new certificate using the new CSR+ 3. Deploy the new certificate before the old one expires++ ```bash+ # Generate a new CSR with your existing key+ openssl req -new -key private.key -out request.csr \+ -subj "/CN=service.example.com"+ ```++ <Tip>+ Set up alerts for certificate expiration to ensure timely renewal.+ </Tip>+ </Accordion>++ <Accordion title="Why am I getting a CSR format error in the UI?">+ **Error**: "CSR cannot be empty" or invalid format error++ **Solution**: Ensure your CSR:+ - Starts with `-----BEGIN CERTIFICATE REQUEST-----`+ - Ends with `-----END CERTIFICATE REQUEST-----`+ - Contains valid base64-encoded content++ The UI accepts multiline PEM format directly—you can paste your CSR as-is from the file without any formatting changes.++ Verify your CSR is valid:+ ```bash+ openssl req -in request.csr -noout -text+ ```+ </Accordion>++ <Accordion title="Why am I getting a CSR format error via API?">++ **Solution**: When sending CSR via API JSON:+ - Replace actual newlines with `\n` in the JSON string+ - Include full PEM headers and footers+ - Ensure proper JSON escaping++ Example format:+ ```json+ {+ "csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIIC...base64content...\n-----END CERTIFICATE REQUEST-----"+ }+ ```+ </Accordion>++ <Accordion title="Why is my CSR failing policy validation?">+ Policy validation errors occur when your CSR doesn't comply with the certificate policy attached to the profile. Common errors include:++ - **Subject attributes**: "Missing required {attribute} attribute" or "{attribute} value does not match allowed patterns"+ - **Subject Alternative Names**: "{type} SAN is not allowed by template policy" or "Required {type} SAN not found"+ - **Key algorithm**: "Key algorithm is not allowed by template policy"+ - **Signature algorithm**: "Signature algorithm is not allowed by template policy"++ **Solution**:+ 1. Review your certificate policy configuration in Project > Certificates > Certificate Policies+ 2. Ensure your CSR includes all required attributes and SANs+ 3. Ensure values match allowed patterns configured in the policy+ 4. Verify your key algorithm is in the policy's allowed list (common options: RSA_2048, RSA_4096, ECDSA_P256, ECDSA_P384)++ Example generating a CSR with full subject and SANs:+ ```bash+ openssl req -new -key key.pem -out request.csr \+ -subj "/CN=service.example.com/O=My Organization/OU=Engineering/C=US/ST=California/L=San Francisco" \+ -addext "subjectAltName=DNS:service.example.com,DNS:api.example.com"+ ```+ </Accordion>++ <Accordion title="Why can't I use CSR with self-signed certificates?">+ **Error**: "Self-signed certificates are not supported for CSR signing"++ **Solution**: CSR-based issuance requires a Certificate Authority to sign the certificate.+ </Accordion>+</AccordionGroup>diff --git a/docs/images/platform/pki/certificate/cert-issue-modal-csr.png b/docs/images/platform/pki/certificate/cert-issue-modal-csr.pngnew file mode 100644index 0000000000..8cc225c0f0Binary files /dev/null and b/docs/images/platform/pki/certificate/cert-issue-modal-csr.png differdiff --git a/docs/images/platform/pki/certificate/cert-issue-modal.png b/docs/images/platform/pki/certificate/cert-issue-modal.pngindex e3de549bb6..9741455166 100644Binary files a/docs/images/platform/pki/certificate/cert-issue-modal.png and b/docs/images/platform/pki/certificate/cert-issue-modal.png differdiff --git a/docs/images/platform/pki/certificate/cert-issue.png b/docs/images/platform/pki/certificate/cert-issue.pngindex 4506b95523..c42c93ab26 100644Binary files a/docs/images/platform/pki/certificate/cert-issue.png and b/docs/images/platform/pki/certificate/cert-issue.png differdiff --git a/frontend/src/hooks/api/certificates/types.ts b/frontend/src/hooks/api/certificates/types.tsindex 9098a8b31d..d66181c0ba 100644--- a/frontend/src/hooks/api/certificates/types.ts+++ b/frontend/src/hooks/api/certificates/types.ts@@ -123,8 +123,8 @@ export type TUnifiedCertificateIssuanceDTO = {type: string;value: string;}>;- signatureAlgorithm: string;- keyAlgorithm: string;+ signatureAlgorithm?: string;+ keyAlgorithm?: string;subjectAlternativeNames?: Array<{type: string;value: string;diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors.tsxindex 562dcb5e1b..e1d0342edd 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors.tsx@@ -13,6 +13,7 @@ type AlgorithmSelectorsProps = {availableKeyAlgorithms: AlgorithmOption[];signatureError?: string;keyError?: string;+ shouldUnregister?: boolean;};export const AlgorithmSelectors = ({@@ -20,7 +21,8 @@ export const AlgorithmSelectors = ({availableSignatureAlgorithms,availableKeyAlgorithms,signatureError,- keyError+ keyError,+ shouldUnregister}: AlgorithmSelectorsProps) => {return (<div className="grid grid-cols-2 gap-4">@@ -28,6 +30,7 @@ export const AlgorithmSelectors = ({<Controllercontrol={control}name="signatureAlgorithm"+ shouldUnregister={shouldUnregister}render={({ field: { onChange, ...field } }) => (<FormControllabel="Signature Algorithm"@@ -62,6 +65,7 @@ export const AlgorithmSelectors = ({<Controllercontrol={control}name="keyAlgorithm"+ shouldUnregister={shouldUnregister}render={({ field: { onChange, ...field } }) => (<FormControllabel="Key Algorithm"diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsxindex 736715765d..9beeaedac5 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx@@ -1,4 +1,4 @@-import { useCallback, useEffect, useMemo, useState } from "react";+import { useCallback, useEffect, useMemo } from "react";import { Controller, useForm } from "react-hook-form";import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";@@ -21,13 +21,18 @@ import {ModalContent,Select,SelectItem,+ TextArea,Tooltip} from "@app/components/v2";import { useOrganization, useProject } from "@app/context";import { useGetCert } from "@app/hooks/api";import { useGetCertificatePolicyById } from "@app/hooks/api/certificatePolicies";import { EnrollmentType, useListCertificateProfiles } from "@app/hooks/api/certificateProfiles";-import { CertExtendedKeyUsage, CertKeyUsage } from "@app/hooks/api/certificates/enums";+import {+ CertExtendedKeyUsage,+ CertificateRequestStatus,+ CertKeyUsage+} from "@app/hooks/api/certificates/enums";import { useUnifiedCertificateIssuance } from "@app/hooks/api/certificates/mutations";import { UsePopUpState } from "@app/hooks/usePopUp";import {@@ -42,70 +47,75 @@ import { SubjectAltNamesField } from "./SubjectAltNamesField";import { SubjectAttributesField } from "./SubjectAttributesField";import { useCertificatePolicy } from "./useCertificatePolicy";-const createSchema = (shouldShowSubjectSection: boolean) => {- return z.object({- profileId: z.string().min(1, "Profile is required"),- subjectAttributes: shouldShowSubjectSection- ? z- .array(- z.object({- type: z.nativeEnum(CertSubjectAttributeType),- value: z.string().min(1, "Value is required")- })- )- .min(1, "At least one subject attribute is required")- : z- .array(- z.object({- type: z.nativeEnum(CertSubjectAttributeType),- value: z.string().min(1, "Value is required")- })- )- .optional(),- subjectAltNames: z- .array(- z.object({- type: z.nativeEnum(CertSubjectAlternativeNameType),- value: z.string().min(1, "Value is required")- })- )- .default([]),- basicConstraints: z- .object({- isCA: z.boolean().default(false),- pathLength: z.number().min(0).nullable().optional()- })- .optional(),- ttl: z.string().trim().min(1, "TTL is required"),- signatureAlgorithm: z.string().min(1, "Signature algorithm is required"),- keyAlgorithm: z.string().min(1, "Key algorithm is required"),- keyUsages: z- .object({- [CertKeyUsage.DIGITAL_SIGNATURE]: z.boolean().optional(),- [CertKeyUsage.KEY_ENCIPHERMENT]: z.boolean().optional(),- [CertKeyUsage.NON_REPUDIATION]: z.boolean().optional(),- [CertKeyUsage.DATA_ENCIPHERMENT]: z.boolean().optional(),- [CertKeyUsage.KEY_AGREEMENT]: z.boolean().optional(),- [CertKeyUsage.KEY_CERT_SIGN]: z.boolean().optional(),- [CertKeyUsage.CRL_SIGN]: z.boolean().optional(),- [CertKeyUsage.ENCIPHER_ONLY]: z.boolean().optional(),- [CertKeyUsage.DECIPHER_ONLY]: z.boolean().optional()+enum RequestMethod {+ MANAGED = "managed",+ CSR = "csr"+}++const baseSchema = z.object({+ profileId: z.string().min(1, "Profile is required"),+ ttl: z.string().trim().min(1, "TTL is required")+});++const csrSchema = baseSchema.extend({+ requestMethod: z.literal(RequestMethod.CSR),+ csr: z.string().min(1, "CSR is required")+});++const managedSchema = baseSchema.extend({+ requestMethod: z.literal(RequestMethod.MANAGED),+ subjectAttributes: z+ .array(+ z.object({+ type: z.nativeEnum(CertSubjectAttributeType),+ value: z.string().min(1, "Value is required")})- .default({}),- extendedKeyUsages: z- .object({- [CertExtendedKeyUsage.CLIENT_AUTH]: z.boolean().optional(),- [CertExtendedKeyUsage.CODE_SIGNING]: z.boolean().optional(),- [CertExtendedKeyUsage.EMAIL_PROTECTION]: z.boolean().optional(),- [CertExtendedKeyUsage.OCSP_SIGNING]: z.boolean().optional(),- [CertExtendedKeyUsage.SERVER_AUTH]: z.boolean().optional(),- [CertExtendedKeyUsage.TIMESTAMPING]: z.boolean().optional()+ )+ .optional(),+ subjectAltNames: z+ .array(+ z.object({+ type: z.nativeEnum(CertSubjectAlternativeNameType),+ value: z.string().min(1, "Value is required")})- .default({})- });-};--export type FormData = z.infer<ReturnType<typeof createSchema>>;+ )+ .default([]),+ basicConstraints: z+ .object({+ isCA: z.boolean().default(false),+ pathLength: z.number().min(0).nullable().optional()+ })+ .optional(),+ signatureAlgorithm: z.string().min(1, "Signature algorithm is required"),+ keyAlgorithm: z.string().min(1, "Key algorithm is required"),+ keyUsages: z+ .object({+ [CertKeyUsage.DIGITAL_SIGNATURE]: z.boolean().optional(),+ [CertKeyUsage.KEY_ENCIPHERMENT]: z.boolean().optional(),+ [CertKeyUsage.NON_REPUDIATION]: z.boolean().optional(),+ [CertKeyUsage.DATA_ENCIPHERMENT]: z.boolean().optional(),+ [CertKeyUsage.KEY_AGREEMENT]: z.boolean().optional(),+ [CertKeyUsage.KEY_CERT_SIGN]: z.boolean().optional(),+ [CertKeyUsage.CRL_SIGN]: z.boolean().optional(),+ [CertKeyUsage.ENCIPHER_ONLY]: z.boolean().optional(),+ [CertKeyUsage.DECIPHER_ONLY]: z.boolean().optional()+ })+ .default({}),+ extendedKeyUsages: z+ .object({+ [CertExtendedKeyUsage.CLIENT_AUTH]: z.boolean().optional(),+ [CertExtendedKeyUsage.CODE_SIGNING]: z.boolean().optional(),+ [CertExtendedKeyUsage.EMAIL_PROTECTION]: z.boolean().optional(),+ [CertExtendedKeyUsage.OCSP_SIGNING]: z.boolean().optional(),+ [CertExtendedKeyUsage.SERVER_AUTH]: z.boolean().optional(),+ [CertExtendedKeyUsage.TIMESTAMPING]: z.boolean().optional()+ })+ .default({})+});++const formSchema = z.discriminatedUnion("requestMethod", [csrSchema, managedSchema]);++export type FormData = z.infer<typeof formSchema>;type Props = {popUp: UsePopUpState<["issueCertificate"]>;@@ -117,7 +127,6 @@ type Props = {};export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }: Props) => {- const [shouldShowSubjectSection, setShouldShowSubjectSection] = useState(true);const { currentProject } = useProject();const { currentOrg } = useOrganization();const navigate = useNavigate();@@ -136,10 +145,6 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }const { mutateAsync: issueCertificate } = useUnifiedCertificateIssuance();- const formResolver = useMemo(() => {- return zodResolver(createSchema(shouldShowSubjectSection));- }, [shouldShowSubjectSection]);-const {control,handleSubmit,@@ -149,8 +154,9 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }formState,formState: { isSubmitting }} = useForm<FormData>({- resolver: formResolver,+ resolver: zodResolver(formSchema),defaultValues: {+ requestMethod: RequestMethod.MANAGED,profileId: profileId || "",subjectAttributes: [],subjectAltNames: [],@@ -166,6 +172,8 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }}});+ const requestMethod = watch("requestMethod");+const actualSelectedProfileId = watch("profileId");const watchedIsCA = watch("basicConstraints.isCA") || false;const actualSelectedProfile = useMemo(@@ -177,12 +185,6 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }policyId: actualSelectedProfile?.certificatePolicyId || ""});- useEffect(() => {- if (policyData !== undefined) {- setShouldShowSubjectSection((policyData?.subject?.length || 0) > 0);- }- }, [policyData]);-const {constraints,filteredKeyUsages,@@ -199,7 +201,6 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId });const resetAllState = useCallback(() => {- setShouldShowSubjectSection(true);resetConstraints();reset();}, [reset, resetConstraints]);@@ -211,6 +212,7 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }subjectAttrs.push({ type: CertSubjectAttributeType.COMMON_NAME, value: cert.commonName });reset({+ requestMethod: RequestMethod.MANAGED,profileId: "",subjectAttributes:subjectAttrs.length > 0@@ -246,17 +248,7 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }}, [popUp?.issueCertificate?.isOpen, profileId, cert, setValue]);const onFormSubmit = useCallback(- async ({- profileId: formProfileId,- subjectAttributes,- subjectAltNames,- basicConstraints,- ttl,- signatureAlgorithm,- keyAlgorithm,- keyUsages,- extendedKeyUsages- }: FormData) => {+ async (formData: FormData) => {if (!currentProject?.slug || !currentProject?.id) {createNotification({text: "Project not found. Please refresh and try again.",@@ -265,6 +257,8 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }return;}+ const { profileId: formProfileId, ttl } = formData;+if (!formProfileId) {createNotification({text: "Please select a certificate profile.",@@ -273,8 +267,62 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }return;}+ const handleIssuanceResponse = (response: Awaited<ReturnType<typeof issueCertificate>>) => {+ if ("certificate" in response && response.certificate) {+ createNotification({ text: "Successfully created certificate", type: "success" });+ handlePopUpToggle("issueCertificate", false);+ if (currentOrg?.id && currentProject?.id && response.certificate.certificateId) {+ navigate({+ to: "/organizations/$orgId/projects/cert-manager/$projectId/certificates/$certificateId",+ params: {+ orgId: currentOrg.id,+ projectId: currentProject.id,+ certificateId: response.certificate.certificateId+ }+ });+ }+ } else if (+ "status" in response &&+ response.status === CertificateRequestStatus.PENDING_APPROVAL+ ) {+ createNotification({+ text: "Certificate request submitted successfully. Approval is required before the certificate can be issued.",+ type: "success"+ });+ handlePopUpToggle("issueCertificate", false);+ } else {+ createNotification({+ text: `Certificate request submitted successfully. This may take a few minutes to process. Certificate Request ID: ${response.certificateRequestId}`,+ type: "success"+ });+ handlePopUpToggle("issueCertificate", false);+ }+ };+try {- // Prepare unified request+ if (formData.requestMethod === RequestMethod.CSR) {+ const response = await issueCertificate({+ profileId: formProfileId,+ projectSlug: currentProject.slug,+ projectId: currentProject.id,+ csr: formData.csr,+ attributes: { ttl }+ });++ handleIssuanceResponse(response);+ return;+ }++ const {+ subjectAttributes,+ subjectAltNames,+ basicConstraints,+ signatureAlgorithm,+ keyAlgorithm,+ keyUsages,+ extendedKeyUsages+ } = formData;+const request: any = {profileId: formProfileId,projectSlug: currentProject.slug,@@ -354,44 +402,7 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }}const response = await issueCertificate(request);-- // Handle certificate issuance response-- if ("certificate" in response && response.certificate) {- const certData = response.certificate;-- createNotification({- text: "Successfully created certificate",- type: "success"- });-- // Close modal and redirect to certificate details page- handlePopUpToggle("issueCertificate", false);-- if (currentOrg?.id && currentProject?.id && certData.certificateId) {- navigate({- to: "/organizations/$orgId/projects/cert-manager/$projectId/certificates/$certificateId",- params: {- orgId: currentOrg.id,- projectId: currentProject.id,- certificateId: certData.certificateId- }- });- }- } else if ("status" in response && response.status === "pending_approval") {- createNotification({- text: "Certificate request submitted successfully. Approval is required before the certificate can be issued.",- type: "success"- });- handlePopUpToggle("issueCertificate", false);- } else {- // Certificate request - async processing- createNotification({- text: `Certificate request submitted successfully. This may take a few minutes to process. Certificate Request ID: ${response.certificateRequestId}`,- type: "success"- });- handlePopUpToggle("issueCertificate", false);- }+ handleIssuanceResponse(response);} catch (error) {createNotification({text: `Failed to request certificate: ${(error as Error)?.message || "Unknown error"}`,@@ -447,6 +458,49 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId })}{!cert && (<form onSubmit={handleSubmit(onFormSubmit)}>+ <Controller+ control={control}+ name="requestMethod"+ render={({ field: { onChange, value } }) => (+ <FormControl+ label={+ <FormLabel+ label="Request Method"+ icon={+ <Tooltip+ content={+ <div className="space-y-2">+ <p>+ <strong>Managed:</strong> We generate and manage the private key for+ you.+ </p>+ <p>+ <strong>CSR:</strong> Provide your own Certificate Signing Request.+ Use this when you need to manage your own private key.+ </p>+ </div>+ }+ >+ <FontAwesomeIcon icon={faQuestionCircle} size="sm" />+ </Tooltip>+ }+ />+ }+ >+ <Select+ value={value}+ onValueChange={(val) => onChange(val as RequestMethod)}+ className="w-full"+ >+ <SelectItem value={RequestMethod.MANAGED}>Managed</SelectItem>+ <SelectItem value={RequestMethod.CSR}>+ Certificate Signing Request (CSR)+ </SelectItem>+ </Select>+ </FormControl>+ )}+ />+{!profileId && (<Controllercontrol={control}@@ -500,19 +554,65 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }{(actualSelectedProfile || profileId) && (<>- {constraints.shouldShowSubjectSection && (- <SubjectAttributesField+ {requestMethod === RequestMethod.CSR && (+ <Controllercontrol={control}- allowedAttributeTypes={constraints.allowedSubjectAttributeTypes}- error={formState.errors.subjectAttributes?.message}+ name="csr"+ shouldUnregister+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="Certificate Signing Request (CSR)"+ isRequired+ errorText={error?.message}+ isError={Boolean(error)}+ >+ <TextArea+ {...field}+ spellCheck={false}+ placeholder={+ "-----BEGIN CERTIFICATE REQUEST-----\n" ++ "MIIByDCCAU4CAQAwfjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\n" ++ "FjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xEjAQBgNVBAoMCURlbW8gQ29ycDEUMBIG\n" ++ "A1UECwwLRW5naW5lZXJpbmcxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbTB2MBAG\n" ++ "ByqGSM49AgEGBSuBBAAiA2IABDHV5yengUugeBcpjsw+iAaxSkCr16LMr3ITyvlM\n" ++ "lDv+AE0Ddc6FsFXJicBfTalM3AKl5F14OCBRfI2jugWJOGCLcKYqRDTDevxQmgCI\n" ++ "IfpRM6+jzPkqe0PsuLhYiRfbFKBRME8GCSqGSIb3DQEJDjFCMEAwPgYDVR0RBDcw\n" ++ "NYIPYXBwLmV4YW1wbGUuY29tghEqLmFwcC5leGFtcGxlLmNvbYIJbG9jYWxob3N0\n" ++ "hwR/AAABMAoGCCqGSM49BAMCA2gAMGUCMGQQYs4lTSc3r/5MlabDx4m+sWaAtDhO\n" ++ "17c3TaoDZOMG6r45mgUskPGTripXV9ItTQIxAJypXNlHnMvks7MO4LmicPqku4MF\n" ++ "IeFqqXMFzC9uAO3iQ8/ji6ukvT6a9A3DE9LLIg==\n" ++ "-----END CERTIFICATE REQUEST-----"+ }+ rows={13}+ className="w-full font-mono text-xs"+ />+ </FormControl>+ )}/>)}- {constraints.shouldShowSanSection && (+ {requestMethod === RequestMethod.MANAGED &&+ constraints.shouldShowSubjectSection && (+ <SubjectAttributesField+ control={control}+ allowedAttributeTypes={constraints.allowedSubjectAttributeTypes}+ error={+ (formState.errors as { subjectAttributes?: { message?: string } })+ .subjectAttributes?.message+ }+ shouldUnregister+ />+ )}++ {requestMethod === RequestMethod.MANAGED && constraints.shouldShowSanSection && (<SubjectAltNamesFieldcontrol={control}allowedSanTypes={constraints.allowedSanTypes}- error={formState.errors.subjectAltNames?.message}+ error={+ (formState.errors as { subjectAltNames?: { message?: string } })+ .subjectAltNames?.message+ }+ shouldUnregister/>)}@@ -531,145 +631,165 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId })}/>- <AlgorithmSelectors- control={control}- availableSignatureAlgorithms={availableSignatureAlgorithms}- availableKeyAlgorithms={availableKeyAlgorithms}- signatureError={formState.errors.signatureAlgorithm?.message}- keyError={formState.errors.keyAlgorithm?.message}- />-- <Accordion type="single" collapsible className="w-full">- <KeyUsageSection- control={control}- title="Key Usages"- accordionValue="key-usages"- namePrefix="keyUsages"- options={filteredKeyUsages}- requiredUsages={constraints.requiredKeyUsages}- />- <KeyUsageSection- control={control}- title="Extended Key Usages"- accordionValue="extended-key-usages"- namePrefix="extendedKeyUsages"- options={filteredExtendedKeyUsages}- requiredUsages={constraints.requiredExtendedKeyUsages}- />- {constraints.templateAllowsCA && (- <AccordionItem value="basic-constraints">- <AccordionTrigger>Basic Constraints</AccordionTrigger>- <AccordionContent>- <div className="space-y-4 pl-2">- <Controller- control={control}- name="basicConstraints.isCA"- render={({ field: { value, onChange } }) => (- <div className="flex items-center gap-3">- <Checkbox- id="isCA"- isChecked={constraints.templateRequiresCA || value || false}- isDisabled={constraints.templateRequiresCA}- onCheckedChange={(checked) => {- if (!constraints.templateRequiresCA) {- onChange(checked);- if (!checked) {- setValue("basicConstraints.pathLength", undefined);- }- }- }}- />- <div className="space-y-1">- <FormLabel- id="isCA"- className="cursor-pointer text-sm font-medium text-mineshaft-100"- label="Issue as Certificate Authority"- />- <p className="text-xs text-bunker-300">- This certificate will be issued with the CA:TRUE extension- </p>- </div>- </div>- )}- />-- {watchedIsCA && (- <Controller- control={control}- name="basicConstraints.pathLength"- render={({ field, fieldState: { error } }) => {- const isPathLengthRequired =- typeof constraints.maxPathLength === "number" &&- constraints.maxPathLength !== -1;- return (- <FormControl- label={- <div>- <FormLabel- isRequired={isPathLengthRequired}- label="Path Length"- icon={- <Tooltip- content={- <div className="max-w-xs">- <p className="font-medium">Values:</p>- <ul className="mt-1 list-disc pl-4 text-xs">- <li>- <strong>Empty</strong> = Unlimited depth- </li>- <li>- <strong>0</strong> = Can only sign end-entity- certs- </li>- <li>- <strong>1+</strong> = CA levels allowed- beneath- </li>- </ul>- </div>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />- </Tooltip>+ {requestMethod === RequestMethod.MANAGED && (+ <>+ <AlgorithmSelectors+ control={control}+ availableSignatureAlgorithms={availableSignatureAlgorithms}+ availableKeyAlgorithms={availableKeyAlgorithms}+ signatureError={+ (formState.errors as { signatureAlgorithm?: { message?: string } })+ .signatureAlgorithm?.message+ }+ keyError={+ (formState.errors as { keyAlgorithm?: { message?: string } }).keyAlgorithm+ ?.message+ }+ shouldUnregister+ />++ <Accordion type="single" collapsible className="w-full">+ <KeyUsageSection+ control={control}+ title="Key Usages"+ accordionValue="key-usages"+ namePrefix="keyUsages"+ options={filteredKeyUsages}+ requiredUsages={constraints.requiredKeyUsages}+ shouldUnregister+ />+ <KeyUsageSection+ control={control}+ title="Extended Key Usages"+ accordionValue="extended-key-usages"+ namePrefix="extendedKeyUsages"+ options={filteredExtendedKeyUsages}+ requiredUsages={constraints.requiredExtendedKeyUsages}+ shouldUnregister+ />+ {constraints.templateAllowsCA && (+ <AccordionItem value="basic-constraints">+ <AccordionTrigger>Basic Constraints</AccordionTrigger>+ <AccordionContent>+ <div className="space-y-4 pl-2">+ <Controller+ control={control}+ name="basicConstraints.isCA"+ shouldUnregister+ render={({ field: { value, onChange } }) => (+ <div className="flex items-center gap-3">+ <Checkbox+ id="isCA"+ isChecked={constraints.templateRequiresCA || value || false}+ isDisabled={constraints.templateRequiresCA}+ onCheckedChange={(checked) => {+ if (!constraints.templateRequiresCA) {+ onChange(checked);+ if (!checked) {+ setValue("basicConstraints.pathLength", undefined);}- />- </div>- }- isError={Boolean(error)}- errorText={error?.message}- helperText="Sets the pathLen for this CA certificate. Controls how many levels of sub-CAs can exist below."- >- <Input- {...field}- type="number"- min={0}- placeholder={- isPathLengthRequired- ? "Enter path length (required)"- : "Leave empty for no constraint"- }- className="w-full"- value={field.value ?? ""}- onChange={(e) => {- const val = e.target.value;- if (val === "") {- field.onChange(undefined);- } else {- const numVal = parseInt(val, 10);- field.onChange(Number.isNaN(numVal) ? undefined : numVal);}}}/>- </FormControl>- );- }}- />- )}- </div>- </AccordionContent>- </AccordionItem>- )}- </Accordion>+ <div className="space-y-1">+ <FormLabel+ id="isCA"+ className="cursor-pointer text-sm font-medium text-mineshaft-100"+ label="Issue as Certificate Authority"+ />+ <p className="text-xs text-bunker-300">+ This certificate will be issued with the CA:TRUE extension+ </p>+ </div>+ </div>+ )}+ />++ {watchedIsCA && (+ <Controller+ control={control}+ name="basicConstraints.pathLength"+ shouldUnregister+ render={({ field, fieldState: { error } }) => {+ const isPathLengthRequired =+ typeof constraints.maxPathLength === "number" &&+ constraints.maxPathLength !== -1;+ return (+ <FormControl+ label={+ <div>+ <FormLabel+ isRequired={isPathLengthRequired}+ label="Path Length"+ icon={+ <Tooltip+ content={+ <div className="max-w-xs">+ <p className="font-medium">Values:</p>+ <ul className="mt-1 list-disc pl-4 text-xs">+ <li>+ <strong>Empty</strong> = Unlimited depth+ </li>+ <li>+ <strong>0</strong> = Can only sign+ end-entity certs+ </li>+ <li>+ <strong>1+</strong> = CA levels allowed+ beneath+ </li>+ </ul>+ </div>+ }+ >+ <FontAwesomeIcon+ icon={faQuestionCircle}+ size="sm"+ />+ </Tooltip>+ }+ />+ </div>+ }+ isError={Boolean(error)}+ errorText={error?.message}+ helperText="Sets the pathLen for this CA certificate. Controls how many levels of sub-CAs can exist below."+ >+ <Input+ {...field}+ type="number"+ min={0}+ placeholder={+ isPathLengthRequired+ ? "Enter path length (required)"+ : "Leave empty for no constraint"+ }+ className="w-full"+ value={field.value ?? ""}+ onChange={(e) => {+ const val = e.target.value;+ if (val === "") {+ field.onChange(undefined);+ } else {+ const numVal = parseInt(val, 10);+ field.onChange(+ Number.isNaN(numVal) ? undefined : numVal+ );+ }+ }}+ />+ </FormControl>+ );+ }}+ />+ )}+ </div>+ </AccordionContent>+ </AccordionItem>+ )}+ </Accordion>+ </>+ )}</>)}@@ -688,6 +808,7 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }variant="plain"onClick={() => {handlePopUpToggle("issueCertificate", false);+ resetAllState();}}>Canceldiff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/KeyUsageSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/KeyUsageSection.tsxindex 747c6c09fb..136cfe1c01 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/KeyUsageSection.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/KeyUsageSection.tsx@@ -20,6 +20,7 @@ type KeyUsageSectionProps = {namePrefix: "keyUsages" | "extendedKeyUsages";options: KeyUsageOption[];requiredUsages: string[];+ shouldUnregister?: boolean;};export const KeyUsageSection = ({@@ -28,7 +29,8 @@ export const KeyUsageSection = ({accordionValue,namePrefix,options,- requiredUsages+ requiredUsages,+ shouldUnregister}: KeyUsageSectionProps) => {if (options.length === 0) return null;@@ -44,6 +46,7 @@ export const KeyUsageSection = ({key={label}control={control}name={`${namePrefix}.${value}` as any}+ shouldUnregister={shouldUnregister}render={({ field }) => (<div className="flex items-center space-x-3"><Checkboxdiff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField.tsxindex da6427b283..1cd0c34961 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField.tsx@@ -11,12 +11,14 @@ type SubjectAltNamesFieldProps = {control: Control<any>;allowedSanTypes: CertSubjectAlternativeNameType[];error?: string;+ shouldUnregister?: boolean;};export const SubjectAltNamesField = ({control,allowedSanTypes,- error+ error,+ shouldUnregister}: SubjectAltNamesFieldProps) => {const sanTypeLabels = getSanTypeLabels();@@ -24,76 +26,80 @@ export const SubjectAltNamesField = ({<Controllercontrol={control}name="subjectAltNames"- render={({ field: { onChange, value } }) => (- <FormControl- label="Subject Alternative Names (SANs)"- errorText={error}- isError={Boolean(error)}- >- <div className="space-y-2">- {value.map((san: SubjectAltName, index: number) => (- // eslint-disable-next-line react/no-array-index-key- <div key={`subject-alt-name-${index}`} className="flex items-center gap-2">- <Select- value={san.type}- onValueChange={(newType) => {- const newValue = [...value];- newValue[index] = {- ...san,- type: newType as CertSubjectAlternativeNameType- };- onChange(newValue);- }}- className="w-24"- >- {allowedSanTypes.map((sanType) => (- <SelectItem key={sanType} value={sanType}>- {sanTypeLabels[sanType]}- </SelectItem>- ))}- </Select>- <Input- value={san.value}- onChange={(e) => {- const newValue = [...value];- newValue[index] = { ...san, value: e.target.value };- onChange(newValue);- }}- placeholder={getSanPlaceholder(san.type)}- className="flex-1"- />- <IconButton- ariaLabel="Remove SAN"- variant="plain"- size="sm"- onClick={() => {- const newValue = value.filter((_: any, i: number) => i !== index);- onChange(newValue);- }}- >- <FontAwesomeIcon icon={faTrash} />- </IconButton>- </div>- ))}- <Button- type="button"- variant="outline_bg"- size="xs"- leftIcon={<FontAwesomeIcon icon={faPlus} />}- onClick={() => {- const defaultType =- allowedSanTypes.length > 0- ? allowedSanTypes[0]- : CertSubjectAlternativeNameType.DNS_NAME;- onChange([...value, { type: defaultType, value: "" }]);- }}- className="w-full"- >- Add SAN- </Button>- </div>- </FormControl>- )}+ shouldUnregister={shouldUnregister}+ render={({ field: { onChange, value } }) => {+ const currentValues = value || [];+ return (+ <FormControl+ label="Subject Alternative Names (SANs)"+ errorText={error}+ isError={Boolean(error)}+ >+ <div className="space-y-2">+ {currentValues.map((san: SubjectAltName, index: number) => (+ // eslint-disable-next-line react/no-array-index-key+ <div key={`subject-alt-name-${index}`} className="flex items-center gap-2">+ <Select+ value={san.type}+ onValueChange={(newType) => {+ const newValue = [...currentValues];+ newValue[index] = {+ ...san,+ type: newType as CertSubjectAlternativeNameType+ };+ onChange(newValue);+ }}+ className="w-24"+ >+ {allowedSanTypes.map((sanType) => (+ <SelectItem key={sanType} value={sanType}>+ {sanTypeLabels[sanType]}+ </SelectItem>+ ))}+ </Select>+ <Input+ value={san.value}+ onChange={(e) => {+ const newValue = [...currentValues];+ newValue[index] = { ...san, value: e.target.value };+ onChange(newValue);+ }}+ placeholder={getSanPlaceholder(san.type)}+ className="flex-1"+ />+ <IconButton+ ariaLabel="Remove SAN"+ variant="plain"+ size="sm"+ onClick={() => {+ const newValue = currentValues.filter((_: any, i: number) => i !== index);+ onChange(newValue);+ }}+ >+ <FontAwesomeIcon icon={faTrash} />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline_bg"+ size="xs"+ leftIcon={<FontAwesomeIcon icon={faPlus} />}+ onClick={() => {+ const defaultType =+ allowedSanTypes.length > 0+ ? allowedSanTypes[0]+ : CertSubjectAlternativeNameType.DNS_NAME;+ onChange([...currentValues, { type: defaultType, value: "" }]);+ }}+ className="w-full"+ >+ Add SAN+ </Button>+ </div>+ </FormControl>+ );+ }}/>);};diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAttributesField.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAttributesField.tsxindex 8479ed88ae..1dfa8a4862 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAttributesField.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAttributesField.tsx@@ -43,17 +43,20 @@ type SubjectAttributesFieldProps = {control: Control<any>;allowedAttributeTypes: CertSubjectAttributeType[];error?: string;+ shouldUnregister?: boolean;};export const SubjectAttributesField = ({control,allowedAttributeTypes,- error+ error,+ shouldUnregister}: SubjectAttributesFieldProps) => {return (<Controllercontrol={control}name="subjectAttributes"+ shouldUnregister={shouldUnregister}render={({ field: { onChange, value } }) => {const currentValues = value || [];const usedTypes = currentValues.map((attr: SubjectAttribute) => attr.type);