[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
This commit is contained in:
Jacek Kolezynski 2025-01-08 14:26:32 +01:00 committed by GitHub
parent 4ba5879fa9
commit 6d49348db8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(