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] update score trendline to support muting rules #173987

Merged
merged 14 commits into from
Jan 3, 2024

Conversation

CohenIdo
Copy link
Contributor

@CohenIdo CohenIdo commented Dec 27, 2023

Summary

solves:

This PR modifies the score trendline, reflecting it based on muted rules. If rules are muted, the dashboard displays the custom compliance score trendline, which is derived from the disabled rules.

It's done by indexing score documents with a flag is_custom_score that indicates if the score is calculated based on all findings or for findings of enabled rules.

We continue to calculate the complete score anyway for future product requirements that will enable the user to compare between his custom score the the full compliance score.

It is the first step to making the compliance dashboard compatible with muting rules and contains only the score trendline.
In the next task, https://github.com/elastic/security-team/issues/7958, we will cover the whole dashboard page to support muting rules and then tests will be added.

For now, as long as the muting rules functionality is not exposed the current behavior will remain the same.

Demo

score.trendline.mp4

@CohenIdo CohenIdo force-pushed the index-custom-posture-score branch from 8626e1f to 7346b3d Compare December 28, 2023 09:05
@CohenIdo CohenIdo marked this pull request as ready for review December 28, 2023 13:58
@CohenIdo CohenIdo requested a review from a team as a code owner December 28, 2023 13:58
@CohenIdo CohenIdo added the release_note:skip Skip the PR/issue when compiling release notes label Dec 28, 2023
Copy link
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.

haven't finished with the CR yet, will get back to it tomorrow. Sharing the comments I have so far

@@ -157,25 +157,33 @@ export type CspBenchmarkRulesBulkActionRequestSchema = TypeOf<
typeof cspBenchmarkRulesBulkActionRequestSchema
Copy link
Contributor

Choose a reason for hiding this comment

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

the latest version now is v4 introduced in #173345 . Though I'm not sure if we need a v4 tbh. If we don't really need v4, let's consider reverting to having v3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@@ -10,6 +10,7 @@ import {
CspBenchmarkRulesBulkActionRequestSchema,
CspBenchmarkRulesStates,
cspBenchmarkRulesBulkActionRequestSchema,
CspBenchmarkRulesBulkActionResponse,
} from '../../../../common/types/rules/v3';
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason not to import from latest? now when we have v4 I'm lost in the version tbh :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So now I import from v4, since the response is coupled with the api version we don't want to import it from latest

@@ -47,5 +47,8 @@ export const benchmarkScoreMapping: MappingTypeMapping = {
low: {
type: 'long',
},
is_custom_score: {
Copy link
Contributor

Choose a reason for hiding this comment

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

what about is_unmuted_score ? custom to me is very generic name, which might be good if we plan to add more 'signals' to the same score, but otherwise it's hard to undertand what custom refers to without knowing the history

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed it to is_enabled_rules_score

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's better than custom but how do you decide when to use mute/unmute and when enable/disabled. I think we should settle on one term and use it consistently, otherwise in the future it might get very confusing. I also thought that we decided to go with mute/unmute but I might be missing smth. Wouldn't block the pr on the naming ofc, but consider the renaming in the follow up if you think it makes sense

Copy link
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.

left some comments on potential improvements. Nothing critical but some things worth fixing in my opinion

@@ -100,6 +102,9 @@ export default function ({ getService }: FtrProviderContext) {
await kibanaServer.savedObjects.clean({
types: ['cloud-security-posture-settings'],
});
await kibanaServer.savedObjects.clean({
Copy link
Contributor

Choose a reason for hiding this comment

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

can it be joined with the prev clean call? Like

await kibanaServer.savedObjects.clean({
  types: ['cloud-security-posture-settings', 'alert'],
});

@CohenIdo CohenIdo requested a review from maxcold January 2, 2024 08:49
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #4 / Serverless Common UI - Management Data View Management runtime fields create runtime field should modify runtime field

Metrics [docs]

✅ unchanged

History

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

@CohenIdo CohenIdo merged commit c05b893 into elastic:main Jan 3, 2024
20 checks passed
@kibanamachine kibanamachine added v8.13.0 backport:skip This commit does not require backporting labels Jan 3, 2024
@bhavyarm bhavyarm added the Team:Cloud Security Cloud Security team related label Jan 17, 2024
@elasticmachine
Copy link
Contributor

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

@bhavyarm
Copy link
Contributor

Hey team, bunch of PRs were missing the team label. I added the labels in. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants