Skip to content

Commit

Permalink
[TIP] Enables TI plugin with kibana.yml feature flag (#137838)
Browse files Browse the repository at this point in the history
- 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']

elastic/security-team#4505
  • Loading branch information
PhilippeOberti authored Aug 9, 2022
1 parent 75bbe04 commit ff28e68
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export const useSecuritySolutionNavigation = () => {

const disabledNavTabs = [
...(!useIsExperimentalFeatureEnabled('kubernetesEnabled') ? ['kubernetes'] : []),
...(!useIsExperimentalFeatureEnabled('threatIntelligenceEnabled')
? ['threat-intelligence']
: []),
];
const enabledNavTabs: GenericNavRecord = omit(disabledNavTabs, navTabs);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
: []),
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
];
1 change: 1 addition & 0 deletions x-pack/test/security_solution_cypress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
'riskyHostsEnabled',
'riskyUsersEnabled',
'insightsRelatedAlertsByProcessAncestry',
'threatIntelligenceEnabled',
])}`,
`--home.disableWelcomeScreen=true`,
],
Expand Down
1 change: 1 addition & 0 deletions x-pack/test/threat_intelligence_cypress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
`--xpack.securitySolution.enableExperimental=${JSON.stringify([
'riskyHostsEnabled',
'riskyUsersEnabled',
'threatIntelligenceEnabled',
])}`,
`--home.disableWelcomeScreen=true`,
],
Expand Down

0 comments on commit ff28e68

Please sign in to comment.