Skip to content

Commit 70019b7

Browse files
Merge branch 'master' into improve-alpha-messaging
2 parents 771153e + 7dc3972 commit 70019b7

File tree

239 files changed

+8178
-616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

239 files changed

+8178
-616
lines changed

.eslintrc.js

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,101 @@ module.exports = {
742742
},
743743
},
744744

745+
/**
746+
* Lists overrides
747+
*/
748+
{
749+
// typescript and javascript for front and back end
750+
files: ['x-pack/plugins/lists/**/*.{js,ts,tsx}'],
751+
plugins: ['eslint-plugin-node'],
752+
env: {
753+
mocha: true,
754+
jest: true,
755+
},
756+
rules: {
757+
'accessor-pairs': 'error',
758+
'array-callback-return': 'error',
759+
'no-array-constructor': 'error',
760+
complexity: 'error',
761+
'consistent-return': 'error',
762+
'func-style': ['error', 'expression'],
763+
'import/order': [
764+
'error',
765+
{
766+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
767+
'newlines-between': 'always',
768+
},
769+
],
770+
'sort-imports': [
771+
'error',
772+
{
773+
ignoreDeclarationSort: true,
774+
},
775+
],
776+
'node/no-deprecated-api': 'error',
777+
'no-bitwise': 'error',
778+
'no-continue': 'error',
779+
'no-dupe-keys': 'error',
780+
'no-duplicate-case': 'error',
781+
'no-duplicate-imports': 'error',
782+
'no-empty-character-class': 'error',
783+
'no-empty-pattern': 'error',
784+
'no-ex-assign': 'error',
785+
'no-extend-native': 'error',
786+
'no-extra-bind': 'error',
787+
'no-extra-boolean-cast': 'error',
788+
'no-extra-label': 'error',
789+
'no-func-assign': 'error',
790+
'no-implicit-globals': 'error',
791+
'no-implied-eval': 'error',
792+
'no-invalid-regexp': 'error',
793+
'no-inner-declarations': 'error',
794+
'no-lone-blocks': 'error',
795+
'no-multi-assign': 'error',
796+
'no-misleading-character-class': 'error',
797+
'no-new-symbol': 'error',
798+
'no-obj-calls': 'error',
799+
'no-param-reassign': ['error', { props: true }],
800+
'no-process-exit': 'error',
801+
'no-prototype-builtins': 'error',
802+
'no-return-await': 'error',
803+
'no-self-compare': 'error',
804+
'no-shadow-restricted-names': 'error',
805+
'no-sparse-arrays': 'error',
806+
'no-this-before-super': 'error',
807+
'no-undef': 'error',
808+
'no-unreachable': 'error',
809+
'no-unsafe-finally': 'error',
810+
'no-useless-call': 'error',
811+
'no-useless-catch': 'error',
812+
'no-useless-concat': 'error',
813+
'no-useless-computed-key': 'error',
814+
'no-useless-escape': 'error',
815+
'no-useless-rename': 'error',
816+
'no-useless-return': 'error',
817+
'no-void': 'error',
818+
'one-var-declaration-per-line': 'error',
819+
'prefer-object-spread': 'error',
820+
'prefer-promise-reject-errors': 'error',
821+
'prefer-rest-params': 'error',
822+
'prefer-spread': 'error',
823+
'prefer-template': 'error',
824+
'require-atomic-updates': 'error',
825+
'symbol-description': 'error',
826+
'vars-on-top': 'error',
827+
'@typescript-eslint/explicit-member-accessibility': 'error',
828+
'@typescript-eslint/no-this-alias': 'error',
829+
'@typescript-eslint/no-explicit-any': 'error',
830+
'@typescript-eslint/no-useless-constructor': 'error',
831+
'@typescript-eslint/unified-signatures': 'error',
832+
'@typescript-eslint/explicit-function-return-type': 'error',
833+
'@typescript-eslint/no-non-null-assertion': 'error',
834+
'@typescript-eslint/no-unused-vars': 'error',
835+
'no-template-curly-in-string': 'error',
836+
'sort-keys': 'error',
837+
'prefer-destructuring': 'error',
838+
},
839+
},
745840
/**
746841
* Alerting Services overrides
747842
*/

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
/x-pack/test/detection_engine_api_integration @elastic/siem
225225
/x-pack/test/api_integration/apis/siem @elastic/siem
226226
/x-pack/plugins/case @elastic/siem
227+
/x-pack/plugins/lists @elastic/siem
227228

228229
# Security Intelligence And Analytics
229-
/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules @elastic/security-intelligence-analytics
230230
/x-pack/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules @elastic/security-intelligence-analytics

x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SpanFlyout/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ function getSpanTypes(span: Span) {
7171
};
7272
}
7373

74-
const SpanBadge = styled(EuiBadge)`
74+
const SpanBadge = (styled(EuiBadge)`
7575
display: inline-block;
7676
margin-right: ${px(units.quarter)};
77-
` as any;
77+
` as unknown) as typeof EuiBadge;
7878

7979
const HttpInfoContainer = styled('div')`
8080
margin-right: ${px(units.quarter)};

x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Waterfall/SyncBadge.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import React from 'react';
1010
import styled from 'styled-components';
1111
import { px, units } from '../../../../../../style/variables';
1212

13-
const SpanBadge = styled(EuiBadge)`
13+
const SpanBadge = (styled(EuiBadge)`
1414
display: inline-block;
1515
margin-right: ${px(units.quarter)};
16-
` as any;
16+
` as unknown) as typeof EuiBadge;
1717

1818
interface SyncBadgeProps {
1919
/**

x-pack/legacy/plugins/apm/public/components/shared/Summary/ErrorCountSummaryItemBadge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface Props {
1717

1818
const Badge = (styled(EuiBadge)`
1919
margin-top: ${px(units.eighth)};
20-
` as any) as any;
20+
` as unknown) as typeof EuiBadge;
2121

2222
export const ErrorCountSummaryItemBadge = ({ count }: Props) => (
2323
<Badge color={euiThemeLight.euiColorDanger}>

x-pack/legacy/plugins/apm/public/components/shared/Summary/HttpInfoSummaryItem/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { HttpStatusBadge } from '../HttpStatusBadge';
1313

1414
const HttpInfoBadge = (styled(EuiBadge)`
1515
margin-right: ${px(units.quarter)};
16-
` as any) as any;
16+
` as unknown) as typeof EuiBadge;
1717

1818
const Url = styled('span')`
1919
display: inline-block;

x-pack/legacy/plugins/maps/public/angular/map_controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ app.controller(
336336

337337
function addFilters(newFilters) {
338338
newFilters.forEach(filter => {
339-
filter.$state = esFilters.FilterStateStore.APP_STATE;
339+
filter.$state = { store: esFilters.FilterStateStore.APP_STATE };
340340
});
341341
$scope.updateFiltersAndDispatch([...$scope.filters, ...newFilters]);
342342
}

x-pack/plugins/endpoint/common/generate_data.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ export class EndpointDocGenerator {
307307
process: {
308308
entity_id: options.entityID ? options.entityID : this.randomString(10),
309309
parent: options.parentEntityID ? { entity_id: options.parentEntityID } : undefined,
310-
name: options.processName ? options.processName : 'powershell.exe',
310+
name: options.processName ? options.processName : randomProcessName(),
311311
},
312312
};
313313
}
@@ -645,3 +645,16 @@ export class EndpointDocGenerator {
645645
return uuid.v4({ random: [...this.randomNGenerator(255, 16)] });
646646
}
647647
}
648+
649+
const fakeProcessNames = [
650+
'lsass.exe',
651+
'notepad.exe',
652+
'mimikatz.exe',
653+
'powershell.exe',
654+
'iexlorer.exe',
655+
'explorer.exe',
656+
];
657+
/** Return a random fake process name */
658+
function randomProcessName(): string {
659+
return fakeProcessNames[Math.floor(Math.random() * fakeProcessNames.length)];
660+
}

x-pack/plugins/endpoint/common/models/event.ts

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,45 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import { EndpointEvent, LegacyEndpointEvent } from '../types';
7+
import { LegacyEndpointEvent, ResolverEvent } from '../types';
88

9-
export function isLegacyEvent(
10-
event: EndpointEvent | LegacyEndpointEvent
11-
): event is LegacyEndpointEvent {
9+
export function isLegacyEvent(event: ResolverEvent): event is LegacyEndpointEvent {
1210
return (event as LegacyEndpointEvent).endgame !== undefined;
1311
}
1412

15-
export function eventTimestamp(
16-
event: EndpointEvent | LegacyEndpointEvent
17-
): string | undefined | number {
13+
export function eventTimestamp(event: ResolverEvent): string | undefined | number {
1814
if (isLegacyEvent(event)) {
1915
return event.endgame.timestamp_utc;
2016
} else {
2117
return event['@timestamp'];
2218
}
2319
}
2420

25-
export function eventName(event: EndpointEvent | LegacyEndpointEvent): string {
21+
export function eventName(event: ResolverEvent): string {
2622
if (isLegacyEvent(event)) {
2723
return event.endgame.process_name ? event.endgame.process_name : '';
2824
} else {
2925
return event.process.name;
3026
}
3127
}
28+
29+
export function eventId(event: ResolverEvent): string {
30+
if (isLegacyEvent(event)) {
31+
return event.endgame.serial_event_id ? String(event.endgame.serial_event_id) : '';
32+
}
33+
return event.event.id;
34+
}
35+
36+
export function entityId(event: ResolverEvent): string {
37+
if (isLegacyEvent(event)) {
38+
return event.endgame.unique_pid ? String(event.endgame.unique_pid) : '';
39+
}
40+
return event.process.entity_id;
41+
}
42+
43+
export function parentEntityId(event: ResolverEvent): string | undefined {
44+
if (isLegacyEvent(event)) {
45+
return event.endgame.unique_ppid ? String(event.endgame.unique_ppid) : undefined;
46+
}
47+
return event.process.parent?.entity_id;
48+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { schema } from '@kbn/config-schema';
8+
9+
/**
10+
* Used to validate GET requests for a complete resolver tree.
11+
*/
12+
export const validateTree = {
13+
params: schema.object({ id: schema.string() }),
14+
query: schema.object({
15+
children: schema.number({ defaultValue: 10, min: 0, max: 100 }),
16+
generations: schema.number({ defaultValue: 3, min: 0, max: 3 }),
17+
ancestors: schema.number({ defaultValue: 3, min: 0, max: 5 }),
18+
events: schema.number({ defaultValue: 100, min: 0, max: 1000 }),
19+
afterEvent: schema.maybe(schema.string()),
20+
afterChild: schema.maybe(schema.string()),
21+
legacyEndpointID: schema.maybe(schema.string()),
22+
}),
23+
};
24+
25+
/**
26+
* Used to validate GET requests for non process events for a specific event.
27+
*/
28+
export const validateEvents = {
29+
params: schema.object({ id: schema.string() }),
30+
query: schema.object({
31+
events: schema.number({ defaultValue: 100, min: 1, max: 1000 }),
32+
afterEvent: schema.maybe(schema.string()),
33+
legacyEndpointID: schema.maybe(schema.string()),
34+
}),
35+
};
36+
37+
/**
38+
* Used to validate GET requests for the ancestors of a process event.
39+
*/
40+
export const validateAncestry = {
41+
params: schema.object({ id: schema.string() }),
42+
query: schema.object({
43+
ancestors: schema.number({ defaultValue: 0, min: 0, max: 10 }),
44+
legacyEndpointID: schema.maybe(schema.string()),
45+
}),
46+
};
47+
48+
/**
49+
* Used to validate GET requests for children of a specified process event.
50+
*/
51+
export const validateChildren = {
52+
params: schema.object({ id: schema.string() }),
53+
query: schema.object({
54+
children: schema.number({ defaultValue: 10, min: 10, max: 100 }),
55+
generations: schema.number({ defaultValue: 3, min: 0, max: 3 }),
56+
afterChild: schema.maybe(schema.string()),
57+
legacyEndpointID: schema.maybe(schema.string()),
58+
}),
59+
};

0 commit comments

Comments
 (0)