Skip to content

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

Address PR comments

Carlos Monastyrski47ab6cd31936
diff --git a/backend/src/server/routes/v1/certificate-router.ts b/backend/src/server/routes/v1/certificate-router.ts
index 760ed016fe..78bc7ba437 100644
--- a/backend/src/server/routes/v1/certificate-router.ts
+++ b/backend/src/server/routes/v1/certificate-router.ts
@@ -148,7 +148,7 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {
country: subjectAttributeField.nullish(),
state: subjectAttributeField.nullish(),
locality: subjectAttributeField.nullish(),
- domainComponents: z.array(domainComponentSchema).optional(),
+ domainComponents: z.array(domainComponentSchema).nullish(),
keyUsages: z.nativeEnum(CertKeyUsageType).array().optional(),
extendedKeyUsages: z.nativeEnum(CertExtendedKeyUsageType).array().optional(),
altNames: z
diff --git a/backend/src/services/certificate-common/certificate-csr-utils.ts b/backend/src/services/certificate-common/certificate-csr-utils.ts
index 89867c47f7..722f33f3ba 100644
--- a/backend/src/services/certificate-common/certificate-csr-utils.ts
+++ b/backend/src/services/certificate-common/certificate-csr-utils.ts
@@ -110,7 +110,7 @@ export const buildSubjectOverrideForCsr = (
csr: string,
request: Pick<
TCertificateRequest,
- "commonName" | "organization" | "organizationalUnit" | "country" | "state" | "locality"
+ "commonName" | "organization" | "organizationalUnit" | "country" | "state" | "locality" | "domainComponents"
>
): string => {
const csrSubject = extractDnParts(new x509.Pkcs10CertificateRequest(csr).subjectName);
@@ -122,7 +122,7 @@ export const buildSubjectOverrideForCsr = (
country: csrSubject.country ?? request.country,
province: csrSubject.province ?? request.state,
locality: csrSubject.locality ?? request.locality,
- domainComponents: csrSubject.domainComponents
+ domainComponents: csrSubject.domainComponents ?? request.domainComponents
});
};
diff --git a/backend/src/services/certificate-v3/certificate-approval-fns.ts b/backend/src/services/certificate-v3/certificate-approval-fns.ts
index 8ef4c1529e..10b2cc006f 100644
--- a/backend/src/services/certificate-v3/certificate-approval-fns.ts
+++ b/backend/src/services/certificate-v3/certificate-approval-fns.ts
@@ -523,7 +523,8 @@ export const certificateApprovalServiceFactory = (
organizationalUnit: reconstructedRequest.organizationalUnit,
country: reconstructedRequest.country,
state: reconstructedRequest.state,
- locality: reconstructedRequest.locality
+ locality: reconstructedRequest.locality,
+ domainComponents: reconstructedRequest.domainComponents
});
const { certificate, certificateChain, issuingCaCertificate, serialNumber, cert } =
diff --git a/backend/src/services/certificate-v3/certificate-v3-service.ts b/backend/src/services/certificate-v3/certificate-v3-service.ts
index a6a2edd0ed..d80785ff48 100644
--- a/backend/src/services/certificate-v3/certificate-v3-service.ts
+++ b/backend/src/services/certificate-v3/certificate-v3-service.ts
@@ -1767,7 +1767,8 @@ export const certificateV3ServiceFactory = ({
organizationalUnit: certificateRequest.organizationalUnit,
country: certificateRequest.country,
state: certificateRequest.state,
- locality: certificateRequest.locality
+ locality: certificateRequest.locality,
+ domainComponents: certificateRequest.domainComponents
});
const { certificate, certificateChain, issuingCaCertificate, serialNumber, cert, certificateRequestId } =
diff --git a/docs/documentation/platform/pki/settings/policies.mdx b/docs/documentation/platform/pki/settings/policies.mdx
index 7de908dd4b..f93b53a768 100644
--- a/docs/documentation/platform/pki/settings/policies.mdx
+++ b/docs/documentation/platform/pki/settings/policies.mdx
@@ -76,12 +76,11 @@ For each attribute, configure enforcement:
</AccordionGroup>
<Note>
- Domain Component (DC) is matched independently from the Common Name. A subject can carry more than
- one domain component (for example `CN=host, DC=auth, DC=lucidgov, DC=app`), and each value is
- checked against the Domain Component rule individually, similar to Subject Alternative Names. To
- scope certificates to a domain, add a Common Name rule for the hostname and a separate Domain
- Component rule for the domain labels (for the example above, allow `auth`, `lucidgov`, and `app`,
- or a pattern such as `*`).
+ Domain Component (DC) support is for requests that use DC attributes explicitly. Each DC value is
+ matched independently against the Domain Component rule (like a Subject Alternative Name),
+ separately from the Common Name. A subject can carry more than one domain component (for example
+ `CN=host, DC=auth, DC=lucidgov, DC=app`), so allow the labels your requests use, such as `auth`,
+ `lucidgov`, and `app`, or a pattern like `*`.
</Note>
<Warning>