-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Case] Detection rules for case #88726
Merged
jonathan-buttner
merged 71 commits into
elastic:master
from
jonathan-buttner:detection-rules-for-case
Feb 12, 2021
Merged
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
1346445
Adding type field to client
jonathan-buttner 9f82a3d
Removing context and adding association type
jonathan-buttner edf97b3
Handle alerts from multiple indices
jonathan-buttner e10e620
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner ada3eb9
Adding flow for adding a sub case
jonathan-buttner 695df14
Making progress on creating alerts from rules
jonathan-buttner a01a70f
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner 7c012c7
Refactored add comment to handle case and sub case
jonathan-buttner 914a263
Starting sub case API and refactoring of case client
jonathan-buttner cc57dd9
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner 26a02fc
Fleshing out find cases
jonathan-buttner 2d1b4e9
Finished the find cases api
jonathan-buttner c5f47b3
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner c58ddb0
Filtering comments by association type
jonathan-buttner fcc40c0
Fixing tests and types
jonathan-buttner bc62907
Updating snapshots
jonathan-buttner 2507213
Cleaning up comment references
jonathan-buttner d486483
Working unit tests
jonathan-buttner 2ee61b0
Fixing integration tests and got ES to work
jonathan-buttner 34fb160
Unit tests and api integration test working
jonathan-buttner 435b741
Refactoring find and get_status
jonathan-buttner 1b45ca5
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner a4f4114
Starting patch, and update
jonathan-buttner 5f4bbb3
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner 060db5b
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner a96c765
script for sub cases
jonathan-buttner bc3e861
Removing converted_by and fixing type errors
jonathan-buttner f13d1d4
Adding docs for script
jonathan-buttner 1db10e5
Removing converted_by and fixing integration test
jonathan-buttner dd1744e
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner f7b136b
Adding sub case id to comment routes
jonathan-buttner 51504e0
Removing stringify comparison
jonathan-buttner 1d81bdf
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner db09ea7
Adding delete api and tests
jonathan-buttner 5279958
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner 541daa8
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner 9633296
Updating license
jonathan-buttner 2333330
missed license files
jonathan-buttner 80c2161
Integration tests passing
jonathan-buttner eed7f56
Adding more tests for sub cases
jonathan-buttner 877a82c
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner acf20f4
Find int tests, scoped client, patch sub user actions
jonathan-buttner 96e38f8
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner ee0fea6
fixing types and call cluster
jonathan-buttner 24919af
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner a4458d1
fixing get sub case param issue
jonathan-buttner e2a020a
Adding user actions for sub cases
jonathan-buttner dfccb2e
Preventing alerts on collections and refactoring user
jonathan-buttner 9903a51
Allowing type to be updated for ind cases
jonathan-buttner 019a63e
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner 1441a76
Refactoring and writing tests
jonathan-buttner 6449229
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner 728c2de
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner 8cde2b5
Fixing sub case status filtering
jonathan-buttner c35a735
Adding more tests not allowing gen alerts patch
jonathan-buttner ff0297f
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner 338cd16
Working unit tests
jonathan-buttner 315a46d
Push to connector gets all sub case comments
jonathan-buttner 886badd
Writing more tests and cleaning up
jonathan-buttner f69b0dd
Updating push functionality for generated alerts and sub cases
jonathan-buttner 0cce723
Adding comment about updating collection sync
jonathan-buttner 5c282a5
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner 8a553c2
Merge branch 'master' into detection-rules-for-case
kibanamachine f78ba23
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner b6c296e
Refactoring update alert status for sub cases and removing request an…
jonathan-buttner 57b8414
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner f58b5ff
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner 575d849
Addressing alert service feedback
jonathan-buttner fe3d043
Fixing sub case sync bug and cleaning up comment types
jonathan-buttner 0c98e1c
Merge branch 'master' of github.com:elastic/kibana into detection-rul…
jonathan-buttner 99d37ae
Addressing more feedback
jonathan-buttner 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
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,35 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import * as rt from 'io-ts'; | ||
import { CaseAttributesRt } from './case'; | ||
import { CommentResponseRt } from './comment'; | ||
import { SubCaseAttributesRt, SubCaseResponseRt } from './sub_case'; | ||
|
||
export const CollectionSubCaseAttributesRt = rt.intersection([ | ||
rt.partial({ subCase: SubCaseAttributesRt }), | ||
rt.type({ | ||
case: CaseAttributesRt, | ||
}), | ||
]); | ||
|
||
export const CollectWithSubCaseResponseRt = rt.intersection([ | ||
CaseAttributesRt, | ||
rt.type({ | ||
id: rt.string, | ||
totalComment: rt.number, | ||
version: rt.string, | ||
}), | ||
rt.partial({ | ||
subCase: SubCaseResponseRt, | ||
totalAlerts: rt.number, | ||
comments: rt.array(CommentResponseRt), | ||
}), | ||
]); | ||
|
||
export type CollectionWithSubCaseResponse = rt.TypeOf<typeof CollectWithSubCaseResponseRt>; | ||
export type CollectionWithSubCaseAttributes = rt.TypeOf<typeof CollectionSubCaseAttributesRt>; |
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
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,80 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import * as rt from 'io-ts'; | ||
|
||
import { NumberFromString } from '../saved_object'; | ||
import { UserRT } from '../user'; | ||
import { CommentResponseRt } from './comment'; | ||
import { CasesStatusResponseRt } from './status'; | ||
import { CaseStatusRt } from './status'; | ||
|
||
const SubCaseBasicRt = rt.type({ | ||
status: CaseStatusRt, | ||
}); | ||
|
||
export const SubCaseAttributesRt = rt.intersection([ | ||
SubCaseBasicRt, | ||
rt.type({ | ||
closed_at: rt.union([rt.string, rt.null]), | ||
closed_by: rt.union([UserRT, rt.null]), | ||
created_at: rt.string, | ||
created_by: rt.union([UserRT, rt.null]), | ||
updated_at: rt.union([rt.string, rt.null]), | ||
updated_by: rt.union([UserRT, rt.null]), | ||
}), | ||
]); | ||
|
||
export const SubCasesFindRequestRt = rt.partial({ | ||
status: CaseStatusRt, | ||
defaultSearchOperator: rt.union([rt.literal('AND'), rt.literal('OR')]), | ||
fields: rt.array(rt.string), | ||
page: NumberFromString, | ||
perPage: NumberFromString, | ||
search: rt.string, | ||
searchFields: rt.array(rt.string), | ||
sortField: rt.string, | ||
sortOrder: rt.union([rt.literal('desc'), rt.literal('asc')]), | ||
}); | ||
|
||
export const SubCaseResponseRt = rt.intersection([ | ||
SubCaseAttributesRt, | ||
rt.type({ | ||
id: rt.string, | ||
totalComment: rt.number, | ||
totalAlerts: rt.number, | ||
version: rt.string, | ||
}), | ||
rt.partial({ | ||
comments: rt.array(CommentResponseRt), | ||
}), | ||
]); | ||
|
||
export const SubCasesFindResponseRt = rt.intersection([ | ||
rt.type({ | ||
subCases: rt.array(SubCaseResponseRt), | ||
page: rt.number, | ||
per_page: rt.number, | ||
total: rt.number, | ||
}), | ||
CasesStatusResponseRt, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This status is the parent case status? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I misread it! Ignore :) |
||
]); | ||
|
||
export const SubCasePatchRequestRt = rt.intersection([ | ||
rt.partial(SubCaseBasicRt.props), | ||
rt.type({ id: rt.string, version: rt.string }), | ||
]); | ||
|
||
export const SubCasesPatchRequestRt = rt.type({ subCases: rt.array(SubCasePatchRequestRt) }); | ||
export const SubCasesResponseRt = rt.array(SubCaseResponseRt); | ||
|
||
export type SubCaseAttributes = rt.TypeOf<typeof SubCaseAttributesRt>; | ||
export type SubCaseResponse = rt.TypeOf<typeof SubCaseResponseRt>; | ||
export type SubCasesResponse = rt.TypeOf<typeof SubCasesResponseRt>; | ||
export type SubCasesFindResponse = rt.TypeOf<typeof SubCasesFindResponseRt>; | ||
export type SubCasePatchRequest = rt.TypeOf<typeof SubCasePatchRequestRt>; | ||
export type SubCasesPatchRequest = rt.TypeOf<typeof SubCasesPatchRequestRt>; |
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
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.
Thanks for all the comments 👍🏾