From 4c50f74d4ba715f028970f9b23ecac328e05447f Mon Sep 17 00:00:00 2001 From: Sergi Massaneda Date: Tue, 1 Oct 2024 12:18:17 +0200 Subject: [PATCH] [Security Solution] Fix the feature app list (#191965) ## Summary Fixes https://github.com/elastic/kibana-team/issues/1136 The Kibana feature definition for Security Solution was missing the correct plugin ID registered in the `app` definition. We were still defining the old _"securitySolution"_ app ID in the `app` property, instead of the new _"securitySolutionUI"_ ID. The Security Solution plugin ID change (_"securitySolution"_ -> _"securitySolutionUI"_) was done a long time ago, the inconsistency with the Security feature definition is causing the _Security_ app to still be visible in the global search when the Security feature is disabled: - In the role features Security and Cases disabled - Or in the space features config Captura de pantalla 2024-09-03 a les 15 31 09 This is fixed now: Before: Security app incorrectly enabled After: Security app disabled properly ### Caveat As per this PR changes: https://github.com/elastic/kibana/pull/113573 In the Kibana features of the role, under the Security catalog, both Security and Cases features need to be `none` for the Security Solution plugin to be disabled. Otherwise, we must enable the plugin and make the enabled features available. So, with a role with the following Kibana features: Security disabled cases enabled The Security app needs to be available and display only Cases available: navigation with only cases --------- Co-authored-by: Elastic Machine (cherry picked from commit e373e443770399d4b0401b02abc39f794a3ec321) --- .../security_solution/public/plugin.tsx | 195 ++++++++++-------- 1 file changed, 106 insertions(+), 89 deletions(-) diff --git a/x-pack/plugins/security_solution/public/plugin.tsx b/x-pack/plugins/security_solution/public/plugin.tsx index f7c35fbcb99f5..9833414b7a31f 100644 --- a/x-pack/plugins/security_solution/public/plugin.tsx +++ b/x-pack/plugins/security_solution/public/plugin.tsx @@ -17,7 +17,7 @@ import type { PluginInitializerContext, Plugin as IPlugin, } from '@kbn/core/public'; -import { DEFAULT_APP_CATEGORIES } from '@kbn/core/public'; +import { AppStatus, DEFAULT_APP_CATEGORIES } from '@kbn/core/public'; import { Storage } from '@kbn/kibana-utils-plugin/public'; import type { TriggersAndActionsUIPublicPluginSetup } from '@kbn/triggers-actions-ui-plugin/public'; import { uiMetricService } from '@kbn/cloud-security-posture-common/utils/ui_metrics'; @@ -208,81 +208,8 @@ export class Plugin implements IPlugin { if (!this._subPlugins) { const { subPluginClasses } = await this.lazySubPlugins(); @@ -317,9 +249,6 @@ export class Plugin implements IPlugin ({ + status: AppStatus.inaccessible, + visibleIn: [], + })); + // no need to register the links updater when the plugin is inaccessible + return; + } + + // Configuration of AppLinks updater registration based on license and capabilities const { appLinks: initialAppLinks, getFilteredLinks, solutionAppLinksSwitcher, } = await this.lazyApplicationLinks(); - const { license$ } = plugins.licensing; - const { upsellingService, isSolutionNavigationEnabled$ } = this.contract; registerDeepLinksUpdater(this.appUpdater$, isSolutionNavigationEnabled$); - const appLinks$ = new Subject(); - appLinks$.next(initialAppLinks); + const appLinksToUpdate$ = new Subject(); + appLinksToUpdate$.next(initialAppLinks); - appLinks$ + appLinksToUpdate$ .pipe(combineLatestWith(license$, isSolutionNavigationEnabled$)) .subscribe(([appLinks, license, isSolutionNavigationEnabled]) => { const links = isSolutionNavigationEnabled ? solutionAppLinksSwitcher(appLinks) : appLinks; const linksPermissions: LinksPermissions = { experimentalFeatures: this.experimentalFeatures, upselling: upsellingService, - capabilities: core.application.capabilities, + capabilities, uiSettingsClient: core.uiSettings, ...(license.type != null && { license }), }; @@ -437,7 +379,82 @@ export class Plugin implements IPlugin