Skip to content

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

Improve pathLength constraint error message

Carlos Monastyrski4b3d6c95a3dc
diff --git a/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts b/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts
index d53423c61a..cbe26773b7 100644
--- a/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts
+++ b/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts
@@ -168,7 +168,7 @@ export const internalCertificateAuthorityServiceFactory = ({
if (policyMaxPathLength !== undefined && policyMaxPathLength !== null && policyMaxPathLength !== -1) {
if (pathLength === undefined || pathLength === null) {
throw new BadRequestError({
- message: `Path length is required when issuing CA certificates. Policy allows maximum path length of ${policyMaxPathLength}.`
+ message: `Path length is required when issuing CA certificates because the policy only allows a maximum path length of ${policyMaxPathLength}.`
});
}
if (pathLength > policyMaxPathLength) {
diff --git a/backend/src/services/certificate-policy/certificate-policy-service.ts b/backend/src/services/certificate-policy/certificate-policy-service.ts
index 8fb023c422..84862ba5c6 100644
--- a/backend/src/services/certificate-policy/certificate-policy-service.ts
+++ b/backend/src/services/certificate-policy/certificate-policy-service.ts
@@ -624,7 +624,7 @@ export const certificatePolicyServiceFactory = ({
if (maxPathLength !== undefined && maxPathLength !== null && maxPathLength !== -1) {
if (request.basicConstraints?.pathLength === undefined || request.basicConstraints?.pathLength === null) {
errors.push(
- `Path length is required when issuing CA certificates. Policy allows maximum path length of ${maxPathLength}.`
+ `Path length is required when issuing CA certificates because the policy only allows a maximum path length of ${maxPathLength}.`
);
} else if (request.basicConstraints.pathLength > maxPathLength) {
errors.push(