-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[SIEM][Detections] Adds large list support using REST endpoints #62552
Merged
FrankHassanabad
merged 82 commits into
elastic:master
from
FrankHassanabad:add-list-endpoints
Apr 28, 2020
Merged
Changes from 56 commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
7ceb7fa
POC Large Lists Support
FrankHassanabad 9324132
added more wip code
FrankHassanabad c949a1c
Moved from saved objects to data indexes
FrankHassanabad af269b6
Merge branch 'master' into add-list-endpoints
FrankHassanabad b1309f4
Fixed type issues and API from update from master
FrankHassanabad 5330743
Added more endpoints for delete and get
FrankHassanabad 2077c49
Added more delete endpoints
FrankHassanabad e1bd777
Merge branch 'master' into add-list-endpoints
FrankHassanabad 15e14cb
Updated lists to work with custom buffer and fixed bugs
FrankHassanabad 0d52c3e
Merge branch 'master' into add-list-endpoints
FrankHassanabad b8bbf26
Merge branch 'master' into add-list-endpoints
FrankHassanabad 928b45f
Large sweeping changes
FrankHassanabad 79e0bf4
Fixed single test
FrankHassanabad 4608a13
Changed string to be keyword to be closer to the mapping
FrankHassanabad 48ae3f3
mapping and type changes
FrankHassanabad 7f869c9
Merge branch 'master' into add-list-endpoints
FrankHassanabad 0f6d49b
Merge branch 'master' into add-list-endpoints
FrankHassanabad a240f11
Changed lists routes to use /api/lists instead of api/detection_engin…
FrankHassanabad 72a007b
Moves detection list items out of detection api folder
FrankHassanabad 815fe14
Merge branch 'master' into add-list-endpoints
FrankHassanabad 3d24148
Remove uneeded modification
FrankHassanabad 9a12ab1
Moved lists to plugin but have not removed the older lists completely
FrankHassanabad 0af51b6
Removed lists functionality from siem as it is now its own plugin
FrankHassanabad 53d98fd
Merge branch 'master' into add-list-endpoints
FrankHassanabad 532703f
Updated to remove all SIEM code and just have lists plugin now
FrankHassanabad b786df8
Removed the last of the siem code
FrankHassanabad 33d69d5
Fixed up imports a bit more
FrankHassanabad be48a15
Removed more TODO blocks
FrankHassanabad 30757fc
Merge branch 'master' into add-list-endpoints
FrankHassanabad 9672a48
Added the first client based API and changed things around to work wi…
FrankHassanabad a2752bf
Created API and cleaned up more of the code
FrankHassanabad 5c9602f
Merge branch 'master' into add-list-endpoints
FrankHassanabad bf51473
Updated with user and other fields as needed
FrankHassanabad e161a41
Merge branch 'master' into add-list-endpoints
FrankHassanabad 7c0f042
Merge branch 'master' into add-list-endpoints
FrankHassanabad 740b639
Removed more TODO blocks
FrankHassanabad d3610c2
More TODO's removed
FrankHassanabad 27a1a4f
Fixed update and patch and removed more TODO blocks and fixed issues …
FrankHassanabad cbbca14
Removed more TODO blocks
FrankHassanabad 2b67ec8
Merge branch 'master' into add-list-endpoints
FrankHassanabad c7f7e52
Updated to put siem deps into their own folders and updated the paths…
FrankHassanabad 6027c95
Updated to the new suggested structure
FrankHassanabad 65525a9
Fixed startup issue
FrankHassanabad fe857c8
Changed schemas and error handling
FrankHassanabad 9770dee
Merge branch 'master' into add-list-endpoints
FrankHassanabad a560db2
Changed access:list to be access:lists
FrankHassanabad ec01b14
Changes out the buildRouteValidation to the migrated version within SIEM
FrankHassanabad 5936889
Fixed linter issues
FrankHassanabad 7e149c5
Added lists to the CODEOWNERS file
FrankHassanabad fdb96e1
Added return validations
FrankHassanabad e11b210
Updated types to be more inline with more Elastic types
FrankHassanabad d7c5ca2
Merge branch 'master' into add-list-endpoints
FrankHassanabad caf8c70
Added meta to be possible on list and list item as well as restructur…
FrankHassanabad 4badfe5
Merge branch 'master' into add-list-endpoints
FrankHassanabad 4a2c7ef
Added linter rule to sort all the keys and just one test for create l…
FrankHassanabad 79dad91
Added linter rule to sort the import statements
FrankHassanabad cc16171
Added some unit tests
FrankHassanabad 809557c
Added more tests
FrankHassanabad e6a2f2e
Merge branch 'master' into add-list-endpoints
FrankHassanabad 16b77f0
Removed the __mocks__ for mocks and fixed merge with master
FrankHassanabad cf3cd9a
More tests
FrankHassanabad 8966dac
More tests and some renaming
FrankHassanabad 1a4c2ec
More tests
FrankHassanabad 0344014
Added another test
FrankHassanabad 3b95567
Removed the "s" to be consistent and fix weird issues where some thin…
FrankHassanabad afd0073
Part 2 of removing "s" in most places for consistency
FrankHassanabad 7416250
More tests
FrankHassanabad 049d81a
Fixed mapping to not allow any dynamic element but rather just the ob…
FrankHassanabad 9983363
More renames and more tests
FrankHassanabad 7e286e8
Merge branch 'master' into add-list-endpoints
elasticmachine d0c0315
Merge branch 'master' into add-list-endpoints
elasticmachine 3a89cc5
More unit tests and bug fixes
FrankHassanabad 2f10efe
Merge branch 'add-list-endpoints' of github.com:FrankHassanabad/kiban…
FrankHassanabad 6a09157
Merge branch 'master' into add-list-endpoints
FrankHassanabad 9c34531
More tests, more linter rules
FrankHassanabad a842e07
More tests and small bug fixes
FrankHassanabad bb99813
More tests and cleaned up comments left over
FrankHassanabad 0269ee2
Merge branch 'master' into add-list-endpoints
FrankHassanabad 21c7762
Fixed the linter and updated with master
FrankHassanabad 14f6f5c
Merge branch 'master' into add-list-endpoints
FrankHassanabad 06c9d9a
Merge branch 'master' into add-list-endpoints
FrankHassanabad 3cb4c27
Added feature flag to be enabled in the position off along with warni…
FrankHassanabad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/** | ||
* Lists routes | ||
*/ | ||
export const LIST_URL = `/api/lists`; | ||
export const LIST_INDEX = `${LIST_URL}/index`; | ||
export const LIST_ITEM_URL = `${LIST_URL}/items`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export * from './schemas'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/* eslint-disable @typescript-eslint/camelcase */ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
import { NonEmptyString } from '../types/non_empty_string'; | ||
|
||
export const name = t.string; | ||
export type Name = t.TypeOf<typeof name>; | ||
export const nameOrUndefined = t.union([name, t.undefined]); | ||
export type NameOrUndefined = t.TypeOf<typeof nameOrUndefined>; | ||
|
||
export const description = t.string; | ||
export type Description = t.TypeOf<typeof description>; | ||
export const descriptionOrUndefined = t.union([description, t.undefined]); | ||
export type DescriptionOrUndefined = t.TypeOf<typeof descriptionOrUndefined>; | ||
|
||
export const list_id = NonEmptyString; | ||
export const list_idOrUndefined = t.union([list_id, t.undefined]); | ||
export type List_idOrUndefined = t.TypeOf<typeof list_idOrUndefined>; | ||
|
||
export const item = t.string; | ||
export const created_at = t.string; // TODO: Make this into an ISO Date string check | ||
export const updated_at = t.string; // TODO: Make this into an ISO Date string check | ||
export const updated_by = t.string; | ||
export const created_by = t.string; | ||
export const file = t.object; | ||
|
||
export const id = NonEmptyString; | ||
export type Id = t.TypeOf<typeof id>; | ||
export const idOrUndefined = t.union([id, t.undefined]); | ||
export type IdOrUndefined = t.TypeOf<typeof idOrUndefined>; | ||
|
||
export const ip = t.string; | ||
export const ipOrUndefined = t.union([ip, t.undefined]); | ||
|
||
export const keyword = t.string; | ||
export const keywordOrUndefined = t.union([keyword, t.undefined]); | ||
|
||
export const value = t.string; | ||
export const valueOrUndefined = t.union([value, t.undefined]); | ||
|
||
export const tie_breaker_id = t.string; // TODO: Use UUID for this instead of a string for validation | ||
export const _index = t.string; | ||
|
||
export const type = t.keyof({ ip: null, keyword: null }); // TODO: Add the other data types here | ||
|
||
export const typeOrUndefined = t.union([type, t.undefined]); | ||
export type Type = t.TypeOf<typeof type>; | ||
|
||
export const meta = t.object; | ||
export type Meta = t.TypeOf<typeof meta>; | ||
export const metaOrUndefined = t.union([meta, t.undefined]); | ||
export type MetaOrUndefined = t.TypeOf<typeof metaOrUndefined>; | ||
|
||
export const esDataTypeUnion = t.union([t.type({ ip }), t.type({ keyword })]); | ||
export type EsDataTypeUnion = t.TypeOf<typeof esDataTypeUnion>; |
17 changes: 17 additions & 0 deletions
17
x-pack/plugins/lists/common/schemas/elastic_query/create_es_bulk_type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
import { _index } from '../common/schemas'; | ||
|
||
export const createEsBulkTypeSchema = t.exact( | ||
t.type({ | ||
create: t.exact(t.type({ _index })), | ||
}) | ||
); | ||
|
||
export type CreateEsBulkTypeSchema = t.TypeOf<typeof createEsBulkTypeSchema>; |
37 changes: 37 additions & 0 deletions
37
x-pack/plugins/lists/common/schemas/elastic_query/create_es_lists_items_schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/* eslint-disable @typescript-eslint/camelcase */ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
import { | ||
created_at, | ||
created_by, | ||
esDataTypeUnion, | ||
list_id, | ||
metaOrUndefined, | ||
tie_breaker_id, | ||
updated_at, | ||
updated_by, | ||
} from '../common/schemas'; | ||
|
||
export const createEsListsItemsSchema = t.intersection([ | ||
t.exact( | ||
t.type({ | ||
created_at, | ||
created_by, | ||
list_id, | ||
meta: metaOrUndefined, | ||
tie_breaker_id, | ||
updated_at, | ||
updated_by, | ||
}) | ||
), | ||
esDataTypeUnion, | ||
]); | ||
|
||
export type CreateEsListsItemsSchema = t.TypeOf<typeof createEsListsItemsSchema>; |
10 changes: 10 additions & 0 deletions
10
x-pack/plugins/lists/common/schemas/elastic_query/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
export * from './update_es_lists_schema'; | ||
export * from './index_es_lists_schema'; | ||
export * from './update_es_lists_items_schema'; | ||
export * from './create_es_lists_items_schema'; | ||
export * from './create_es_bulk_type'; |
37 changes: 37 additions & 0 deletions
37
x-pack/plugins/lists/common/schemas/elastic_query/index_es_lists_schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/* eslint-disable @typescript-eslint/camelcase */ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
import { | ||
created_at, | ||
created_by, | ||
description, | ||
metaOrUndefined, | ||
name, | ||
tie_breaker_id, | ||
type, | ||
updated_at, | ||
updated_by, | ||
} from '../common/schemas'; | ||
|
||
export const indexEsListsSchema = t.exact( | ||
t.type({ | ||
created_at, | ||
created_by, | ||
description, | ||
meta: metaOrUndefined, | ||
name, | ||
tie_breaker_id, | ||
type, | ||
updated_at, | ||
updated_by, | ||
}) | ||
); | ||
|
||
export type IndexEsListsSchema = t.TypeOf<typeof indexEsListsSchema>; |
24 changes: 24 additions & 0 deletions
24
x-pack/plugins/lists/common/schemas/elastic_query/update_es_lists_items_schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/* eslint-disable @typescript-eslint/camelcase */ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
import { esDataTypeUnion, metaOrUndefined, updated_at, updated_by } from '../common/schemas'; | ||
|
||
export const updateEsListsItemsSchema = t.intersection([ | ||
t.exact( | ||
t.type({ | ||
meta: metaOrUndefined, | ||
updated_at, | ||
updated_by, | ||
}) | ||
), | ||
esDataTypeUnion, | ||
]); | ||
|
||
export type UpdateEsListsItemsSchema = t.TypeOf<typeof updateEsListsItemsSchema>; |
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/lists/common/schemas/elastic_query/update_es_lists_schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/* eslint-disable @typescript-eslint/camelcase */ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
import { | ||
descriptionOrUndefined, | ||
metaOrUndefined, | ||
nameOrUndefined, | ||
updated_at, | ||
updated_by, | ||
} from '../common/schemas'; | ||
|
||
export const updateEsListsSchema = t.exact( | ||
t.type({ | ||
description: descriptionOrUndefined, | ||
meta: metaOrUndefined, | ||
name: nameOrUndefined, | ||
updated_at, | ||
updated_by, | ||
}) | ||
); | ||
|
||
export type UpdateEsListsSchema = t.TypeOf<typeof updateEsListsSchema>; |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/lists/common/schemas/elastic_response/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export * from './search_es_lists_items_schema'; | ||
export * from './search_es_lists_schema'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look forward to having some of these over in the detections engine too :)