Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Fix KID match
Fang-Pen Lin5256b11402cd
diff --git a/backend/src/ee/services/pki-acme/pki-acme-service.ts b/backend/src/ee/services/pki-acme/pki-acme-service.tsindex 498537c82a..cc3df7ce77 100644--- a/backend/src/ee/services/pki-acme/pki-acme-service.ts+++ b/backend/src/ee/services/pki-acme/pki-acme-service.ts@@ -339,10 +339,15 @@ export const pkiAcmeServiceFactory = ({externalAccountBinding,eabSecret);- const eabAlg = eabProtectedHeader!.alg!;- if (!["HS256", "HS384", "HS512"].includes(eabAlg)) {+ const { alg: eabAlg, kid: eabKid } = eabProtectedHeader!;+ if (!["HS256", "HS384", "HS512"].includes(eabAlg!)) {throw new AcmeMalformedError({ detail: "Invalid algorithm for external account binding JWS payload" });}+ // Make sure the KID in the EAB payload matches the profile ID+ if (eabKid !== profile.id) {+ throw new UnauthorizedError({ message: "External account binding KID mismatch" });+ }+// Make sure the URL matches the expected URLconst url = eabProtectedHeader!.url!;if (url !== buildUrl(profile.id, "/new-account")) {@@ -359,10 +364,6 @@ export const pkiAcmeServiceFactory = ({message: "External account binding public key thumbprint or algorithm mismatch"});}- // Make sure the KID in the EAB payload matches the profile ID- if ((eabPayload as unknown as { kid: string }).kid !== profile.id) {- throw new UnauthorizedError({ message: "External account binding KID mismatch" });- }} catch (error) {if (error instanceof errors.JWSInvalid) {throw new AcmeMalformedError({ detail: "Invalid external account binding JWS payload" });