Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Merge remote-tracking branch 'origin/main' into feat/PKI-281

Carlos Monastyrski3aab243503ef
diff --cc frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
index 89aff498ca,04b3ac88da..d952ae7a57
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
@@@ -1,28 -1,14 +1,30 @@@
-import { useEffect, useState } from "react";
+import { useCallback, useEffect, useState } from "react";
import { Controller, useForm } from "react-hook-form";
+ import { SingleValue } from "react-select";
import { faCheck, faCopy, faDownload } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { EyeIcon, EyeOffIcon, FileTextIcon, Plus, RotateCwIcon } from "lucide-react";
+import {
+ AlertTriangleIcon,
+ EyeIcon,
+ EyeOffIcon,
+ FileTextIcon,
+ Plus,
+ RotateCwIcon
+} from "lucide-react";
+ import { AppConnectionOption } from "@app/components/app-connections";
import { createNotification } from "@app/components/notifications";
-import { ConfirmActionModal, Spinner, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
+import { Spinner, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
Button,
Dialog,
DialogContent,
@@@ -829,16 -751,14 +841,18 @@@ const ScepPanel = (
profileId,
profileSlug,
enabled,
+ caType,
- initial
+ initial,
+ onCancelPending,
+ onDirtyChange
}: {
applicationId: string;
profileId: string;
profileSlug: string;
enabled: boolean;
+ caType: CaType;
+ onCancelPending: () => void;
+ onDirtyChange: (isDirty: boolean) => void;
initial: {
challengeType: ScepChallengeType;
includeCaCertInResponse: boolean;
@@@ -849,17 -769,14 +863,21 @@@
challengeEndpointUrl: string | null;
raCertificatePem: string;
raCertExpiresAt: string;
+ validationConnectionId: string | null;
+ signRaWithCa: boolean;
} | null;
}) => {
+ const { currentProject } = useProject();
const setMutation = useSetPkiApplicationScepEnrollment();
const clearMutation = useClearPkiApplicationScepEnrollment();
- const { control, handleSubmit, watch, reset, setValue } = useForm<{
+ const {
+ control,
+ handleSubmit,
+ watch,
+ reset,
++ setValue,
+ formState: { isDirty }
+ } = useForm<{
challengeType: ScepChallengeType;
challengePassword?: string;
includeCaCertInResponse: boolean;
@@@ -896,15 -821,42 +922,47 @@@
]);
const challengeType = watch("challengeType");
+ const isIntune = challengeType === ScepChallengeType.MICROSOFT_INTUNE;
+ const isScepConfigured = Boolean(initial);
+ const raCaSigningSupported = isScepRaCaSigningSupported(caType);
+
+ const { permission } = useProjectPermission();
+ const { popUp, handlePopUpToggle, handlePopUpOpen } = usePopUp(["addConnection"] as const);
+ const canCreateConnection = permission.can(
+ ProjectPermissionAppConnectionActions.Create,
+ ProjectPermissionSub.AppConnections
+ );
+
+ useEffect(() => {
+ if (isIntune && !isScepConfigured && raCaSigningSupported) setValue("signRaWithCa", true);
+ }, [isIntune, isScepConfigured, raCaSigningSupported, setValue]);
+
+ const { data: intuneConnections, isPending: isIntuneConnectionsLoading } =
+ useListAvailableAppConnections(AppConnection.MicrosoftIntune, currentProject.id, {
+ enabled: isIntune
+ });
+ useEffect(() => {
+ onDirtyChange(isDirty);
+ }, [isDirty, onDirtyChange]);
+
const onSave = handleSubmit(async (values) => {
try {
- await setMutation.mutateAsync({ applicationId, profileId, ...values });
+ const signRaWithCa = raCaSigningSupported && values.signRaWithCa;
+ const payload = isIntune
+ ? {
+ applicationId,
+ profileId,
+ challengeType: values.challengeType,
+ includeCaCertInResponse: values.includeCaCertInResponse,
+ // Cert-based renewal would bypass Intune's per-request validation, so it is always off.
+ allowCertBasedRenewal: false,
+ signRaWithCa,
+ validationConnectionId: values.validationConnectionId
+ }
+ : { applicationId, profileId, ...values, signRaWithCa, validationConnectionId: undefined };
+ await setMutation.mutateAsync(payload);
+ reset({ ...values, challengePassword: "" });
createNotification({ type: "success", text: "SCEP enrollment saved" });
} catch (err) {
createNotification({ type: "error", text: errorText(err, "Failed to save SCEP enrollment") });
@@@ -1096,31 -1145,48 +1251,53 @@@
/>
<Controller
control={control}
- name="allowCertBasedRenewal"
+ name="includeCaCertInResponse"
render={({ field }) => (
- <div className="flex items-start justify-between gap-4">
- <div>
- <FieldLabel>Include CA cert in response</FieldLabel>
- <p className="text-xs text-accent">
+ <Field orientation="horizontal">
+ <FieldContent>
- <Label>Allow cert-based renewal</Label>
++ <Label>Include CA cert in response</Label>
+ <FieldDescription>
- Let clients renew using their existing certificate as authentication.
+ Return the issuing CA certificate inline alongside the issued cert.
- </p>
- </div>
+ </FieldDescription>
+ </FieldContent>
<Switch
variant="project"
- id="scep-cert-renewal"
+ id="scep-include-ca"
checked={field.value}
onCheckedChange={field.onChange}
/>
- </div>
+ </Field>
)}
/>
+ {!isIntune && (
+ <Controller
+ control={control}
+ name="allowCertBasedRenewal"
+ render={({ field }) => (
- <div className="flex items-start justify-between gap-4">
- <div>
- <FieldLabel>Allow cert-based renewal</FieldLabel>
- <p className="text-xs text-accent">
++ <Field orientation="horizontal">
++ <FieldContent>
++ <Label>Allow cert-based renewal</Label>
++ <FieldDescription>
+ Let clients renew using their existing certificate as authentication.
- </p>
- </div>
++ </FieldDescription>
++ </FieldContent>
+ <Switch
+ variant="project"
+ id="scep-cert-renewal"
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
- </div>
++ </Field>
+ )}
+ />
+ )}
</SectionCard>
<div className="flex justify-end gap-2 pt-2">
+ {!enabled && (
+ <Button variant="outline" onClick={onCancelPending}>
+ Cancel
+ </Button>
+ )}
{enabled && (
<DisableEnrollmentButton
method="SCEP"
@@@ -1398,9 -1431,8 +1587,10 @@@ export const ConfigureEnrollmentModal
profileId={profileId}
profileSlug={profile?.profileSlug ?? ""}
enabled={Boolean(data?.scepConfigured)}
+ caType={data?.caType ?? CaType.INTERNAL}
initial={data?.scep ?? null}
+ onCancelPending={() => handleCancelPending("scep")}
+ onDirtyChange={(d) => handleDirtyChange("scep", d)}
/>
</TabPanel>
) : null}
diff --cc frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx
index 799d248a06,689c89f47e..5ae8cbd1f5
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx
@@@ -41,11 -29,12 +41,8 @@@ import { useGetCert } from "@app/hooks/
import { CaType } from "@app/hooks/api/ca";
import { useGetCertificatePolicyById } from "@app/hooks/api/certificatePolicies";
import { EnrollmentType, useListCertificateProfiles } from "@app/hooks/api/certificateProfiles";
- import {
- CertExtendedKeyUsage,
- CertificateRequestStatus,
- CertKeyUsage
- } from "@app/hooks/api/certificates/enums";
+ import { buildExtendedKeyUsageToggleSchema } from "@app/hooks/api/certificates/constants";
-import {
- CertExtendedKeyUsage,
- CertificateRequestStatus,
- CertKeyUsage
-} from "@app/hooks/api/certificates/enums";
++import { CertificateRequestStatus, CertKeyUsage } from "@app/hooks/api/certificates/enums";
import { useUnifiedCertificateIssuance } from "@app/hooks/api/certificates/mutations";
import { useListPkiApplicationProfiles } from "@app/hooks/api/pkiApplications";
import { UsePopUpState } from "@app/hooks/usePopUp";