Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(pki-discovery): report unreadable ca certificates when importing them
bernie-ga61e40adccc2
diff --git a/backend/src/ee/services/pki-discovery/pki-discovery-windows-scan-fns.test.ts b/backend/src/ee/services/pki-discovery/pki-discovery-windows-scan-fns.test.tsindex ac52a8e3e7..54e59a685c 100644--- a/backend/src/ee/services/pki-discovery/pki-discovery-windows-scan-fns.test.ts+++ b/backend/src/ee/services/pki-discovery/pki-discovery-windows-scan-fns.test.ts@@ -173,6 +173,25 @@ describe("summarizeWindowsScanIssues", () => {]);});+ test("reports unreadable CA store certificates only when CA certificates are imported", () => {+ const response = {+ host: { hostname: "web-01" },+ certificates: [+ {+ store: WindowsCertificateStore.IntermediateCertificationAuthorities,+ thumbprint: "CC",+ hasPrivateKey: false,+ status: HostCertificateFileStatus.ParseError,+ chains: []+ }+ ]+ };+ expect(summarizeWindowsScanIssues("web-01", response)).toEqual([]);+ expect(summarizeWindowsScanIssues("web-01", response, true)).toEqual([+ "web-01: These certificates could not be read: Intermediate Certification Authorities (CC)"+ ]);+ });+test("tells the user to select fewer stores when the response was too large", () => {expect(summarizeWindowsScanIssues("web-01", {diff --git a/backend/src/ee/services/pki-discovery/pki-discovery-windows-scan-fns.ts b/backend/src/ee/services/pki-discovery/pki-discovery-windows-scan-fns.tsindex 172820d76c..6e9f30a145 100644--- a/backend/src/ee/services/pki-discovery/pki-discovery-windows-scan-fns.ts+++ b/backend/src/ee/services/pki-discovery/pki-discovery-windows-scan-fns.ts@@ -256,7 +256,8 @@ const STORE_NAMES: Record<string, string> = {export const summarizeWindowsScanIssues = (hostIdentifier: string,- response: TWindowsCertificateScanResponse+ response: TWindowsCertificateScanResponse,+ importStandaloneCa = false): string[] => {const issues: string[] = [];const denied = response.deniedStores ?? [];@@ -270,7 +271,7 @@ export const summarizeWindowsScanIssues = (const unreadable = (response.certificates ?? []).filter((cert) =>cert.status !== HostCertificateFileStatus.Ok &&- !(CA_ONLY_WINDOWS_STORES as readonly string[]).includes(cert.store)+ (importStandaloneCa || !(CA_ONLY_WINDOWS_STORES as readonly string[]).includes(cert.store)));if (unreadable.length > 0) {const listed = unreadable@@ -331,7 +332,7 @@ const scanWindowsConnection = async (const response = await withConnectionScanSlot(host.connectionId, AppConnection.WinRM, deps, () =>runWindowsCertificateScan(host, run.targetConfig.certificateStores, deps));- issues.push(...summarizeWindowsScanIssues(host.hostIdentifier, response));+ issues.push(...summarizeWindowsScanIssues(host.hostIdentifier, response, run.ctx.importStandaloneCaCertificates));const scannedHost = { ...host, hostname: response.host.hostname };const pool = (response.pool ?? []).map((der) => Buffer.from(der, "base64"));