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

[Cloud Security] Fix for console error message in rules benchmark page #177887

Merged
merged 7 commits into from
Mar 3, 2024

Conversation

animehart
Copy link
Contributor

@animehart animehart commented Mar 1, 2024

Summary

Currently in Rules benchmark page, users seems to be getting error message in their console (not affecting the UI).

This error is caused by malformed request to detection rule API and this is due to us sending an empty Array. This is not a problem on other component as in other component the API is called after users clicks to open the component which will in turn fill in the array which means the array is never empty. This is not the issue with this case as the API is called even in the beginning

The solution in this PR is basically just giving default return value if its ever empty

@animehart animehart added v8.13.0 Team:Cloud Security Cloud Security team related release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting labels Mar 1, 2024
@animehart
Copy link
Contributor Author

/ci

@animehart animehart marked this pull request as ready for review March 1, 2024 18:36
@animehart animehart requested a review from a team as a code owner March 1, 2024 18:36
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security)

Copy link
Contributor

@JordanSh JordanSh left a comment

Choose a reason for hiding this comment

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

we can go with either method, but why not only calling the API when the array is not empty?

@animehart
Copy link
Contributor Author

we can go with either method, but why not only calling the API when the array is not empty?

no reason, when i made this change, the first thing that came up into my mind is just this solution

@JordanSh
Copy link
Contributor

JordanSh commented Mar 3, 2024

no reason, when i made this change, the first thing that came up into my mind is just this solution

in that case i think not calling the API is a slightly better solution, consider making this change before merge

@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
cloudSecurityPosture 412.4KB 412.4KB +36.0B

History

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

@animehart animehart merged commit c1ccb1d into elastic:main Mar 3, 2024
16 checks passed
semd pushed a commit to semd/kibana that referenced this pull request Mar 4, 2024
elastic#177887)

## Summary

Currently in Rules benchmark page, users seems to be getting error
message in their console (not affecting the UI).

This error is caused by malformed request to detection rule API and this
is due to us sending an empty Array. This is not a problem on other
component as in other component the API is called after users clicks to
open the component which will in turn fill in the array which means the
array is never empty. This is not the issue with this case as the API is
called even in the beginning

The solution in this PR is basically just giving default return value if
its ever empty
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
elastic#177887)

## Summary

Currently in Rules benchmark page, users seems to be getting error
message in their console (not affecting the UI).

This error is caused by malformed request to detection rule API and this
is due to us sending an empty Array. This is not a problem on other
component as in other component the API is called after users clicks to
open the component which will in turn fill in the array which means the
array is never empty. This is not the issue with this case as the API is
called even in the beginning

The solution in this PR is basically just giving default return value if
its ever empty
@animehart animehart added v8.13.0 backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) and removed v8.13.0 backport:skip This commit does not require backporting v8.14.0 labels Mar 5, 2024
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 5, 2024
elastic#177887)

## Summary

Currently in Rules benchmark page, users seems to be getting error
message in their console (not affecting the UI).

This error is caused by malformed request to detection rule API and this
is due to us sending an empty Array. This is not a problem on other
component as in other component the API is called after users clicks to
open the component which will in turn fill in the array which means the
array is never empty. This is not the issue with this case as the API is
called even in the beginning

The solution in this PR is basically just giving default return value if
its ever empty

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

💚 All backports created successfully

Status Branch Result
8.13

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 Mar 5, 2024
…ark page (#177887) (#178039)

# Backport

This will backport the following commits from `main` to `8.13`:
- [[Cloud Security] Fix for console error message in rules benchmark
page (#177887)](#177887)

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

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

<!--BACKPORT [{"author":{"name":"Rickyanto
Ang","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-03-03T22:12:41Z","message":"[Cloud
Security] Fix for console error message in rules benchmark page
(#177887)\n\n## Summary\r\n\r\nCurrently in Rules benchmark page, users
seems to be getting error\r\nmessage in their console (not affecting the
UI).\r\n\r\nThis error is caused by malformed request to detection rule
API and this\r\nis due to us sending an empty Array. This is not a
problem on other\r\ncomponent as in other component the API is called
after users clicks to\r\nopen the component which will in turn fill in
the array which means the\r\narray is never empty. This is not the issue
with this case as the API is\r\ncalled even in the beginning\r\n\r\nThe
solution in this PR is basically just giving default return value
if\r\nits ever
empty","sha":"c1ccb1d3d3dbce9dac1bf96c2ddb99a31f233b85","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Cloud
Security","backport:prev-minor","v8.13.0","v8.14.0"],"title":"[Cloud
Security] Fix for console error message in rules benchmark
page","number":177887,"url":"https://github.com/elastic/kibana/pull/177887","mergeCommit":{"message":"[Cloud
Security] Fix for console error message in rules benchmark page
(#177887)\n\n## Summary\r\n\r\nCurrently in Rules benchmark page, users
seems to be getting error\r\nmessage in their console (not affecting the
UI).\r\n\r\nThis error is caused by malformed request to detection rule
API and this\r\nis due to us sending an empty Array. This is not a
problem on other\r\ncomponent as in other component the API is called
after users clicks to\r\nopen the component which will in turn fill in
the array which means the\r\narray is never empty. This is not the issue
with this case as the API is\r\ncalled even in the beginning\r\n\r\nThe
solution in this PR is basically just giving default return value
if\r\nits ever
empty","sha":"c1ccb1d3d3dbce9dac1bf96c2ddb99a31f233b85"}},"sourceBranch":"main","suggestedTargetBranches":["8.13"],"targetPullRequestStates":[{"branch":"8.13","label":"v8.13.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.14.0","branchLabelMappingKey":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/177887","number":177887,"mergeCommit":{"message":"[Cloud
Security] Fix for console error message in rules benchmark page
(#177887)\n\n## Summary\r\n\r\nCurrently in Rules benchmark page, users
seems to be getting error\r\nmessage in their console (not affecting the
UI).\r\n\r\nThis error is caused by malformed request to detection rule
API and this\r\nis due to us sending an empty Array. This is not a
problem on other\r\ncomponent as in other component the API is called
after users clicks to\r\nopen the component which will in turn fill in
the array which means the\r\narray is never empty. This is not the issue
with this case as the API is\r\ncalled even in the beginning\r\n\r\nThe
solution in this PR is basically just giving default return value
if\r\nits ever
empty","sha":"c1ccb1d3d3dbce9dac1bf96c2ddb99a31f233b85"}}]}] BACKPORT-->

Co-authored-by: Rickyanto Ang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related v8.13.0 v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants