Skip to content

Commit

Permalink
[7.x] [SECURITY] Alerts back to Detections (#71142) (#71193)
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierM authored Jul 10, 2020
1 parent 6b989b0 commit 7ad38fc
Show file tree
Hide file tree
Showing 285 changed files with 206 additions and 226 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/security_solution/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const NO_ALERT_INDEX = 'no-alert-index-049FC71A-4C2C-446F-9901-37XMC5024C
export const ENDPOINT_METADATA_INDEX = 'metrics-endpoint.metadata-*';

export enum SecurityPageName {
alerts = 'alerts',
detections = 'detections',
overview = 'overview',
hosts = 'hosts',
network = 'network',
Expand All @@ -46,7 +46,7 @@ export enum SecurityPageName {
}

export const APP_OVERVIEW_PATH = `${APP_PATH}/overview`;
export const APP_ALERTS_PATH = `${APP_PATH}/alerts`;
export const APP_DETECTIONS_PATH = `${APP_PATH}/detections`;
export const APP_HOSTS_PATH = `${APP_PATH}/hosts`;
export const APP_NETWORK_PATH = `${APP_PATH}/network`;
export const APP_TIMELINES_PATH = `${APP_PATH}/timelines`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ export interface SavedTimelineNote extends runtimeTypes.TypeOf<typeof SavedTimel
export enum TimelineId {
hostsPageEvents = 'hosts-page-events',
hostsPageExternalAlerts = 'hosts-page-external-alerts',
alertsRulesDetailsPage = 'alerts-rules-details-page',
alertsPage = 'alerts-page',
detectionsRulesDetailsPage = 'detections-rules-details-page',
detectionsPage = 'detections-page',
networkPageExternalAlerts = 'network-page-external-alerts',
active = 'timeline-1',
test = 'test', // Reserved for testing purposes
Expand All @@ -250,8 +250,8 @@ export enum TimelineId {
export const TimelineIdLiteralRt = runtimeTypes.union([
runtimeTypes.literal(TimelineId.hostsPageEvents),
runtimeTypes.literal(TimelineId.hostsPageExternalAlerts),
runtimeTypes.literal(TimelineId.alertsRulesDetailsPage),
runtimeTypes.literal(TimelineId.alertsPage),
runtimeTypes.literal(TimelineId.detectionsRulesDetailsPage),
runtimeTypes.literal(TimelineId.detectionsPage),
runtimeTypes.literal(TimelineId.networkPageExternalAlerts),
runtimeTypes.literal(TimelineId.active),
runtimeTypes.literal(TimelineId.test),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ import {
import { esArchiverLoad } from '../tasks/es_archiver';
import { loginAndWaitForPage } from '../tasks/login';

import { ALERTS_URL } from '../urls/navigation';
import { DETECTIONS_URL } from '../urls/navigation';

// Flaky: https://github.com/elastic/kibana/issues/70727
describe.skip('Alerts', () => {
context('Closing alerts', () => {
beforeEach(() => {
esArchiverLoad('alerts');
loginAndWaitForPage(ALERTS_URL);
loginAndWaitForPage(DETECTIONS_URL);
});

it('Closes and opens alerts', () => {
Expand Down Expand Up @@ -162,7 +162,7 @@ describe.skip('Alerts', () => {
context('Opening alerts', () => {
beforeEach(() => {
esArchiverLoad('closed_alerts');
loginAndWaitForPage(ALERTS_URL);
loginAndWaitForPage(DETECTIONS_URL);
});

it('Open one alert when more than one closed alerts are selected', () => {
Expand Down Expand Up @@ -208,7 +208,7 @@ describe.skip('Alerts', () => {
context('Marking alerts as in-progress', () => {
beforeEach(() => {
esArchiverLoad('alerts');
loginAndWaitForPage(ALERTS_URL);
loginAndWaitForPage(DETECTIONS_URL);
});

it('Mark one alert in progress when more than one open alerts are selected', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { esArchiverLoad, esArchiverUnload } from '../tasks/es_archiver';
import { loginAndWaitForPageWithoutDateRange } from '../tasks/login';

import { ALERTS_URL } from '../urls/navigation';
import { DETECTIONS_URL } from '../urls/navigation';

describe('Alerts detection rules', () => {
before(() => {
Expand All @@ -38,7 +38,7 @@ describe('Alerts detection rules', () => {
});

it('Sorts by activated rules', () => {
loginAndWaitForPageWithoutDateRange(ALERTS_URL);
loginAndWaitForPageWithoutDateRange(DETECTIONS_URL);
waitForAlertsPanelToBeLoaded();
waitForAlertsIndexToBeCreated();
goToManageAlertsDetectionRules();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import {
import { esArchiverLoad, esArchiverUnload } from '../tasks/es_archiver';
import { loginAndWaitForPageWithoutDateRange } from '../tasks/login';

import { ALERTS_URL } from '../urls/navigation';
import { DETECTIONS_URL } from '../urls/navigation';

describe.skip('Detection rules, custom', () => {
before(() => {
Expand All @@ -74,7 +74,7 @@ describe.skip('Detection rules, custom', () => {
});

it('Creates and activates a new custom rule', () => {
loginAndWaitForPageWithoutDateRange(ALERTS_URL);
loginAndWaitForPageWithoutDateRange(DETECTIONS_URL);
waitForAlertsPanelToBeLoaded();
waitForAlertsIndexToBeCreated();
goToManageAlertsDetectionRules();
Expand Down Expand Up @@ -169,7 +169,7 @@ describe.skip('Detection rules, custom', () => {
describe('Deletes custom rules', () => {
beforeEach(() => {
esArchiverLoad('custom_rules');
loginAndWaitForPageWithoutDateRange(ALERTS_URL);
loginAndWaitForPageWithoutDateRange(DETECTIONS_URL);
waitForAlertsPanelToBeLoaded();
waitForAlertsIndexToBeCreated();
goToManageAlertsDetectionRules();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { exportFirstRule } from '../tasks/alerts_detection_rules';
import { esArchiverLoad, esArchiverUnload } from '../tasks/es_archiver';
import { loginAndWaitForPageWithoutDateRange } from '../tasks/login';

import { ALERTS_URL } from '../urls/navigation';
import { DETECTIONS_URL } from '../urls/navigation';

const EXPECTED_EXPORTED_RULE_FILE_PATH = 'cypress/test_files/expected_rules_export.ndjson';

Expand All @@ -32,7 +32,7 @@ describe('Export rules', () => {
});

it('Exports a custom rule', () => {
loginAndWaitForPageWithoutDateRange(ALERTS_URL);
loginAndWaitForPageWithoutDateRange(DETECTIONS_URL);
waitForAlertsPanelToBeLoaded();
waitForAlertsIndexToBeCreated();
goToManageAlertsDetectionRules();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import {
import { esArchiverLoad, esArchiverUnload } from '../tasks/es_archiver';
import { loginAndWaitForPageWithoutDateRange } from '../tasks/login';

import { ALERTS_URL } from '../urls/navigation';
import { DETECTIONS_URL } from '../urls/navigation';

describe('Detection rules, machine learning', () => {
before(() => {
Expand All @@ -70,7 +70,7 @@ describe('Detection rules, machine learning', () => {
});

it('Creates and activates a new ml rule', () => {
loginAndWaitForPageWithoutDateRange(ALERTS_URL);
loginAndWaitForPageWithoutDateRange(DETECTIONS_URL);
waitForAlertsPanelToBeLoaded();
waitForAlertsIndexToBeCreated();
goToManageAlertsDetectionRules();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
import { esArchiverLoadEmptyKibana, esArchiverUnloadEmptyKibana } from '../tasks/es_archiver';
import { loginAndWaitForPageWithoutDateRange } from '../tasks/login';

import { ALERTS_URL } from '../urls/navigation';
import { DETECTIONS_URL } from '../urls/navigation';

import { totalNumberOfPrebuiltRules } from '../objects/rule';

Expand All @@ -48,7 +48,7 @@ describe('Alerts rules, prebuilt rules', () => {
const expectedNumberOfRules = totalNumberOfPrebuiltRules;
const expectedElasticRulesBtnText = `Elastic rules (${expectedNumberOfRules})`;

loginAndWaitForPageWithoutDateRange(ALERTS_URL);
loginAndWaitForPageWithoutDateRange(DETECTIONS_URL);
waitForAlertsPanelToBeLoaded();
waitForAlertsIndexToBeCreated();
goToManageAlertsDetectionRules();
Expand All @@ -73,7 +73,7 @@ describe('Deleting prebuilt rules', () => {
const expectedElasticRulesBtnText = `Elastic rules (${expectedNumberOfRules})`;

esArchiverLoadEmptyKibana();
loginAndWaitForPageWithoutDateRange(ALERTS_URL);
loginAndWaitForPageWithoutDateRange(DETECTIONS_URL);
waitForAlertsPanelToBeLoaded();
waitForAlertsIndexToBeCreated();
goToManageAlertsDetectionRules();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import {
import { esArchiverLoad, esArchiverUnload } from '../tasks/es_archiver';
import { loginAndWaitForPage } from '../tasks/login';

import { ALERTS_URL } from '../urls/navigation';
import { DETECTIONS_URL } from '../urls/navigation';

// Flakky: https://github.com/elastic/kibana/issues/71220
describe.skip('Alerts timeline', () => {
beforeEach(() => {
esArchiverLoad('timeline_alerts');
loginAndWaitForPage(ALERTS_URL);
loginAndWaitForPage(DETECTIONS_URL);
});

afterEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import {
ALERTS,
CASES,
DETECTIONS,
HOSTS,
MANAGEMENT,
NETWORK,
Expand All @@ -17,7 +17,7 @@ import { loginAndWaitForPage } from '../tasks/login';
import { navigateFromHeaderTo } from '../tasks/security_header';

import {
ALERTS_URL,
DETECTIONS_URL,
CASES_URL,
HOSTS_URL,
KIBANA_HOME,
Expand All @@ -28,8 +28,8 @@ import {
} from '../urls/navigation';
import { openKibanaNavigation, navigateFromKibanaCollapsibleTo } from '../tasks/kibana_navigation';
import {
ALERTS_PAGE,
CASES_PAGE,
DETECTIONS_PAGE,
HOSTS_PAGE,
ADMINISTRATION_PAGE,
NETWORK_PAGE,
Expand All @@ -47,9 +47,9 @@ describe('top-level navigation common to all pages in the Security app', () => {
cy.url().should('include', OVERVIEW_URL);
});

it('navigates to the Alerts page', () => {
navigateFromHeaderTo(ALERTS);
cy.url().should('include', ALERTS_URL);
it('navigates to the Detections page', () => {
navigateFromHeaderTo(DETECTIONS);
cy.url().should('include', DETECTIONS_URL);
});

it('navigates to the Hosts page', () => {
Expand Down Expand Up @@ -90,9 +90,9 @@ describe('Kibana navigation to all pages in the Security app ', () => {
cy.url().should('include', OVERVIEW_URL);
});

it('navigates to the Alerts page', () => {
navigateFromKibanaCollapsibleTo(ALERTS_PAGE);
cy.url().should('include', ALERTS_URL);
it('navigates to the Detections page', () => {
navigateFromKibanaCollapsibleTo(DETECTIONS_PAGE);
cy.url().should('include', DETECTIONS_URL);
});

it('navigates to the Hosts page', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { loginAndWaitForPage } from '../tasks/login';
import { DETECTIONS } from '../urls/navigation';

describe('URL compatibility', () => {
it('Redirects to Alerts from old Detections URL', () => {
it('Redirects to Detection alerts from old Detections URL', () => {
loginAndWaitForPage(DETECTIONS);

cy.url().should('include', '/security/alerts');
cy.url().should('include', '/security/detections');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const ALERTS_PAGE = '[data-test-subj="collapsibleNavGroup-security"] [title="Alerts"]';
export const DETECTIONS_PAGE =
'[data-test-subj="collapsibleNavGroup-security"] [title="Detections"]';

export const CASES_PAGE = '[data-test-subj="collapsibleNavGroup-security"] [title="Cases"]';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const ALERTS = '[data-test-subj="navigation-alerts"]';
export const DETECTIONS = '[data-test-subj="navigation-detections"]';

export const BREADCRUMBS = '[data-test-subj="breadcrumbs"] a';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const ALERTS_URL = 'app/security/alerts';
export const DETECTIONS_URL = 'app/security/detections';
export const CASES_URL = '/app/security/cases';
export const DETECTIONS = '/app/siem#/detections';
export const HOSTS_URL = '/app/security/hosts/allHosts';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SecurityPageName } from '../types';
import { SiemNavTab } from '../../common/components/navigation/types';
import {
APP_OVERVIEW_PATH,
APP_ALERTS_PATH,
APP_DETECTIONS_PATH,
APP_HOSTS_PATH,
APP_NETWORK_PATH,
APP_TIMELINES_PATH,
Expand All @@ -25,12 +25,12 @@ export const navTabs: SiemNavTab = {
disabled: false,
urlKey: 'overview',
},
[SecurityPageName.alerts]: {
id: SecurityPageName.alerts,
name: i18n.ALERTS,
href: APP_ALERTS_PATH,
[SecurityPageName.detections]: {
id: SecurityPageName.detections,
name: i18n.DETECTION_ENGINE,
href: APP_DETECTIONS_PATH,
disabled: false,
urlKey: 'alerts',
urlKey: 'detections',
},
[SecurityPageName.hosts]: {
id: SecurityPageName.hosts,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/security_solution/public/app/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { UseUrlState } from '../../common/components/url_state';
import { useWithSource } from '../../common/containers/source';
import { useShowTimeline } from '../../common/utils/timeline/use_show_timeline';
import { navTabs } from './home_navigations';
import { useSignalIndex } from '../../alerts/containers/detection_engine/alerts/use_signal_index';
import { useSignalIndex } from '../../detections/containers/detection_engine/alerts/use_signal_index';

const WrappedByAutoSizer = styled.div`
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { Case, DeleteCase, FilterOptions, SortFieldCase } from '../../containers
import { useGetCases, UpdateCase } from '../../containers/use_get_cases';
import { useGetCasesStatus } from '../../containers/use_get_cases_status';
import { useDeleteCases } from '../../containers/use_delete_cases';
import { EuiBasicTableOnChange } from '../../../alerts/pages/detection_engine/rules/types';
import { EuiBasicTableOnChange } from '../../../detections/pages/detection_engine/rules/types';
import { Panel } from '../../../common/components/panel';
import {
UtilityBar,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const ALERTS_TABLE_TITLE = i18n.translate(
export const ALERTS_GRAPH_TITLE = i18n.translate(
'xpack.securitySolution.alertsView.alertsGraphTitle',
{
defaultMessage: 'External alert count',
defaultMessage: 'External alert trend',
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import { wait } from '../../lib/helpers';
import { mockEventViewerResponse } from './mock';
import { StatefulEventsViewer } from '.';
import { defaultHeaders } from './default_headers';
import { useFetchIndexPatterns } from '../../../alerts/containers/detection_engine/rules/fetch_index_patterns';
import { useFetchIndexPatterns } from '../../../detections/containers/detection_engine/rules/fetch_index_patterns';
import { mockBrowserFields } from '../../containers/source/mock';
import { eventsDefaultModel } from './default_model';
import { useMountAppended } from '../../utils/use_mount_appended';

const mockUseFetchIndexPatterns: jest.Mock = useFetchIndexPatterns as jest.Mock;
jest.mock('../../../alerts/containers/detection_engine/rules/fetch_index_patterns');
jest.mock('../../../detections/containers/detection_engine/rules/fetch_index_patterns');
mockUseFetchIndexPatterns.mockImplementation(() => [
{
browserFields: mockBrowserFields,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import { useMountAppended } from '../../utils/use_mount_appended';

import { mockEventViewerResponse } from './mock';
import { StatefulEventsViewer } from '.';
import { useFetchIndexPatterns } from '../../../alerts/containers/detection_engine/rules/fetch_index_patterns';
import { useFetchIndexPatterns } from '../../../detections/containers/detection_engine/rules/fetch_index_patterns';
import { mockBrowserFields } from '../../containers/source/mock';
import { eventsDefaultModel } from './default_model';

const mockUseFetchIndexPatterns: jest.Mock = useFetchIndexPatterns as jest.Mock;
jest.mock('../../../alerts/containers/detection_engine/rules/fetch_index_patterns');
jest.mock('../../../detections/containers/detection_engine/rules/fetch_index_patterns');
mockUseFetchIndexPatterns.mockImplementation(() => [
{
browserFields: mockBrowserFields,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { OnChangeItemsPerPage } from '../../../timelines/components/timeline/eve
import { Filter } from '../../../../../../../src/plugins/data/public';
import { useUiSetting } from '../../lib/kibana';
import { EventsViewer } from './events_viewer';
import { useFetchIndexPatterns } from '../../../alerts/containers/detection_engine/rules/fetch_index_patterns';
import { useFetchIndexPatterns } from '../../../detections/containers/detection_engine/rules/fetch_index_patterns';
import { InspectButtonContainer } from '../inspect';

export interface OwnProps {
Expand Down
Loading

0 comments on commit 7ad38fc

Please sign in to comment.