Skip to content

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

Fixes

Carlos Monastyrski7613c69849b5
diff --git a/backend/src/ee/services/pki-discovery/pki-discovery-host-scan-fns.test.ts b/backend/src/ee/services/pki-discovery/pki-discovery-host-scan-fns.test.ts
index 0e3747896f..1e6afa6320 100644
--- a/backend/src/ee/services/pki-discovery/pki-discovery-host-scan-fns.test.ts
+++ b/backend/src/ee/services/pki-discovery/pki-discovery-host-scan-fns.test.ts
@@ -1,7 +1,7 @@
import * as x509 from "@peculiar/x509";
import { webcrypto } from "crypto";
-import { NotFoundError } from "@app/lib/errors";
+import { GatewayTransportError, NotFoundError } from "@app/lib/errors";
import { computeCertFingerprint, parseCertificateDer } from "./pki-discovery-fns";
import { scanHost, THostScanDeps, toHostScanErrorMessage, writeHostFile } from "./pki-discovery-host-scan-fns";
@@ -59,6 +59,9 @@ describe("scanHost", () => {
test("unexpected errors are hidden behind a product message", () => {
expect(toHostScanErrorMessage(new NotFoundError({ message: "Gateway not found" }), "ctx")).toBe("Gateway not found");
+ expect(
+ toHostScanErrorMessage(new GatewayTransportError({ message: "TLS connection error: connect ECONNREFUSED" }), "ctx")
+ ).toBe("Could not reach the gateway through its relay. Check that the gateway and its relay are running.");
expect(toHostScanErrorMessage(new Error('relation "x" does not exist'), "ctx")).toBe(
"The scan failed unexpectedly. Try again later."
);
diff --git a/backend/src/ee/services/pki-discovery/pki-discovery-host-scan-fns.ts b/backend/src/ee/services/pki-discovery/pki-discovery-host-scan-fns.ts
index cf441fd7ea..cf9b76e10e 100644
--- a/backend/src/ee/services/pki-discovery/pki-discovery-host-scan-fns.ts
+++ b/backend/src/ee/services/pki-discovery/pki-discovery-host-scan-fns.ts
@@ -9,7 +9,7 @@ import { TGatewayV2DALFactory } from "@app/ee/services/gateway-v2/gateway-v2-dal
import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";
import { TKeyStoreFactory } from "@app/keystore/keystore";
import { delay } from "@app/lib/delay";
-import { BadRequestError, NotFoundError } from "@app/lib/errors";
+import { BadRequestError, GatewayTransportError, NotFoundError } from "@app/lib/errors";
import { callCertificateScan, TCertificateScanRequest } from "@app/lib/gateway-v2/certificate-scan-rpc";
import { getMissingGatewayMessage } from "@app/lib/gateway-v2/gateway-errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
@@ -113,6 +113,10 @@ const canScanCertificates = (capabilities: unknown) =>
(capabilities as Record<string, unknown> | null)?.certificateScan === true;
export const toHostScanErrorMessage = (error: unknown, logContext: string): string => {
+ if (error instanceof GatewayTransportError) {
+ logger.warn(`${logContext} [error=${error.message}]`);
+ return "Could not reach the gateway through its relay. Check that the gateway and its relay are running.";
+ }
if (error instanceof BadRequestError || error instanceof NotFoundError) {
logger.warn(`${logContext} [error=${error.message}]`);
return error.message;
diff --git a/docs/documentation/platform/pki/discovery/network.mdx b/docs/documentation/platform/pki/discovery/network.mdx
index 654533c0d2..d53d4ad64a 100644
--- a/docs/documentation/platform/pki/discovery/network.mdx
+++ b/docs/documentation/platform/pki/discovery/network.mdx
@@ -17,9 +17,9 @@ Network discovery scans network endpoints over TLS to discover certificates serv
</Step>
<Step>
Under **Targets**, set what to scan:
- - **Targets**: Domains, IP addresses, or CIDR ranges to scan, such as `example.com`, `192.168.1.1`, or `10.0.0.0/24`.
- - **Ports**: Ports to scan for TLS certificates. Defaults to common TLS ports if not specified.
- - **Gateway** (optional): The Infisical Gateway for scanning private networks.
+ - **Targets**: Domains, IP addresses, or CIDR ranges to scan, such as `example.com`, `192.168.1.1`, or `10.0.0.0/24`
+ - **Ports**: Ports to scan for TLS certificates (defaults to common TLS ports)
+ - **Gateway** (optional): The Infisical Gateway for scanning private networks
<Note>
At least one target (domain or IP) must be specified.
@@ -36,9 +36,9 @@ Network discovery scans network endpoints over TLS to discover certificates serv
</Step>
<Step>
After a scan completes, view the results:
- - **Installations**: Unique locations where certificates were found.
- - **Certificates**: Details including common name, issuer, and expiration date.
- - **Scan History**: Log of all scans with status and timestamps.
+ - **Installations**: Unique locations where certificates were found
+ - **Certificates**: Details including common name, issuer, and expiration date
+ - **Scan History**: Log of all scans with status and timestamps
</Step>
</Steps>
</Tab>