[Security] Add telemetry for new protection types and arrays of objects#97624
[Security] Add telemetry for new protection types and arrays of objects#97624rw-access merged 8 commits intoelastic:masterfrom rw-access:telemetry-new-protections
Conversation
| return { | ||
| ...newEvent, | ||
| // cast to object[] to be a valid SearchTypes variant | ||
| [allowKey]: (eventValue as object[]).map((v) => |
There was a problem hiding this comment.
It seems like this cast isn't safe because even if eventValue is an array, it might be an array of strings, boolean, or any other object, according to SearchTypes.
There was a problem hiding this comment.
fair point. yeah i think this assumes that you'll never find something inconsistent with the schema
| return { | ||
| ...newEvent, | ||
| // cast to object[] to be a valid SearchTypes variant | ||
| [allowKey]: (eventValue as object[]).map((v) => | ||
| copyAllowlistedFields(allowValue, v as TelemetryEvent) | ||
| ), | ||
| }; |
There was a problem hiding this comment.
| return { | |
| ...newEvent, | |
| // cast to object[] to be a valid SearchTypes variant | |
| [allowKey]: (eventValue as object[]).map((v) => | |
| copyAllowlistedFields(allowValue, v as TelemetryEvent) | |
| ), | |
| }; | |
| const allowedFields = []; | |
| for (const v of eventValue) { | |
| if (typeof v === 'object') { | |
| // casting this as AllowlistFields is a recursive structure, any object values it has are also AllowlistFields | |
| const sub: AllowlistFields = v as AllowlistFields; | |
| allowedFields.push(copyAllowlistedFields(allowValue, sub)); | |
| } | |
| } | |
| return { | |
| ...newEvent, | |
| [allowKey]: allowedFields, | |
| }; |
This approach would check that the value is an object before casting it to an AllowlistFields
There was a problem hiding this comment.
also i thought for loops were basically despised for being non-idiomatic
There was a problem hiding this comment.
this work? basically did what you have but filter+map
bbcaec1
There was a problem hiding this comment.
also had to split out BaseSearchTypes from SearchTypes, for typescript to not barf
…ts (elastic#97624) * Add telemetry for new protection types and arrays of objects * Add malware_signature to process.Ext + dll.Ext * Fix comments for base fields * Move naming convention disable to a line * Fix unit test for rule.version
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
💛 Build succeeded, but was flaky
Test FailuresKibana Pipeline / general / X-Pack Search Sessions Integration.x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/sessions_in_space·ts.Dashboard dashboard in space Disabled storing search sessions "before all" hook for "Doesn't allow to store a session"Standard OutStack TraceKibana Pipeline / general / X-Pack Search Sessions Integration.x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/sessions_in_space·ts.Dashboard dashboard in space Disabled storing search sessions "after all" hook for "Doesn't allow to store a session"Standard OutStack TraceKibana Pipeline / general / X-Pack Search Sessions Integration.x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search.Dashboard "after all" hook in "Dashboard"Standard OutStack TraceMetrics [docs]Unknown metric groupsAPI count
API count missing comments
Non-exported public API item count
History
To update your PR or re-run it, just comment with: |
…ts (#97624) (#97703) * Add telemetry for new protection types and arrays of objects * Add malware_signature to process.Ext + dll.Ext * Fix comments for base fields * Move naming convention disable to a line * Fix unit test for rule.version Co-authored-by: Ross Wolf <31489089+rw-access@users.noreply.github.com>
Summary
Added additional telemetry fields for new protection types.
The behavior protection contains
events: [...]where some events (file, registry, network, process, etc.) are nested inside the document. I slightly restructured the code for better reuse. Also, I added support to traverse arrays of objects, which the existing allowlist checking code didn't do.