Skip to content
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

[EDR Workflows][Osquery] Fix last results pack value #192678

Merged
merged 3 commits into from
Sep 17, 2024

Conversation

szwarckonrad
Copy link
Contributor

@szwarckonrad szwarckonrad commented Sep 12, 2024

The “Last Results” tab in the active pack details is displaying incorrect date-time values. This is due to a mismatch in data format. The component responsible for formatting the date-time values expects a string, but it is currently receiving an array with a single string inside.

Before:

Screenshot 2024-09-12 at 10 33 39

After:

Screenshot 2024-09-12 at 12 40 04

@szwarckonrad szwarckonrad added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.16.0 labels Sep 12, 2024
@szwarckonrad szwarckonrad marked this pull request as ready for review September 12, 2024 10:57
@szwarckonrad szwarckonrad requested a review from a team as a code owner September 12, 2024 10:57
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-defend-workflows (Team:Defend Workflows)

const dateTime = lastResultsData?.['@timestamp'];
if (!dateTime) return undefined;

return Array.isArray(dateTime) ? dateTime[0] : dateTime;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was reported that this issue is a regression. As a result, I’ve accounted for the possibility that some stack versions might return the search aggregation as a string rather than an array of strings.

@szwarckonrad szwarckonrad self-assigned this Sep 12, 2024
Copy link
Contributor

@tomsonpl tomsonpl left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Contributor

@gergoabraham gergoabraham left a comment

Choose a reason for hiding this comment

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

looks good! 🚀 but... what about tests? : ) i'd suggest to add some if applicable

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
osquery 1.0MB 1.0MB +4.0B

History

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

cc @szwarckonrad

@szwarckonrad szwarckonrad merged commit cfcb6e8 into elastic:main Sep 17, 2024
21 checks passed
@jbudz
Copy link
Member

jbudz commented Sep 20, 2024

@szwarckonrad this pull request has an 8.16.0 label and a backport:skip label. Can you please apply a backport or drop the version label? Replacing backport:skip with backport:version will allow automation to run.

@szwarckonrad szwarckonrad added backport:version Backport to applied version labels and removed backport:skip This commit does not require backporting labels Sep 20, 2024
@szwarckonrad
Copy link
Contributor Author

@szwarckonrad this pull request has an 8.16.0 label and a backport:skip label. Can you please apply a backport or drop the version label? Replacing backport:skip with backport:version will allow automation to run.

Added backport:version, sorry for the trouble.

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 20, 2024
The “Last Results” tab in the active pack details is displaying
incorrect date-time values. This is due to a mismatch in data format.
The component responsible for formatting the date-time values expects a
string, but it is currently receiving an array with a single string
inside.

Before:

![Screenshot 2024-09-12 at 10 33
39](https://github.com/user-attachments/assets/844fd699-a086-44d8-aa0b-a06e65e5aa60)

After:

![Screenshot 2024-09-12 at 12 40
04](https://github.com/user-attachments/assets/bcce9b69-58b8-438d-89e8-c78a3922845c)

(cherry picked from commit cfcb6e8)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Sep 20, 2024
…193579)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[EDR Workflows][Osquery] Fix last results pack value
(#192678)](#192678)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Konrad
Szwarc","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-17T08:18:09Z","message":"[EDR
Workflows][Osquery] Fix last results pack value (#192678)\n\nThe “Last
Results” tab in the active pack details is displaying\r\nincorrect
date-time values. This is due to a mismatch in data format.\r\nThe
component responsible for formatting the date-time values expects
a\r\nstring, but it is currently receiving an array with a single
string\r\ninside.\r\n\r\nBefore:\r\n\r\n![Screenshot 2024-09-12 at 10
33\r\n39](https://github.com/user-attachments/assets/844fd699-a086-44d8-aa0b-a06e65e5aa60)\r\n\r\nAfter:
\r\n\r\n![Screenshot 2024-09-12 at 12
40\r\n04](https://github.com/user-attachments/assets/bcce9b69-58b8-438d-89e8-c78a3922845c)","sha":"cfcb6e8f4ddf078ccdcec2a03788e39c6e4dfdef","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Defend
Workflows","v8.16.0","backport:version"],"title":"[EDR
Workflows][Osquery] Fix last results pack
value","number":192678,"url":"https://github.com/elastic/kibana/pull/192678","mergeCommit":{"message":"[EDR
Workflows][Osquery] Fix last results pack value (#192678)\n\nThe “Last
Results” tab in the active pack details is displaying\r\nincorrect
date-time values. This is due to a mismatch in data format.\r\nThe
component responsible for formatting the date-time values expects
a\r\nstring, but it is currently receiving an array with a single
string\r\ninside.\r\n\r\nBefore:\r\n\r\n![Screenshot 2024-09-12 at 10
33\r\n39](https://github.com/user-attachments/assets/844fd699-a086-44d8-aa0b-a06e65e5aa60)\r\n\r\nAfter:
\r\n\r\n![Screenshot 2024-09-12 at 12
40\r\n04](https://github.com/user-attachments/assets/bcce9b69-58b8-438d-89e8-c78a3922845c)","sha":"cfcb6e8f4ddf078ccdcec2a03788e39c6e4dfdef"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192678","number":192678,"mergeCommit":{"message":"[EDR
Workflows][Osquery] Fix last results pack value (#192678)\n\nThe “Last
Results” tab in the active pack details is displaying\r\nincorrect
date-time values. This is due to a mismatch in data format.\r\nThe
component responsible for formatting the date-time values expects
a\r\nstring, but it is currently receiving an array with a single
string\r\ninside.\r\n\r\nBefore:\r\n\r\n![Screenshot 2024-09-12 at 10
33\r\n39](https://github.com/user-attachments/assets/844fd699-a086-44d8-aa0b-a06e65e5aa60)\r\n\r\nAfter:
\r\n\r\n![Screenshot 2024-09-12 at 12
40\r\n04](https://github.com/user-attachments/assets/bcce9b69-58b8-438d-89e8-c78a3922845c)","sha":"cfcb6e8f4ddf078ccdcec2a03788e39c6e4dfdef"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Konrad Szwarc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants