Skip to content

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

Added missing EST cert request and approvals management

Carlos Monastyrski4e9fdb8851c2
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index d2efbacfbd..816463b38e 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -2333,16 +2333,15 @@ export const registerRoutes = async (
});
const certificateEstV3Service = certificateEstV3ServiceFactory({
- internalCertificateAuthorityService,
- certificatePolicyService,
- certificatePolicyDAL,
+ certificateV3Service,
certificateAuthorityDAL,
certificateAuthorityCertDAL,
projectDAL,
kmsService,
licenseService,
certificateProfileDAL,
- estEnrollmentConfigDAL
+ estEnrollmentConfigDAL,
+ certificatePolicyDAL
});
const acmeChallengeService = pkiAcmeChallengeServiceFactory({
diff --git a/backend/src/services/certificate-est-v3/certificate-est-v3-service.test.ts b/backend/src/services/certificate-est-v3/certificate-est-v3-service.test.ts
index b14016ab06..ea0df870bb 100644
--- a/backend/src/services/certificate-est-v3/certificate-est-v3-service.test.ts
+++ b/backend/src/services/certificate-est-v3/certificate-est-v3-service.test.ts
@@ -4,10 +4,10 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-explicit-any */
-/* eslint-disable no-bitwise */
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { BadRequestError, NotFoundError } from "@app/lib/errors";
+import { CertificateRequestStatus } from "@app/services/certificate-request/certificate-request-types";
import { EnrollmentType } from "../certificate-profile/certificate-profile-types";
import { certificateEstV3ServiceFactory, TCertificateEstV3ServiceFactory } from "./certificate-est-v3-service";
@@ -18,7 +18,9 @@ vi.mock("@peculiar/x509", () => ({
GeneralNames: vi.fn(),
KeyUsagesExtension: vi.fn(),
ExtendedKeyUsageExtension: vi.fn(),
- X509Certificate: vi.fn(),
+ X509Certificate: vi.fn().mockImplementation(() => ({
+ rawData: new ArrayBuffer(0)
+ })),
KeyUsageFlags: {
digitalSignature: 1,
nonRepudiation: 2,
@@ -32,117 +34,44 @@ vi.mock("@peculiar/x509", () => ({
}
}));
-// Mock other dependencies
-vi.mock("@app/services/certificate-authority/certificate-authority-fns", () => ({
- parseDistinguishedName: vi.fn((subject: string) => {
- const parts = subject.split(",");
- const result: any = {};
- parts.forEach((part) => {
- const [key, value] = part.split("=");
- switch (key.trim()) {
- case "CN":
- result.commonName = value;
- break;
- case "O":
- result.organization = value;
- break;
- case "OU":
- result.ou = value;
- break;
- case "L":
- result.locality = value;
- break;
- case "ST":
- result.province = value;
- break;
- case "C":
- result.country = value;
- break;
- default:
- break;
- }
- });
- return result;
- })
+vi.mock("@app/lib/certificates/extract-certificate", () => ({
+ extractX509CertFromChain: vi.fn(() => ["mock-cert"])
}));
-vi.mock("@app/services/certificate-authority/certificate-authority-validators", () => ({
- validateAndMapAltNameType: vi.fn((value: string) => {
- if (value.includes(".") && !value.match(/^\d+\.\d+\.\d+\.\d+$/)) {
- return { type: "dns", value };
- }
- if (value.match(/^\d+\.\d+\.\d+\.\d+$/)) {
- return { type: "ip", value };
- }
- return null;
- })
+vi.mock("@app/services/certificate/certificate-fns", () => ({
+ isCertChainValid: vi.fn(() => Promise.resolve(true))
}));
-vi.mock("@app/services/certificate/certificate-types", () => ({
- mapLegacyAltNameType: vi.fn((type: string) => {
- const mapping: Record<string, string> = {
- dns: "dns_name",
- ip: "ip_address",
- email: "rfc822_name",
- url: "uniform_resource_identifier"
- };
- return mapping[type] || type;
- }),
- TAltNameType: {
- EMAIL: "email",
- DNS: "dns",
- IP: "ip",
- URL: "url"
- },
- CertExtendedKeyUsageOIDToName: {
- "1.3.6.1.5.5.7.3.1": "serverAuth",
- "1.3.6.1.5.5.7.3.2": "clientAuth",
- "1.3.6.1.5.5.7.3.3": "codeSigning"
- },
- CertKeyUsage: {
- DIGITAL_SIGNATURE: "digitalSignature",
- KEY_ENCIPHERMENT: "keyEncipherment",
- KEY_CERT_SIGN: "keyCertSign",
- NON_REPUDIATION: "nonRepudiation",
- DATA_ENCIPHERMENT: "dataEncipherment",
- KEY_AGREEMENT: "keyAgreement",
- CRL_SIGN: "cRLSign",
- ENCIPHER_ONLY: "encipherOnly",
- DECIPHER_ONLY: "decipherOnly"
- },
- CertExtendedKeyUsage: {
- CLIENT_AUTH: "clientAuth",
- SERVER_AUTH: "serverAuth",
- CODE_SIGNING: "codeSigning"
- }
+vi.mock("@app/services/certificate-authority/certificate-authority-fns", () => ({
+ getCaCertChain: vi.fn(() =>
+ Promise.resolve({
+ caCert: "mock-ca-cert",
+ caCertChain: "mock-ca-chain"
+ })
+ ),
+ getCaCertChains: vi.fn(() =>
+ Promise.resolve([
+ {
+ certificate: "mock-cert",
+ certificateChain: "mock-chain"
+ }
+ ])
+ )
}));
-vi.mock("@app/services/certificate-common/certificate-utils", () => ({
- mapEnumsForValidation: vi.fn((req: any) => req)
+vi.mock("@app/services/project/project-fns", () => ({
+ getProjectKmsCertificateKeyId: vi.fn(() => Promise.resolve("mock-kms-id"))
}));
vi.mock("../../ee/services/certificate-est/certificate-est-fns", () => ({
convertRawCertsToPkcs7: vi.fn(() => "mocked-pkcs7-response")
}));
-describe("CertificateEstV3Service Security Fix", () => {
+describe("CertificateEstV3Service", () => {
let service: TCertificateEstV3ServiceFactory;
- const mockInternalCertificateAuthorityService = {
- signCertFromCa: vi.fn()
- };
-
- const mockCertificatePolicyService = {
- validateCertificateRequest: vi.fn()
- };
-
- const mockCertificatePolicyDAL = {
- findById: vi.fn().mockResolvedValue({
- id: "policy-123",
- basicConstraints: null,
- subject: [],
- sans: []
- })
+ const mockCertificateV3Service = {
+ signCertificateFromProfile: vi.fn()
};
const mockCertificateAuthorityDAL = {
@@ -162,7 +91,7 @@ describe("CertificateEstV3Service Security Fix", () => {
};
const mockKmsService = {
- decryptWithKmsKey: vi.fn(),
+ decryptWithKmsKey: vi.fn().mockResolvedValue(vi.fn(() => Promise.resolve(Buffer.from("mock-decrypted")))),
generateKmsKey: vi.fn()
};
@@ -178,6 +107,10 @@ describe("CertificateEstV3Service Security Fix", () => {
findById: vi.fn()
};
+ const mockCertificatePolicyDAL = {
+ findById: vi.fn()
+ };
+
const mockProfile = {
id: "profile-123",
projectId: "project-123",
@@ -193,7 +126,11 @@ describe("CertificateEstV3Service Security Fix", () => {
const mockEstConfig = {
id: "est-config-123",
- disableBootstrapCaValidation: true
+ disableBootstrapCaValidation: true,
+ encryptedCaChain: null,
+ hashedPassphrase: "hashed",
+ createdAt: new Date(),
+ updatedAt: new Date()
};
const mockProject = {
@@ -205,514 +142,316 @@ describe("CertificateEstV3Service Security Fix", () => {
pkiEst: true
};
- beforeEach(async () => {
- const { Pkcs10CertificateRequest, GeneralNames } = await import("@peculiar/x509");
+ const mockPolicy = {
+ id: "policy-123",
+ validity: { max: "90d" }
+ };
+ beforeEach(async () => {
service = certificateEstV3ServiceFactory({
- internalCertificateAuthorityService: mockInternalCertificateAuthorityService,
- certificatePolicyService: mockCertificatePolicyService,
- certificatePolicyDAL: mockCertificatePolicyDAL,
+ certificateV3Service: mockCertificateV3Service,
certificateAuthorityDAL: mockCertificateAuthorityDAL,
certificateAuthorityCertDAL: mockCertificateAuthorityCertDAL,
projectDAL: mockProjectDAL,
kmsService: mockKmsService,
licenseService: mockLicenseService,
certificateProfileDAL: mockCertificateProfileDAL,
- estEnrollmentConfigDAL: mockEstEnrollmentConfigDAL
+ estEnrollmentConfigDAL: mockEstEnrollmentConfigDAL,
+ certificatePolicyDAL: mockCertificatePolicyDAL
});
mockCertificateProfileDAL.findByIdWithConfigs.mockResolvedValue(mockProfile);
mockEstEnrollmentConfigDAL.findById.mockResolvedValue(mockEstConfig);
mockProjectDAL.findOne.mockResolvedValue(mockProject);
mockLicenseService.getPlan.mockResolvedValue(mockPlan);
-
- // Set up the default CSR parsing behavior
- (Pkcs10CertificateRequest as any).mockImplementation((csr: string) => {
- const parsed = JSON.parse(csr);
- const mockExtensions: any[] = [];
-
- if (parsed.sans && parsed.sans.length > 0) {
- mockExtensions.push({ type: "2.5.29.17", value: "mock-san-value" });
- }
-
- return {
- subject: parsed.subject,
- extensions: mockExtensions,
- getExtension: vi.fn((oid: string) => {
- if (oid === "2.5.29.15" && parsed.keyUsages && parsed.keyUsages.length > 0) {
- // Calculate usages as bitwise OR of key usage flags
- let usages = 0;
- parsed.keyUsages.forEach((usage: string) => {
- switch (usage) {
- case "digital_signature":
- usages |= 1; // KeyUsageFlags.digitalSignature
- break;
- case "key_encipherment":
- usages |= 4; // KeyUsageFlags.keyEncipherment
- break;
- case "key_cert_sign":
- usages |= 32; // KeyUsageFlags.keyCertSign
- break;
- default:
- break;
- }
- });
- return { usages };
- }
- if (oid === "2.5.29.37" && parsed.extendedKeyUsages && parsed.extendedKeyUsages.length > 0) {
- const ekuOids = parsed.extendedKeyUsages.map((eku: string) => {
- switch (eku) {
- case "client_auth":
- return "1.3.6.1.5.5.7.3.2";
- case "server_auth":
- return "1.3.6.1.5.5.7.3.1";
- case "code_signing":
- return "1.3.6.1.5.5.7.3.3";
- default:
- return "1.3.6.1.5.5.7.3.1";
- }
- });
- return { usages: ekuOids };
- }
- return undefined;
- })
- };
- });
-
- (GeneralNames as any).mockImplementation(() => ({
- items: [
- { type: "dns", value: "test.example.com" },
- { type: "ip", value: "192.168.1.1" }
- ]
- }));
+ mockCertificatePolicyDAL.findById.mockResolvedValue(mockPolicy);
});
afterEach(() => {
vi.clearAllMocks();
});
- const createMockCSR = (
- options: {
- subject?: string;
- keyUsages?: string[];
- extendedKeyUsages?: string[];
- sans?: Array<{ type: string; value: string }>;
- } = {}
- ) => {
- const {
- subject = "CN=test.example.com,O=Test Org,C=US",
- keyUsages = [],
- extendedKeyUsages = [],
- sans = []
- } = options;
-
- return JSON.stringify({
- subject,
- keyUsages,
- extendedKeyUsages,
- sans
- });
- };
-
- describe("CSR Extraction and Template Validation", () => {
- it("should extract subject attributes from CSR", async () => {
- const csr = createMockCSR({
- subject: "CN=test.example.com,O=Test Organization,OU=IT Department,L=San Francisco,ST=California,C=US"
+ describe("simpleEnrollByProfile", () => {
+ it("should successfully enroll and return PKCS7 response", async () => {
+ mockCertificateV3Service.signCertificateFromProfile.mockResolvedValue({
+ status: CertificateRequestStatus.ISSUED,
+ certificate: "-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----",
+ certificateId: "cert-123"
});
- mockCertificatePolicyService.validateCertificateRequest.mockResolvedValue({
- isValid: true,
- errors: [],
- warnings: []
- });
-
- mockInternalCertificateAuthorityService.signCertFromCa.mockResolvedValue({
- certificate: { rawData: new ArrayBuffer(0) }
- });
-
- await service.simpleEnrollByProfile({
- csr,
+ const result = await service.simpleEnrollByProfile({
+ csr: "mock-csr",
profileId: "profile-123",
sslClientCert: ""
});
- expect(mockCertificatePolicyService.validateCertificateRequest).toHaveBeenCalledWith(
- "policy-123",
+ expect(result).toBe("mocked-pkcs7-response");
+ expect(mockCertificateV3Service.signCertificateFromProfile).toHaveBeenCalledWith(
expect.objectContaining({
- commonName: "test.example.com",
- organization: "Test Organization",
- organizationalUnit: "IT Department",
- locality: "San Francisco",
- state: "California",
- country: "US"
+ profileId: "profile-123",
+ csr: "mock-csr",
+ enrollmentType: EnrollmentType.EST,
+ validity: { ttl: "90d" }
})
);
});
- it("should extract key usages from CSR", async () => {
- const csr = createMockCSR({
- keyUsages: ["digital_signature", "key_encipherment"]
- });
-
- mockCertificatePolicyService.validateCertificateRequest.mockResolvedValue({
- isValid: true,
- errors: [],
- warnings: []
- });
-
- mockInternalCertificateAuthorityService.signCertFromCa.mockResolvedValue({
- certificate: { rawData: new ArrayBuffer(0) }
+ it("should throw error when approval is required", async () => {
+ mockCertificateV3Service.signCertificateFromProfile.mockResolvedValue({
+ status: CertificateRequestStatus.PENDING_APPROVAL,
+ certificateRequestId: "req-123",
+ message: "Requires approval"
});
- await service.simpleEnrollByProfile({
- csr,
- profileId: "profile-123",
- sslClientCert: ""
- });
-
- expect(mockCertificatePolicyService.validateCertificateRequest).toHaveBeenCalledWith(
- "policy-123",
- expect.objectContaining({
- keyUsages: expect.arrayContaining(["digital_signature", "key_encipherment"])
+ await expect(
+ service.simpleEnrollByProfile({
+ csr: "mock-csr",
+ profileId: "profile-123",
+ sslClientCert: ""
})
- );
- });
-
- it("should extract extended key usages from CSR", async () => {
- const csr = createMockCSR({
- extendedKeyUsages: ["client_auth", "server_auth"]
- });
-
- mockCertificatePolicyService.validateCertificateRequest.mockResolvedValue({
- isValid: true,
- errors: [],
- warnings: []
- });
-
- mockInternalCertificateAuthorityService.signCertFromCa.mockResolvedValue({
- certificate: { rawData: new ArrayBuffer(0) }
- });
-
- await service.simpleEnrollByProfile({
- csr,
- profileId: "profile-123",
- sslClientCert: ""
- });
+ ).rejects.toThrow(BadRequestError);
- expect(mockCertificatePolicyService.validateCertificateRequest).toHaveBeenCalledWith(
- "policy-123",
- expect.objectContaining({
- extendedKeyUsages: expect.arrayContaining(["client_auth", "server_auth"])
+ await expect(
+ service.simpleEnrollByProfile({
+ csr: "mock-csr",
+ profileId: "profile-123",
+ sslClientCert: ""
})
- );
+ ).rejects.toThrow(/requires approval/i);
});
- it("should extract Subject Alternative Names from CSR", async () => {
- const { GeneralNames } = await import("@peculiar/x509");
-
- const csr = createMockCSR({
- sans: [
- { type: "dns", value: "test.example.com" },
- { type: "ip", value: "192.168.1.1" }
- ]
- });
-
- (GeneralNames as any).mockImplementation(() => ({
- items: [
- { type: "dns", value: "test.example.com" },
- { type: "ip", value: "192.168.1.1" }
- ]
- }));
-
- mockCertificatePolicyService.validateCertificateRequest.mockResolvedValue({
- isValid: true,
- errors: [],
- warnings: []
- });
-
- mockInternalCertificateAuthorityService.signCertFromCa.mockResolvedValue({
- certificate: { rawData: new ArrayBuffer(0) }
- });
-
- await service.simpleEnrollByProfile({
- csr,
- profileId: "profile-123",
- sslClientCert: ""
- });
+ it("should throw error when profile not found", async () => {
+ mockCertificateProfileDAL.findByIdWithConfigs.mockResolvedValue(null);
- expect(mockCertificatePolicyService.validateCertificateRequest).toHaveBeenCalledWith(
- "policy-123",
- expect.objectContaining({
- subjectAlternativeNames: expect.arrayContaining([
- expect.objectContaining({
- type: "dns_name",
- value: "test.example.com"
- }),
- expect.objectContaining({
- type: "ip_address",
- value: "192.168.1.1"
- })
- ])
+ await expect(
+ service.simpleEnrollByProfile({
+ csr: "mock-csr",
+ profileId: "nonexistent",
+ sslClientCert: ""
})
- );
+ ).rejects.toThrow(NotFoundError);
});
- });
- describe("Template Validation Enforcement", () => {
- const basicCSR = createMockCSR();
-
- it("should enforce template validation and reject invalid requests", async () => {
- mockCertificatePolicyService.validateCertificateRequest.mockResolvedValue({
- isValid: false,
- errors: ["Common name 'test.example.com' is not allowed", "Key usage 'digital_signature' is denied"],
- warnings: []
+ it("should throw error when profile is not configured for EST", async () => {
+ mockCertificateProfileDAL.findByIdWithConfigs.mockResolvedValue({
+ ...mockProfile,
+ enrollmentType: EnrollmentType.API
});
await expect(
service.simpleEnrollByProfile({
- csr: basicCSR,
+ csr: "mock-csr",
profileId: "profile-123",
sslClientCert: ""
})
).rejects.toThrow(BadRequestError);
-
- expect(mockInternalCertificateAuthorityService.signCertFromCa).not.toHaveBeenCalled();
- });
-
- it("should allow valid requests that pass template validation", async () => {
- mockCertificatePolicyService.validateCertificateRequest.mockResolvedValue({
- isValid: true,
- errors: [],
- warnings: []
- });
-
- mockInternalCertificateAuthorityService.signCertFromCa.mockResolvedValue({
- certificate: { rawData: new ArrayBuffer(0) }
- });
-
- await service.simpleEnrollByProfile({
- csr: basicCSR,
- profileId: "profile-123",
- sslClientCert: ""
- });
-
- expect(mockCertificatePolicyService.validateCertificateRequest).toHaveBeenCalledWith(
- "policy-123",
- expect.any(Object)
- );
- expect(mockInternalCertificateAuthorityService.signCertFromCa).toHaveBeenCalledWith({
- isInternal: true,
- caId: "ca-123",
- csr: basicCSR,
- isFromProfile: true,
- basicConstraints: undefined
- });
});
- it("should validate template for both simpleEnrollByProfile and simpleReenrollByProfile", async () => {
- mockCertificatePolicyService.validateCertificateRequest.mockResolvedValue({
- isValid: false,
- errors: ["SAN value 'evil.com' is denied"],
- warnings: []
- });
+ it("should throw error when EST config not found", async () => {
+ mockEstEnrollmentConfigDAL.findById.mockResolvedValue(null);
await expect(
service.simpleEnrollByProfile({
- csr: basicCSR,
+ csr: "mock-csr",
profileId: "profile-123",
sslClientCert: ""
})
- ).rejects.toThrow(BadRequestError);
-
- expect(mockCertificatePolicyService.validateCertificateRequest).toHaveBeenCalled();
- expect(mockInternalCertificateAuthorityService.signCertFromCa).not.toHaveBeenCalled();
- });
- });
-
- describe("Policy Bypass Prevention", () => {
- const maliciousCSR = createMockCSR({
- subject: "CN=evil.com,O=Evil Corp,C=XX",
- keyUsages: ["key_cert_sign"],
- sans: [
- { type: "dns", value: "*.example.com" },
- { type: "ip", value: "127.0.0.1" }
- ]
+ ).rejects.toThrow(NotFoundError);
});
- it("should block attempts to bypass subject attribute policies", async () => {
- mockCertificatePolicyService.validateCertificateRequest.mockResolvedValue({
- isValid: false,
- errors: ["Organization 'Evil Corp' is denied", "Country 'XX' is not allowed"],
- warnings: []
- });
+ it("should throw error when PKI EST is not available in plan", async () => {
+ mockLicenseService.getPlan.mockResolvedValue({ pkiEst: false });
await expect(
service.simpleEnrollByProfile({
- csr: maliciousCSR,
+ csr: "mock-csr",
profileId: "profile-123",
sslClientCert: ""
})
).rejects.toThrow(BadRequestError);
-
- expect(mockCertificatePolicyService.validateCertificateRequest).toHaveBeenCalledWith(
- "policy-123",
- expect.objectContaining({
- commonName: "evil.com",
- organization: "Evil Corp",
- country: "XX"
- })
- );
});
- it("should block attempts to bypass key usage policies", async () => {
- mockCertificatePolicyService.validateCertificateRequest.mockResolvedValue({
- isValid: false,
- errors: ["Key usage 'key_cert_sign' is denied - certificate authority privileges not allowed"],
- warnings: []
+ it("should throw error when certificate is not returned", async () => {
+ mockCertificateV3Service.signCertificateFromProfile.mockResolvedValue({
+ status: CertificateRequestStatus.ISSUED,
+ certificate: null,
+ certificateId: "cert-123"
});
await expect(
service.simpleEnrollByProfile({
- csr: maliciousCSR,
+ csr: "mock-csr",
profileId: "profile-123",
sslClientCert: ""
})
).rejects.toThrow(BadRequestError);
+ });
+
+ it("should use policy max validity as TTL", async () => {
+ mockCertificatePolicyDAL.findById.mockResolvedValue({
+ id: "policy-123",
+ validity: { max: "30d" }
+ });
+
+ mockCertificateV3Service.signCertificateFromProfile.mockResolvedValue({
+ status: CertificateRequestStatus.ISSUED,
+ certificate: "-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----",
+ certificateId: "cert-123"
+ });
- expect(mockCertificatePolicyService.validateCertificateRequest).toHaveBeenCalledWith(
- "policy-123",
+ await service.simpleEnrollByProfile({
+ csr: "mock-csr",
+ profileId: "profile-123",
+ sslClientCert: ""
+ });
+
+ expect(mockCertificateV3Service.signCertificateFromProfile).toHaveBeenCalledWith(
expect.objectContaining({
- keyUsages: expect.arrayContaining(["key_cert_sign"])
+ validity: { ttl: "30d" }
})
);
});
- it("should block attempts to bypass SAN policies", async () => {
- const { GeneralNames } = await import("@peculiar/x509");
+ it("should use default 90d TTL when policy has no validity", async () => {
+ mockCertificatePolicyDAL.findById.mockResolvedValue({
+ id: "policy-123",
+ validity: null
+ });
- (GeneralNames as any).mockImplementation(() => ({
- items: [
- { type: "dns", value: "*.example.com" },
- { type: "ip", value: "127.0.0.1" }
- ]
- }));
+ mockCertificateV3Service.signCertificateFromProfile.mockResolvedValue({
+ status: CertificateRequestStatus.ISSUED,
+ certificate: "-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----",
+ certificateId: "cert-123"
+ });
- mockCertificatePolicyService.validateCertificateRequest.mockResolvedValue({
- isValid: false,
- errors: ["SAN value '*.example.com' matches denied wildcard pattern", "SAN value '127.0.0.1' is denied"],
- warnings: []
+ await service.simpleEnrollByProfile({
+ csr: "mock-csr",
+ profileId: "profile-123",
+ sslClientCert: ""
});
- await expect(
- service.simpleEnrollByProfile({
- csr: maliciousCSR,
- profileId: "profile-123",
- sslClientCert: ""
+ expect(mockCertificateV3Service.signCertificateFromProfile).toHaveBeenCalledWith(
+ expect.objectContaining({
+ validity: { ttl: "90d" }
})
- ).rejects.toThrow(BadRequestError);
+ );
});
});
- describe("Error Handling", () => {
- const basicCSR = createMockCSR();
+ describe("simpleReenrollByProfile", () => {
+ beforeEach(async () => {
+ const { Pkcs10CertificateRequest, X509Certificate, GeneralNames } = await import("@peculiar/x509");
- it("should handle profile not found", async () => {
- mockCertificateProfileDAL.findByIdWithConfigs.mockResolvedValue(null);
+ (Pkcs10CertificateRequest as any).mockImplementation(() => ({
+ subject: "CN=test.example.com",
+ extensions: []
+ }));
- await expect(
- service.simpleEnrollByProfile({
- csr: basicCSR,
- profileId: "nonexistent",
- sslClientCert: ""
- })
- ).rejects.toThrow(NotFoundError);
+ (X509Certificate as any).mockImplementation(() => ({
+ subject: "CN=test.example.com",
+ extensions: [],
+ rawData: new ArrayBuffer(0)
+ }));
+
+ (GeneralNames as any).mockImplementation(() => ({
+ items: []
+ }));
});
- it("should handle non-EST enrollment type", async () => {
- mockCertificateProfileDAL.findByIdWithConfigs.mockResolvedValue({
- ...mockProfile,
- enrollmentType: EnrollmentType.API
+ it("should successfully re-enroll and return PKCS7 response", async () => {
+ mockCertificateV3Service.signCertificateFromProfile.mockResolvedValue({
+ status: CertificateRequestStatus.ISSUED,
+ certificate: "-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----",
+ certificateId: "cert-123"
+ });
+
+ const result = await service.simpleReenrollByProfile({
+ csr: "mock-csr",
+ profileId: "profile-123",
+ sslClientCert: encodeURIComponent("-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----")
});
+ expect(result).toBe("mocked-pkcs7-response");
+ });
+
+ it("should throw error when subjects do not match", async () => {
+ const { Pkcs10CertificateRequest, X509Certificate } = await import("@peculiar/x509");
+
+ (Pkcs10CertificateRequest as any).mockImplementation(() => ({
+ subject: "CN=different.example.com",
+ extensions: []
+ }));
+
+ (X509Certificate as any).mockImplementation(() => ({
+ subject: "CN=test.example.com",
+ extensions: [],
+ rawData: new ArrayBuffer(0)
+ }));
+
await expect(
- service.simpleEnrollByProfile({
- csr: basicCSR,
+ service.simpleReenrollByProfile({
+ csr: "mock-csr",
profileId: "profile-123",
- sslClientCert: ""
+ sslClientCert: encodeURIComponent("-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----")
})
).rejects.toThrow(BadRequestError);
});
- it("should handle template validation service errors", async () => {
- mockCertificatePolicyService.validateCertificateRequest.mockRejectedValue(
- new Error("Template validation service unavailable")
- );
+ it("should throw error when approval is required for re-enrollment", async () => {
+ mockCertificateV3Service.signCertificateFromProfile.mockResolvedValue({
+ status: CertificateRequestStatus.PENDING_APPROVAL,
+ certificateRequestId: "req-123",
+ message: "Requires approval"
+ });
await expect(
- service.simpleEnrollByProfile({
- csr: basicCSR,
+ service.simpleReenrollByProfile({
+ csr: "mock-csr",
profileId: "profile-123",
- sslClientCert: ""
+ sslClientCert: encodeURIComponent("-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----")
})
- ).rejects.toThrow("Template validation service unavailable");
+ ).rejects.toThrow(/requires approval/i);
});
});
- describe("Integration with existing flow", () => {
- const basicCSR = createMockCSR();
-
- beforeEach(() => {
- mockCertificatePolicyService.validateCertificateRequest.mockResolvedValue({
- isValid: true,
- errors: [],
- warnings: []
- });
- });
-
- it("should call internal CA service with correct parameters after validation", async () => {
- mockInternalCertificateAuthorityService.signCertFromCa.mockResolvedValue({
- certificate: { rawData: new ArrayBuffer(0) }
+ describe("getCaCertsByProfile", () => {
+ it("should return CA certificates in PKCS7 format", async () => {
+ mockCertificateAuthorityDAL.findByIdWithAssociatedCa.mockResolvedValue({
+ id: "ca-123",
+ internalCa: {
+ id: "internal-ca-123",
+ activeCaCertId: "ca-cert-123"
+ }
});
- await service.simpleEnrollByProfile({
- csr: basicCSR,
- profileId: "profile-123",
- sslClientCert: ""
+ const result = await service.getCaCertsByProfile({
+ profileId: "profile-123"
});
- expect(mockInternalCertificateAuthorityService.signCertFromCa).toHaveBeenCalledWith({
- isInternal: true,
- caId: "ca-123",
- isFromProfile: true,
- csr: basicCSR,
- basicConstraints: undefined
- });
+ expect(result).toBe("mocked-pkcs7-response");
});
- it("should use profile's CA ID instead of template ID to avoid v1/v2 mismatch", async () => {
- mockInternalCertificateAuthorityService.signCertFromCa.mockResolvedValue({
- certificate: { rawData: new ArrayBuffer(0) }
- });
-
- await service.simpleEnrollByProfile({
- csr: basicCSR,
- profileId: "profile-123",
- sslClientCert: ""
- });
+ it("should throw error when profile not found", async () => {
+ mockCertificateProfileDAL.findByIdWithConfigs.mockResolvedValue(null);
- // Verify it uses caId from profile, not certificatePolicyId
- expect(mockInternalCertificateAuthorityService.signCertFromCa).toHaveBeenCalledWith(
- expect.objectContaining({
- caId: "ca-123"
+ await expect(
+ service.getCaCertsByProfile({
+ profileId: "nonexistent"
})
- );
+ ).rejects.toThrow(NotFoundError);
+ });
- // Verify it does NOT pass certificatePolicyId to avoid v1/v2 confusion
- expect(mockInternalCertificateAuthorityService.signCertFromCa).toHaveBeenCalledWith(
- expect.not.objectContaining({
- certificatePolicyId: expect.anything()
+ it("should throw error when profile is not configured for EST", async () => {
+ mockCertificateProfileDAL.findByIdWithConfigs.mockResolvedValue({
+ ...mockProfile,
+ enrollmentType: EnrollmentType.API
+ });
+
+ await expect(
+ service.getCaCertsByProfile({
+ profileId: "profile-123"
})
- );
+ ).rejects.toThrow(BadRequestError);
});
});
});
diff --git a/backend/src/services/certificate-est-v3/certificate-est-v3-service.ts b/backend/src/services/certificate-est-v3/certificate-est-v3-service.ts
index 6d42472165..885fd99b7b 100644
--- a/backend/src/services/certificate-est-v3/certificate-est-v3-service.ts
+++ b/backend/src/services/certificate-est-v3/certificate-est-v3-service.ts
@@ -2,17 +2,15 @@ import * as x509 from "@peculiar/x509";
import { extractX509CertFromChain } from "@app/lib/certificates/extract-certificate";
import { BadRequestError, NotFoundError, UnauthorizedError } from "@app/lib/errors";
+import { ActorType } from "@app/services/auth/auth-type";
import { isCertChainValid } from "@app/services/certificate/certificate-fns";
import { TCertificateAuthorityCertDALFactory } from "@app/services/certificate-authority/certificate-authority-cert-dal";
import { TCertificateAuthorityDALFactory } from "@app/services/certificate-authority/certificate-authority-dal";
import { getCaCertChain, getCaCertChains } from "@app/services/certificate-authority/certificate-authority-fns";
-import { TInternalCertificateAuthorityServiceFactory } from "@app/services/certificate-authority/internal/internal-certificate-authority-service";
-import { CertPolicyState } from "@app/services/certificate-common/certificate-constants";
-import { extractCertificateRequestFromCSR } from "@app/services/certificate-common/certificate-csr-utils";
-import { mapEnumsForValidation } from "@app/services/certificate-common/certificate-utils";
-import { TCertificatePolicyServiceFactory } from "@app/services/certificate-policy/certificate-policy-service";
import { TCertificateProfileDALFactory } from "@app/services/certificate-profile/certificate-profile-dal";
import { EnrollmentType } from "@app/services/certificate-profile/certificate-profile-types";
+import { CertificateRequestStatus } from "@app/services/certificate-request/certificate-request-types";
+import { TCertificateV3ServiceFactory } from "@app/services/certificate-v3/certificate-v3-service";
import { TEstEnrollmentConfigDALFactory } from "@app/services/enrollment-config/est-enrollment-config-dal";
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
import { TProjectDALFactory } from "@app/services/project/project-dal";
@@ -23,9 +21,7 @@ import { TLicenseServiceFactory } from "../../ee/services/license/license-servic
import { TCertificatePolicyDALFactory } from "../certificate-policy/certificate-policy-dal";
type TCertificateEstV3ServiceFactoryDep = {
- internalCertificateAuthorityService: Pick<TInternalCertificateAuthorityServiceFactory, "signCertFromCa">;
- certificatePolicyService: Pick<TCertificatePolicyServiceFactory, "validateCertificateRequest">;
- certificatePolicyDAL: Pick<TCertificatePolicyDALFactory, "findById">;
+ certificateV3Service: Pick<TCertificateV3ServiceFactory, "signCertificateFromProfile">;
certificateAuthorityDAL: Pick<TCertificateAuthorityDALFactory, "findById" | "findByIdWithAssociatedCa">;
certificateAuthorityCertDAL: Pick<TCertificateAuthorityCertDALFactory, "find" | "findById">;
projectDAL: Pick<TProjectDALFactory, "findOne" | "updateById" | "transaction">;
@@ -33,22 +29,69 @@ type TCertificateEstV3ServiceFactoryDep = {
licenseService: Pick<TLicenseServiceFactory, "getPlan">;
certificateProfileDAL: Pick<TCertificateProfileDALFactory, "findByIdWithConfigs">;
estEnrollmentConfigDAL: Pick<TEstEnrollmentConfigDALFactory, "findById">;
+ certificatePolicyDAL: Pick<TCertificatePolicyDALFactory, "findById">;
};
export type TCertificateEstV3ServiceFactory = ReturnType<typeof certificateEstV3ServiceFactory>;
export const certificateEstV3ServiceFactory = ({
- internalCertificateAuthorityService,
- certificatePolicyService,
- certificatePolicyDAL,
+ certificateV3Service,
certificateAuthorityCertDAL,
certificateAuthorityDAL,
projectDAL,
kmsService,
licenseService,
certificateProfileDAL,
- estEnrollmentConfigDAL
+ estEnrollmentConfigDAL,
+ certificatePolicyDAL
}: TCertificateEstV3ServiceFactoryDep) => {
+ const validateEstClientCertificate = async (
+ estConfig: { disableBootstrapCaValidation?: boolean | null; encryptedCaChain?: Buffer | null },
+ projectId: string,
+ sslClientCert: string
+ ) => {
+ if (estConfig.disableBootstrapCaValidation) {
+ return;
+ }
+
+ const certificateManagerKmsId = await getProjectKmsCertificateKeyId({
+ projectId,
+ projectDAL,
+ kmsService
+ });
+
+ const kmsDecryptor = await kmsService.decryptWithKmsKey({
+ kmsId: certificateManagerKmsId
+ });
+
+ const decryptedCaChain = estConfig.encryptedCaChain
+ ? (
+ await kmsDecryptor({
+ cipherTextBlob: estConfig.encryptedCaChain
+ })
+ ).toString()
+ : "";
+
+ const caCerts = extractX509CertFromChain(decryptedCaChain)?.map((cert) => {
+ return new x509.X509Certificate(cert);
+ });
+
+ if (!caCerts) {
+ throw new BadRequestError({ message: "Failed to parse certificate chain" });
+ }
+
+ const leafCertificate = extractX509CertFromChain(decodeURIComponent(sslClientCert))?.[0];
+
+ if (!leafCertificate) {
+ throw new UnauthorizedError({ message: "Missing client certificate" });
+ }
+
+ const certObj = new x509.X509Certificate(leafCertificate);
+ if (!(await isCertChainValid([certObj, ...caCerts]))) {
+ throw new BadRequestError({ message: "Invalid certificate chain" });
+ }
+ };
+
const simpleEnrollByProfile = async ({
csr,
profileId,
@@ -95,93 +138,33 @@ export const certificateEstV3ServiceFactory = ({
});
}
- if (!estConfig.disableBootstrapCaValidation) {
- const certificateManagerKmsId = await getProjectKmsCertificateKeyId({
- projectId: profile.projectId,
- projectDAL,
- kmsService
- });
-
- const kmsDecryptor = await kmsService.decryptWithKmsKey({
- kmsId: certificateManagerKmsId
- });
-
- const decryptedCaChain = estConfig.encryptedCaChain
- ? (
- await kmsDecryptor({
- cipherTextBlob: estConfig.encryptedCaChain
- })
- ).toString()
- : "";
-
- const caCerts = extractX509CertFromChain(decryptedCaChain)?.map((cert) => {
- return new x509.X509Certificate(cert);
- });
-
- if (!caCerts) {
- throw new BadRequestError({ message: "Failed to parse certificate chain" });
- }
-
- const leafCertificate = extractX509CertFromChain(decodeURIComponent(sslClientCert))?.[0];
-
- if (!leafCertificate) {
- throw new UnauthorizedError({ message: "Missing client certificate" });
- }
-
- const certObj = new x509.X509Certificate(leafCertificate);
- if (!(await isCertChainValid([certObj, ...caCerts]))) {
- throw new BadRequestError({ message: "Invalid certificate chain" });
- }
- }
-
- const certificateRequest = extractCertificateRequestFromCSR(csr);
- const mappedCertificateRequest = mapEnumsForValidation(certificateRequest);
- const validationResult = await certificatePolicyService.validateCertificateRequest(
- profile.certificatePolicyId,
- mappedCertificateRequest
- );
-
- if (!validationResult.isValid) {
- throw new BadRequestError({
- message: `Certificate request validation failed: ${validationResult.errors.join(", ")}`
- });
- }
-
- // Fetch the policy to get basicConstraints for CA certificate support
+ await validateEstClientCertificate(estConfig, profile.projectId, sslClientCert);
const policy = await certificatePolicyDAL.findById(profile.certificatePolicyId);
+ const ttl = policy?.validity?.max || "90d";
+
+ const result = await certificateV3Service.signCertificateFromProfile({
+ actor: ActorType.PLATFORM,
+ actorId: profileId,
+ actorAuthMethod: null,
+ actorOrgId: project.orgId,
+ profileId,
+ csr,
+ validity: { ttl },
+ enrollmentType: EnrollmentType.EST
+ });
- const csrRequestsCA = certificateRequest.basicConstraints?.isCA === true;
- const policyIsCAState: CertPolicyState =
- (policy?.basicConstraints?.isCA as CertPolicyState) || CertPolicyState.DENIED;
-
- if (csrRequestsCA && policyIsCAState === CertPolicyState.DENIED) {
+ if (result.status === CertificateRequestStatus.PENDING_APPROVAL) {
throw new BadRequestError({
- message:
- "CA certificate issuance is not allowed by this policy. The policy's basicConstraints must be set to 'allowed' or 'required'."
+ message: `Certificate request requires approval. Request ID: ${result.certificateRequestId}. Please complete the approval workflow in the Infisical UI.`
});
}
- if (policyIsCAState === CertPolicyState.REQUIRED && !csrRequestsCA) {
- throw new BadRequestError({
- message:
- "CA certificate issuance is required by this policy. The CSR must include basicConstraints with CA:TRUE."
- });
+ if (!result.certificate) {
+ throw new BadRequestError({ message: "There was an error issuing the certificate" });
}
- const caBasicConstraints = csrRequestsCA
- ? { isCA: true, pathLength: policy?.basicConstraints?.maxPathLength }
- : undefined;
-
- const { certificate } = await internalCertificateAuthorityService.signCertFromCa({
- isInternal: true,
- caId: profile.caId,
- csr,
- isFromProfile: true,
- // Pass CA settings to the CA service (undefined for leaf certificates, object for CA certificates)
- basicConstraints: caBasicConstraints
- });
-
- return convertRawCertsToPkcs7([certificate.rawData]);
+ const certObj = new x509.X509Certificate(result.certificate);
+ return convertRawCertsToPkcs7([certObj.rawData]);
};
const simpleReenrollByProfile = async ({
@@ -287,56 +270,32 @@ export const certificateEstV3ServiceFactory = ({
});
}
- const certificateRequest = extractCertificateRequestFromCSR(csr);
- const mappedCertificateRequest = mapEnumsForValidation(certificateRequest);
- const validationResult = await certificatePolicyService.validateCertificateRequest(
- profile.certificatePolicyId,
- mappedCertificateRequest
- );
-
- if (!validationResult.isValid) {
- throw new BadRequestError({
- message: `Certificate request validation failed: ${validationResult.errors.join(", ")}`
- });
- }
-
- // Fetch the policy to get basicConstraints for CA certificate support
const policy = await certificatePolicyDAL.findById(profile.certificatePolicyId);
+ const ttl = policy?.validity?.max || "90d";
+
+ const result = await certificateV3Service.signCertificateFromProfile({
+ actor: ActorType.PLATFORM,
+ actorId: profileId,
+ actorAuthMethod: null,
+ actorOrgId: project.orgId,
+ profileId,
+ csr,
+ validity: { ttl },
+ enrollmentType: EnrollmentType.EST
+ });
- // Check if the CSR requests CA certificate
- const csrRequestsCA = certificateRequest.basicConstraints?.isCA === true;
- const policyIsCAState: CertPolicyState =
- (policy?.basicConstraints?.isCA as CertPolicyState) || CertPolicyState.DENIED;
-
- // Validate CA request against policy
- if (csrRequestsCA && policyIsCAState === CertPolicyState.DENIED) {
+ if (result.status === CertificateRequestStatus.PENDING_APPROVAL) {
throw new BadRequestError({
- message:
- "CA certificate issuance is not allowed by this policy. The policy's basicConstraints must be set to 'allowed' or 'required'."
+ message: `Certificate re-enrollment request requires approval. Request ID: ${result.certificateRequestId}. Please complete the approval workflow in the Infisical UI.`
});
}
- if (policyIsCAState === CertPolicyState.REQUIRED && !csrRequestsCA) {
- throw new BadRequestError({
- message:
- "CA certificate issuance is required by this policy. The CSR must include basicConstraints with CA:TRUE."
- });
+ if (!result.certificate) {
+ throw new BadRequestError({ message: "Certificate was not returned from issuance" });
}
- const caBasicConstraints = csrRequestsCA
- ? { isCA: true, pathLength: policy?.basicConstraints?.maxPathLength }
- : undefined;
-
- const { certificate } = await internalCertificateAuthorityService.signCertFromCa({
- isInternal: true,
- caId: profile.caId,
- csr,
- isFromProfile: true,
- // Pass CA settings to the CA service (undefined for leaf certificates, object for CA certificates)
- basicConstraints: caBasicConstraints
- });
-
- return convertRawCertsToPkcs7([certificate.rawData]);
+ const certObj = new x509.X509Certificate(result.certificate);
+ return convertRawCertsToPkcs7([certObj.rawData]);
};
const getCaCertsByProfile = async ({ profileId }: { profileId: string }) => {
diff --git a/backend/src/services/certificate-request/certificate-request-service.ts b/backend/src/services/certificate-request/certificate-request-service.ts
index 1f777c1a10..f32936bb4f 100644
--- a/backend/src/services/certificate-request/certificate-request-service.ts
+++ b/backend/src/services/certificate-request/certificate-request-service.ts
@@ -130,7 +130,7 @@ export const certificateRequestServiceFactory = ({
status,
...requestData
}: TCreateCertificateRequestDTO & { tx?: Knex }) => {
- if (actor !== ActorType.ACME_ACCOUNT) {
+ if (actor !== ActorType.ACME_ACCOUNT && actor !== ActorType.PLATFORM) {
const { permission } = await permissionService.getProjectPermission({
actor,
actorId,
diff --git a/backend/src/services/certificate-v3/certificate-v3-service.ts b/backend/src/services/certificate-v3/certificate-v3-service.ts
index 552566b69e..6646b53383 100644
--- a/backend/src/services/certificate-v3/certificate-v3-service.ts
+++ b/backend/src/services/certificate-v3/certificate-v3-service.ts
@@ -187,6 +187,10 @@ const validateProfileAndPermissions = async (
return profile;
}
+ if (actor === ActorType.PLATFORM && requiredEnrollmentType === EnrollmentType.EST) {
+ return profile;
+ }
+
const { permission } = await permissionService.getProjectPermission({
actor,
actorId,
@@ -914,7 +918,8 @@ export const certificateV3ServiceFactory = ({
*/
const resolveRequesterInfo = async (
actor: ActorType,
- actorId: string
+ actorId: string,
+ enrollmentType: EnrollmentType
): Promise<{ requesterName: string; requesterEmail: string }> => {
if (actor === ActorType.USER) {
const user = await userDAL.findById(actorId);
@@ -933,8 +938,12 @@ export const certificateV3ServiceFactory = ({
};
}
return { requesterName: "Machine Identity", requesterEmail: "" };
+ } else if (actor === ActorType.ACME_ACCOUNT || actor === ActorType.ACME_PROFILE) {
+ return { requesterName: "ACME Client", requesterEmail: "" };
+ } else if (enrollmentType === EnrollmentType.EST) {
+ return { requesterName: "EST Client", requesterEmail: "" };
}
- return { requesterName: "Unknown Requester", requesterEmail: "" };
+ return { requesterName: "Unknown Client", requesterEmail: "" };
};
/**
@@ -1066,7 +1075,7 @@ export const certificateV3ServiceFactory = ({
const approvalPolicy = matchedApprovalPolicy;
const policySteps = await approvalPolicyDAL.findStepsByPolicyId(approvalPolicy.id);
- const { requesterName, requesterEmail } = await resolveRequesterInfo(actor, actorId);
+ const { requesterName, requesterEmail } = await resolveRequesterInfo(actor, actorId, EnrollmentType.API);
const certRequest = await certificateRequestDAL.create({
projectId: profile.projectId,
@@ -1545,7 +1554,7 @@ export const certificateV3ServiceFactory = ({
const approvalPolicy = csrMatchedApprovalPolicy;
const policySteps = await approvalPolicyDAL.findStepsByPolicyId(approvalPolicy.id);
- const { requesterName, requesterEmail } = await resolveRequesterInfo(actor, actorId);
+ const { requesterName, requesterEmail } = await resolveRequesterInfo(actor, actorId, enrollmentType);
const certRequest = await certificateRequestDAL.create({
projectId: profile.projectId,
@@ -1826,7 +1835,7 @@ export const certificateV3ServiceFactory = ({
const approvalPolicy = orderMatchedApprovalPolicy;
const policySteps = await approvalPolicyDAL.findStepsByPolicyId(approvalPolicy.id);
- const { requesterName, requesterEmail } = await resolveRequesterInfo(actor, actorId);
+ const { requesterName, requesterEmail } = await resolveRequesterInfo(actor, actorId, EnrollmentType.API);
const certRequest = await certificateRequestDAL.create({
projectId: profile.projectId,
diff --git a/frontend/src/pages/cert-manager/ApprovalRequestDetailPage/components/CertificateDetailsSection.tsx b/frontend/src/pages/cert-manager/ApprovalRequestDetailPage/components/CertificateDetailsSection.tsx
index b54c45bd52..3ee2e53ab4 100644
--- a/frontend/src/pages/cert-manager/ApprovalRequestDetailPage/components/CertificateDetailsSection.tsx
+++ b/frontend/src/pages/cert-manager/ApprovalRequestDetailPage/components/CertificateDetailsSection.tsx
@@ -168,7 +168,7 @@ export const CertificateDetailsSection = ({ request }: Props) => {
)}
</div>
<div>
- <p className="text-xs text-mineshaft-400">Profile</p>
+ <p className="text-xs text-mineshaft-400">Certificate Profile</p>
<p className="mt-0.5 text-sm text-mineshaft-100">{requestData.profileName}</p>
</div>
</div>
diff --git a/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx b/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx
index 2540473532..87b8595a43 100644
--- a/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx
+++ b/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx
@@ -77,7 +77,7 @@ export const PolicyDetailsStep = () => {
errorText={error?.message}
helperText="Policy applies to certificates issued from these profiles"
>
- <FilterableSelect<ProfileOption>
+ <FilterableSelect
isMulti
isLoading={isProfilesLoading}
options={profileOptions}
@@ -88,6 +88,7 @@ export const PolicyDetailsStep = () => {
}}
placeholder="Select certificate profiles..."
noOptionsMessage={() => "No profiles found"}
+ maxMenuHeight={150}
/>
</FormControl>
)}