Skip to content

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

Address PR comments

Carlos Monastyrski9af17c78ca9e
diff --git a/backend/src/ee/services/pki-discovery/pki-discovery-queue.ts b/backend/src/ee/services/pki-discovery/pki-discovery-queue.ts
index 6be01d91de..2e87354f06 100644
--- a/backend/src/ee/services/pki-discovery/pki-discovery-queue.ts
+++ b/backend/src/ee/services/pki-discovery/pki-discovery-queue.ts
@@ -42,6 +42,7 @@ type TPkiDiscoveryQueueFactoryDep = {
keyStore: Pick<TKeyStoreFactory, "incrementByAndRefreshExpiryIfUnderLimit" | "decrementByOrDelete">;
};
+const SCAN_WORKER_CONCURRENCY = 3;
const RESCAN_WORKER_CONCURRENCY = 3;
export type TPkiDiscoveryQueueFactory = ReturnType<typeof pkiDiscoveryQueueFactory>;
@@ -84,47 +85,51 @@ export const pkiDiscoveryQueueFactory = ({
};
const startPkiDiscoveryScanQueue = () => {
- queueService.start(QueueName.PkiDiscoveryScan, async (job) => {
- try {
- if (job.name === QueueJobs.PkiDiscoveryRunScan) {
- const { discoveryId } = job.data as { discoveryId: string };
+ queueService.start(
+ QueueName.PkiDiscoveryScan,
+ async (job) => {
+ try {
+ if (job.name === QueueJobs.PkiDiscoveryRunScan) {
+ const { discoveryId } = job.data as { discoveryId: string };
- const discoveryConfig = await pkiDiscoveryConfigDAL.findById(discoveryId);
- if (!discoveryConfig) {
- logger.error({ discoveryId }, "Discovery config not found, skipping scan");
- return;
- }
+ const discoveryConfig = await pkiDiscoveryConfigDAL.findById(discoveryId);
+ if (!discoveryConfig) {
+ logger.error({ discoveryId }, "Discovery config not found, skipping scan");
+ return;
+ }
- const discoveryType = (discoveryConfig.discoveryType as PkiDiscoveryType) || PkiDiscoveryType.Network;
+ const discoveryType = (discoveryConfig.discoveryType as PkiDiscoveryType) || PkiDiscoveryType.Network;
- switch (discoveryType) {
- case PkiDiscoveryType.Network:
- await executeScan(discoveryId, scanDeps);
- break;
- case PkiDiscoveryType.LinuxServer:
- await executeLinuxServerScan(discoveryId, scanDeps);
- break;
- default:
- throw new Error(`Unsupported discovery type: ${discoveryType as string}`);
- }
- } else if (job.name === QueueJobs.PkiDiscoveryScheduledScan) {
- const dueConfigs = await pkiDiscoveryConfigDAL.findDueForScan();
+ switch (discoveryType) {
+ case PkiDiscoveryType.Network:
+ await executeScan(discoveryId, scanDeps);
+ break;
+ case PkiDiscoveryType.LinuxServer:
+ await executeLinuxServerScan(discoveryId, scanDeps);
+ break;
+ default:
+ throw new Error(`Unsupported discovery type: ${discoveryType as string}`);
+ }
+ } else if (job.name === QueueJobs.PkiDiscoveryScheduledScan) {
+ const dueConfigs = await pkiDiscoveryConfigDAL.findDueForScan();
- for (const config of dueConfigs) {
- // eslint-disable-next-line no-await-in-loop
- await queueService.queue(
- QueueName.PkiDiscoveryScan,
- QueueJobs.PkiDiscoveryRunScan,
- { discoveryId: config.id },
- { jobId: `pki-discovery-scan-${config.id}` }
- );
+ for (const config of dueConfigs) {
+ // eslint-disable-next-line no-await-in-loop
+ await queueService.queue(
+ QueueName.PkiDiscoveryScan,
+ QueueJobs.PkiDiscoveryRunScan,
+ { discoveryId: config.id },
+ { jobId: `pki-discovery-scan-${config.id}` }
+ );
+ }
}
+ } catch (error) {
+ logger.error({ error, jobName: job.name, jobId: job.id }, "PKI discovery queue job failed");
+ throw error;
}
- } catch (error) {
- logger.error({ error, jobName: job.name, jobId: job.id }, "PKI discovery queue job failed");
- throw error;
- }
- });
+ },
+ { concurrency: SCAN_WORKER_CONCURRENCY }
+ );
queueService.start(
QueueName.PkiDiscoveryRescan,
diff --git a/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobSheet/LinuxServerHostsFields.tsx b/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobSheet/LinuxServerHostsFields.tsx
index b39511751b..642109fbb5 100644
--- a/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobSheet/LinuxServerHostsFields.tsx
+++ b/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobSheet/LinuxServerHostsFields.tsx
@@ -9,7 +9,10 @@ import {
FieldContent,
FieldDescription,
FieldError,
- FieldLabel
+ FieldLabel,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
} from "@app/components/v3";
import { ProjectPermissionSub, useProject, useProjectPermission } from "@app/context";
import { ProjectPermissionAppConnectionActions } from "@app/context/ProjectPermissionContext/types";
@@ -100,8 +103,16 @@ export const LinuxServerHostsFields = () => {
isOptionDisabled={isUnusable}
renderOption={(option) => {
let unusableLabel: string | null = null;
- if (isMissingGateway(option)) unusableLabel = "No gateway";
- else if (isGatewayOutdated(option)) unusableLabel = "Update gateway";
+ let unusableHint: string | null = null;
+ if (isMissingGateway(option)) {
+ unusableLabel = "No gateway";
+ unusableHint =
+ "This SSH connection has no gateway. Add one to the connection to scan this server.";
+ } else if (isGatewayOutdated(option)) {
+ unusableLabel = "Update gateway";
+ unusableHint =
+ "This connection's gateway is too old for certificate scanning. Update it to the latest version.";
+ }
return (
<AppConnectionOptionContent
data={resolveOption(option)}
@@ -111,7 +122,14 @@ export const LinuxServerHostsFields = () => {
}
label={
unusableLabel && (
- <span className="mr-2 shrink-0 text-xs text-muted">{unusableLabel}</span>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span className="pointer-events-auto mr-2 shrink-0 cursor-help text-xs text-muted">
+ {unusableLabel}
+ </span>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-xs">{unusableHint}</TooltipContent>
+ </Tooltip>
)
}
/>