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

Fix vuln flyout when score is zero #196092

Merged
merged 4 commits into from
Oct 14, 2024
Merged

Conversation

CohenIdo
Copy link
Contributor

@CohenIdo CohenIdo commented Oct 14, 2024

solves:

Summary

Ensure the score box is not rendered when the score is zero.

@CohenIdo CohenIdo changed the title fix flyout when score is zero Fix vuln flyout when score is zero Oct 14, 2024
@@ -161,7 +161,7 @@ const VulnerabilityOverviewTiles = ({ vulnerabilityRecord }: VulnerabilityTabPro

return (
<EuiFlexGroup data-test-subj={OVERVIEW_TAB_VULNERABILITY_FLYOUT}>
Copy link
Contributor Author

@CohenIdo CohenIdo Oct 14, 2024

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.

Copy link
Contributor

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?

Copy link
Contributor

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

@CohenIdo CohenIdo added release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Oct 14, 2024
@CohenIdo CohenIdo marked this pull request as ready for review October 14, 2024 10:39
@CohenIdo CohenIdo requested a review from a team as a code owner October 14, 2024 10:39
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

💚 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 507.8KB 507.8KB -4.0B

@CohenIdo CohenIdo merged commit 8fe292f into elastic:main Oct 14, 2024
21 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11329185396

@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 Oct 14, 2024
# 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) 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.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants