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] Introduce kibana nav #68862

Merged
merged 70 commits into from
Jun 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
1d80af1
Change the bootstrap of the app
XavierM Jun 5, 2020
61046d7
rename SiemPageName to SecurityPageName
XavierM Jun 6, 2020
da728cb
modify alerts routes
XavierM Jun 11, 2020
0d2ded1
modify cases routes
XavierM Jun 11, 2020
85694c6
modify hosts routes
XavierM Jun 11, 2020
8b14aaa
modify network routes
XavierM Jun 11, 2020
e22ffc1
modify overview routes
XavierM Jun 11, 2020
b6fa804
modify timelines routes
XavierM Jun 11, 2020
1ebe9cf
wip change management route
XavierM Jun 11, 2020
24b13c2
change route for common
XavierM Jun 11, 2020
5042843
some fixing from the first commit
XavierM Jun 11, 2020
2c19e2f
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 11, 2020
d59b7dd
modify route for management
XavierM Jun 11, 2020
83558d1
update url format hook to use history
XavierM Jun 11, 2020
0b2557c
bug when you click on external alerts from host or network
XavierM Jun 12, 2020
f72ecdc
improvement from josh feedback
XavierM Jun 12, 2020
dbd5710
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 12, 2020
0c35a8a
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 12, 2020
e9ae95b
redirect siem to security solution
XavierM Jun 15, 2020
9883885
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 15, 2020
2b6a3c1
a little clean up
XavierM Jun 15, 2020
a80574e
Fix types
XavierM Jun 15, 2020
6ebdb6a
fix breadcrumbs
XavierM Jun 15, 2020
a0fc914
fix unit test
XavierM Jun 16, 2020
7531b06
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 16, 2020
86012f5
Update index.tsx
patrykkopycinski Jun 16, 2020
efba7dd
Fix cypress
patrykkopycinski Jun 16, 2020
6541019
bug remove timeline when you are in case configure
XavierM Jun 16, 2020
e7da804
Merge branch 'security-nav-url' of github.com:XavierM/kibana into sec…
XavierM Jun 16, 2020
715d194
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 16, 2020
807cde2
Fix functionel test for management
XavierM Jun 16, 2020
9886f4e
Fix redirect siem + ml
XavierM Jun 16, 2020
89d6d5c
fixes some cypress tests
MadameSheema Jun 17, 2020
73f78ad
adds 'URL compatibility' test
MadameSheema Jun 17, 2020
6dd88de
bring ml back to alerts
XavierM Jun 17, 2020
1a5d15f
Merge branch 'security-nav-url' of github.com:XavierM/kibana into sec…
XavierM Jun 17, 2020
c85207f
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 17, 2020
2943240
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 17, 2020
dab391c
review I
XavierM Jun 17, 2020
7b02670
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 17, 2020
726f92b
Fix memory leak in timelines page
patrykkopycinski Jun 17, 2020
ecd5781
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 17, 2020
c7380d3
fix storage bug for timeline search bar
XavierM Jun 17, 2020
a8250ca
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 17, 2020
cdf96c7
Merge branch 'security-nav-url' of github.com:XavierM/kibana into sec…
XavierM Jun 17, 2020
d2bf563
fix endpoint merge + functional test
XavierM Jun 17, 2020
f7d1c66
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 17, 2020
884ce77
avoid timeline flyout toggle
XavierM Jun 17, 2020
93c8dbc
Fix link to ml score
XavierM Jun 18, 2020
fa3d27d
Fix breadcrumb
XavierM Jun 18, 2020
10f40b0
Fix management url
XavierM Jun 18, 2020
38c57ce
fix unit test
XavierM Jun 18, 2020
803a8e1
fixes typecheck issue
MadameSheema Jun 18, 2020
ff936e9
fixes remaining url cypress tests
MadameSheema Jun 18, 2020
4a6bfdf
fixes timeline scenario
MadameSheema Jun 18, 2020
f92623e
Merge branch 'master' into security-nav-url
elasticmachine Jun 18, 2020
992943c
fix link to details rule from timeline
XavierM Jun 18, 2020
7f09a1b
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 18, 2020
0a8dc14
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 18, 2020
be8b6b4
Merge branch 'master' into security-nav-url
elasticmachine Jun 19, 2020
c4d0f9e
review remove absolute path for consistency
XavierM Jun 19, 2020
9bbb8aa
Merge branch 'master' of github.com:elastic/kibana into security-nav-url
XavierM Jun 19, 2020
664ba4d
Merge branch 'security-nav-url' of github.com:XavierM/kibana into sec…
XavierM Jun 19, 2020
7ec8836
Fixing resolver alert generation (#69587)
jonathan-buttner Jun 19, 2020
7c7191f
[Security_Solution][Endpoint] Resolver leverage ancestry array for qu…
jonathan-buttner Jun 19, 2020
ff22d66
fix cypress test
XavierM Jun 19, 2020
6fe244e
skip failing suite (#69595)
spalger Jun 19, 2020
9a41c1d
[Endpoint] Fix flaky endpoints list unit test (#69591)
paul-tavares Jun 19, 2020
3758734
Merge branch 'security-nav-url' of github.com:XavierM/kibana into sec…
XavierM Jun 20, 2020
63a49c3
remove flaky test
XavierM Jun 20, 2020
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
8 changes: 8 additions & 0 deletions x-pack/plugins/security_solution/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ export const DEFAULT_INTERVAL_VALUE = 300000; // ms
export const DEFAULT_TIMEPICKER_QUICK_RANGES = 'timepicker:quickRanges';
export const NO_ALERT_INDEX = 'no-alert-index-049FC71A-4C2C-446F-9901-37XMC5024C51';

export const APP_OVERVIEW_PATH = `${APP_PATH}/overview`;
export const APP_ALERTS_PATH = `${APP_PATH}/alerts`;
export const APP_HOSTS_PATH = `${APP_PATH}/hosts`;
export const APP_NETWORK_PATH = `${APP_PATH}/network`;
export const APP_TIMELINES_PATH = `${APP_PATH}/timelines`;
export const APP_CASES_PATH = `${APP_PATH}/cases`;
export const APP_MANAGEMENT_PATH = `${APP_PATH}/management`;

/** 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 @@ -10,6 +10,7 @@ import {
TreeNode,
RelatedEventCategory,
ECSCategory,
ANCESTRY_LIMIT,
} from './generate_data';

interface Node {
Expand Down Expand Up @@ -113,6 +114,7 @@ describe('data generator', () => {
relatedEvents: 0,
relatedAlerts: 0,
});
tree.ancestry.delete(tree.origin.id);
});

it('creates an alert for the origin node but no other nodes', () => {
Expand Down Expand Up @@ -159,6 +161,30 @@ describe('data generator', () => {
return (inRelated || inRelatedAlerts || inLifecycle) && event.process.entity_id === node.id;
};

const verifyAncestry = (event: Event, genTree: Tree) => {
if (event.process.Ext.ancestry.length > 0) {
expect(event.process.parent?.entity_id).toBe(event.process.Ext.ancestry[0]);
}
for (let i = 0; i < event.process.Ext.ancestry.length; i++) {
const ancestor = event.process.Ext.ancestry[i];
const parent = genTree.children.get(ancestor) || genTree.ancestry.get(ancestor);
expect(ancestor).toBe(parent?.lifecycle[0].process.entity_id);

// the next ancestor should be the grandparent
if (i + 1 < event.process.Ext.ancestry.length) {
const grandparent = event.process.Ext.ancestry[i + 1];
expect(grandparent).toBe(parent?.lifecycle[0].process.parent?.entity_id);
}
}
};

it('has ancestry array defined', () => {
expect(tree.origin.lifecycle[0].process.Ext.ancestry.length).toBe(ANCESTRY_LIMIT);
for (const event of tree.allEvents) {
verifyAncestry(event, tree);
}
});

it('has the right related events for each node', () => {
const checkRelatedEvents = (node: TreeNode) => {
expect(node.relatedEvents.length).toEqual(4);
Expand All @@ -185,8 +211,6 @@ describe('data generator', () => {
for (const node of tree.children.values()) {
checkRelatedEvents(node);
}

checkRelatedEvents(tree.origin);
});

it('has the right number of related alerts for each node', () => {
Expand All @@ -202,7 +226,8 @@ describe('data generator', () => {
});

it('has the right number of ancestors', () => {
expect(tree.ancestry.size).toEqual(ancestors);
// +1 for the origin node
expect(tree.ancestry.size).toEqual(ancestors + 1);
});

it('has the right number of total children', () => {
Expand Down Expand Up @@ -239,10 +264,7 @@ describe('data generator', () => {
const children = tree.children.get(event.process.entity_id);
if (children) {
expect(eventInNode(event, children)).toBeTruthy();
return;
}

expect(eventInNode(event, tree.origin)).toBeTruthy();
});
});

Expand All @@ -260,8 +282,6 @@ describe('data generator', () => {
total += nodeEventCount(node);
}

total += nodeEventCount(tree.origin);

expect(tree.allEvents.length).toEqual(total);
});
});
Expand Down
49 changes: 42 additions & 7 deletions x-pack/plugins/security_solution/common/endpoint/generate_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ import {
import { factory as policyFactory } from './models/policy_config';

export type Event = AlertEvent | EndpointEvent;
/**
* This value indicates the limit for the size of the ancestry array. The endpoint currently saves up to 20 values
* in its messages. To simulate a limit on the array size I'm using 2 here so that we can't rely on there being a large
* number like 20. The ancestry array contains entity_ids for the ancestors of a particular process.
*
* The array has a special format. The entity_ids towards the beginning of the array are closer ancestors and the
* values towards the end of the array are more distant ancestors (grandparents). Therefore
* ancestry_array[0] == process.parent.entity_id and ancestry_array[1] == process.parent.parent.entity_id
*/
export const ANCESTRY_LIMIT: number = 2;

interface EventOptions {
timestamp?: number;
Expand All @@ -26,6 +36,7 @@ interface EventOptions {
eventType?: string;
eventCategory?: string | string[];
processName?: string;
ancestry?: string[];
pid?: number;
parentPid?: number;
extensions?: object;
Expand Down Expand Up @@ -352,7 +363,8 @@ export class EndpointDocGenerator {
public generateAlert(
ts = new Date().getTime(),
entityID = this.randomString(10),
parentEntityID?: string
parentEntityID?: string,
ancestryArray: string[] = []
): AlertEvent {
return {
...this.commonInfo,
Expand Down Expand Up @@ -412,6 +424,9 @@ export class EndpointDocGenerator {
sha256: 'fake sha256',
},
Ext: {
// simulate a finite ancestry array size, the endpoint limits the ancestry array to 20 entries we'll use
// 2 so that the backend can handle that case
ancestry: ancestryArray.slice(0, ANCESTRY_LIMIT),
code_signature: [
{
trusted: false,
Expand Down Expand Up @@ -532,6 +547,9 @@ export class EndpointDocGenerator {
}
: undefined,
name: processName,
// simulate a finite ancestry array size, the endpoint limits the ancestry array to 20 entries we'll use
// 2 so that the backend can handle that case
Ext: { ancestry: options.ancestry?.slice(0, ANCESTRY_LIMIT) || [] },
},
user: {
domain: this.randomString(10),
Expand Down Expand Up @@ -589,9 +607,6 @@ export class EndpointDocGenerator {
throw Error(`could not find origin while building tree: ${alert.process.entity_id}`);
}

// remove the origin node from the ancestry array
ancestryNodes.delete(alert.process.entity_id);

const children = Array.from(
this.descendantsTreeGenerator(
alert,
Expand Down Expand Up @@ -652,6 +667,7 @@ export class EndpointDocGenerator {
const ancestry = this.createAlertEventAncestry(
options.ancestors,
options.relatedEvents,
options.relatedAlerts,
options.percentWithRelated,
options.percentTerminated
);
Expand Down Expand Up @@ -715,7 +731,7 @@ export class EndpointDocGenerator {
}
};

// generate related alerts for rootW
// generate related alerts for root
const processDuration: number = 6 * 3600;
if (this.randomN(100) < pctWithRelated) {
addRelatedEvents(ancestor, processDuration, events);
Expand All @@ -740,6 +756,8 @@ export class EndpointDocGenerator {
ancestor = this.generateEvent({
timestamp,
parentEntityID: ancestor.process.entity_id,
// add the parent to the ancestry array
ancestry: [ancestor.process.entity_id, ...ancestor.process.Ext.ancestry],
parentPid: ancestor.process.pid,
pid: this.randomN(5000),
});
Expand All @@ -755,6 +773,7 @@ export class EndpointDocGenerator {
parentEntityID: ancestor.process.parent?.entity_id,
eventCategory: 'process',
eventType: 'end',
ancestry: ancestor.process.Ext.ancestry,
})
);
}
Expand All @@ -773,7 +792,12 @@ export class EndpointDocGenerator {
}
}
events.push(
this.generateAlert(timestamp, ancestor.process.entity_id, ancestor.process.parent?.entity_id)
this.generateAlert(
timestamp,
ancestor.process.entity_id,
ancestor.process.parent?.entity_id,
ancestor.process.Ext.ancestry
)
);
return events;
}
Expand Down Expand Up @@ -828,6 +852,10 @@ export class EndpointDocGenerator {
const child = this.generateEvent({
timestamp,
parentEntityID: currentState.event.process.entity_id,
ancestry: [
currentState.event.process.entity_id,
...currentState.event.process.Ext.ancestry,
],
});

maxChildren = this.randomN(maxChildrenPerNode + 1);
Expand All @@ -849,6 +877,7 @@ export class EndpointDocGenerator {
parentEntityID: child.process.parent?.entity_id,
eventCategory: 'process',
eventType: 'end',
ancestry: child.process.Ext.ancestry,
});
}
if (this.randomN(100) < percentNodesWithRelated) {
Expand Down Expand Up @@ -893,6 +922,7 @@ export class EndpointDocGenerator {
parentEntityID: node.process.parent?.entity_id,
eventCategory: eventInfo.category,
eventType: eventInfo.creationType,
ancestry: node.process.Ext.ancestry,
});
}
}
Expand All @@ -911,7 +941,12 @@ export class EndpointDocGenerator {
) {
for (let i = 0; i < relatedAlerts; i++) {
const ts = node['@timestamp'] + this.randomN(alertCreationTime) * 1000;
yield this.generateAlert(ts, node.process.entity_id, node.process.parent?.entity_id);
yield this.generateAlert(
ts,
node.process.entity_id,
node.process.parent?.entity_id,
node.process.Ext.ancestry
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ export function parentEntityId(event: ResolverEvent): string | undefined {
return event.process.parent?.entity_id;
}

export function ancestryArray(event: ResolverEvent): string[] | undefined {
if (isLegacyEvent(event)) {
return undefined;
}
return event.process.Ext.ancestry;
}

/**
* @param event The event to get the category for
*/
Expand Down
14 changes: 14 additions & 0 deletions x-pack/plugins/security_solution/common/endpoint/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ export interface AlertEvent {
thread?: ThreadFields[];
uptime: number;
Ext: {
/*
* The array has a special format. The entity_ids towards the beginning of the array are closer ancestors and the
* values towards the end of the array are more distant ancestors (grandparents). Therefore
* ancestry_array[0] == process.parent.entity_id and ancestry_array[1] == process.parent.parent.entity_id
*/
ancestry: string[];
code_signature: Array<{
subject_name: string;
trusted: boolean;
Expand Down Expand Up @@ -469,6 +475,14 @@ export interface EndpointEvent {
name?: string;
pid?: number;
};
/*
* The array has a special format. The entity_ids towards the beginning of the array are closer ancestors and the
* values towards the end of the array are more distant ancestors (grandparents). Therefore
* ancestry_array[0] == process.parent.entity_id and ancestry_array[1] == process.parent.parent.entity_id
*/
Ext: {
ancestry: string[];
};
};
user?: {
domain?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ import {
import { esArchiverLoad } from '../tasks/es_archiver';
import { loginAndWaitForPage } from '../tasks/login';

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

describe('Detections', () => {
context('Closing alerts', () => {
beforeEach(() => {
esArchiverLoad('alerts');
loginAndWaitForPage(DETECTIONS);
loginAndWaitForPage(ALERTS_URL);
});

it('Closes and opens alerts', () => {
Expand Down Expand Up @@ -161,7 +161,7 @@ describe('Detections', () => {
context('Opening alerts', () => {
beforeEach(() => {
esArchiverLoad('closed_alerts');
loginAndWaitForPage(DETECTIONS);
loginAndWaitForPage(ALERTS_URL);
});

it('Open one alert when more than one closed alerts are selected', () => {
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('Detections', () => {
context('Marking alerts as in-progress', () => {
beforeEach(() => {
esArchiverLoad('alerts');
loginAndWaitForPage(DETECTIONS);
loginAndWaitForPage(ALERTS_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 @@ -15,12 +15,12 @@ import {
import { esArchiverLoad, esArchiverUnload } from '../tasks/es_archiver';
import { loginAndWaitForPage } from '../tasks/login';

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

describe('Detections timeline', () => {
beforeEach(() => {
esArchiverLoad('timeline_alerts');
loginAndWaitForPage(DETECTIONS);
loginAndWaitForPage(ALERTS_URL);
});

afterEach(() => {
Expand Down
Loading