-
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
[Cloud Security] posture_type
Backward compatibility changes
#151647
Conversation
posture_type
posture_type
posture_type
Backward compatibility changes
Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security) |
<EuiFlexGroup | ||
gutterSize="l" | ||
css={css` | ||
// height for compliance by cis section with max rows | ||
height: 310px; | ||
`} | ||
> |
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.
unrelated but this fixes problems of unmatching summary sizes between dashboard tabs when there are not enough items in the compliance by score table
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 great 🚀
* Creates the `safe_posture_type` runtime field with the value of either | ||
* `kspm` or `cspm` based on the value of `rule.benchmark.posture_type` | ||
*/ | ||
export const getSafePostureTypeRuntimeMapping = (): MappingRuntimeFields => ({ |
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.
nice, usually I'm against runtime mappings, but since it's on the latest
index, performance won't be an issue, great BC solution
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: cc @JordanSh |
💔 All backports failed
Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
I am going to manually backport this PR, and that should fix this issue |
…ic#151647) (cherry picked from commit 5037ca1) # Conflicts: # x-pack/plugins/cloud_security_posture/public/pages/compliance_dashboard/dashboard_sections/cluster_details_box.tsx
…151647) (#153276) # Backport This will backport the following commits from `main` to `8.7`: - [[Cloud Security] `posture_type` Backward compatibility changes (#151647)](#151647) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jordan","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-02-22T12:00:53Z","message":"[Cloud Security] `posture_type` Backward compatibility changes (#151647)","sha":"5037ca12bee23fc1b51ae6ec7a3091a4139e444f","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Cloud Security","v8.7.0","v8.8.0"],"number":151647,"url":"https://github.com/elastic/kibana/pull/151647","mergeCommit":{"message":"[Cloud Security] `posture_type` Backward compatibility changes (#151647)","sha":"5037ca12bee23fc1b51ae6ec7a3091a4139e444f"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/151647","number":151647,"mergeCommit":{"message":"[Cloud Security] `posture_type` Backward compatibility changes (#151647)","sha":"5037ca12bee23fc1b51ae6ec7a3091a4139e444f"}}]}] BACKPORT--> --------- Co-authored-by: Jordan <[email protected]>
Resolves #150608
Summary
This PR adds BC to the newly added
posture_type
field. Since this field only exists in findings from our latest integration version, older versions of findings won't have it. Thus some of our code on Kibana's side needs to be able to accomplish certain functionalities even without it.ESQuery filtering
We used the
posture_type
field to filter the different dashboard tabs. In order to keep the same filtering functionalities, a newruntime field
was added.This runtime field creates a safe to use field which will be equal to the posture type even for older findings. we will then use this field instead in order to query over the findings in all of our getter functions
Dashboard navigation query
Since we don't always have
posture_type
, we need to have a solution for dashboard navigations for those cases as well.In order to do that, the navigation option of using negated filters was added to the
useNavigate
hook. it can be used like sowill result in
Removal of direct
posture_type === 'kspm'
checksWe no longer check if
kspm
is the posture type directly, all checks are now forposture_type === 'cspm'
and if not, resulting in a default value. For example:Before
After
More of those were already done in #151265 as well
How to check
You will need to have findings without the
posture_type
field and run on Kibana 8.7. this can be done either with mocks or persistent ES, from there all dashboard functionalities should work as expected.