Skip to content

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

Fix match logic

Fang-Pen Lind70fa8f40686
diff --git a/backend/src/ee/services/pki-acme/pki-acme-service.ts b/backend/src/ee/services/pki-acme/pki-acme-service.ts
index 7cc9ae6f1e..e3b366d5b4 100644
--- a/backend/src/ee/services/pki-acme/pki-acme-service.ts
+++ b/backend/src/ee/services/pki-acme/pki-acme-service.ts
@@ -680,15 +680,16 @@ export const pkiAcmeServiceFactory = ({
tx
))!;
const csrIdentifierValues = new Set(
- orderWithAuthorizations.authorizations
- .map((auth) => auth.identifierValue.toLowerCase())
+ (certificateRequest.subjectAlternativeNames ?? [])
+ .map((san) => san.value.toLowerCase())
.concat([certificateRequest.commonName!.toLowerCase()])
);
+ const expectedIdentifierValues = new Set(
+ orderWithAuthorizations.authorizations.map((auth) => auth.identifierValue.toLowerCase())
+ );
if (
- csrIdentifierValues.size !== orderWithAuthorizations.authorizations.length ||
- !orderWithAuthorizations.authorizations.every((auth) =>
- csrIdentifierValues.has(auth.identifierValue.toLowerCase())
- )
+ csrIdentifierValues.size != expectedIdentifierValues.size ||
+ !csrIdentifierValues.isSubsetOf(expectedIdentifierValues)
) {
throw new AcmeBadCSRError({ detail: "Invalid CSR: Common name + SANs mismatch with order identifiers" });
}