[TIP] Enables TI plugin with kibana.yml feature flag (#137838) (#138373)

- show/hide navbar entries in both old and new navigation per feature flag value
- load plugin per feature flag value
- flag: xpack.securitySolution.enableExperimental: ['threatIntelligenceEnabled']

https://github.com/elastic/security-team/issues/4505
(cherry picked from commit ff28e68159)

Co-authored-by: Philippe Oberti <philippe.oberti@elastic.co>
This commit is contained in:
Kibana Machine 2022-08-09 07:10:55 -04:00 committed by GitHub
parent 62ed40b0aa
commit 31726b19b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 18 deletions

View file

@ -22,9 +22,10 @@ export const allowedExperimentalValues = Object.freeze({
pendingActionResponsesWithAck: true,
policyListEnabled: true,
policyResponseInFleetEnabled: true,
threatIntelligenceEnabled: false,
/**
* This is used for enabling the end to end tests for the security_solution telemetry.
* This is used for enabling the end-to-end tests for the security_solution telemetry.
* We disable the telemetry since we don't have specific roles or permissions around it and
* we don't want people to be able to violate security by getting access to whole documents
* around telemetry they should not.

View file

@ -142,16 +142,6 @@ Object {
"name": "Users",
"onClick": [Function],
},
Object {
"data-href": "securitySolutionUI/threat-intelligence",
"data-test-subj": "navigation-threat-intelligence",
"disabled": false,
"href": "securitySolutionUI/threat-intelligence",
"id": "threat-intelligence",
"isSelected": false,
"name": "Threat Intelligence",
"onClick": [Function],
},
],
"name": "Explore",
},

View file

@ -31,6 +31,9 @@ export const useSecuritySolutionNavigation = () => {
const disabledNavTabs = [
...(!useIsExperimentalFeatureEnabled('kubernetesEnabled') ? ['kubernetes'] : []),
...(!useIsExperimentalFeatureEnabled('threatIntelligenceEnabled')
? ['threat-intelligence']
: []),
];
const enabledNavTabs: GenericNavRecord = omit(disabledNavTabs, navTabs);

View file

@ -113,7 +113,9 @@ function usePrimaryNavigationItemsToDisplay(navTabs: Record<string, NavTab>) {
...(navTabs[SecurityPageName.users] != null
? [navTabs[SecurityPageName.users]]
: []),
navTabs[SecurityPageName.threatIntelligence],
...(navTabs[SecurityPageName.threatIntelligence] != null
? [navTabs[SecurityPageName.threatIntelligence]]
: []),
],
},
{

View file

@ -15,6 +15,7 @@ export const links: LinkItem = {
id: SecurityPageName.threatIntelligence,
title: THREAT_INTELLIGENCE,
path: THREAT_INTELLIGENCE_PATH,
experimentalKey: 'threatIntelligenceEnabled',
landingImage: threatIntelligencePageImg,
description: i18n.translate('xpack.securitySolution.appLinks.threatIntelligence.description', {
defaultMessage:

View file

@ -6,20 +6,29 @@
*/
import React from 'react';
import { Redirect } from 'react-router-dom';
import { TrackApplicationView } from '@kbn/usage-collection-plugin/public';
import { ThreatIntelligencePage } from './pages/threat_intelligence';
import { SecurityPageName, THREAT_INTELLIGENCE_PATH } from '../../common/constants';
import type { SecuritySubPluginRoutes } from '../app/types';
import { useIsExperimentalFeatureEnabled } from '../common/hooks/use_experimental_features';
const ThreatIntelligenceRoutes = () => (
<TrackApplicationView viewId={SecurityPageName.threatIntelligence}>
<ThreatIntelligencePage />
</TrackApplicationView>
);
const ThreatIntelligenceRoutes = () => {
const enabled = useIsExperimentalFeatureEnabled('threatIntelligenceEnabled');
if (!enabled) {
return <Redirect to="/" />;
}
return (
<TrackApplicationView viewId={SecurityPageName.threatIntelligence}>
<ThreatIntelligencePage />
</TrackApplicationView>
);
};
export const routes: SecuritySubPluginRoutes = [
{
path: THREAT_INTELLIGENCE_PATH,
render: ThreatIntelligenceRoutes,
component: ThreatIntelligenceRoutes,
},
];

View file

@ -52,6 +52,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
'riskyHostsEnabled',
'riskyUsersEnabled',
'insightsRelatedAlertsByProcessAncestry',
'threatIntelligenceEnabled',
])}`,
`--home.disableWelcomeScreen=true`,
],

View file

@ -51,6 +51,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
`--xpack.securitySolution.enableExperimental=${JSON.stringify([
'riskyHostsEnabled',
'riskyUsersEnabled',
'threatIntelligenceEnabled',
])}`,
`--home.disableWelcomeScreen=true`,
],