Skip to content

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

Add missing refine checks to avoid setting skipEabBinding and skipDnsOwnershipVerification at the same time

Carlos Monastyrski6d64b67f85c3
diff --git a/backend/src/server/routes/v1/certificate-profiles-router.ts b/backend/src/server/routes/v1/certificate-profiles-router.ts
index 440497c0b2..da0385c5f6 100644
--- a/backend/src/server/routes/v1/certificate-profiles-router.ts
+++ b/backend/src/server/routes/v1/certificate-profiles-router.ts
@@ -493,6 +493,17 @@ export const registerCertificateProfilesRouter = async (
{
message: "Cannot have EST config with API enrollment type or API config with EST enrollment type."
}
+ )
+ .refine(
+ (data) => {
+ if (data.acmeConfig) {
+ return !(data.acmeConfig.skipEabBinding && data.acmeConfig.skipDnsOwnershipVerification);
+ }
+ return true;
+ },
+ {
+ message: "Cannot skip both External Account Binding (EAB) and DNS ownership verification at the same time."
+ }
),
response: {
200: z.object({
diff --git a/backend/src/services/certificate-profile/certificate-profile-schemas.ts b/backend/src/services/certificate-profile/certificate-profile-schemas.ts
index 48a990943b..49e0412f76 100644
--- a/backend/src/services/certificate-profile/certificate-profile-schemas.ts
+++ b/backend/src/services/certificate-profile/certificate-profile-schemas.ts
@@ -103,6 +103,18 @@ export const createCertificateProfileSchema = z
message: "ACME enrollment type cannot have EST or API configuration"
}
)
+ .refine(
+ (data) => {
+ if (data.enrollmentType === EnrollmentType.ACME && data.acmeConfig) {
+ return !(data.acmeConfig.skipEabBinding && data.acmeConfig.skipDnsOwnershipVerification);
+ }
+ return true;
+ },
+ {
+ message:
+ "Cannot skip both External Account Binding (EAB) and DNS ownership verification at the same time for security reasons"
+ }
+ )
.refine(
(data) => {
if (data.issuerType === IssuerType.CA) {
@@ -190,6 +202,18 @@ export const updateCertificateProfileSchema = z
message: "API enrollment type cannot have EST configuration"
}
)
+ .refine(
+ (data) => {
+ if (data.acmeConfig) {
+ return !(data.acmeConfig.skipEabBinding && data.acmeConfig.skipDnsOwnershipVerification);
+ }
+ return true;
+ },
+ {
+ message:
+ "Cannot skip both External Account Binding (EAB) and DNS ownership verification at the same time for security reasons"
+ }
+ )
.refine(
(data) => {
if (data.issuerType === IssuerType.SELF_SIGNED) {