[Security Solution] Fixes Related Integrations showing as not installed or enabled when they actually are#152055
Conversation
|
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
|
Pinging @elastic/security-solution (Team: SecuritySolution) |
|
Pinging @elastic/fleet (Team:Fleet) |
| const packageInfo = getPackageInfoFromPolicy(policy); | ||
| const integrationsInfo = getIntegrationsInfoFromPolicy(policy, packageInfo); | ||
| const packageKey = `${packageInfo.package_name}:${packageInfo.package_version}`; | ||
| const packageKey = `${packageInfo.package_name}`; |
There was a problem hiding this comment.
As mentioned in the description, I removed package_version from the packageKey when calculating installed integrations as there can be mis-matches between different policy versions and the integration itself, and I believe the intended behavior here is to not have multiple relatedIntegrations returned for different versions (just one for each package+integration combination).
...ection_engine/fleet_integrations/api/get_installed_integrations/installed_integration_set.ts
Outdated
Show resolved
Hide resolved
...ection_engine/fleet_integrations/api/get_installed_integrations/installed_integration_set.ts
Show resolved
Hide resolved
banderror
left a comment
There was a problem hiding this comment.
Tested the fix locally, reviewed the diff, and pushed a few improvements to the code.
Thank you for figuring out how to fetch all the packages, that should allow us to fix the rest of the issues with related integrations which is awesome 🚀
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @spong |
…ed or enabled when they actually are (elastic#152055) ## Summary Resolves: elastic#142081 elastic#149970 elastic#150968 By adding an initial query for installed integrations and augments the existing `InstalledIntegrationArray` constructed using `PackagePolicy`'s. Also removes `version` from the `packageKey` when calculating installed integrations as there can be mis-matches between different policy versions and the integration itself, and I believe the intended behavior here is to not have multiple `relatedIntegrations` returned for different versions. We may want to expand the response here to include all the different policy versions that exist (and perhaps # of agents assigned the policy). Lastly, updates `getIntegrationsInfoFromPolicy()` to also pull the base `package` details in addition to the policy_template details, as this is what ensure base packages show as `Installed: enabled` if they have an integration policy assigned (vs just showing as `Installed` like when there isn't an integration policy). Note: This PR also adds the `getPackages()` method to the `PackageClient` as it didn't currently exist, and was only available via the fleet API via the `/api/fleet/epm/packages` route. ### Before: <p align="center"> <img width="500" src="https://user-images.githubusercontent.com/2946766/221066781-be7aa1c6-1728-4200-98b2-d40946e48bbe.png" /> </p> ### After <p align="center"> <img width="500" src="https://user-images.githubusercontent.com/2946766/221323469-e24081f9-0741-41fd-8227-9e319c98b0d3.png" /> </p> --------- Co-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co> (cherry picked from commit b833b10)
…ed or enabled when they actually are (elastic#152055) ## Summary Resolves: elastic#142081 elastic#149970 elastic#150968 By adding an initial query for installed integrations and augments the existing `InstalledIntegrationArray` constructed using `PackagePolicy`'s. Also removes `version` from the `packageKey` when calculating installed integrations as there can be mis-matches between different policy versions and the integration itself, and I believe the intended behavior here is to not have multiple `relatedIntegrations` returned for different versions. We may want to expand the response here to include all the different policy versions that exist (and perhaps # of agents assigned the policy). Lastly, updates `getIntegrationsInfoFromPolicy()` to also pull the base `package` details in addition to the policy_template details, as this is what ensure base packages show as `Installed: enabled` if they have an integration policy assigned (vs just showing as `Installed` like when there isn't an integration policy). Note: This PR also adds the `getPackages()` method to the `PackageClient` as it didn't currently exist, and was only available via the fleet API via the `/api/fleet/epm/packages` route. ### Before: <p align="center"> <img width="500" src="https://user-images.githubusercontent.com/2946766/221066781-be7aa1c6-1728-4200-98b2-d40946e48bbe.png" /> </p> ### After <p align="center"> <img width="500" src="https://user-images.githubusercontent.com/2946766/221323469-e24081f9-0741-41fd-8227-9e319c98b0d3.png" /> </p> --------- Co-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co> (cherry picked from commit b833b10)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…nstalled or enabled when they actually are (#152055) (#152411) # Backport This will backport the following commits from `main` to `8.6`: - [[Security Solution] Fixes Related Integrations showing as not installed or enabled when they actually are (#152055)](#152055) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Garrett Spong","email":"spong@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-03-01T01:47:28Z","message":"[Security Solution] Fixes Related Integrations showing as not installed or enabled when they actually are (#152055)\n\n## Summary\r\n\r\nResolves: https://github.com/elastic/kibana/issues/142081\r\nhttps://github.com/elastic/kibana/issues/149970\r\nhttps://github.com/elastic/kibana/issues/150968\r\n\r\nBy adding an initial query for installed integrations and augments the\r\nexisting `InstalledIntegrationArray` constructed using\r\n`PackagePolicy`'s. Also removes `version` from the `packageKey` when\r\ncalculating installed integrations as there can be mis-matches between\r\ndifferent policy versions and the integration itself, and I believe the\r\nintended behavior here is to not have multiple `relatedIntegrations`\r\nreturned for different versions. We may want to expand the response here\r\nto include all the different policy versions that exist (and perhaps #\r\nof agents assigned the policy).\r\n\r\nLastly, updates `getIntegrationsInfoFromPolicy()` to also pull the base\r\n`package` details in addition to the policy_template details, as this is\r\nwhat ensure base packages show as `Installed: enabled` if they have an\r\nintegration policy assigned (vs just showing as `Installed` like when\r\nthere isn't an integration policy).\r\n\r\nNote: This PR also adds the `getPackages()` method to the\r\n`PackageClient` as it didn't currently exist, and was only available via\r\nthe fleet API via the `/api/fleet/epm/packages` route.\r\n\r\n\r\n### Before:\r\n<p align=\"center\">\r\n<img width=\"500\"\r\nsrc=\"https://user-images.githubusercontent.com/2946766/221066781-be7aa1c6-1728-4200-98b2-d40946e48bbe.png\"\r\n/>\r\n</p>\r\n\r\n\r\n\r\n### After\r\n<p align=\"center\">\r\n<img width=\"500\"\r\nsrc=\"https://user-images.githubusercontent.com/2946766/221323469-e24081f9-0741-41fd-8227-9e319c98b0d3.png\"\r\n/>\r\n</p>\r\n\r\n\r\n---------\r\n\r\nCo-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>","sha":"b833b108215c858177535fd3feee406cc628bca8","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Fleet","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rules","v8.7.0","v8.8.0","v8.6.3","Feature:Related Integrations"],"number":152055,"url":"https://github.com/elastic/kibana/pull/152055","mergeCommit":{"message":"[Security Solution] Fixes Related Integrations showing as not installed or enabled when they actually are (#152055)\n\n## Summary\r\n\r\nResolves: https://github.com/elastic/kibana/issues/142081\r\nhttps://github.com/elastic/kibana/issues/149970\r\nhttps://github.com/elastic/kibana/issues/150968\r\n\r\nBy adding an initial query for installed integrations and augments the\r\nexisting `InstalledIntegrationArray` constructed using\r\n`PackagePolicy`'s. Also removes `version` from the `packageKey` when\r\ncalculating installed integrations as there can be mis-matches between\r\ndifferent policy versions and the integration itself, and I believe the\r\nintended behavior here is to not have multiple `relatedIntegrations`\r\nreturned for different versions. We may want to expand the response here\r\nto include all the different policy versions that exist (and perhaps #\r\nof agents assigned the policy).\r\n\r\nLastly, updates `getIntegrationsInfoFromPolicy()` to also pull the base\r\n`package` details in addition to the policy_template details, as this is\r\nwhat ensure base packages show as `Installed: enabled` if they have an\r\nintegration policy assigned (vs just showing as `Installed` like when\r\nthere isn't an integration policy).\r\n\r\nNote: This PR also adds the `getPackages()` method to the\r\n`PackageClient` as it didn't currently exist, and was only available via\r\nthe fleet API via the `/api/fleet/epm/packages` route.\r\n\r\n\r\n### Before:\r\n<p align=\"center\">\r\n<img width=\"500\"\r\nsrc=\"https://user-images.githubusercontent.com/2946766/221066781-be7aa1c6-1728-4200-98b2-d40946e48bbe.png\"\r\n/>\r\n</p>\r\n\r\n\r\n\r\n### After\r\n<p align=\"center\">\r\n<img width=\"500\"\r\nsrc=\"https://user-images.githubusercontent.com/2946766/221323469-e24081f9-0741-41fd-8227-9e319c98b0d3.png\"\r\n/>\r\n</p>\r\n\r\n\r\n---------\r\n\r\nCo-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>","sha":"b833b108215c858177535fd3feee406cc628bca8"}},"sourceBranch":"main","suggestedTargetBranches":["8.7","8.6"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/152055","number":152055,"mergeCommit":{"message":"[Security Solution] Fixes Related Integrations showing as not installed or enabled when they actually are (#152055)\n\n## Summary\r\n\r\nResolves: https://github.com/elastic/kibana/issues/142081\r\nhttps://github.com/elastic/kibana/issues/149970\r\nhttps://github.com/elastic/kibana/issues/150968\r\n\r\nBy adding an initial query for installed integrations and augments the\r\nexisting `InstalledIntegrationArray` constructed using\r\n`PackagePolicy`'s. Also removes `version` from the `packageKey` when\r\ncalculating installed integrations as there can be mis-matches between\r\ndifferent policy versions and the integration itself, and I believe the\r\nintended behavior here is to not have multiple `relatedIntegrations`\r\nreturned for different versions. We may want to expand the response here\r\nto include all the different policy versions that exist (and perhaps #\r\nof agents assigned the policy).\r\n\r\nLastly, updates `getIntegrationsInfoFromPolicy()` to also pull the base\r\n`package` details in addition to the policy_template details, as this is\r\nwhat ensure base packages show as `Installed: enabled` if they have an\r\nintegration policy assigned (vs just showing as `Installed` like when\r\nthere isn't an integration policy).\r\n\r\nNote: This PR also adds the `getPackages()` method to the\r\n`PackageClient` as it didn't currently exist, and was only available via\r\nthe fleet API via the `/api/fleet/epm/packages` route.\r\n\r\n\r\n### Before:\r\n<p align=\"center\">\r\n<img width=\"500\"\r\nsrc=\"https://user-images.githubusercontent.com/2946766/221066781-be7aa1c6-1728-4200-98b2-d40946e48bbe.png\"\r\n/>\r\n</p>\r\n\r\n\r\n\r\n### After\r\n<p align=\"center\">\r\n<img width=\"500\"\r\nsrc=\"https://user-images.githubusercontent.com/2946766/221323469-e24081f9-0741-41fd-8227-9e319c98b0d3.png\"\r\n/>\r\n</p>\r\n\r\n\r\n---------\r\n\r\nCo-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>","sha":"b833b108215c858177535fd3feee406cc628bca8"}},{"branch":"8.6","label":"v8.6.3","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Garrett Spong <spong@users.noreply.github.com>
…nstalled or enabled when they actually are (#152055) (#152412) # Backport This will backport the following commits from `main` to `8.7`: - [[Security Solution] Fixes Related Integrations showing as not installed or enabled when they actually are (#152055)](#152055) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Garrett Spong","email":"spong@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-03-01T01:47:28Z","message":"[Security Solution] Fixes Related Integrations showing as not installed or enabled when they actually are (#152055)\n\n## Summary\r\n\r\nResolves: https://github.com/elastic/kibana/issues/142081\r\nhttps://github.com/elastic/kibana/issues/149970\r\nhttps://github.com/elastic/kibana/issues/150968\r\n\r\nBy adding an initial query for installed integrations and augments the\r\nexisting `InstalledIntegrationArray` constructed using\r\n`PackagePolicy`'s. Also removes `version` from the `packageKey` when\r\ncalculating installed integrations as there can be mis-matches between\r\ndifferent policy versions and the integration itself, and I believe the\r\nintended behavior here is to not have multiple `relatedIntegrations`\r\nreturned for different versions. We may want to expand the response here\r\nto include all the different policy versions that exist (and perhaps #\r\nof agents assigned the policy).\r\n\r\nLastly, updates `getIntegrationsInfoFromPolicy()` to also pull the base\r\n`package` details in addition to the policy_template details, as this is\r\nwhat ensure base packages show as `Installed: enabled` if they have an\r\nintegration policy assigned (vs just showing as `Installed` like when\r\nthere isn't an integration policy).\r\n\r\nNote: This PR also adds the `getPackages()` method to the\r\n`PackageClient` as it didn't currently exist, and was only available via\r\nthe fleet API via the `/api/fleet/epm/packages` route.\r\n\r\n\r\n### Before:\r\n<p align=\"center\">\r\n<img width=\"500\"\r\nsrc=\"https://user-images.githubusercontent.com/2946766/221066781-be7aa1c6-1728-4200-98b2-d40946e48bbe.png\"\r\n/>\r\n</p>\r\n\r\n\r\n\r\n### After\r\n<p align=\"center\">\r\n<img width=\"500\"\r\nsrc=\"https://user-images.githubusercontent.com/2946766/221323469-e24081f9-0741-41fd-8227-9e319c98b0d3.png\"\r\n/>\r\n</p>\r\n\r\n\r\n---------\r\n\r\nCo-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>","sha":"b833b108215c858177535fd3feee406cc628bca8","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Fleet","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rules","v8.7.0","v8.8.0","v8.6.3","Feature:Related Integrations"],"number":152055,"url":"https://github.com/elastic/kibana/pull/152055","mergeCommit":{"message":"[Security Solution] Fixes Related Integrations showing as not installed or enabled when they actually are (#152055)\n\n## Summary\r\n\r\nResolves: https://github.com/elastic/kibana/issues/142081\r\nhttps://github.com/elastic/kibana/issues/149970\r\nhttps://github.com/elastic/kibana/issues/150968\r\n\r\nBy adding an initial query for installed integrations and augments the\r\nexisting `InstalledIntegrationArray` constructed using\r\n`PackagePolicy`'s. Also removes `version` from the `packageKey` when\r\ncalculating installed integrations as there can be mis-matches between\r\ndifferent policy versions and the integration itself, and I believe the\r\nintended behavior here is to not have multiple `relatedIntegrations`\r\nreturned for different versions. We may want to expand the response here\r\nto include all the different policy versions that exist (and perhaps #\r\nof agents assigned the policy).\r\n\r\nLastly, updates `getIntegrationsInfoFromPolicy()` to also pull the base\r\n`package` details in addition to the policy_template details, as this is\r\nwhat ensure base packages show as `Installed: enabled` if they have an\r\nintegration policy assigned (vs just showing as `Installed` like when\r\nthere isn't an integration policy).\r\n\r\nNote: This PR also adds the `getPackages()` method to the\r\n`PackageClient` as it didn't currently exist, and was only available via\r\nthe fleet API via the `/api/fleet/epm/packages` route.\r\n\r\n\r\n### Before:\r\n<p align=\"center\">\r\n<img width=\"500\"\r\nsrc=\"https://user-images.githubusercontent.com/2946766/221066781-be7aa1c6-1728-4200-98b2-d40946e48bbe.png\"\r\n/>\r\n</p>\r\n\r\n\r\n\r\n### After\r\n<p align=\"center\">\r\n<img width=\"500\"\r\nsrc=\"https://user-images.githubusercontent.com/2946766/221323469-e24081f9-0741-41fd-8227-9e319c98b0d3.png\"\r\n/>\r\n</p>\r\n\r\n\r\n---------\r\n\r\nCo-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>","sha":"b833b108215c858177535fd3feee406cc628bca8"}},"sourceBranch":"main","suggestedTargetBranches":["8.7","8.6"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/152055","number":152055,"mergeCommit":{"message":"[Security Solution] Fixes Related Integrations showing as not installed or enabled when they actually are (#152055)\n\n## Summary\r\n\r\nResolves: https://github.com/elastic/kibana/issues/142081\r\nhttps://github.com/elastic/kibana/issues/149970\r\nhttps://github.com/elastic/kibana/issues/150968\r\n\r\nBy adding an initial query for installed integrations and augments the\r\nexisting `InstalledIntegrationArray` constructed using\r\n`PackagePolicy`'s. Also removes `version` from the `packageKey` when\r\ncalculating installed integrations as there can be mis-matches between\r\ndifferent policy versions and the integration itself, and I believe the\r\nintended behavior here is to not have multiple `relatedIntegrations`\r\nreturned for different versions. We may want to expand the response here\r\nto include all the different policy versions that exist (and perhaps #\r\nof agents assigned the policy).\r\n\r\nLastly, updates `getIntegrationsInfoFromPolicy()` to also pull the base\r\n`package` details in addition to the policy_template details, as this is\r\nwhat ensure base packages show as `Installed: enabled` if they have an\r\nintegration policy assigned (vs just showing as `Installed` like when\r\nthere isn't an integration policy).\r\n\r\nNote: This PR also adds the `getPackages()` method to the\r\n`PackageClient` as it didn't currently exist, and was only available via\r\nthe fleet API via the `/api/fleet/epm/packages` route.\r\n\r\n\r\n### Before:\r\n<p align=\"center\">\r\n<img width=\"500\"\r\nsrc=\"https://user-images.githubusercontent.com/2946766/221066781-be7aa1c6-1728-4200-98b2-d40946e48bbe.png\"\r\n/>\r\n</p>\r\n\r\n\r\n\r\n### After\r\n<p align=\"center\">\r\n<img width=\"500\"\r\nsrc=\"https://user-images.githubusercontent.com/2946766/221323469-e24081f9-0741-41fd-8227-9e319c98b0d3.png\"\r\n/>\r\n</p>\r\n\r\n\r\n---------\r\n\r\nCo-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>","sha":"b833b108215c858177535fd3feee406cc628bca8"}},{"branch":"8.6","label":"v8.6.3","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Garrett Spong <spong@users.noreply.github.com>
…ed or enabled when they actually are (elastic#152055) ## Summary Resolves: elastic#142081 elastic#149970 elastic#150968 By adding an initial query for installed integrations and augments the existing `InstalledIntegrationArray` constructed using `PackagePolicy`'s. Also removes `version` from the `packageKey` when calculating installed integrations as there can be mis-matches between different policy versions and the integration itself, and I believe the intended behavior here is to not have multiple `relatedIntegrations` returned for different versions. We may want to expand the response here to include all the different policy versions that exist (and perhaps # of agents assigned the policy). Lastly, updates `getIntegrationsInfoFromPolicy()` to also pull the base `package` details in addition to the policy_template details, as this is what ensure base packages show as `Installed: enabled` if they have an integration policy assigned (vs just showing as `Installed` like when there isn't an integration policy). Note: This PR also adds the `getPackages()` method to the `PackageClient` as it didn't currently exist, and was only available via the fleet API via the `/api/fleet/epm/packages` route. ### Before: <p align="center"> <img width="500" src="https://user-images.githubusercontent.com/2946766/221066781-be7aa1c6-1728-4200-98b2-d40946e48bbe.png" /> </p> ### After <p align="center"> <img width="500" src="https://user-images.githubusercontent.com/2946766/221323469-e24081f9-0741-41fd-8227-9e319c98b0d3.png" /> </p> --------- Co-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>
Summary
Resolves: #142081 #149970 #150968
By adding an initial query for installed integrations and augments the existing
InstalledIntegrationArrayconstructed usingPackagePolicy's. Also removesversionfrom thepackageKeywhen calculating installed integrations as there can be mis-matches between different policy versions and the integration itself, and I believe the intended behavior here is to not have multiplerelatedIntegrationsreturned for different versions. We may want to expand the response here to include all the different policy versions that exist (and perhaps # of agents assigned the policy).Lastly, updates
getIntegrationsInfoFromPolicy()to also pull the basepackagedetails in addition to the policy_template details, as this is what ensure base packages show asInstalled: enabledif they have an integration policy assigned (vs just showing asInstalledlike when there isn't an integration policy).Note: This PR also adds the
getPackages()method to thePackageClientas it didn't currently exist, and was only available via the fleet API via the/api/fleet/epm/packagesroute.Before:
After
Checklist
Delete any items that are not applicable to this PR.