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
Only limit cloud discovery jobs
Carlos Monastyrskic689c425e014
diff --git a/backend/src/ee/services/pki-discovery/pki-discovery-service.ts b/backend/src/ee/services/pki-discovery/pki-discovery-service.tsindex d7e2f54ed1..48d3993802 100644--- a/backend/src/ee/services/pki-discovery/pki-discovery-service.ts+++ b/backend/src/ee/services/pki-discovery/pki-discovery-service.ts@@ -9,6 +9,7 @@ import {ProjectPermissionPkiDiscoveryActions,ProjectPermissionSub} from "@app/ee/services/permission/project-permission";+import { getConfig } from "@app/lib/config/env";import { BadRequestError, DatabaseError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";import { TGatewayV2DALFactory } from "../gateway-v2/gateway-v2-dal";@@ -28,7 +29,7 @@ import {TUpdatePkiDiscoveryDTO} from "./pki-discovery-types";-const MAX_DISCOVERIES_PER_PROJECT = 10;+const MAX_CLOUD_DISCOVERIES_PER_PROJECT = 10;const SCAN_RATE_LIMIT_HOURS = 24;type TPkiDiscoveryServiceFactoryDep = {@@ -112,11 +113,14 @@ export const pkiDiscoveryServiceFactory = ({ProjectPermissionSub.PkiDiscovery);- const existingCount = await pkiDiscoveryConfigDAL.countByProjectId(projectId);- if (existingCount >= MAX_DISCOVERIES_PER_PROJECT) {- throw new BadRequestError({- message: `Maximum number of discovery configurations (${MAX_DISCOVERIES_PER_PROJECT}) reached for this project`- });+ const appCfg = getConfig();+ if (appCfg.isCloud) {+ const existingCount = await pkiDiscoveryConfigDAL.countByProjectId(projectId);+ if (existingCount >= MAX_CLOUD_DISCOVERIES_PER_PROJECT) {+ throw new BadRequestError({+ message: `Maximum number of discovery configurations (${MAX_CLOUD_DISCOVERIES_PER_PROJECT}) reached for this project`+ });+ }}validateTargetConfigForType(discoveryType, targetConfig);