mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 10:23:14 -04:00
[Cloud Security] Cis section passed link (#177083)
## Summary
Summarize your PR. If it involves visual changes include a screenshot or
gif.
This PR has enabled CIS Section linking with a posture score of 100%.
**CIS Section** will 100% Posture score will allow you to navigate to
the findings page with `result.evaluation: passed`.
[Quick Wins](
https://github.com/elastic/security-team/issues/8690)
f3cdc650
-4b29-425e-adb9-d18fe0144a35
This commit is contained in:
parent
37ae67a0a0
commit
5876cac5c1
2 changed files with 45 additions and 10 deletions
|
@ -19,7 +19,7 @@ import type {
|
||||||
PosturePolicyTemplate,
|
PosturePolicyTemplate,
|
||||||
} from '../../../../common/types_old';
|
} from '../../../../common/types_old';
|
||||||
import { RisksTable } from '../compliance_charts/risks_table';
|
import { RisksTable } from '../compliance_charts/risks_table';
|
||||||
import { RULE_FAILED } from '../../../../common/constants';
|
import { RULE_FAILED, RULE_PASSED } from '../../../../common/constants';
|
||||||
import { LOCAL_STORAGE_DASHBOARD_BENCHMARK_SORT_KEY } from '../../../common/constants';
|
import { LOCAL_STORAGE_DASHBOARD_BENCHMARK_SORT_KEY } from '../../../common/constants';
|
||||||
import { NavFilter, useNavigateFindings } from '../../../common/hooks/use_navigate_findings';
|
import { NavFilter, useNavigateFindings } from '../../../common/hooks/use_navigate_findings';
|
||||||
import { dashboardColumnsGrow, getPolicyTemplateQuery } from './summary_section';
|
import { dashboardColumnsGrow, getPolicyTemplateQuery } from './summary_section';
|
||||||
|
@ -70,13 +70,14 @@ export const BenchmarksSection = ({
|
||||||
|
|
||||||
const navToFailedFindingsByBenchmarkAndSection = (
|
const navToFailedFindingsByBenchmarkAndSection = (
|
||||||
benchmark: BenchmarkData,
|
benchmark: BenchmarkData,
|
||||||
ruleSection: string
|
ruleSection: string,
|
||||||
|
resultEvaluation: 'passed' | 'failed' = RULE_FAILED
|
||||||
) => {
|
) => {
|
||||||
navToFindings({
|
navToFindings({
|
||||||
...getPolicyTemplateQuery(dashboardType),
|
...getPolicyTemplateQuery(dashboardType),
|
||||||
...getBenchmarkIdQuery(benchmark),
|
...getBenchmarkIdQuery(benchmark),
|
||||||
'rule.section': ruleSection,
|
'rule.section': ruleSection,
|
||||||
'result.evaluation': RULE_FAILED,
|
'result.evaluation': resultEvaluation,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -190,9 +191,25 @@ export const BenchmarksSection = ({
|
||||||
compact
|
compact
|
||||||
data={benchmark.groupedFindingsEvaluation}
|
data={benchmark.groupedFindingsEvaluation}
|
||||||
maxItems={3}
|
maxItems={3}
|
||||||
onCellClick={(resourceTypeName) =>
|
onCellClick={(resourceTypeName) => {
|
||||||
navToFailedFindingsByBenchmarkAndSection(benchmark, resourceTypeName)
|
const cisSectionEvaluation = benchmark.groupedFindingsEvaluation.find(
|
||||||
|
(groupedFindingsEvaluation) =>
|
||||||
|
groupedFindingsEvaluation.name === resourceTypeName
|
||||||
|
);
|
||||||
|
// if the CIS Section posture score is 100, we should navigate with result evaluation as passed or result evaluation as failed
|
||||||
|
if (
|
||||||
|
cisSectionEvaluation?.postureScore &&
|
||||||
|
Math.trunc(cisSectionEvaluation?.postureScore) === 100
|
||||||
|
) {
|
||||||
|
navToFailedFindingsByBenchmarkAndSection(
|
||||||
|
benchmark,
|
||||||
|
resourceTypeName,
|
||||||
|
RULE_PASSED
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
navToFailedFindingsByBenchmarkAndSection(benchmark, resourceTypeName);
|
||||||
}
|
}
|
||||||
|
}}
|
||||||
viewAllButtonTitle={i18n.translate(
|
viewAllButtonTitle={i18n.translate(
|
||||||
'xpack.csp.dashboard.risksTable.benchmarkCardViewAllButtonTitle',
|
'xpack.csp.dashboard.risksTable.benchmarkCardViewAllButtonTitle',
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,6 +32,7 @@ import {
|
||||||
CSPM_POLICY_TEMPLATE,
|
CSPM_POLICY_TEMPLATE,
|
||||||
KSPM_POLICY_TEMPLATE,
|
KSPM_POLICY_TEMPLATE,
|
||||||
RULE_FAILED,
|
RULE_FAILED,
|
||||||
|
RULE_PASSED,
|
||||||
} from '../../../../common/constants';
|
} from '../../../../common/constants';
|
||||||
import { AccountsEvaluatedWidget } from '../../../components/accounts_evaluated_widget';
|
import { AccountsEvaluatedWidget } from '../../../components/accounts_evaluated_widget';
|
||||||
|
|
||||||
|
@ -66,11 +67,14 @@ export const SummarySection = ({
|
||||||
navToFindings({ 'result.evaluation': evaluation, ...getPolicyTemplateQuery(dashboardType) });
|
navToFindings({ 'result.evaluation': evaluation, ...getPolicyTemplateQuery(dashboardType) });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCellClick = (ruleSection: string) => {
|
const handleCellClick = (
|
||||||
|
ruleSection: string,
|
||||||
|
resultEvaluation: 'passed' | 'failed' = RULE_FAILED
|
||||||
|
) => {
|
||||||
navToFindings({
|
navToFindings({
|
||||||
'rule.section': ruleSection,
|
|
||||||
'result.evaluation': RULE_FAILED,
|
|
||||||
...getPolicyTemplateQuery(dashboardType),
|
...getPolicyTemplateQuery(dashboardType),
|
||||||
|
'rule.section': ruleSection,
|
||||||
|
'result.evaluation': resultEvaluation,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -192,7 +196,21 @@ export const SummarySection = ({
|
||||||
<RisksTable
|
<RisksTable
|
||||||
data={complianceData.groupedFindingsEvaluation}
|
data={complianceData.groupedFindingsEvaluation}
|
||||||
maxItems={5}
|
maxItems={5}
|
||||||
onCellClick={handleCellClick}
|
onCellClick={(cisSection: string) => {
|
||||||
|
const cisSectionEvaluation = complianceData.groupedFindingsEvaluation.find(
|
||||||
|
(groupedFindingsEvaluation) => groupedFindingsEvaluation.name === cisSection
|
||||||
|
);
|
||||||
|
|
||||||
|
// if the CIS Section posture score is 100, we should navigate with result evaluation as passed or result evaluation as failed
|
||||||
|
if (
|
||||||
|
cisSectionEvaluation?.postureScore &&
|
||||||
|
Math.trunc(cisSectionEvaluation?.postureScore) === 100
|
||||||
|
) {
|
||||||
|
handleCellClick(cisSection, RULE_PASSED);
|
||||||
|
} else {
|
||||||
|
handleCellClick(cisSection);
|
||||||
|
}
|
||||||
|
}}
|
||||||
onViewAllClick={handleViewAllClick}
|
onViewAllClick={handleViewAllClick}
|
||||||
viewAllButtonTitle={i18n.translate(
|
viewAllButtonTitle={i18n.translate(
|
||||||
'xpack.csp.dashboard.risksTable.viewAllButtonTitle',
|
'xpack.csp.dashboard.risksTable.viewAllButtonTitle',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue