From 6d49348db89302cf658637e8e8bd9e33760a2cad Mon Sep 17 00:00:00 2001 From: Jacek Kolezynski Date: Wed, 8 Jan 2025 14:26:32 +0100 Subject: [PATCH] [Security Solution] List all policies to display integrations properly (#205103) **Resolves: #200167** ## Summary Increase number of fetched package policies to the maximum. Currently only the first 20 policies (the first page) are returned, which results in treating all remaining ones as disabled. I am proposing the simplest change of increasing the limit here to the maximum. There shouldn't be too many policies there, e.g. in the reproduction I am running there are 23 instead of 20. If that is not enough, however, the alternative would be to discover that there are more policies than the specified limit and the next page(s) would have to be collected and the results added to the final list. #BEFORE ![image](https://github.com/user-attachments/assets/c98ab5a5-e822-459e-8abc-b45a963e93d7) #AFTER ![image](https://github.com/user-attachments/assets/ac519ec2-5674-4d17-bea3-7b6df72078dc) ### Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --- .../fleet_integrations/api/get_all_integrations/route.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/solutions/security/plugins/security_solution/server/lib/detection_engine/fleet_integrations/api/get_all_integrations/route.ts b/x-pack/solutions/security/plugins/security_solution/server/lib/detection_engine/fleet_integrations/api/get_all_integrations/route.ts index 4b5642b9d199b..5adc103cfff7c 100644 --- a/x-pack/solutions/security/plugins/security_solution/server/lib/detection_engine/fleet_integrations/api/get_all_integrations/route.ts +++ b/x-pack/solutions/security/plugins/security_solution/server/lib/detection_engine/fleet_integrations/api/get_all_integrations/route.ts @@ -6,6 +6,7 @@ */ import { transformError } from '@kbn/securitysolution-es-utils'; +import { SO_SEARCH_LIMIT } from '@kbn/fleet-plugin/common/constants'; import { PREBUILT_RULES_PACKAGE_NAME } from '../../../../../../common/detection_engine/constants'; import { buildSiemResponse } from '../../../routes/utils'; import type { SecuritySolutionPluginRouter } from '../../../../../types'; @@ -43,7 +44,9 @@ export const getAllIntegrationsRoute = (router: SecuritySolutionPluginRouter) => const [packages, packagePolicies] = await Promise.all([ fleet.packages.getPackages(), - fleet.packagePolicy.list(fleet.savedObjects.createInternalScopedSoClient(), {}), + fleet.packagePolicy.list(fleet.savedObjects.createInternalScopedSoClient(), { + perPage: SO_SEARCH_LIMIT, + }), ]); // Elastic prebuilt rules is a special package and should be skipped const packagesWithoutPrebuiltSecurityRules = packages.filter(