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): enable OCSP by default on new certificate authorities for plans that include it
Carlos Monastyrski6a0bf2c7ca8a
diff --git a/backend/src/services/certificate-authority/internal/internal-certificate-authority-schemas.ts b/backend/src/services/certificate-authority/internal/internal-certificate-authority-schemas.tsindex 2f79a7818c..7076b737ed 100644--- a/backend/src/services/certificate-authority/internal/internal-certificate-authority-schemas.ts+++ b/backend/src/services/certificate-authority/internal/internal-certificate-authority-schemas.ts@@ -84,11 +84,7 @@ export const InternalCertificateAuthorityConfigurationSchema = z.optional().default(false).describe(CertificateAuthorities.CONFIGURATIONS.INTERNAL.disableManagedCrlDistributionPointUrl),- isOcspEnabled: z- .boolean()- .optional()- .default(false)- .describe(CertificateAuthorities.CONFIGURATIONS.INTERNAL.isOcspEnabled)+ isOcspEnabled: z.boolean().optional().describe(CertificateAuthorities.CONFIGURATIONS.INTERNAL.isOcspEnabled)}).refine((data) => {diff --git a/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts b/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.tsindex ac843d5bdb..1bdfa5a2a3 100644--- a/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts+++ b/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts@@ -386,15 +386,16 @@ export const internalCertificateAuthorityServiceFactory = ({});}- if (isOcspEnabled) {- if (!(await $isOcspAllowed(projectId))) {- throw new BadRequestError({- message:- "Failed to create certificate authority with OCSP enabled due to plan restriction. Upgrade plan to use OCSP."- });- }+ const isOcspAllowed = await $isOcspAllowed(projectId);+ if (isOcspEnabled && !isOcspAllowed) {+ throw new BadRequestError({+ message:+ "Failed to create certificate authority with OCSP enabled due to plan restriction. Upgrade plan to use OCSP."+ });}+ const resolvedIsOcspEnabled = isOcspEnabled ?? isOcspAllowed;+const dn = createDistinguishedName({commonName,organization,@@ -598,7 +599,7 @@ export const internalCertificateAuthorityServiceFactory = ({keyAlgorithm,crlDistributionPointUrls: crlDistributionPointUrls ?? [],disableManagedCrlDistributionPointUrl: disableManagedCrlDistributionPointUrl ?? false,- isOcspEnabled: isOcspEnabled ?? false,+ isOcspEnabled: resolvedIsOcspEnabled,...(type === InternalCaType.ROOT && {maxPathLength,...(notAfter && {diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/CreateCaWizard.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/CreateCaWizard.tsxindex 1dd8f9f02c..3749625b7f 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/CreateCaWizard.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/CreateCaWizard.tsx@@ -56,6 +56,7 @@ const DEFAULT_VALUES: CaWizardForm = {keyAlgorithm: CertKeyAlgorithm.ECDSA_P256,notAfter: getDateTenYearsFromToday(),maxPathLength: "-1",+ isOcspEnabled: false,disableManagedCrlDistributionPointUrl: false,crlDistributionPointUrls: []};@@ -81,14 +82,19 @@ export const CreateCaWizard = ({ isOpen, onOpenChange }: Props) => {[hsmConnectors]);+ const buildDefaultValues = (): CaWizardForm => ({+ ...DEFAULT_VALUES,+ isOcspEnabled: Boolean(subscription?.pkiOcsp)+ });+const form = useForm<CaWizardForm>({resolver: zodResolver(caWizardSchema),- defaultValues: DEFAULT_VALUES+ defaultValues: buildDefaultValues()});const reset = () => {setStep(0);- form.reset(DEFAULT_VALUES);+ form.reset(buildDefaultValues());};const handleClose = (open: boolean) => {@@ -121,7 +127,8 @@ export const CreateCaWizard = ({ isOpen, onOpenChange }: Props) => {maxPathLength: Number(values.maxPathLength),...(isRoot ? { notAfter: values.notAfter } : {}),crlDistributionPointUrls: values.crlDistributionPointUrls.map(({ value }) => value),- disableManagedCrlDistributionPointUrl: values.disableManagedCrlDistributionPointUrl+ disableManagedCrlDistributionPointUrl: values.disableManagedCrlDistributionPointUrl,+ isOcspEnabled: values.isOcspEnabled}});diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/DistributionStep.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/DistributionStep.tsxindex 4c68e5d431..d43826da7e 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/DistributionStep.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/DistributionStep.tsx@@ -2,6 +2,7 @@ import { Controller, useFieldArray, UseFormReturn } from "react-hook-form";import { PlusIcon, Trash2Icon } from "lucide-react";import {+ Badge,Button,Field,FieldContent,@@ -11,7 +12,10 @@ import {FieldLabel,IconButton,Input,- Toggle+ Toggle,+ Tooltip,+ TooltipContent,+ TooltipTrigger} from "@app/components/v3";import { useSubscription } from "@app/context";import { MAX_INTERNAL_CA_DISTRIBUTION_POINT_URLS } from "@app/hooks/api/ca";@@ -28,9 +32,44 @@ export const DistributionStep = ({ form }: Props) => {// Creating a CA with any custom URL is refused by the plan gate, so the control is disabled// up front rather than failing at the end of the wizard.const canAddCrlUrls = subscription.caCrl;+ const canUseOcsp = Boolean(subscription.pkiOcsp);return (<FieldGroup>+ <Controller+ name="isOcspEnabled"+ control={form.control}+ render={({ field: { value, onChange } }) => (+ <Field orientation="horizontal">+ <FieldContent>+ <FieldLabel>+ Enable OCSP+ {!canUseOcsp && (+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="info">Enterprise</Badge>+ </TooltipTrigger>+ <TooltipContent className="max-w-xs">+ OCSP is available on Infisical's Enterprise plan.+ </TooltipContent>+ </Tooltip>+ )}+ </FieldLabel>+ <FieldDescription>+ Certificates issued by this CA carry an OCSP responder URL, and that responder+ answers revocation status checks for them.+ </FieldDescription>+ </FieldContent>+ <Toggle+ variant="project"+ checked={value}+ onCheckedChange={onChange}+ disabled={!canUseOcsp}+ />+ </Field>+ )}+ />+<Controllername="disableManagedCrlDistributionPointUrl"control={form.control}diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/schemas.ts b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/schemas.tsindex 6b587ecc44..4ea0d67333 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/schemas.ts+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/schemas.ts@@ -58,6 +58,7 @@ export const caWizardSchema = zkeyAlgorithm: z.nativeEnum(CertKeyAlgorithm).default(CertKeyAlgorithm.ECDSA_P256),notAfter: z.string().trim().default(""),maxPathLength: z.string().default("-1"),+ isOcspEnabled: z.boolean().default(false),disableManagedCrlDistributionPointUrl: z.boolean().default(false),crlDistributionPointUrls: distributionPointUrlsSchema.default([])})diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/types.ts b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/types.tsindex c0a0e72daa..660a2b2e96 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/types.ts+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/types.ts@@ -56,10 +56,10 @@ export const STEPS: WizardStep[] = [name: "Distribution",shortDescription: "Revocation endpoints",title: "Distribution",- subtitle: "Configure the CRL distribution points embedded in issued certificates.",+ subtitle: "Configure how clients check whether certificates from this CA are revoked.",rightLabel: "DISTRIBUTION",rightDescription:- "Certificates issued by this CA carry CRL Distribution Point URLs so clients can check revocation. The Infisical-managed CRL endpoint is included by default; add backup URLs or disable the managed one as needed.",+ "Certificates issued by this CA carry revocation endpoints so clients can check their status. OCSP answers for one certificate at a time, while a CRL lists every certificate this CA has revoked. The Infisical-managed CRL endpoint is included by default; add backup URLs or disable the managed one as needed.",docsUrl: PkiDocsUrls.ca.internal}];