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
Minor improvements
Carlos Monastyrskia553b73adf2a
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.tsindex 9797132ac5..d7b0e12afd 100644--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@ -3106,6 +3106,8 @@ interface CreateCa {caId: string;name: string;dn?: string;+ keySource?: string;+ hsmConnectorId?: string;};}diff --git a/backend/src/lib/csr/pkcs11-algorithm-map.ts b/backend/src/lib/csr/pkcs11-algorithm-map.tsindex cfd64147e0..9926374ded 100644--- a/backend/src/lib/csr/pkcs11-algorithm-map.ts+++ b/backend/src/lib/csr/pkcs11-algorithm-map.ts@@ -66,3 +66,9 @@ export const ecdsaRawRsToDer = (raw: Buffer): Buffer => {const seqBody = Buffer.concat([rTlv, sTlv]);return Buffer.concat([Buffer.from([0x30, seqBody.length]), seqBody]);};++export const bufferToArrayBuffer = (buf: Buffer): ArrayBuffer => {+ const ab = new ArrayBuffer(buf.length);+ new Uint8Array(ab).set(buf);+ return ab;+};diff --git a/backend/src/server/routes/v1/certificate-authority-routers/certificate-authority-endpoints.ts b/backend/src/server/routes/v1/certificate-authority-routers/certificate-authority-endpoints.tsindex f2d593359c..6e987a2a49 100644--- a/backend/src/server/routes/v1/certificate-authority-routers/certificate-authority-endpoints.ts+++ b/backend/src/server/routes/v1/certificate-authority-routers/certificate-authority-endpoints.ts@@ -142,7 +142,10 @@ export const registerCertificateAuthorityEndpoints = <},onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),handler: async (req) => {- const body = req.body as { projectId?: string };+ const body = req.body as {+ projectId?: string;+ configuration?: { keySource?: string; hsmConnectorId?: string };+ };const certificateAuthority = (await server.services.certificateAuthority.createCertificateAuthority({ ...req.body, projectId: body.projectId ?? req.internalCertManagerProjectId, type: caType },req.permission@@ -155,7 +158,9 @@ export const registerCertificateAuthorityEndpoints = <type: EventType.CREATE_CA,metadata: {name: certificateAuthority.name,- caId: certificateAuthority.id+ caId: certificateAuthority.id,+ keySource: body.configuration?.keySource,+ hsmConnectorId: body.configuration?.hsmConnectorId}}});diff --git a/backend/src/services/cert-manager-export/cert-manager-export-service.ts b/backend/src/services/cert-manager-export/cert-manager-export-service.tsindex 16b9404a36..c9b5fb6c9a 100644--- a/backend/src/services/cert-manager-export/cert-manager-export-service.ts+++ b/backend/src/services/cert-manager-export/cert-manager-export-service.ts@@ -187,7 +187,7 @@ export const certManagerExportServiceFactory = ({.map((ca) => ca.name).join(", ");throw new BadRequestError({- message: `Cannot export HSM-backed certificate authorities (${names}); their signing keys are bound to a project-scoped HSM connector. Remove them from the source project before exporting.`+ message: `Cannot export HSM-backed certificate authorities (${names}). Their signing keys live on an HSM reached through a connector that exists only in the source project, so they cannot be recreated in the destination. Delete these certificate authorities, then export again.`});}diff --git a/backend/src/services/certificate-authority/ca-signer.ts b/backend/src/services/certificate-authority/ca-signer.tsindex cb15526887..5e831d5664 100644--- a/backend/src/services/certificate-authority/ca-signer.ts+++ b/backend/src/services/certificate-authority/ca-signer.ts@@ -4,7 +4,7 @@ import { Certificate, CertificateList } from "@peculiar/asn1-x509";import * as x509 from "@peculiar/x509";import { crypto } from "@app/lib/crypto/cryptography";-import { ecdsaRawRsToDer } from "@app/lib/csr/pkcs11-algorithm-map";+import { bufferToArrayBuffer, ecdsaRawRsToDer } from "@app/lib/csr/pkcs11-algorithm-map";import { BadRequestError } from "@app/lib/errors";import { CertKeyAlgorithm } from "@app/services/certificate/certificate-types";import { HsmKeyAlgorithm } from "@app/services/signer/signer-enums";@@ -98,15 +98,6 @@ export const caKeyAlgorithmToHsmShape = (keyAlgorithm: CertKeyAlgorithm | string}};-export const caKeyAlgorithmToHsmKeyAlgorithm = (keyAlgorithm: CertKeyAlgorithm | string): HsmKeyAlgorithm =>- caKeyAlgorithmToHsmShape(keyAlgorithm).hsmKeyAlgorithm;--const bufferToArrayBuffer = (buf: Buffer): ArrayBuffer => {- const ab = new ArrayBuffer(buf.length);- new Uint8Array(ab).set(buf);- return ab;-};-export const buildLocalCaSigner = ({privateKey,publicKey,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 5f63f62c57..01e4abd709 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@@ -56,13 +56,7 @@ import { DEFAULT_CRL_VALIDITY_DAYS } from "../../certificate-common/certificate-import { validatePqcLicense } from "../../certificate-common/certificate-utils";import { TCertificateTemplateDALFactory } from "../../certificate-template/certificate-template-dal";import { validateCertificateDetailsAgainstTemplate } from "../../certificate-template/certificate-template-fns";-import {- buildHsmCaSigner,- buildLocalCaSigner,- caKeyAlgorithmToHsmKeyAlgorithm,- caKeyAlgorithmToHsmShape,- TCaSigner-} from "../ca-signer";+import { buildHsmCaSigner, buildLocalCaSigner, caKeyAlgorithmToHsmShape, TCaSigner } from "../ca-signer";import { TCaSigningConfigDALFactory } from "../ca-signing-config/ca-signing-config-dal";import { CaSigningConfigType } from "../ca-signing-config/ca-signing-config-enums";import { TCertificateAuthorityCertDALFactory } from "../certificate-authority-cert-dal";@@ -381,7 +375,7 @@ export const internalCertificateAuthorityServiceFactory = ({connectorId: dto.hsmConnectorId,projectId,keyLabel: `ca-${crypto.nativeCrypto.randomUUID()}`,- keyAlgorithm: caKeyAlgorithmToHsmKeyAlgorithm(keyAlgorithm)+ keyAlgorithm: shape.hsmKeyAlgorithm});hsmKey = generated;@@ -410,20 +404,79 @@ export const internalCertificateAuthorityServiceFactory = ({});}- const newCa = await certificateAuthorityDAL.transaction(async (tx) => {- let notBeforeDate: Date | undefined;- if (notAfter) {- notBeforeDate = notBefore ? new Date(notBefore) : new Date();- }-+ let notBeforeDate: Date | undefined;+ let notAfterDate: Date | undefined;+ if (notAfter) {+ notBeforeDate = notBefore ? new Date(notBefore) : new Date();// if undefined, set [notAfterDate] to 10 years from now- let notAfterDate: Date | undefined;- if (notAfter) {- notAfterDate = new Date(notAfter);+ notAfterDate = new Date(notAfter);+ }+ const serialNumber = createSerialNumber();++ const certificateManagerKmsId = await getProjectKmsCertificateKeyId({+ projectId,+ projectDAL,+ kmsService+ });+ const kmsEncryptor = await kmsService.encryptWithKmsKey({+ kmsId: certificateManagerKmsId+ });++ let encryptedPrivateKey: Buffer | undefined;+ if (!useHsm) {+ const localPrivateKey = (localKeys as CryptoKeyPair).privateKey;+ // https://nodejs.org/api/crypto.html#static-method-keyobjectfromkey+ let privateKeyDer: Buffer;+ if (isPqcCryptoKey(localPrivateKey)) {+ privateKeyDer = await exportPqcKeyToDer(localPrivateKey);+ } else {+ const skObj = crypto.nativeCrypto.KeyObject.from(localPrivateKey);+ privateKeyDer = skObj.export({ type: "pkcs8", format: "der" });}+ encryptedPrivateKey = (await kmsEncryptor({ plainText: privateKeyDer })).cipherTextBlob;+ }- const serialNumber = createSerialNumber();+ let rootCertMaterial: { encryptedCertificate: Buffer; encryptedCertificateChain: Buffer } | undefined;+ if (type === InternalCaType.ROOT && notAfter) {+ const cert = await caSigner.createCertificate({+ subject: dn,+ issuer: dn,+ serialNumber,+ notBefore: notBeforeDate,+ notAfter: notAfterDate,+ publicKey: caSigner.caPublicKey,+ extensions: [+ new x509.BasicConstraintsExtension(+ true,+ maxPathLength === -1 || maxPathLength === null ? undefined : maxPathLength,+ true+ ),+ new x509.KeyUsagesExtension(isPqcAlgorithm(keyAlgorithm) ? PQC_ROOT_CA_KEY_USAGES : ROOT_CA_KEY_USAGES, true),+ await x509.SubjectKeyIdentifierExtension.create(caSigner.caPublicKey)+ ]+ });+ rootCertMaterial = {+ encryptedCertificate: (await kmsEncryptor({ plainText: Buffer.from(new Uint8Array(cert.rawData)) }))+ .cipherTextBlob,+ encryptedCertificateChain: (await kmsEncryptor({ plainText: Buffer.alloc(0) })).cipherTextBlob+ };+ }++ const thisUpdate = new Date();+ const nextUpdate = new Date(thisUpdate);+ nextUpdate.setDate(nextUpdate.getDate() + DEFAULT_CRL_VALIDITY_DAYS);+ const crl = await caSigner.createCrl({+ issuer: dn,+ thisUpdate,+ nextUpdate,+ entries: []+ });+ const { cipherTextBlob: encryptedCrl } = await kmsEncryptor({+ plainText: Buffer.from(new Uint8Array(crl.rawData))+ });++ const newCa = await certificateAuthorityDAL.transaction(async (tx) => {const ca = await certificateAuthorityDAL.create({projectId,@@ -461,119 +514,42 @@ export const internalCertificateAuthorityServiceFactory = ({tx);- const certificateManagerKmsId = await getProjectKmsCertificateKeyId({- projectId,- projectDAL,- kmsService- });- const kmsEncryptor = await kmsService.encryptWithKmsKey({- kmsId: certificateManagerKmsId- });-- let caSecret;- if (useHsm && hsmKey) {- caSecret = await certificateAuthoritySecretDAL.create(- {- caId: ca.id,- keySource: CertKeySource.Hsm,- hsmConnectorId: dto.hsmConnectorId,- hsmKeyLabel: hsmKey.keyLabel,- hsmPublicKeySpki: hsmKey.publicKeySpkiDer- },- tx- );- } else {- const localPrivateKey = (localKeys as CryptoKeyPair).privateKey;- // https://nodejs.org/api/crypto.html#static-method-keyobjectfromkey- let privateKeyDer: Buffer;- if (isPqcCryptoKey(localPrivateKey)) {- privateKeyDer = await exportPqcKeyToDer(localPrivateKey);- } else {- const skObj = crypto.nativeCrypto.KeyObject.from(localPrivateKey);- privateKeyDer = skObj.export({ type: "pkcs8", format: "der" });- }-- const { cipherTextBlob: encryptedPrivateKey } = await kmsEncryptor({- plainText: privateKeyDer- });-- caSecret = await certificateAuthoritySecretDAL.create(- {- caId: ca.id,- keySource: CertKeySource.Infisical,- encryptedPrivateKey- },- tx- );- }-- if (type === InternalCaType.ROOT && notAfter) {- // note: create self-signed cert only applicable for root CA- const cert = await caSigner.createCertificate({- subject: dn,- issuer: dn,- serialNumber,- notBefore: notBeforeDate,- notAfter: notAfterDate,- publicKey: caSigner.caPublicKey,- extensions: [- new x509.BasicConstraintsExtension(- true,- maxPathLength === -1 || maxPathLength === null ? undefined : maxPathLength,- true- ),- new x509.KeyUsagesExtension(- isPqcAlgorithm(keyAlgorithm) ? PQC_ROOT_CA_KEY_USAGES : ROOT_CA_KEY_USAGES,- true- ),- await x509.SubjectKeyIdentifierExtension.create(caSigner.caPublicKey)- ]- });-- const { cipherTextBlob: encryptedCertificate } = await kmsEncryptor({- plainText: Buffer.from(new Uint8Array(cert.rawData))- });-- const { cipherTextBlob: encryptedCertificateChain } = await kmsEncryptor({- plainText: Buffer.alloc(0)- });-+ const caSecret =+ useHsm && hsmKey+ ? await certificateAuthoritySecretDAL.create(+ {+ caId: ca.id,+ keySource: CertKeySource.Hsm,+ hsmConnectorId: dto.hsmConnectorId,+ hsmKeyLabel: hsmKey.keyLabel,+ hsmPublicKeySpki: hsmKey.publicKeySpkiDer+ },+ tx+ )+ : await certificateAuthoritySecretDAL.create(+ {+ caId: ca.id,+ keySource: CertKeySource.Infisical,+ encryptedPrivateKey+ },+ tx+ );++ if (rootCertMaterial) {const caCert = await certificateAuthorityCertDAL.create({caId: ca.id,- encryptedCertificate,- encryptedCertificateChain,+ encryptedCertificate: rootCertMaterial.encryptedCertificate,+ encryptedCertificateChain: rootCertMaterial.encryptedCertificateChain,version: 1,caSecretId: caSecret.id},tx);- await internalCertificateAuthorityDAL.updateById(- internalCa.id,- {- activeCaCertId: caCert.id- },- tx- );+ await internalCertificateAuthorityDAL.updateById(internalCa.id, { activeCaCertId: caCert.id }, tx);}- // create empty CRL- const thisUpdate = new Date();- const nextUpdate = new Date(thisUpdate);- nextUpdate.setDate(nextUpdate.getDate() + DEFAULT_CRL_VALIDITY_DAYS);-- const crl = await caSigner.createCrl({- issuer: internalCa.dn,- thisUpdate,- nextUpdate,- entries: []- });-- const { cipherTextBlob: encryptedCrl } = await kmsEncryptor({- plainText: Buffer.from(new Uint8Array(crl.rawData))- });-await certificateAuthorityCrlDAL.create({caId: ca.id,diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsxindex 922efd4409..c38b9dcd42 100644--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx@@ -29,7 +29,6 @@ import { ProjectType } from "@app/hooks/api/projects/types";import { usePopUp } from "@app/hooks/usePopUp";import { CaInstallCertModal } from "../CertificateAuthoritiesPage/components/CaInstallCertModal";-import { CaModal } from "../CertificateAuthoritiesPage/components/CaModal";import {CaCertDetailsSection,CaCertificatesSection,@@ -74,7 +73,6 @@ const Page = () => {const { mutateAsync: deleteCa } = useDeleteCa();const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([- "ca","deleteCa","installCaCert","renewCa",@@ -204,7 +202,6 @@ const Page = () => {}</ProjectPermissionCan>)}- <CaModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} /><CaRenewalModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} /><CaInstallCertModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} /><CaGenerateRootCertModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaModal.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaModal.tsxdeleted file mode 100644index f4781df5c6..0000000000--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaModal.tsx+++ /dev/null@@ -1,594 +0,0 @@-import { useEffect } from "react";-import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { zodResolver } from "@hookform/resolvers/zod";-import { format } from "date-fns";-import { z } from "zod";--import { createNotification } from "@app/components/notifications";-import {- Button,- FormControl,- IconButton,- Input,- Modal,- ModalContent,- Select,- SelectItem,- Switch,- Tooltip- // DatePicker-} from "@app/components/v2";-import { Badge } from "@app/components/v3";-import { useProject, useSubscription } from "@app/context";-import {- CaStatus,- CaType,- InternalCaType,- MAX_DISTRIBUTION_POINT_URL_LENGTH,- MAX_INTERNAL_CA_DISTRIBUTION_POINT_URLS,- useCreateCa,- useGetCa,- useUpdateCa-} from "@app/hooks/api/ca";-import { certKeyAlgorithms, isPqcAlgorithm } from "@app/hooks/api/certificates/constants";-import { CertKeyAlgorithm } from "@app/hooks/api/certificates/enums";-import { UsePopUpState } from "@app/hooks/usePopUp";-import { slugSchema } from "@app/lib/schemas";--const isValidDate = (dateString: string) => {- const date = new Date(dateString);- return !Number.isNaN(date.getTime());-};--const getDateTenYearsFromToday = () => {- const date = new Date();- date.setFullYear(date.getFullYear() + 10);- return format(date, "yyyy-MM-dd");-};--const distributionPointUrlEntrySchema = z.object({- value: z- .string()- .trim()- .max(MAX_DISTRIBUTION_POINT_URL_LENGTH, "URL is too long")- .url("Must be a valid URL")- .refine((url) => /^https?:\/\//i.test(url), { message: "URL must use http:// or https://" })-});--const distributionPointUrlsSchema = z- .array(distributionPointUrlEntrySchema)- .max(- MAX_INTERNAL_CA_DISTRIBUTION_POINT_URLS,- `Up to ${MAX_INTERNAL_CA_DISTRIBUTION_POINT_URLS} URLs are allowed`- )- .superRefine((entries, ctx) => {- const seen = new Set<string>();- entries.forEach((entry, index) => {- const normalized = entry.value.trim().replace(/\/+$/, "").toLowerCase();- if (seen.has(normalized)) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- path: [index, "value"],- message: "Duplicate URL"- });- }- seen.add(normalized);- });- });--const schema = z- .object({- type: z.nativeEnum(CaType),- name: slugSchema({- field: "Name"- }),- status: z.nativeEnum(CaStatus),- configuration: z- .object({- type: z.enum([InternalCaType.ROOT, InternalCaType.INTERMEDIATE]),- organization: z.string(),- ou: z.string(),- country: z.string(),- province: z.string(),- locality: z.string(),- commonName: z.string(),- notAfter: z.string().trim().refine(isValidDate, { message: "Invalid date format" }),- maxPathLength: z.string(),- keyAlgorithm: z.nativeEnum(CertKeyAlgorithm),- crlDistributionPointUrls: distributionPointUrlsSchema.default([]),- disableManagedCrlDistributionPointUrl: z.boolean().default(false)- })- .required()- })- .required();--export type FormData = z.infer<typeof schema>;--type Props = {- popUp: UsePopUpState<["ca"]>;- handlePopUpToggle: (popUpName: keyof UsePopUpState<["ca"]>, state?: boolean) => void;-};--const caTypes = [- { label: "Root", value: InternalCaType.ROOT },- { label: "Intermediate", value: InternalCaType.INTERMEDIATE }-];--export const CaModal = ({ popUp, handlePopUpToggle }: Props) => {- const { currentProject } = useProject();- const { subscription } = useSubscription();- const { data: ca } = useGetCa({- caId: (popUp?.ca?.data as { caId: string })?.caId || "",- type: CaType.INTERNAL- });-- const { mutateAsync: createMutateAsync } = useCreateCa();- const { mutateAsync: updateMutateAsync } = useUpdateCa();-- const {- control,- handleSubmit,- reset,- formState: { isSubmitting },- watch- } = useForm<FormData>({- resolver: zodResolver(schema),- defaultValues: {- type: CaType.INTERNAL,- name: "",- status: CaStatus.ACTIVE,- configuration: {- type: InternalCaType.ROOT,- organization: "",- ou: "",- country: "",- province: "",- locality: "",- commonName: "",- notAfter: getDateTenYearsFromToday(),- maxPathLength: "-1",- keyAlgorithm: CertKeyAlgorithm.RSA_2048,- crlDistributionPointUrls: [],- disableManagedCrlDistributionPointUrl: false- }- }- });-- const caType = watch("configuration.type");-- const crlUrlsFieldArray = useFieldArray({- control,- name: "configuration.crlDistributionPointUrls"- });-- useEffect(() => {- if (ca && ca.type === CaType.INTERNAL) {- reset({- type: ca.type,- name: ca.name,- status: ca.status,- configuration: {- type: ca.configuration.type,- organization: ca.configuration.organization,- ou: ca.configuration.ou,- country: ca.configuration.country,- province: ca.configuration.province,- locality: ca.configuration.locality,- commonName: ca.configuration.commonName,- notAfter: ca.configuration.notAfter- ? format(new Date(ca.configuration.notAfter), "yyyy-MM-dd")- : "",- maxPathLength: ca.configuration.maxPathLength- ? String(ca.configuration.maxPathLength)- : "",- keyAlgorithm: Object.values(CertKeyAlgorithm).includes(- ca.configuration.keyAlgorithm as CertKeyAlgorithm- )- ? ca.configuration.keyAlgorithm- : CertKeyAlgorithm.RSA_2048,- crlDistributionPointUrls: (ca.configuration.crlDistributionPointUrls ?? []).map(- (value) => ({ value })- ),- disableManagedCrlDistributionPointUrl:- ca.configuration.disableManagedCrlDistributionPointUrl ?? false- }- });- } else {- reset({- type: CaType.INTERNAL,- name: "",- status: CaStatus.ACTIVE,- configuration: {- type: InternalCaType.ROOT,- organization: "",- ou: "",- country: "",- province: "",- locality: "",- commonName: "",- notAfter: getDateTenYearsFromToday(),- maxPathLength: "-1",- keyAlgorithm: CertKeyAlgorithm.RSA_2048,- crlDistributionPointUrls: [],- disableManagedCrlDistributionPointUrl: false- }- });- }- }, [ca]);-- const onFormSubmit = async ({ type, name, status, configuration }: FormData) => {- if (!currentProject?.slug) return;-- if (ca) {- // update- await updateMutateAsync({- id: ca.id,- name,- type: CaType.INTERNAL,- status- });- } else {- // create- await createMutateAsync({- name,- type,- status,- configuration: {- ...configuration,- maxPathLength: Number(configuration.maxPathLength),- crlDistributionPointUrls: configuration.crlDistributionPointUrls.map(({ value }) => value)- }- });- }-- reset();- handlePopUpToggle("ca", false);-- createNotification({- text: `Successfully ${ca ? "updated" : "created"} CA`,- type: "success"- });- };-- return (- <Modal- isOpen={popUp?.ca?.isOpen}- onOpenChange={(isOpen) => {- reset();- handlePopUpToggle("ca", isOpen);- }}- >- <ModalContent title={`${ca ? "View" : "Create"} Private CA`}>- <form onSubmit={handleSubmit(onFormSubmit)}>- {ca && (- <FormControl label="CA ID">- <Input value={ca.id} isDisabled className="bg-white/[0.07]" />- </FormControl>- )}- <Controller- control={control}- name="configuration.type"- defaultValue={InternalCaType.ROOT}- render={({ field: { onChange, ...field }, fieldState: { error } }) => (- <FormControl label="CA Type" errorText={error?.message} isError={Boolean(error)}>- <Select- defaultValue={field.value}- {...field}- onValueChange={(e) => onChange(e)}- className="w-full"- isDisabled={Boolean(ca)}- >- {caTypes.map(({ label, value }) => (- <SelectItem value={String(value || "")} key={label}>- {label}- </SelectItem>- ))}- </Select>- </FormControl>- )}- />- {caType === InternalCaType.ROOT && (- <>- {/* <Controller- name="notAfter"- control={control}- defaultValue={getDefaultNotAfterDate()}- render={({ field: { onChange, ...field }, fieldState: { error } }) => {- return (- <FormControl- label="Validity"- errorText={error?.message}- isError={Boolean(error)}- className="mr-4"- >- <DatePicker- value={field.value || undefined}- onChange={(date) => {- onChange(date);- setIsStartDatePickerOpen(false);- }}- popUpProps={{- open: isStartDatePickerOpen,- onOpenChange: setIsStartDatePickerOpen- }}- popUpContentProps={{}}- />- </FormControl>- );- }}- /> */}- <Controller- control={control}- defaultValue=""- name="configuration.notAfter"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Valid Until"- isError={Boolean(error)}- errorText={error?.message}- isRequired- >- <Input {...field} placeholder="YYYY-MM-DD" isDisabled={Boolean(ca)} />- </FormControl>- )}- />- <Controller- control={control}- name="configuration.maxPathLength"- defaultValue="-1"- render={({ field: { onChange, ...field }, fieldState: { error } }) => (- <FormControl- label="Path Length"- errorText={error?.message}- isError={Boolean(error)}- className="mt-4"- >- <Select- defaultValue={field.value}- {...field}- onValueChange={(e) => onChange(e)}- className="w-full"- isDisabled={Boolean(ca)}- >- {[-1, 0, 1, 2, 3, 4].map((value) => (- <SelectItem value={String(value)} key={`ca-path-length-${value}`}>- {`${value}`}- </SelectItem>- ))}- </Select>- </FormControl>- )}- />- </>- )}- <Controller- control={control}- name="configuration.keyAlgorithm"- defaultValue={CertKeyAlgorithm.RSA_2048}- render={({ field: { onChange, ...field }, fieldState: { error } }) => (- <FormControl- label="Key Algorithm"- errorText={error?.message}- isError={Boolean(error)}- >- <Select- defaultValue={field.value}- {...field}- onValueChange={(e) => onChange(e)}- className="w-full"- isDisabled={Boolean(ca)}- >- {certKeyAlgorithms.map(({ label, value }) => (- <SelectItem- value={String(value || "")}- key={label}- isDisabled={isPqcAlgorithm(value) && !subscription?.pkiPqc}- >- <div className="flex items-center gap-2">- {label}- {isPqcAlgorithm(value) && !subscription?.pkiPqc && (- <Badge variant="info">Enterprise</Badge>- )}- </div>- </SelectItem>- ))}- </Select>- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="name"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Name"- isError={Boolean(error)}- errorText={error?.message}- isRequired- >- <Input {...field} placeholder="my-internal-ca" isDisabled={Boolean(ca)} />- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="configuration.organization"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Organization (O)"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="Acme Corp" isDisabled={Boolean(ca)} />- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="configuration.ou"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Organization Unit (OU)"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="Engineering" isDisabled={Boolean(ca)} />- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="configuration.country"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Country Name (C)"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="United States (US)" isDisabled={Boolean(ca)} />- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="configuration.province"- render={({ field, fieldState: { error } }) => (- <FormControl- label="State or Province Name"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="California" isDisabled={Boolean(ca)} />- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="configuration.locality"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Locality Name"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="San Francisco" isDisabled={Boolean(ca)} />- </FormControl>- )}- />- <Controller- control={control}- defaultValue=""- name="configuration.commonName"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Common Name (CN)"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="Example CA" isDisabled={Boolean(ca)} />- </FormControl>- )}- />- {!ca && (- <>- <Controller- control={control}- name="configuration.disableManagedCrlDistributionPointUrl"- render={({ field: { value, onChange } }) => (- <FormControl>- <Switch- id="disableManagedCrlDistributionPointUrl"- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- thumbClassName="bg-mineshaft-800"- isChecked={value}- onCheckedChange={onChange}- >- Disable managed CRL URL- </Switch>- </FormControl>- )}- />- <FormControl- label="CRL Distribution Points"- helperText={`Backup CRL URLs embedded in issued certificates. Up to ${MAX_INTERNAL_CA_DISTRIBUTION_POINT_URLS}.`}- >- <div className="flex flex-col gap-2">- {crlUrlsFieldArray.fields.map((field, index) => (- <Controller- key={field.id}- control={control}- name={`configuration.crlDistributionPointUrls.${index}.value`}- render={({ field: inputField, fieldState: { error } }) => (- <div className="flex items-start gap-2">- <FormControl- isError={Boolean(error)}- errorText={error?.message}- className="mb-0 flex-1"- >- <Input- {...inputField}- placeholder="https://crl.example.com/internal-ca.crl"- />- </FormControl>- <Tooltip content="Remove URL" position="right">- <IconButton- ariaLabel="Remove URL"- colorSchema="danger"- variant="plain"- size="sm"- className="mt-1.5"- onClick={() => crlUrlsFieldArray.remove(index)}- >- <FontAwesomeIcon icon={faTrash} />- </IconButton>- </Tooltip>- </div>- )}- />- ))}- <Button- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- variant="outline_bg"- isDisabled={- crlUrlsFieldArray.fields.length >= MAX_INTERNAL_CA_DISTRIBUTION_POINT_URLS- }- onClick={() => crlUrlsFieldArray.append({ value: "" })}- >- Add URL- </Button>- </div>- </FormControl>- </>- )}- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {popUp?.ca?.data ? "Update" : "Create"}- </Button>- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("ca", false)}- >- Cancel- </Button>- </div>- </form>- </ModalContent>- </Modal>- );-};diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsxindex 1357a03dc8..daa9694d47 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx@@ -26,7 +26,6 @@ import { PkiDocsUrls } from "../../pki-docs-urls";import { CreateCaWizard } from "./CreateCaWizard/CreateCaWizard";import { CaCertModal } from "./CaCertModal";import { CaInstallCertModal } from "./CaInstallCertModal";-import { CaModal } from "./CaModal";import { CaTable } from "./CaTable";export const CaSection = () => {@@ -36,7 +35,6 @@ export const CaSection = () => {const [isCreateWizardOpen, setIsCreateWizardOpen] = useState(false);const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([- "ca","caCert","installCaCert","deleteCa",@@ -102,7 +100,6 @@ export const CaSection = () => {<CaTable handlePopUpOpen={handlePopUpOpen} /></CardContent><CreateCaWizard isOpen={isCreateWizardOpen} onOpenChange={setIsCreateWizardOpen} />- <CaModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} /><CaInstallCertModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} /><CaCertModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} /><DeleteActionModaldiff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsxindex 9376c76db8..32e47246b1 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx@@ -41,7 +41,7 @@ import { UsePopUpState } from "@app/hooks/usePopUp";type Props = {handlePopUpOpen: (- popUpName: keyof UsePopUpState<["installCaCert", "caCert", "ca", "deleteCa", "caStatus"]>,+ popUpName: keyof UsePopUpState<["installCaCert", "caCert", "deleteCa", "caStatus"]>,data?: {caId?: string;caName?: string;diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/BasicsStep.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/BasicsStep.tsxindex c909c1b25f..ab4fba1310 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/BasicsStep.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/BasicsStep.tsx@@ -1,4 +1,4 @@-import { Controller, useForm } from "react-hook-form";+import { Controller, UseFormReturn } from "react-hook-form";import {Field,@@ -19,7 +19,7 @@ import { InternalCaType } from "@app/hooks/api/ca/enums";import { CaWizardForm } from "./schemas";type Props = {- form: ReturnType<typeof useForm<CaWizardForm>>;+ form: UseFormReturn<CaWizardForm>;};export const BasicsStep = ({ form }: Props) => {diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/DistributionStep.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/DistributionStep.tsxindex 022f8d9b67..df5eb6cf09 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/DistributionStep.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/DistributionStep.tsx@@ -1,4 +1,4 @@-import { Controller, useFieldArray, useForm } from "react-hook-form";+import { Controller, useFieldArray, UseFormReturn } from "react-hook-form";import { PlusIcon, Trash2Icon } from "lucide-react";import {@@ -18,7 +18,7 @@ import { MAX_INTERNAL_CA_DISTRIBUTION_POINT_URLS } from "@app/hooks/api/ca";import { CaWizardForm } from "./schemas";type Props = {- form: ReturnType<typeof useForm<CaWizardForm>>;+ form: UseFormReturn<CaWizardForm>;};export const DistributionStep = ({ form }: Props) => {diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/KeyValidityStep.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/KeyValidityStep.tsxindex f3c383d1ce..0b73d467e9 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/KeyValidityStep.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/KeyValidityStep.tsx@@ -1,4 +1,4 @@-import { Controller, useForm } from "react-hook-form";+import { Controller, UseFormReturn } from "react-hook-form";import {Badge,@@ -30,7 +30,7 @@ import { CaWizardForm } from "./schemas";import { HSM_SUPPORTED_CA_KEY_ALGORITHMS, HsmConnectorOption } from "./types";type Props = {- form: ReturnType<typeof useForm<CaWizardForm>>;+ form: UseFormReturn<CaWizardForm>;hsmConnectorOptions: HsmConnectorOption[];isHsmConnectorsLoading: boolean;};diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/SubjectStep.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/SubjectStep.tsxindex bddc52f334..a21ae2fb43 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/SubjectStep.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/SubjectStep.tsx@@ -1,11 +1,11 @@-import { Controller, useForm } from "react-hook-form";+import { Controller, UseFormReturn } from "react-hook-form";import { Field, FieldContent, FieldError, FieldGroup, FieldLabel, Input } from "@app/components/v3";import { CaWizardForm } from "./schemas";type Props = {- form: ReturnType<typeof useForm<CaWizardForm>>;+ form: UseFormReturn<CaWizardForm>;};const SUBJECT_FIELDS: { name: keyof CaWizardForm; label: string; placeholder: string }[] = [diff --git a/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/HsmConnectorDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/HsmConnectorDetailsByIDPage.tsxindex 6f896f88e2..1a14b3078b 100644--- a/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/HsmConnectorDetailsByIDPage.tsx+++ b/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/HsmConnectorDetailsByIDPage.tsx@@ -17,7 +17,7 @@ import { ProjectType } from "@app/hooks/api/projects/types";import { DeleteHsmConnectorDialog } from "../SettingsPage/components/HsmConnectorsTab/DeleteHsmConnectorDialog";import { EditHsmConnectorSheet } from "../SettingsPage/components/HsmConnectorsTab/EditHsmConnectorSheet";-import { HsmConnectorLinkedCertsSection, HsmConnectorOverviewSection } from "./components";+import { HsmConnectorLinkedResourcesSection, HsmConnectorOverviewSection } from "./components";const Page = () => {const { currentProject } = useProject();@@ -105,7 +105,7 @@ const Page = () => {/></div><div className="flex flex-1 flex-col gap-y-5">- <HsmConnectorLinkedCertsSection connectorId={connector.id} />+ <HsmConnectorLinkedResourcesSection connectorId={connector.id} /></div></div>diff --git a/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/HsmConnectorLinkedCertsSection.tsx b/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/HsmConnectorLinkedResourcesSection.tsxsimilarity index 98%rename from frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/HsmConnectorLinkedCertsSection.tsxrename to frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/HsmConnectorLinkedResourcesSection.tsxindex 2008a5bb67..1151349b35 100644--- a/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/HsmConnectorLinkedCertsSection.tsx+++ b/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/HsmConnectorLinkedResourcesSection.tsx@@ -32,7 +32,7 @@ import { useListHsmConnectorLinkedResources } from "@app/hooks/api/hsmConnectorstype Props = { connectorId: string };-export const HsmConnectorLinkedCertsSection = ({ connectorId }: Props) => {+export const HsmConnectorLinkedResourcesSection = ({ connectorId }: Props) => {const [page, setPage] = useState(1);const [perPage, setPerPage] = useState(20);const { data, isPending } = useListHsmConnectorLinkedResources(connectorId, {diff --git a/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/index.ts b/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/index.tsindex fc880391f4..9aca07fea9 100644--- a/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/index.ts+++ b/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/index.ts@@ -1,2 +1,2 @@-export { HsmConnectorLinkedCertsSection } from "./HsmConnectorLinkedCertsSection";+export { HsmConnectorLinkedResourcesSection } from "./HsmConnectorLinkedResourcesSection";export { HsmConnectorOverviewSection } from "./HsmConnectorOverviewSection";