-
Notifications
You must be signed in to change notification settings - Fork 93
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
add should_create_single_alert_for_findings field to security-analytics #757
Conversation
Signed-off-by: Subhobrata Dey <[email protected]>
Signed-off-by: Subhobrata Dey <[email protected]>
Signed-off-by: Subhobrata Dey <[email protected]>
@@ -21,7 +21,8 @@ data class IndexExecutionContext( | |||
val updatedIndexNames: List<String>, | |||
val concreteIndexNames: List<String>, | |||
val conflictingFields: List<String>, | |||
val docIds: List<String>? = emptyList() | |||
val docIds: List<String>? = emptyList(), | |||
val findingIds: List<String>? = emptyList() |
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 adding this here?
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.
just to add findingIds
to IndexExecutionContext
.
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.
finding_ids should already be present in the workflow context?
@@ -43,6 +43,7 @@ data class Monitor( | |||
val uiMetadata: Map<String, Any>, | |||
val dataSources: DataSources = DataSources(), | |||
val deleteQueryIndexInEveryRun: Boolean? = false, | |||
val shouldPersistFindingsAndAlerts: Boolean? = false, |
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.
shouldn't this be true by default?
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.
the field is named now as shouldCreateSingleAlertForFindings
. & its set to False
by default.
@@ -332,6 +338,11 @@ data class Monitor( | |||
} else { | |||
xcp.booleanValue() | |||
} | |||
SHOULD_PERSIST_FINDINGS_AND_ALERTS_FIELD -> delegateMonitor = if (xcp.currentToken() == XContentParser.Token.VALUE_NULL) { |
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.
thinking of a scenario where this field is null
shouldn't we persist alerts and findings by default but we have initilalized var delegateMonitor = false
and wont end up persisting
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.
same as #757 (comment)
@@ -17,7 +17,7 @@ data class WorkflowRunContext( | |||
val workflowId: String, | |||
val workflowMetadataId: String, | |||
val chainedMonitorId: String?, | |||
val matchingDocIdsPerIndex: Map<String, List<String>>, | |||
val matchingDocIdsPerIndex: Pair<Map<String, List<String>>, List<String>>, |
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.
is this change backward compatible?
can we revert this?
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.
fixed this.
this PR seems to be making multiple minor changes and additions |
+1 is there a github issue or something we can track to see why we're making these changes? |
as discussed we seem to be creating a single alert for all findings |
Signed-off-by: Subhobrata Dey <[email protected]>
only |
Signed-off-by: Subhobrata Dey <[email protected]>
@@ -43,6 +43,7 @@ data class Monitor( | |||
val uiMetadata: Map<String, Any>, | |||
val dataSources: DataSources = DataSources(), | |||
val deleteQueryIndexInEveryRun: Boolean? = false, | |||
val shouldCreateSingleAlertForFindings: Boolean? = false, |
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.
Since alerts are generated by triggers, would it be worthwhile to make this configurable at the trigger-level instead of the monitor-level?
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.
Description
findingIds
toIndexExecutionContext
. https://github.com/opensearch-project/common-utils/pull/757/files#diff-74f48ba337f4ed529bbc3b631ff66bf2d2e95a657c6238b1ecf018785db97f50R25should_create_single_alert_for_findings
field to security-analytics https://github.com/opensearch-project/common-utils/pull/757/files#diff-74f48ba337f4ed529bbc3b631ff66bf2d2e95a657c6238b1ecf018785db97f50R25findingIds
toWorkflowRunContext
. https://github.com/opensearch-project/common-utils/pull/757/files#diff-d955843c0c82617b06bce8aa4393c1d947e6930202daaf84c022e5c1ea2dba10R22continuing from pr add ignore_findings_and_alerts field to monitors #756
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.