[Security Solution][CTI] Better handling of enriched alerts during upgrade to 7.15#108300
Closed
rylnd wants to merge 6 commits intoelastic:masterfrom
Closed
[Security Solution][CTI] Better handling of enriched alerts during upgrade to 7.15#108300rylnd wants to merge 6 commits intoelastic:masterfrom
rylnd wants to merge 6 commits intoelastic:masterfrom
Conversation
5ca592d to
dd746a5
Compare
A function returning React.ReactNode cannot be mounted by enzyme, for example.
If we have no mappings and a single nested indicator object, the current sourceror behavior is that we receive e.g. `threat.indicator` as a single object. Our code was expecting this to be an array, so the fix here is to simply ensure that we're dealing with an array of indicators.
If an indicator document has only some (or no) ECS indicator fields, then the resulting enriched alert will also be missing those fields. This ensures that we still render what data we have in those cases.
This code was written before those were migrated, and while the component was fixed the test data was not.
dd746a5 to
cb1a5da
Compare
Contributor
Author
|
@elasticmachine merge upstream |
angorayc
reviewed
Aug 20, 2021
| sourceField: get(data, MATCHED_FIELD)[0] as string, | ||
| sourceValue: get(data, MATCHED_ATOMIC)[0] as string, | ||
| sourceField: getOr([], MATCHED_FIELD, data)[0] as string, | ||
| sourceValue: getOr([], MATCHED_ATOMIC, data)[0] as string, |
Contributor
There was a problem hiding this comment.
Line 52- 52, If we put the fallback value as empty an array, means that eventually it could still be undefined here, right?
If the enrichment is somehow missing `matched.field` or `matched.atomic`, we do not render match details in the row renderer.
Contributor
⏳ Build in-progress, with failures
Failed CI StepsHistory
To update your PR or re-run it, just comment with: cc @rylnd |
Contributor
Author
|
Closing as this is no longer an issue; see notes in #108287 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Regression unit tests have been added for both these situations.
Notes
The manifestation of this bug is due to the fact that if a nested field (array) is unmapped, the timeline data received is an object and not an array. It could be argued that this behavior is the true bug here, although I need to discuss with @elastic/security-threat-hunting to determine the most appropriate outcome here.
Checklist
Delete any items that are not applicable to this PR.
For maintainers