-
Notifications
You must be signed in to change notification settings - Fork 103
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
Findings API Enhancements changes and integ tests fix #1464
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,8 +45,6 @@ class RestGetFindingsAction : BaseRestHandler() { | |
val size = request.paramAsInt("size", 20) | ||
val startIndex = request.paramAsInt("startIndex", 0) | ||
val searchString = request.param("searchString", "") | ||
val severity: String? = request.param("severity", "ALL") | ||
val detectionType: String? = request.param("detectionType", "rules") | ||
|
||
val table = Table( | ||
sortOrder, | ||
|
@@ -59,9 +57,7 @@ class RestGetFindingsAction : BaseRestHandler() { | |
|
||
val getFindingsSearchRequest = GetFindingsRequest( | ||
findingID, | ||
table, | ||
severity, | ||
detectionType | ||
table | ||
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. we aren't resolving boolQueryBuilder param? 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. we don't need to |
||
) | ||
return RestChannelConsumer { | ||
channel -> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,8 +82,6 @@ class TransportGetFindingsSearchAction @Inject constructor( | |
val getFindingsRequest = request as? GetFindingsRequest | ||
?: recreateObject(request) { GetFindingsRequest(it) } | ||
val tableProp = getFindingsRequest.table | ||
val severity = getFindingsRequest.severity | ||
val detectionType = getFindingsRequest.detectionType | ||
val searchString = tableProp.searchString | ||
|
||
val sortBuilder = SortBuilders | ||
|
@@ -125,7 +123,8 @@ class TransportGetFindingsSearchAction @Inject constructor( | |
queryBuilder.filter(timeRangeQuery) | ||
} | ||
|
||
if (!detectionType.isNullOrBlank()) { | ||
if (!getFindingsRequest.detectionType.isNullOrBlank()) { | ||
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. what is detectionType? 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. yes In alerting it has no meannig but we need to filter the SA findings based on the detectionType [threat intel or rule based], this will query on 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. pass querybuilder as param in findings request |
||
val detectionType = getFindingsRequest.detectionType | ||
val nestedQueryBuilder = QueryBuilders.nestedQuery( | ||
"queries", | ||
when { | ||
|
@@ -161,7 +160,8 @@ class TransportGetFindingsSearchAction @Inject constructor( | |
.minimumShouldMatch(1) | ||
} | ||
|
||
if (!severity.isNullOrBlank()) { | ||
if (!getFindingsRequest.severity.isNullOrBlank()) { | ||
val severity = getFindingsRequest.severity | ||
queryBuilder | ||
.must( | ||
QueryBuilders.nestedQuery( | ||
|
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.
why are we removing severity??
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.
we don't need to change the behavior of existing Alerting Plugin API]. This was the part of prev commit which was merged.