Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SECURITY] Add endpoint alerts url #69707

Merged
merged 6 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions x-pack/plugins/security_solution/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export const APP_TIMELINES_PATH = `${APP_PATH}/timelines`;
export const APP_CASES_PATH = `${APP_PATH}/cases`;
export const APP_MANAGEMENT_PATH = `${APP_PATH}/management`;

export const SHOW_ENDPOINT_ALERTS_NAV = true;
export const APP_ENDPOINT_ALERTS_PATH = `${APP_PATH}/endpoint-alerts`;

/** The comma-delimited list of Elasticsearch indices from which the SIEM app collects events */
export const DEFAULT_INDEX_PATTERN = [
'apm-*-transaction*',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
APP_TIMELINES_PATH,
APP_CASES_PATH,
APP_MANAGEMENT_PATH,
APP_ENDPOINT_ALERTS_PATH,
} from '../../../common/constants';

export const navTabs: SiemNavTab = {
Expand Down Expand Up @@ -68,4 +69,11 @@ export const navTabs: SiemNavTab = {
disabled: false,
urlKey: SecurityPageName.management,
},
[SecurityPageName.endpointAlerts]: {
id: SecurityPageName.endpointAlerts,
name: 'Endpoint Alerts', // No Need of i18n since, it is just temporary
href: APP_ENDPOINT_ALERTS_PATH,
disabled: false,
urlKey: SecurityPageName.management, // Just to make type happy, this should go away soon
},
};
1 change: 1 addition & 0 deletions x-pack/plugins/security_solution/public/app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export enum SecurityPageName {
timelines = 'timelines',
case = 'case',
management = 'management',
endpointAlerts = 'endpointAlerts',
}
export interface SecuritySubPluginStore<K extends SecuritySubPluginKeyStore, T> {
initialState: Record<K, T | undefined>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ describe('SIEM Navigation', () => {
name: 'Timelines',
urlKey: 'timeline',
},
endpointAlerts: {
disabled: false,
href: '/app/security/endpoint-alerts',
id: 'endpointAlerts',
name: 'Endpoint Alerts',
urlKey: 'management',
},
},
pageName: 'hosts',
pathName: '/',
Expand Down Expand Up @@ -185,7 +192,7 @@ describe('SIEM Navigation', () => {
wrapper.setProps({
pageName: 'network',
pathName: '/',
tabName: undefined,
tabName: 'authentications',
});
wrapper.update();
expect(setBreadcrumbs).toHaveBeenNthCalledWith(
Expand All @@ -209,7 +216,13 @@ describe('SIEM Navigation', () => {
name: 'Cases',
urlKey: 'case',
},

endpointAlerts: {
disabled: false,
href: '/app/security/endpoint-alerts',
id: 'endpointAlerts',
name: 'Endpoint Alerts',
urlKey: 'management',
},
hosts: {
disabled: false,
href: '/app/security/hosts',
Expand Down Expand Up @@ -252,7 +265,7 @@ describe('SIEM Navigation', () => {
savedQuery: undefined,
search: '',
state: undefined,
tabName: undefined,
tabName: 'authentications',
timeline: { id: '', isOpen: false },
timerange: {
global: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export type SiemNavTabKey =
| SecurityPageName.alerts
| SecurityPageName.timelines
| SecurityPageName.case
| SecurityPageName.management;
| SecurityPageName.management
| SecurityPageName.endpointAlerts;

export type SiemNavTab = Record<SiemNavTabKey, NavTab>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AlertIndex } from './view';

export const EndpointAlertsRoutes: React.FC = () => (
<Switch>
<Route path="/:pageName(endpoint-alerts)">
<Route path="/">
<AlertIndex />
</Route>
</Switch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ export const alertListPagination = createStructuredSelector({
* Returns a boolean based on whether or not the user is on the alerts page
*/
export const isOnAlertPage = (state: Immutable<AlertListState>): boolean => {
return state.location ? state.location.pathname === '/endpoint-alerts' : false;
return state.location
? state.location.pathname === '/endpoint-alerts' ||
window.location.pathname.includes('/endpoint-alerts')
: false;
};

/**
Expand Down
31 changes: 31 additions & 0 deletions x-pack/plugins/security_solution/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import {
APP_TIMELINES_PATH,
APP_MANAGEMENT_PATH,
APP_CASES_PATH,
SHOW_ENDPOINT_ALERTS_NAV,
APP_ENDPOINT_ALERTS_PATH,
} from '../common/constants';
import { ConfigureEndpointDatasource } from './management/pages/policy/view/ingest_manager_integration/configure_datasource';

Expand Down Expand Up @@ -290,6 +292,35 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
},
});

if (SHOW_ENDPOINT_ALERTS_NAV) {
core.application.register({
id: `${APP_ID}:${SecurityPageName.endpointAlerts}`,
title: 'Endpoint Alerts',
order: 9002,
euiIconType: APP_ICON,
category: DEFAULT_APP_CATEGORIES.security,
appRoute: APP_ENDPOINT_ALERTS_PATH,
mount: async (params: AppMountParameters) => {
const [
{ coreStart, startPlugins, store, services },
{ renderApp, composeLibs },
{ endpointAlertsSubPlugin },
] = await Promise.all([
mountSecurityFactory(),
this.downloadAssets(),
this.downloadSubPlugins(),
]);
return renderApp({
...composeLibs(coreStart),
...params,
services,
store,
SubPluginRoutes: endpointAlertsSubPlugin.start(coreStart, startPlugins).SubPluginRoutes,
});
},
});
}

core.application.register({
id: 'siem',
appRoute: 'app/siem',
Expand Down