Skip to content

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

misc: addressed issue

Sheen Capadngan1dabd6c5c4b9
diff --git a/backend/src/services/certificate-authority/certificate-authority-fns.ts b/backend/src/services/certificate-authority/certificate-authority-fns.ts
index 52b032a4b7..541f5a0102 100644
--- a/backend/src/services/certificate-authority/certificate-authority-fns.ts
+++ b/backend/src/services/certificate-authority/certificate-authority-fns.ts
@@ -37,11 +37,13 @@ export const createDistinguishedName = (parts: TDNParts) => {
};
/**
- * Helper to get the first value of a DN attribute from an x509 Name object.
+ * Helper to get the last value of a DN attribute from an x509 Name object.
+ * Returns the last value for backward compatibility with the old parsing behavior
+ * which used loop assignment (last occurrence wins for multi-valued attributes).
*/
const getNameField = (name: x509.Name, field: string): string | undefined => {
const values = name.getField(field);
- return values.length > 0 ? values[0] : undefined;
+ return values.length > 0 ? values[values.length - 1] : undefined;
};
/**