-
Notifications
You must be signed in to change notification settings - Fork 475
o365: add fallback for missing startTime #8374
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
Conversation
🌐 Coverage report
|
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
* make evaluation step clearly defined * remove redundant as macro use * use string for RFC 3339 timestamp formatting * use more vertical whitespace
These fields have been observed in the wild.
: has(reqQuery.startTime) ? | ||
reqQuery.startTime[0] | ||
: | ||
string(now() - duration(state.base.list_contents_start_time)) |
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.
Maybe we could set the value from the cursor at this point. If that cursor value doesn't exist, then default to state.base.list_contents_start_time
So, something like this:
reqQuery.endTime[0]
: has(reqQuery.startTime) ?
reqQuery.startTime[0]
: has (state.cursor.content_types_state_as_list.filter(e, e.content_type == content_type)[0].content_created_at) ?
state.cursor.content_types_state_as_list.filter(e, e.content_type == content_type)[0].content_created_at
:
string(now() - duration(state.base.list_contents_start_time))
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.
Done. It's a pity the filter needs to be evaluated twice; I don't see a way to avoid this. However, I've got a change in mito that will allow us to use optional types and then this will be doable, along with not having to say has(x) && has(x.y) && has(x.y.z) && x.y.z == "foo"
, instead just x.?y.?z == "foo"
.
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! LGTM 👍🏼
Package o365 - 1.25.1 containing this change is available at https://epr.elastic.co/search?package=o365 |
1 similar comment
Package o365 - 1.25.1 containing this change is available at https://epr.elastic.co/search?package=o365 |
Proposed commit message
Improve clarity of CEL code:
Reduce repeated work:
Add fallback for case where request URL in response has no startTime.
Add mappings for missing fields:
Checklist
changelog.yml
file.Author's Checklist
How to test this PR locally
Related issues
Screenshots