Skip to content

Commit

Permalink
[Security Solution] List all policies to display integrations properly (
Browse files Browse the repository at this point in the history
elastic#205103)

**Resolves: elastic#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

(cherry picked from commit 6d49348)
  • Loading branch information
jkelas committed Jan 8, 2025
1 parent 51080a5 commit ae25442
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit ae25442

Please sign in to comment.