Skip to content

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

Address PR comments

Carlos Monastyrskic03efbe12c04
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index 4f3cb19928..1563f919ce 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -2951,6 +2951,7 @@ export const registerRoutes = async (
acmeEnrollmentConfigDAL,
scepEnrollmentConfigDAL,
appConnectionService,
+ approvalPolicyDAL,
certificateProfileDAL,
certificateAuthorityDAL,
certificateAuthoritySecretDAL,
diff --git a/backend/src/services/certificate-common/certificate-issuance-utils.ts b/backend/src/services/certificate-common/certificate-issuance-utils.ts
index b5f3049954..56ab540842 100644
--- a/backend/src/services/certificate-common/certificate-issuance-utils.ts
+++ b/backend/src/services/certificate-common/certificate-issuance-utils.ts
@@ -428,7 +428,7 @@ export const generateSelfSignedCertificate = async ({
message: `Unsupported Subject Alternative Name type: ${san.type as string}`
});
}
- return { type: generalNameType as "dns" | "ip" | "email" | "url" | "upn", value: san.value };
+ return { type: generalNameType, value: san.value };
}) || [],
false
)
diff --git a/backend/src/services/pki-application/pki-application-enrollment-service.ts b/backend/src/services/pki-application/pki-application-enrollment-service.ts
index 2b5cb76b27..554f02b835 100644
--- a/backend/src/services/pki-application/pki-application-enrollment-service.ts
+++ b/backend/src/services/pki-application/pki-application-enrollment-service.ts
@@ -19,6 +19,10 @@ import { BadRequestError, NotFoundError } from "@app/lib/errors";
import { TProjectPermission } from "@app/lib/types";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import { TAppConnectionServiceFactory } from "@app/services/app-connection/app-connection-service";
+import { TApprovalPolicyDALFactory } from "@app/services/approval-policy/approval-policy-dal";
+import { ApprovalPolicyType } from "@app/services/approval-policy/approval-policy-enums";
+import { APPROVAL_POLICY_FACTORY_MAP } from "@app/services/approval-policy/approval-policy-factory";
+import { TCertRequestPolicy } from "@app/services/approval-policy/cert-request/cert-request-policy-types";
import { TCertificateAuthorityCertDALFactory } from "@app/services/certificate-authority/certificate-authority-cert-dal";
import { TCertificateAuthorityDALFactory } from "@app/services/certificate-authority/certificate-authority-dal";
import { CaType } from "@app/services/certificate-authority/certificate-authority-enums";
@@ -107,6 +111,7 @@ type TPkiApplicationEnrollmentServiceFactoryDep = {
acmeEnrollmentConfigDAL: Pick<TAcmeEnrollmentConfigDALFactory, "create" | "updateById" | "deleteById" | "findById">;
scepEnrollmentConfigDAL: Pick<TScepEnrollmentConfigDALFactory, "create" | "updateById" | "deleteById" | "findById">;
appConnectionService: Pick<TAppConnectionServiceFactory, "validateAppConnectionUsageById">;
+ approvalPolicyDAL: Pick<TApprovalPolicyDALFactory, "findByProjectId">;
certificateProfileDAL: Pick<TCertificateProfileDALFactory, "findById">;
certificateAuthorityDAL: Pick<TCertificateAuthorityDALFactory, "findById" | "findByIdWithAssociatedCa">;
certificateAuthoritySecretDAL: Pick<TCertificateAuthoritySecretDALFactory, "findOne">;
@@ -130,6 +135,7 @@ export const pkiApplicationEnrollmentServiceFactory = ({
acmeEnrollmentConfigDAL,
scepEnrollmentConfigDAL,
appConnectionService,
+ approvalPolicyDAL,
certificateProfileDAL,
certificateAuthorityDAL,
certificateAuthoritySecretDAL,
@@ -720,6 +726,23 @@ export const pkiApplicationEnrollmentServiceFactory = ({
});
}
+ if (isIntune && profile) {
+ const certRequestApprovalFactory = APPROVAL_POLICY_FACTORY_MAP[ApprovalPolicyType.CertRequest](
+ ApprovalPolicyType.CertRequest
+ );
+ const matchedApprovalPolicy = (await certRequestApprovalFactory.matchPolicy(
+ approvalPolicyDAL as TApprovalPolicyDALFactory,
+ projectId,
+ { profileName: profile.slug, applicationId }
+ )) as TCertRequestPolicy | null;
+
+ if (matchedApprovalPolicy) {
+ throw new BadRequestError({
+ message: `Microsoft Intune validation cannot be used on this profile because the certificate request approval policy '${matchedApprovalPolicy.name}' applies to it. Requests that require approval cannot complete within a SCEP request. Remove this profile from the policy, or use a static or dynamic SCEP challenge instead.`
+ });
+ }
+ }
+
const { signRaWithCa } = await resolveScepRaSigning({
caId: profile?.caId,
requestedSignRaWithCa: config.signRaWithCa,
diff --git a/docs/documentation/platform/pki/guides/applications/microsoft-intune-scep.mdx b/docs/documentation/platform/pki/guides/applications/microsoft-intune-scep.mdx
index fede92a085..c2e747abc7 100644
--- a/docs/documentation/platform/pki/guides/applications/microsoft-intune-scep.mdx
+++ b/docs/documentation/platform/pki/guides/applications/microsoft-intune-scep.mdx
@@ -77,7 +77,7 @@ The request flow is: the device retrieves its profile from Intune, submits the S
Navigate to **Certificate Authorities**, open the CA behind your profile, and in the **CA Certificates** section select **Download CA Certificate**.
<Note>
- Infisical exports the certificate as `cert.pem`, and Intune's upload field expects a `.cer` extension. Rename it to `cert.cer` before uploading. No conversion is required, because a `.cer` file carries Base-64 encoded X.509 data, which is what `cert.pem` already contains.
+ Infisical exports the certificate as `cert.pem`. Intune's upload field expects a `.cer` extension, so rename the file to `cert.cer` before uploading it.
</Note>
![Downloading the CA certificate from Infisical](/images/platform/pki/integrations/microsoft-intune/infisical-download-ca-cert.png)
@@ -127,7 +127,7 @@ The request flow is: the device retrieves its profile from Intune, submits the S
Set the subject name format and subject alternative name to what your devices require, then complete the remaining fields.
- Intune treats the remaining settings in two different ways. Some travel to Infisical inside the device's request, while others are policy that Intune enforces on its own side and never transmits:
+ The remaining settings fall into two categories. Some reach Infisical in the device's certificate signing request and shape the certificate it issues. Intune never transmits the others and does not verify them against the certificate it receives, so Infisical supplies those values:
| Source of the issued value | Settings |
|----------------------------|----------|
@@ -135,13 +135,13 @@ The request flow is: the device retrieves its profile from Intune, submits the S
| The Infisical [certificate profile](/documentation/platform/pki/settings/profiles) | **Certificate validity period**, **Extended key usage** |
<Warning>
- **Define matching defaults on the Infisical certificate profile.** Set its TTL and extended key usages to the values configured here, so the issued certificates match the policy Intune enforces. A profile without a TTL falls back to 90 days, and one whose extended key usages are unset or empty issues certificates that carry none. Those values must also be permitted by the profile's [certificate policy](/documentation/platform/pki/settings/policies), which otherwise rejects issuance after Intune has already approved the challenge.
+ **Mirror these values on the Infisical certificate profile.** Intune reports the enrollment as successful without verifying the validity period or extended key usages of the certificate it receives, so any divergence from this profile passes silently. Configure the Infisical profile's TTL and extended key usages to match the values set here. A profile with no TTL defaults to 90 days, and a profile whose extended key usages are unset or empty issues certificates that carry none. The profile's [certificate policy](/documentation/platform/pki/settings/policies) must also permit these values, otherwise issuance fails after Intune has already validated the challenge.
</Warning>
![Intune SCEP certificate profile settings including the Infisical SCEP Server URL](/images/platform/pki/integrations/microsoft-intune/intune-scep-profile-settings.png)
<Note>
- Fields vary by platform. Windows profiles add **Hash algorithm** and **Key storage provider**. Apple profiles add **Deployment Channel**, which has to agree with **Certificate type**: Device Channel stores device certificates in the system keychain, User Channel stores user certificates in the user keychain, and under User Channel the certificate type can only be **User**. The channel cannot be changed after the profile is deployed.
+ The available fields vary by platform. **Certificate type** appears on every platform and determines whether the subject and subject alternative name may carry user attributes or only device attributes. **Key storage provider** applies to Windows, and **Hash algorithm** applies to Windows and Android. **Deployment Channel** determines which keychain stores the certificate: the Device Channel uses the system keychain and the User Channel uses the user keychain. On macOS, a profile assigned to the user channel supports only the **User** certificate type. Unlike the other fields, the deployment channel cannot be changed once the profile is deployed, so a different channel requires a new profile.
</Note>
</Step>
diff --git a/docs/documentation/platform/pki/settings/policies.mdx b/docs/documentation/platform/pki/settings/policies.mdx
index 5c1b5e51b5..bcfc8bc19e 100644
--- a/docs/documentation/platform/pki/settings/policies.mdx
+++ b/docs/documentation/platform/pki/settings/policies.mdx
@@ -109,6 +109,7 @@ Control which SANs can appear on certificates:
| IP | `10.0.0.0/8` | Internal services |
| Email | `*@example.com` | S/MIME certificates |
| URI | `spiffe://example.com/*` | SPIFFE identities |
+| UPN | `*@example.com` | Active Directory user authentication |
Each SAN rule specifies the type, a pattern (fixed or wildcard), and whether to **allow** or **deny** it.
@@ -160,6 +161,8 @@ Define higher-level intended uses:
| Code Signing | Software artifacts |
| Email Protection | S/MIME |
| OCSP Signing | OCSP responders |
+| Time Stamping | Trusted timestamps |
+| Any Extended Key Usage | Any purpose |
If you configure Extended Key Usages, only the usages listed in **Required** or **Allowed** are permitted. Leave Extended Key Usages unconfigured to allow any extended key usage.
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/CreatePolicyModal.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/CreatePolicyModal.tsx
index 3e2b135116..0401dff1f4 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/CreatePolicyModal.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/CreatePolicyModal.tsx
@@ -886,12 +886,14 @@ export const CreatePolicyModal = ({
<div className="grid grid-cols-2 gap-x-6 gap-y-3">
{options.map((usage) => (
<div key={usage} className="flex items-center justify-between gap-2">
- <span className="text-sm text-foreground">{formatter(usage as never)}</span>
+ <span className="text-sm leading-tight text-balance text-foreground">
+ {formatter(usage as never)}
+ </span>
<Select
value={policyOf(usage as never)}
onValueChange={(value) => onChange(usage as never, value as UsagePolicy)}
>
- <SelectTrigger className="w-28">
+ <SelectTrigger className="w-24 shrink-0">
<SelectValue />
</SelectTrigger>
<SelectContent position="popper">