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

[Security Solution] Coverage Overview follow-up #164613

Merged
merged 2 commits into from
Aug 25, 2023

Conversation

dplumlee
Copy link
Contributor

@dplumlee dplumlee commented Aug 23, 2023

Fixes: #164536
Fixes: #164816
Fixes: #164866

Summary

As well as some other housekeeping items like color and text changes for overall usability and design.

  • Now populates initial filter of enabled rules and all rule source types
  • Works in dark mode
  • Moves link to rules tab instead of dashboards
  • Changes tile coloring method

Screenshots

Screenshot 2023-08-23 at 1 13 36 PM

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@dplumlee dplumlee added release_note:skip Skip the PR/issue when compiling release notes Team:Detections and Resp Security Detection Response Team Feature:Rule Management Security Solution Detection Rule Management area Team:Detection Rule Management Security Detection Rule Management Team v8.10.0 v8.11.0 labels Aug 23, 2023
@dplumlee dplumlee self-assigned this Aug 23, 2023
@banderror banderror added bug Fixes for quality problems that affect the customer experience Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. labels Aug 23, 2023
@dplumlee dplumlee marked this pull request as ready for review August 24, 2023 14:20
@dplumlee dplumlee requested review from a team as code owners August 24, 2023 14:20
@dplumlee dplumlee requested review from spong and maximpn August 24, 2023 14:20
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@banderror banderror removed the request for review from spong August 24, 2023 18:22
Copy link
Member

@machadoum machadoum left a comment

Choose a reason for hiding this comment

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

threat-hunting-explore changs LGTM!

@banderror banderror force-pushed the coverage-overview-follow-up branch from 563331b to e76f800 Compare August 25, 2023 13:37
@banderror
Copy link
Contributor

banderror commented Aug 25, 2023

I started testing the PR, so far:

Will be updating this comment with more findings during review and testing.

@kibana-ci
Copy link
Collaborator

💚 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
securitySolution 15.7MB 15.7MB +1.0KB

History

  • 💛 Build #152986 was flaky 563331b1c692063eb47a8e77b2a11592692010b8
  • 💔 Build #152877 failed c8879c4369aa4ab775291a4563388f3397702f12

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

cc @dplumlee

Copy link
Contributor

@banderror banderror left a comment

Choose a reason for hiding this comment

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

Reviewed the diff and tested the app locally. Can confirm that all the fixes work as expected:

  • The "enable rules" button is disabled for read-only users
  • The page now has the initial filter of enabled rules and all rule source types
  • It looks good in both dark and normal modes, the tile coloring corresponds to the design
  • The Nav menu link is now under the "Rules" menu and on the corresponding page, it's not under "Dashboards" anymore

The changes look good, I left a few minor comments but don't want to block the PR from being merged. Feel free to address them in a follow-up PR.

In a comment above I also left a couple of links to the tickets I opened while testing. We will chat if we should include them in the 8.11 scope.

Overall, great PR, thank you @dplumlee for all your efforts! I also took a brief look at the whole implementation and I think it's well done, so a separate thank you for that 👍

import {
CoverageOverviewRuleActivity,
CoverageOverviewRuleSource,
} from '../../../../../common/api/detection_engine';
import * as i18n from './translations';

export const coverageOverviewPaletteColors = euiPalettePositive(5);
export const coverageOverviewPaletteColors = ['#00BFB326', '#00BFB34D', '#00BFB399', '#00BFB3'];
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: why do we need this as a separate array and why it is exported? It looks like magic numbers in an array.

I think this would be sufficient:

/**
 * Rules count -> color map
 *
 * A corresponding color is applied if rules count >= a specific threshold
 */
export const coverageOverviewCardColorThresholds = [
  { threshold: 10, color: '#00BFB3' },
  { threshold: 7, color: '#00BFB399' },
  { threshold: 3, color: '#00BFB34D' },
  { threshold: 1, color: '#00BFB326' },
];

Comment on lines +21 to +33
const subtitle = (
<EuiText color="subdued" size="s">
<span>{i18n.CoverageOverviewDashboardInformation}</span>{' '}
<EuiLink
external={true}
href={'https://www.elastic.co/'} // TODO: change to actual docs link before release
rel="noopener noreferrer"
target="_blank"
>
{i18n.CoverageOverviewDashboardInformationLink}
</EuiLink>
</EuiText>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's extract this to a separate component and memoize it. It's a static component w/o parameters that should be rendered only once.

<span>{i18n.CoverageOverviewDashboardInformation}</span>{' '}
<EuiLink
external={true}
href={'https://www.elastic.co/'} // TODO: change to actual docs link before release
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 time to ask the @elastic/security-docs team more actively to provide the URL. Meanwhile, let's change the link to a more specific one, such as https://www.elastic.co/guide/en/security/current/index.html.

Also, let's render the link itself using x-pack/plugins/security_solution/public/common/components/links_to_docs/links_components.tsx - we'd need to add a new link component to this file.

Also, there's packages/kbn-doc-links/src/get_doc_links.ts but I'm not sure if we've ever used it.

Comment on lines +45 to +60
export const getTotalRuleCount = (
technique: CoverageOverviewMitreTechnique,
activity?: CoverageOverviewRuleActivity[]
): number => {
if (!activity) {
return technique.enabledRules.length + technique.disabledRules.length;
}
let totalRuleCount = 0;
if (activity.includes(CoverageOverviewRuleActivity.Enabled)) {
totalRuleCount += technique.enabledRules.length;
}
if (activity.includes(CoverageOverviewRuleActivity.Disabled)) {
totalRuleCount += technique.disabledRules.length;
}
return totalRuleCount;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually our domain model, it's not just a helper. It's a primitive calculation on CoverageOverviewMitreTechnique, or you could say its "behavior". Since it's highly coupled with CoverageOverviewMitreTechnique, it should be placed closer to this type under x-pack/plugins/security_solution/public/detection_engine/rule_management/model/coverage_overview, or even to the same file.

export const CoverageOverviewDashboardInformationLink = i18n.translate(
'xpack.securitySolution.coverageOverviewDashboard.dashboardInformationLink',
{
defaultMessage: 'docs.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: We could reword the sentence so that we don't have to include punctuation in our localization dictionary.

@dplumlee
Copy link
Contributor Author

@banderror these are good comments, since we're doing a follow-up anyways for the column order I can address them there just to get this merged today 👍

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 25, 2023
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.10

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@dplumlee dplumlee deleted the coverage-overview-follow-up branch August 25, 2023 18:07
kibanamachine added a commit that referenced this pull request Aug 25, 2023
…4885)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[Security Solution] Coverage Overview follow-up
(#164613)](#164613)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Davis
Plumlee","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-08-25T17:56:55Z","message":"[Security
Solution] Coverage Overview follow-up
(#164613)","sha":"168e3dc5e979a677186a99d624b3bff0b6cd0545","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:Detections
and Resp","Team: SecuritySolution","Feature:Rule
Management","Team:Detection Rule
Management","v8.10.0","v8.11.0"],"number":164613,"url":"https://github.com/elastic/kibana/pull/164613","mergeCommit":{"message":"[Security
Solution] Coverage Overview follow-up
(#164613)","sha":"168e3dc5e979a677186a99d624b3bff0b6cd0545"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/164613","number":164613,"mergeCommit":{"message":"[Security
Solution] Coverage Overview follow-up
(#164613)","sha":"168e3dc5e979a677186a99d624b3bff0b6cd0545"}}]}]
BACKPORT-->

Co-authored-by: Davis Plumlee <[email protected]>
@joepeeples
Copy link
Contributor

@dplumlee My UI copy suggestions (note the title has lowercase "coverage" for consistency with other pages in the Rules section of the app, which follow sentence case):

MITRE ATT&CK® coverage
Your current coverage of MITRE ATT&CK® tactics and techniques, based on installed rules. Click a cell to view and enable a technique’s rules. Rules must be mapped to the MITRE ATT&CK® framework to be displayed. Learn more (link).

For the doc link's target, I just created a stub page at https://www.elastic.co/guide/en/security/master/rules-coverage.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Rule Management Security Solution Detection Rule Management area release_note:feature Makes this part of the condensed release notes Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.10.0 v8.11.0
Projects
None yet
7 participants