Skip to content

[Security Solution][CTI] Better handling of enriched alerts during upgrade to 7.15#108300

Closed
rylnd wants to merge 6 commits intoelastic:masterfrom
rylnd:fixes_unmapped_indicators
Closed

[Security Solution][CTI] Better handling of enriched alerts during upgrade to 7.15#108300
rylnd wants to merge 6 commits intoelastic:masterfrom
rylnd:fixes_unmapped_indicators

Conversation

@rylnd
Copy link
Copy Markdown
Contributor

@rylnd rylnd commented Aug 11, 2021

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

@rylnd rylnd added release_note:fix Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team: CTI Security Solution v7.15.0 v7.14.1 labels Aug 11, 2021
@rylnd rylnd self-assigned this Aug 11, 2021
@rylnd rylnd force-pushed the fixes_unmapped_indicators branch from 5ca592d to dd746a5 Compare August 16, 2021 17:44
@mistic mistic added v7.16.0 and removed v7.15.0 labels Aug 18, 2021
rylnd added 4 commits August 19, 2021 17:57
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.
@rylnd rylnd force-pushed the fixes_unmapped_indicators branch from dd746a5 to cb1a5da Compare August 19, 2021 23:05
@rylnd
Copy link
Copy Markdown
Contributor Author

rylnd commented Aug 20, 2021

@elasticmachine merge upstream

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,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 52- 52, If we put the fallback value as empty an array, means that eventually it could still be undefined here, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Addressed in dc797df.

If the enrichment is somehow missing `matched.field` or
`matched.atomic`, we do not render match details in the row renderer.
@kibanamachine
Copy link
Copy Markdown
Contributor

⏳ Build in-progress, with failures

Failed CI Steps

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @rylnd

@rylnd
Copy link
Copy Markdown
Contributor Author

rylnd commented Aug 23, 2021

Closing as this is no longer an issue; see notes in #108287

@rylnd rylnd closed this Aug 23, 2021
@rylnd rylnd deleted the fixes_unmapped_indicators branch August 23, 2021 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:fix Team: CTI Security Solution Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v7.14.1 v7.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants