Skip to content

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

Merge remote-tracking branch 'origin /main' into feat/PKI-161

Carlos Monastyrski344255a1f2b3
diff --cc backend/src/ee/services/audit-log/audit-log-types.ts
index ba5c6d008c,6e5fbb4ddd..c81eb54800
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@@ -6295,7 -6413,9 +6425,10 @@@ export type Event
| CertificateCleanupCompletedEvent
| ScepEnrollmentEvent
| ScepRenewalEvent
+ | ScepDynamicChallengeGeneratedEvent
| SecretValidationRuleCreateEvent
| SecretValidationRuleUpdateEvent
- | SecretValidationRuleDeleteEvent;
+ | SecretValidationRuleDeleteEvent
+ | CreateEmailDomainEvent
+ | VerifyEmailDomainEvent
+ | DeleteEmailDomainEvent;
diff --cc backend/src/server/plugins/auth/inject-identity.ts
index b8ccda18ec,857f941813..2974e784bc
--- a/backend/src/server/plugins/auth/inject-identity.ts
+++ b/backend/src/server/plugins/auth/inject-identity.ts
@@@ -150,7 -159,11 +159,10 @@@ export const injectIdentity = fp
return;
}
- if (req.url.includes(".well-known/est") || req.url.includes("/api/v3/auth/")) {
+ if (
+ req.url.includes(".well-known/est") ||
- req.url.includes("/scep/") ||
+ (req.url.includes("/api/v3/auth/") && !req.url.includes("/api/v3/auth/select-organization"))
+ ) {
return;
}
diff --cc frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
index d7b9e11531,2a3cc9f1ad..efb21cebe7
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
@@@ -122,431 -121,286 +122,306 @@@ const FORM_STEPS =
}
];
- const createSchema = z
- .object({
- slug: z
- .string()
- .trim()
- .min(1, "Profile slug is required")
- .max(255, "Profile slug must be less than 255 characters")
- .regex(
- /^[a-zA-Z0-9-_]+$/,
- "Profile slug must contain only letters, numbers, hyphens, and underscores"
- ),
- description: z
- .string()
- .trim()
- .max(1000, "Description must be less than 1000 characters")
- .optional(),
- enrollmentType: z.nativeEnum(EnrollmentType),
- issuerType: z.nativeEnum(IssuerType),
- certificateAuthorityId: z.string().nullable().optional(),
- certificatePolicyId: z.string().min(1, "Certificate Policy is required"),
- estConfig: z
- .object({
- disableBootstrapCaValidation: z.boolean().optional(),
- passphrase: z.string().min(1, "EST passphrase is required"),
- caChain: z.string().min(1, "EST CA chain is required").optional()
- })
- .refine(
- (data) => {
- if (!data.disableBootstrapCaValidation && !data.caChain) {
- return false;
+ const stripInactiveEnrollmentConfigs = (val: unknown) => {
+ const data = val as Record<string, unknown>;
+ return {
+ ...data,
+ estConfig: data.enrollmentType === EnrollmentType.EST ? data.estConfig : undefined,
+ apiConfig: data.enrollmentType === EnrollmentType.API ? data.apiConfig : undefined,
+ acmeConfig: data.enrollmentType === EnrollmentType.ACME ? data.acmeConfig : undefined,
+ scepConfig: data.enrollmentType === EnrollmentType.SCEP ? data.scepConfig : undefined
+ };
+ };
+
+ const createSchema = z.preprocess(
+ stripInactiveEnrollmentConfigs,
+ z
+ .object({
+ slug: z
+ .string()
+ .trim()
+ .min(1, "Profile slug is required")
+ .max(255, "Profile slug must be less than 255 characters")
+ .regex(
+ /^[a-zA-Z0-9-_]+$/,
+ "Profile slug must contain only letters, numbers, hyphens, and underscores"
+ ),
+ description: z
+ .string()
+ .trim()
+ .max(1000, "Description must be less than 1000 characters")
+ .optional(),
+ enrollmentType: z.nativeEnum(EnrollmentType),
+ issuerType: z.nativeEnum(IssuerType),
+ certificateAuthorityId: z.string().nullable().optional(),
+ certificatePolicyId: z.string().min(1, "Certificate Policy is required"),
+ estConfig: z
+ .object({
+ disableBootstrapCaValidation: z.boolean().optional(),
+ passphrase: z.string().min(1, "EST passphrase is required"),
+ caChain: z.string().min(1, "EST CA chain is required").optional()
+ })
+ .refine(
+ (data) => {
+ if (!data.disableBootstrapCaValidation && !data.caChain) {
+ return false;
+ }
+ return true;
+ },
+ {
+ message: "EST CA chain is required when bootstrap CA validation is enabled",
+ path: ["caChain"]
}
- return true;
- },
- {
- message: "EST CA chain is required when bootstrap CA validation is enabled",
- path: ["caChain"]
+ )
+ .optional(),
+ apiConfig: z
+ .object({
+ autoRenew: z.boolean().optional(),
+ renewBeforeDays: z.number().min(1).max(365).optional()
+ })
+ .optional(),
+ acmeConfig: z
+ .object({
+ skipDnsOwnershipVerification: z.boolean().optional(),
+ skipEabBinding: z.boolean().optional()
+ })
+ .optional(),
+ scepConfig: z
+ .object({
- challengePassword: z.string().min(8, "Challenge password must be at least 8 characters"),
++ challengeType: z.nativeEnum(ScepChallengeType).default(ScepChallengeType.STATIC),
++ challengePassword: z.string().optional(),
+ includeCaCertInResponse: z.boolean().optional(),
- allowCertBasedRenewal: z.boolean().optional()
++ allowCertBasedRenewal: z.boolean().optional(),
++ dynamicChallengeExpiryMinutes: z.number().min(1).max(1440).optional(),
++ dynamicChallengeMaxPending: z.number().min(1).max(1000).optional()
+ })
+ .optional(),
+ externalConfigs: z
+ .object({
+ template: z.string().min(1, "Azure ADCS template is required")
+ })
+ .optional(),
+ defaults: certificateDefaultsSchema
+ })
+ .refine(
+ (data) => {
+ if (data.enrollmentType === EnrollmentType.EST) {
+ return !!data.estConfig;
}
- )
- .optional(),
- apiConfig: z
- .object({
- autoRenew: z.boolean().optional(),
- renewBeforeDays: z.number().min(1).max(365).optional()
- })
- .optional(),
- acmeConfig: z
- .object({
- skipDnsOwnershipVerification: z.boolean().optional(),
- skipEabBinding: z.boolean().optional()
- })
- .optional(),
- scepConfig: z
- .object({
- challengeType: z.nativeEnum(ScepChallengeType).default(ScepChallengeType.STATIC),
- challengePassword: z.string().optional(),
- includeCaCertInResponse: z.boolean().optional(),
- allowCertBasedRenewal: z.boolean().optional(),
- dynamicChallengeExpiryMinutes: z.number().min(1).max(1440).optional(),
- dynamicChallengeMaxPending: z.number().min(1).max(1000).optional()
- })
- .optional(),
- externalConfigs: z
- .object({
- template: z.string().min(1, "Azure ADCS template is required")
- })
- .optional(),
- defaults: certificateDefaultsSchema
- })
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.EST) {
- return !!data.estConfig;
- }
- return true;
- },
- {
- message: "EST enrollment type requires EST configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.API) {
- return !!data.apiConfig;
- }
- return true;
- },
- {
- message: "API enrollment type requires API configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.ACME) {
- return !!data.acmeConfig;
- }
- return true;
- },
- {
- message: "ACME enrollment type requires ACME configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.SCEP) {
- return !!data.scepConfig;
- }
- return true;
- },
- {
- message: "SCEP enrollment type requires SCEP configuration"
- }
- )
- .refine(
- (data) => {
- if (
- data.enrollmentType === EnrollmentType.SCEP &&
- data.scepConfig &&
- data.scepConfig.challengeType !== ScepChallengeType.DYNAMIC &&
- (!data.scepConfig.challengePassword || data.scepConfig.challengePassword.length < 8)
- ) {
- return false;
- }
- return true;
- },
- {
- message: "Challenge password must be at least 8 characters for static challenges",
- path: ["scepConfig", "challengePassword"]
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.EST) {
- return !data.apiConfig && !data.acmeConfig && !data.scepConfig;
- }
- return true;
- },
- {
- message: "EST enrollment type cannot have API, ACME, or SCEP configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.API) {
- return !data.estConfig && !data.acmeConfig && !data.scepConfig;
- }
- return true;
- },
- {
- message: "API enrollment type cannot have EST, ACME, or SCEP configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.ACME) {
- return !data.estConfig && !data.apiConfig && !data.scepConfig;
+ return true;
+ },
+ {
+ message: "EST enrollment type requires EST configuration",
+ path: ["estConfig"]
}
- return true;
- },
- {
- message: "ACME enrollment type cannot have EST, API, or SCEP configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.SCEP) {
- return !data.estConfig && !data.apiConfig && !data.acmeConfig;
- }
- return true;
- },
- {
- message: "SCEP enrollment type cannot have EST, API, or ACME configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.ACME && data.acmeConfig) {
- return !(data.acmeConfig.skipEabBinding && data.acmeConfig.skipDnsOwnershipVerification);
- }
- return true;
- },
- {
- message: "Cannot skip both EAB and DNS ownership validation."
- }
- )
- .refine(
- (data) => {
- if (data.issuerType === IssuerType.CA) {
- return !!data.certificateAuthorityId;
- }
- return true;
- },
- {
- message: "CA issuer type requires a certificate authority"
- }
- )
- .refine(
- (data) => {
- if (data.issuerType === IssuerType.SELF_SIGNED) {
- return !data.certificateAuthorityId;
- }
- return true;
- },
- {
- message: "Self-signed issuer type cannot have a certificate authority"
- }
- )
- .refine(
- (data) => {
- if (data.issuerType === IssuerType.SELF_SIGNED) {
- return data.enrollmentType === EnrollmentType.API;
- }
- return true;
- },
- {
- message: "Self-signed issuer type only supports API enrollment"
- }
- );
-
- const editSchema = z
- .object({
- slug: z
- .string()
- .trim()
- .min(1, "Profile slug is required")
- .max(255, "Profile slug must be less than 255 characters")
- .regex(
- /^[a-zA-Z0-9-_]+$/,
- "Profile slug must contain only letters, numbers, hyphens, and underscores"
- ),
- description: z
- .string()
- .trim()
- .max(1000, "Description must be less than 1000 characters")
- .optional(),
- enrollmentType: z.nativeEnum(EnrollmentType),
- issuerType: z.nativeEnum(IssuerType),
- certificateAuthorityId: z.string().nullable().optional(),
- certificatePolicyId: z.string().optional(),
- estConfig: z
- .object({
- disableBootstrapCaValidation: z.boolean().optional(),
- passphrase: z.string().optional(),
- caChain: z.string().optional()
- })
- .optional(),
- apiConfig: z
- .object({
- autoRenew: z.boolean().optional(),
- renewBeforeDays: z.number().min(1).max(365).optional()
- })
- .optional(),
- acmeConfig: z
- .object({
- skipDnsOwnershipVerification: z.boolean().optional(),
- skipEabBinding: z.boolean().optional()
- })
- .optional(),
- scepConfig: z
- .object({
- challengeType: z.nativeEnum(ScepChallengeType).default(ScepChallengeType.STATIC),
- challengePassword: z.string().optional(),
- includeCaCertInResponse: z.boolean().optional(),
- allowCertBasedRenewal: z.boolean().optional(),
- dynamicChallengeExpiryMinutes: z.number().min(1).max(1440).optional(),
- dynamicChallengeMaxPending: z.number().min(1).max(1000).optional()
- })
- .optional(),
- externalConfigs: z
- .object({
- template: z.string().optional()
- })
- .optional(),
- defaults: certificateDefaultsSchema
- })
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.EST) {
- return !!data.estConfig;
- }
- return true;
- },
- {
- message: "EST enrollment type requires EST configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.API) {
- return !!data.apiConfig;
+ )
+ .refine(
+ (data) => {
+ if (data.enrollmentType === EnrollmentType.API) {
+ return !!data.apiConfig;
+ }
+ return true;
+ },
+ {
+ message: "API enrollment type requires API configuration",
+ path: ["apiConfig"]
}
- return true;
- },
- {
- message: "API enrollment type requires API configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.ACME) {
- return !!data.acmeConfig;
+ )
+ .refine(
+ (data) => {
+ if (data.enrollmentType === EnrollmentType.ACME) {
+ return !!data.acmeConfig;
+ }
+ return true;
+ },
+ {
+ message: "ACME enrollment type requires ACME configuration",
+ path: ["acmeConfig"]
}
- return true;
- },
- {
- message: "ACME enrollment type requires ACME configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.SCEP) {
- return !!data.scepConfig;
+ )
+ .refine(
+ (data) => {
+ if (data.enrollmentType === EnrollmentType.SCEP) {
+ return !!data.scepConfig;
+ }
+ return true;
+ },
+ {
+ message: "SCEP enrollment type requires SCEP configuration",
+ path: ["scepConfig"]
}
- return true;
- },
- {
- message: "SCEP enrollment type requires SCEP configuration"
- }
- )
- .refine(
- (data) => {
- if (
- data.enrollmentType === EnrollmentType.SCEP &&
- data.scepConfig &&
- data.scepConfig.challengeType !== ScepChallengeType.DYNAMIC &&
- data.scepConfig.challengePassword &&
- data.scepConfig.challengePassword.length > 0 &&
- data.scepConfig.challengePassword.length < 8
- ) {
- return false;
+ )
+ .refine(
+ (data) => {
+ if (data.enrollmentType === EnrollmentType.ACME && data.acmeConfig) {
+ return !(data.acmeConfig.skipEabBinding && data.acmeConfig.skipDnsOwnershipVerification);
+ }
+ return true;
+ },
+ {
+ message: "Cannot skip both EAB and DNS ownership validation.",
+ path: ["acmeConfig", "skipEabBinding"]
}
- return true;
- },
- {
- message: "Challenge password must be at least 8 characters for static challenges",
- path: ["scepConfig", "challengePassword"]
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.EST) {
- return !data.apiConfig && !data.acmeConfig && !data.scepConfig;
+ )
+ .refine(
+ (data) => {
+ if (data.issuerType === IssuerType.CA) {
+ return !!data.certificateAuthorityId;
+ }
+ return true;
+ },
+ {
+ message: "Certificate Authority is required",
+ path: ["certificateAuthorityId"]
}
- return true;
- },
- {
- message: "EST enrollment type cannot have API, ACME, or SCEP configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.API) {
- return !data.estConfig && !data.acmeConfig && !data.scepConfig;
+ )
+ .refine(
+ (data) => {
+ if (data.issuerType === IssuerType.SELF_SIGNED) {
+ return !data.certificateAuthorityId;
+ }
+ return true;
+ },
+ {
+ message: "Self-signed issuer type cannot have a certificate authority",
+ path: ["certificateAuthorityId"]
}
- return true;
- },
- {
- message: "API enrollment type cannot have EST, ACME, or SCEP configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.ACME) {
- return !data.estConfig && !data.apiConfig && !data.scepConfig;
+ )
+ .refine(
+ (data) => {
+ if (data.issuerType === IssuerType.SELF_SIGNED) {
+ return data.enrollmentType === EnrollmentType.API;
+ }
+ return true;
+ },
+ {
+ message: "Self-signed issuer type only supports API enrollment",
+ path: ["enrollmentType"]
}
- return true;
- },
- {
- message: "ACME enrollment type cannot have EST, API, or SCEP configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.SCEP) {
- return !data.estConfig && !data.apiConfig && !data.acmeConfig;
+ )
++ .refine(
++ (data) => {
++ if (
++ data.enrollmentType === EnrollmentType.SCEP &&
++ data.scepConfig &&
++ data.scepConfig.challengeType !== ScepChallengeType.DYNAMIC &&
++ (!data.scepConfig.challengePassword || data.scepConfig.challengePassword.length < 8)
++ ) {
++ return false;
++ }
++ return true;
++ },
++ {
++ message: "Challenge password must be at least 8 characters for static challenges",
++ path: ["scepConfig", "challengePassword"]
+ }
- return true;
- },
- {
- message: "SCEP enrollment type cannot have EST, API, or ACME configuration"
- }
- )
- .refine(
- (data) => {
- if (data.enrollmentType === EnrollmentType.ACME && data.acmeConfig) {
- return !(data.acmeConfig.skipEabBinding && data.acmeConfig.skipDnsOwnershipVerification);
++ )
+ );
+
+ const editSchema = z.preprocess(
+ stripInactiveEnrollmentConfigs,
+ z
+ .object({
+ slug: z
+ .string()
+ .trim()
+ .min(1, "Profile slug is required")
+ .max(255, "Profile slug must be less than 255 characters")
+ .regex(
+ /^[a-zA-Z0-9-_]+$/,
+ "Profile slug must contain only letters, numbers, hyphens, and underscores"
+ ),
+ description: z
+ .string()
+ .trim()
+ .max(1000, "Description must be less than 1000 characters")
+ .optional(),
+ enrollmentType: z.nativeEnum(EnrollmentType),
+ issuerType: z.nativeEnum(IssuerType),
+ certificateAuthorityId: z.string().nullable().optional(),
+ certificatePolicyId: z.string().optional(),
+ estConfig: z
+ .object({
+ disableBootstrapCaValidation: z.boolean().optional(),
+ passphrase: z.string().optional(),
+ caChain: z.string().optional()
+ })
+ .optional(),
+ apiConfig: z
+ .object({
+ autoRenew: z.boolean().optional(),
+ renewBeforeDays: z.number().min(1).max(365).optional()
+ })
+ .optional(),
+ acmeConfig: z
+ .object({
+ skipDnsOwnershipVerification: z.boolean().optional(),
+ skipEabBinding: z.boolean().optional()
+ })
+ .optional(),
+ scepConfig: z
+ .object({
+ challengePassword: z.string().min(8, "Challenge password must be at least 8 characters"),
+ includeCaCertInResponse: z.boolean().optional(),
+ allowCertBasedRenewal: z.boolean().optional()
+ })
+ .optional(),
+ externalConfigs: z
+ .object({
+ template: z.string().optional()
+ })
+ .optional(),
+ defaults: certificateDefaultsSchema
+ })
+ .refine(
+ (data) => {
+ if (data.enrollmentType === EnrollmentType.ACME && data.acmeConfig) {
+ return !(data.acmeConfig.skipEabBinding && data.acmeConfig.skipDnsOwnershipVerification);
+ }
+ return true;
+ },
+ {
+ message: "Cannot skip both EAB and DNS ownership validation.",
+ path: ["acmeConfig", "skipEabBinding"]
}
- return true;
- },
- {
- message: "Cannot skip both EAB and DNS ownership validation."
- }
- )
- .refine(
- (data) => {
- if (data.issuerType === IssuerType.CA) {
- return !!data.certificateAuthorityId;
+ )
+ .refine(
+ (data) => {
+ if (data.issuerType === IssuerType.CA) {
+ return !!data.certificateAuthorityId;
+ }
+ return true;
+ },
+ {
+ message: "Certificate Authority is required",
+ path: ["certificateAuthorityId"]
}
- return true;
- },
- {
- message: "CA issuer type requires a certificate authority"
- }
- )
- .refine(
- (data) => {
- if (data.issuerType === IssuerType.SELF_SIGNED) {
- return !data.certificateAuthorityId;
+ )
+ .refine(
+ (data) => {
+ if (data.issuerType === IssuerType.SELF_SIGNED) {
+ return !data.certificateAuthorityId;
+ }
+ return true;
+ },
+ {
+ message: "Self-signed issuer type cannot have a certificate authority",
+ path: ["certificateAuthorityId"]
}
- return true;
- },
- {
- message: "Self-signed issuer type cannot have a certificate authority"
- }
- )
- .refine(
- (data) => {
- if (data.issuerType === IssuerType.SELF_SIGNED) {
- return data.enrollmentType === EnrollmentType.API;
+ )
+ .refine(
+ (data) => {
+ if (data.issuerType === IssuerType.SELF_SIGNED) {
+ return data.enrollmentType === EnrollmentType.API;
+ }
+ return true;
+ },
+ {
+ message: "Self-signed issuer type only supports API enrollment",
+ path: ["enrollmentType"]
}
- return true;
- },
- {
- message: "Self-signed issuer type only supports API enrollment"
- }
- );
+ )
+ );
export type FormData = z.infer<typeof createSchema>;
@@@ -1456,18 -1245,11 +1279,14 @@@ export const CreateProfileModal = ({ is
skipDnsOwnershipVerification: false,
skipEabBinding: false
});
- setValue("scepConfig", undefined);
} else if (value === EnrollmentType.SCEP) {
- setValue("apiConfig", undefined);
- setValue("estConfig", undefined);
- setValue("acmeConfig", undefined);
setValue("scepConfig", {
+ challengeType: ScepChallengeType.STATIC,
challengePassword: "",
includeCaCertInResponse: true,
- allowCertBasedRenewal: true
+ allowCertBasedRenewal: true,
+ dynamicChallengeExpiryMinutes: 60,
+ dynamicChallengeMaxPending: 100
});
}
onChange(value);