Skip to content

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

Address veria comment

Carlos Monastyrskicb4e42583d9e
diff --git a/backend/src/ee/services/pki-scep/pki-scep-service.ts b/backend/src/ee/services/pki-scep/pki-scep-service.ts
index 812a5ef9db..ab13e5069a 100644
--- a/backend/src/ee/services/pki-scep/pki-scep-service.ts
+++ b/backend/src/ee/services/pki-scep/pki-scep-service.ts
@@ -513,23 +513,47 @@ export const pkiScepServiceFactory = ({
});
}
- void logEnrollmentEvent({
- status: "success",
- issuedCertificateId: result.certificateId,
- issuedSerialNumber: result.serialNumber
- });
-
- // Notify the validator of the issued cert.
- await validationHandler
- .reportIssued?.({
+ const { issuedCertDer } = result;
+ const notifyIssued = () =>
+ validationHandler.reportIssued?.({
transactionId: parsed.transactionId,
csrDer,
- certificateDer: result.issuedCertDer,
+ certificateDer: issuedCertDer,
validationConnectionId: scepConfig.validationConnectionId
- })
- .catch((reportErr) =>
+ });
+
+ if (scepConfig.challengeType === ScepChallengeType.MICROSOFT_INTUNE) {
+ try {
+ await notifyIssued();
+ } catch (reportErr) {
+ logger.error(
+ reportErr,
+ `Failed to report SCEP issuance success to Intune [transactionId=${parsed.transactionId}]`
+ );
+ void logEnrollmentEvent({
+ status: "failure",
+ failReason: "Failed to notify Microsoft Intune of the issued certificate."
+ });
+
+ return buildCertRepFailure({
+ raCertDer,
+ raPrivateKeyDer,
+ transactionId: parsed.transactionId,
+ recipientNonce: parsed.senderNonce,
+ failInfo: ScepFailInfo.BadRequest
+ });
+ }
+ } else {
+ await notifyIssued()?.catch((reportErr) =>
logger.error(reportErr, `Failed to report SCEP issuance success [transactionId=${parsed.transactionId}]`)
);
+ }
+
+ void logEnrollmentEvent({
+ status: "success",
+ issuedCertificateId: result.certificateId,
+ issuedSerialNumber: result.serialNumber
+ });
return buildCertRepSuccess({
issuedCertDer: result.issuedCertDer,