Fix the compare logic, isSubsetOf seems like not available

This commit is contained in:
Fang-Pen Lin
2025-11-11 12:26:19 -08:00
parent d70fa8f406
commit 0593c71d43

View File

@@ -684,12 +684,11 @@ export const pkiAcmeServiceFactory = ({
.map((san) => san.value.toLowerCase())
.concat([certificateRequest.commonName!.toLowerCase()])
);
const expectedIdentifierValues = new Set(
orderWithAuthorizations.authorizations.map((auth) => auth.identifierValue.toLowerCase())
);
if (
csrIdentifierValues.size != expectedIdentifierValues.size ||
!csrIdentifierValues.isSubsetOf(expectedIdentifierValues)
csrIdentifierValues.size !== orderWithAuthorizations.authorizations.length ||
!orderWithAuthorizations.authorizations.every((auth) =>
csrIdentifierValues.has(auth.identifierValue.toLowerCase())
)
) {
throw new AcmeBadCSRError({ detail: "Invalid CSR: Common name + SANs mismatch with order identifiers" });
}