-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Fix vuln flyout when score is zero #196092
Conversation
@@ -161,7 +161,7 @@ const VulnerabilityOverviewTiles = ({ vulnerabilityRecord }: VulnerabilityTabPro | |||
|
|||
return ( | |||
<EuiFlexGroup data-test-subj={OVERVIEW_TAB_VULNERABILITY_FLYOUT}> |
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.
The issue arises because JavaScript treats 0 as a falsy value, but in the case of this condition, the vulnerability?.score?.base && vulnerability.score.base !== 0 is evaluated separately. Since vulnerability?.score?.base returns 0 (falsy), the component still renders because it’s not stopping evaluation correctly.
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.
why base
is 0 in the first place? is wiz.vulnerability.score
0 when it's missing?
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.
looks like 0 is a valid value. we just dont handle it and didnt expect it as such. ive talked with ido, for now i guess just ignore 0 and we will take this with @smriti-elastic
Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security) |
47d7e6d
to
1a27dfc
Compare
💚 Build Succeeded
Metrics [docs]Async chunks
|
Starting backport for target branches: 8.x |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.x`: - [Fix vuln flyout when score is zero](#196092) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Ido Cohen","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-14T14:04:17Z","message":"Fix vuln flyout when score is zero","sha":"8fe292f3ca143266309fd7acda47d58ea367a07c","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:Cloud Security","backport:prev-minor"],"title":"Fix vuln flyout when score is zero","number":196092,"url":"https://github.com/elastic/kibana/pull/196092","mergeCommit":{"message":"Fix vuln flyout when score is zero","sha":"8fe292f3ca143266309fd7acda47d58ea367a07c"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196092","number":196092,"mergeCommit":{"message":"Fix vuln flyout when score is zero","sha":"8fe292f3ca143266309fd7acda47d58ea367a07c"}}]}] BACKPORT--> Co-authored-by: Ido Cohen <[email protected]>
solves:
Summary
Ensure the score box is not rendered when the score is zero.