Skip to content

[Cloud Security] Only adding safe_posture_type to native csp findings#196064

Merged
JordanSh merged 5 commits intoelastic:mainfrom
JordanSh:fix-safe-posture-type
Oct 14, 2024
Merged

[Cloud Security] Only adding safe_posture_type to native csp findings#196064
JordanSh merged 5 commits intoelastic:mainfrom
JordanSh:fix-safe-posture-type

Conversation

@JordanSh
Copy link
Copy Markdown
Contributor

@JordanSh JordanSh commented Oct 14, 2024

Summary

Resolves #195202

In the video:
1 Wiz finding
1 Elastic finding with posture type
1 Elastic finding without posture type

You can see when i search for posture_type i only have 1 finding, when i navigate to kubernetes dashboard 2 findings are showing, including the one without the posture_type field which is assumed to be of type kspm. and the wiz finding is not showing.

Screen.Recording.2024-10-14.at.12.02.28.mov

@JordanSh JordanSh added release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related backport:prev-minor labels Oct 14, 2024
@JordanSh JordanSh self-assigned this Oct 14, 2024
@JordanSh JordanSh requested a review from a team as a code owner October 14, 2024 09:08
@elasticmachine
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

@maxcold maxcold left a comment

Choose a reason for hiding this comment

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

@JordanSh @CohenIdo as it is a non-issue really (due to the fact that we query data for the dashboards only from native index) and I don't trust runtime fields and painless, I wouldn't include it in 8.16. But if you think it gives us more confidence I'm fine with merging

def postureTypeAvailable = doc.containsKey("rule.benchmark.posture_type") &&
!doc["rule.benchmark.posture_type"].empty;
def postureTypeAvailable = doc.containsKey("rule.benchmark.posture_type") && !doc["rule.benchmark.posture_type"].empty;
boolean isNativeCsp = doc.containsKey("data_stream.dataset") && doc["data_stream.dataset"].value == "cloud_security_posture.findings";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

these painless scripts are very brittle, let's add && !doc["data_stream.dataset"].empty as well to the check

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure, i removed this check because we pretty much know that data_stream.dataset always exist but i can add it back.

Regarding your comment, removing this whole process right now is risky, a lot of pieces are relying on it, not worth taking the risk atm.

@JordanSh JordanSh enabled auto-merge (squash) October 14, 2024 17:08
@JordanSh JordanSh merged commit 73c9391 into elastic:main Oct 14, 2024
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.x

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

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @JordanSh

@kibanamachine
Copy link
Copy Markdown
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
…ative csp findings (#196064) (#196200)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Cloud Security] Only adding `safe_posture_type` to native
csp findings (#196064)](#196064)

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

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

<!--BACKPORT
[{"author":{"name":"Jordan","email":"51442161+JordanSh@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-14T18:44:48Z","message":"[Cloud
Security] Only adding `safe_posture_type` to native csp findings
(#196064)","sha":"73c9391c23f6fb52db6d1339da8cc72c602aa855","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":"[Cloud Security] Only adding
`safe_posture_type` to native csp
findings","number":196064,"url":"https://github.com/elastic/kibana/pull/196064","mergeCommit":{"message":"[Cloud
Security] Only adding `safe_posture_type` to native csp findings
(#196064)","sha":"73c9391c23f6fb52db6d1339da8cc72c602aa855"}},"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/196064","number":196064,"mergeCommit":{"message":"[Cloud
Security] Only adding `safe_posture_type` to native csp findings
(#196064)","sha":"73c9391c23f6fb52db6d1339da8cc72c602aa855"}}]}]
BACKPORT-->

Co-authored-by: Jordan <51442161+JordanSh@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

[Cloud Posture] Handle 3P missing posture type

4 participants