diff --git a/x-pack/packages/kbn-cloud-security-posture-common/constants.ts b/x-pack/packages/kbn-cloud-security-posture-common/constants.ts index 2772b6ae6d9c7..0e8b1b3e16cfa 100644 --- a/x-pack/packages/kbn-cloud-security-posture-common/constants.ts +++ b/x-pack/packages/kbn-cloud-security-posture-common/constants.ts @@ -26,3 +26,10 @@ export const CLOUD_SECURITY_POSTURE_BASE_PATH = '/cloud_security_posture'; export const CDR_MISCONFIGURATIONS_DATA_VIEW_ID_PREFIX = 'security_solution_cdr_latest_misconfigurations'; export const SECURITY_DEFAULT_DATA_VIEW_ID = 'security-solution-default'; + +export const CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN = + 'logs-cloud_security_posture.vulnerabilities_latest-default'; +export const CDR_LATEST_THIRD_PARTY_VULNERABILITIES_INDEX_PATTERN = + 'security_solution-*.vulnerability_latest'; +export const CDR_VULNERABILITIES_INDEX_PATTERN = `${CDR_LATEST_THIRD_PARTY_VULNERABILITIES_INDEX_PATTERN},${CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN}`; +export const LATEST_VULNERABILITIES_RETENTION_POLICY = '3d'; diff --git a/x-pack/packages/kbn-cloud-security-posture-common/index.ts b/x-pack/packages/kbn-cloud-security-posture-common/index.ts index 86ed573fc3915..4cb5a8d6e1bd8 100644 --- a/x-pack/packages/kbn-cloud-security-posture-common/index.ts +++ b/x-pack/packages/kbn-cloud-security-posture-common/index.ts @@ -19,9 +19,11 @@ export type { } from './types/status'; export type { CspFinding, CspFindingResult } from './types/findings'; export type { BenchmarksCisId } from './types/benchmark'; +export type { VulnSeverity } from './types/vulnerabilities'; export * from './constants'; export { extractErrorMessage, buildMutedRulesFilter, buildEntityFlyoutPreviewQuery, } from './utils/helpers'; +export { getAbbreviatedNumber } from './utils/get_abbreviated_number'; diff --git a/x-pack/plugins/cloud_security_posture/common/schemas/csp_vulnerability_finding.ts b/x-pack/packages/kbn-cloud-security-posture-common/schema/vulnerabilities/csp_vulnerability_finding.ts similarity index 97% rename from x-pack/plugins/cloud_security_posture/common/schemas/csp_vulnerability_finding.ts rename to x-pack/packages/kbn-cloud-security-posture-common/schema/vulnerabilities/csp_vulnerability_finding.ts index 10b3dbb96b1d3..b2255b8fa51f8 100644 --- a/x-pack/plugins/cloud_security_posture/common/schemas/csp_vulnerability_finding.ts +++ b/x-pack/packages/kbn-cloud-security-posture-common/schema/vulnerabilities/csp_vulnerability_finding.ts @@ -7,7 +7,7 @@ // TODO: this needs to be defined in a versioned schema import type { EcsEvent } from '@elastic/ecs'; -import { VulnSeverity } from '../types_old'; +import type { VulnSeverity } from '../../types/vulnerabilities'; export interface CspVulnerabilityFinding { '@timestamp': string; diff --git a/x-pack/plugins/cloud_security_posture/common/schemas/index.ts b/x-pack/packages/kbn-cloud-security-posture-common/schema/vulnerabilities/latest.ts similarity index 99% rename from x-pack/plugins/cloud_security_posture/common/schemas/index.ts rename to x-pack/packages/kbn-cloud-security-posture-common/schema/vulnerabilities/latest.ts index 8c8dcdc52f0f4..961d1bf9dc49d 100644 --- a/x-pack/plugins/cloud_security_posture/common/schemas/index.ts +++ b/x-pack/packages/kbn-cloud-security-posture-common/schema/vulnerabilities/latest.ts @@ -4,4 +4,5 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ + export * from './csp_vulnerability_finding'; diff --git a/x-pack/packages/kbn-cloud-security-posture-common/types/vulnerabilities.ts b/x-pack/packages/kbn-cloud-security-posture-common/types/vulnerabilities.ts new file mode 100644 index 0000000000000..e4360c1307e0a --- /dev/null +++ b/x-pack/packages/kbn-cloud-security-posture-common/types/vulnerabilities.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type VulnSeverity = 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL' | 'UNKNOWN'; diff --git a/x-pack/plugins/cloud_security_posture/public/common/utils/get_abbreviated_number.test.ts b/x-pack/packages/kbn-cloud-security-posture-common/utils/get_abbreviated_number.test.ts similarity index 100% rename from x-pack/plugins/cloud_security_posture/public/common/utils/get_abbreviated_number.test.ts rename to x-pack/packages/kbn-cloud-security-posture-common/utils/get_abbreviated_number.test.ts diff --git a/x-pack/plugins/cloud_security_posture/public/common/utils/get_abbreviated_number.ts b/x-pack/packages/kbn-cloud-security-posture-common/utils/get_abbreviated_number.ts similarity index 100% rename from x-pack/plugins/cloud_security_posture/public/common/utils/get_abbreviated_number.ts rename to x-pack/packages/kbn-cloud-security-posture-common/utils/get_abbreviated_number.ts diff --git a/x-pack/plugins/cloud_security_posture/common/constants.ts b/x-pack/plugins/cloud_security_posture/common/constants.ts index fc6fc7d76bf7f..e5d95b882b2e7 100644 --- a/x-pack/plugins/cloud_security_posture/common/constants.ts +++ b/x-pack/plugins/cloud_security_posture/common/constants.ts @@ -6,12 +6,8 @@ */ import { KSPM_POLICY_TEMPLATE, CSPM_POLICY_TEMPLATE } from '@kbn/cloud-security-posture-common'; -import { - AwsCredentialsTypeFieldMap, - GcpCredentialsTypeFieldMap, - PostureTypes, - VulnSeverity, -} from './types_old'; +import type { VulnSeverity } from '@kbn/cloud-security-posture-common'; +import { AwsCredentialsTypeFieldMap, GcpCredentialsTypeFieldMap, PostureTypes } from './types_old'; export const CLOUD_SECURITY_INTERTAL_PREFIX_ROUTE_PATH = '/internal/cloud_security_posture/'; @@ -61,14 +57,6 @@ export const VULNERABILITIES_INDEX_DEFAULT_NS = export const LATEST_VULNERABILITIES_INDEX_TEMPLATE_NAME = 'logs-cloud_security_posture.vulnerabilities_latest'; -export const CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN = - 'logs-cloud_security_posture.vulnerabilities_latest-default'; -export const CDR_LATEST_THIRD_PARTY_VULNERABILITIES_INDEX_PATTERN = - 'security_solution-*.vulnerability_latest'; -export const CDR_VULNERABILITIES_INDEX_PATTERN = `${CDR_LATEST_THIRD_PARTY_VULNERABILITIES_INDEX_PATTERN},${CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN}`; - -export const LATEST_VULNERABILITIES_RETENTION_POLICY = '3d'; - export const SECURITY_DEFAULT_DATA_VIEW_ID = 'security-solution-default'; export const ALERTS_INDEX_PATTERN = '.alerts-security.alerts-*'; diff --git a/x-pack/plugins/cloud_security_posture/common/types_old.ts b/x-pack/plugins/cloud_security_posture/common/types_old.ts index c6531605bc328..be5366b89bc24 100644 --- a/x-pack/plugins/cloud_security_posture/common/types_old.ts +++ b/x-pack/plugins/cloud_security_posture/common/types_old.ts @@ -151,8 +151,6 @@ export interface CnvmDashboardData { topVulnerabilities: VulnerabilityStat[]; } -export type VulnSeverity = 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL' | 'UNKNOWN'; - export interface VulnerableResourceStat { vulnerabilityCount: number | undefined; resource: { diff --git a/x-pack/plugins/cloud_security_posture/public/common/utils/get_vulnerability_colors.ts b/x-pack/plugins/cloud_security_posture/public/common/utils/get_vulnerability_colors.ts index db5776bb82ccc..fc63ac1131faa 100644 --- a/x-pack/plugins/cloud_security_posture/public/common/utils/get_vulnerability_colors.ts +++ b/x-pack/plugins/cloud_security_posture/public/common/utils/get_vulnerability_colors.ts @@ -6,8 +6,8 @@ */ import { euiThemeVars } from '@kbn/ui-theme'; +import type { VulnSeverity } from '@kbn/cloud-security-posture-common'; import { VULNERABILITIES_SEVERITY } from '../../../common/constants'; -import { VulnSeverity } from '../../../common/types_old'; export const getCvsScoreColor = (score: number): string | undefined => { if (score <= 4) { diff --git a/x-pack/plugins/cloud_security_posture/public/components/cloud_security_data_table/additional_controls.tsx b/x-pack/plugins/cloud_security_posture/public/components/cloud_security_data_table/additional_controls.tsx index b967384161949..856c2a5c91d75 100644 --- a/x-pack/plugins/cloud_security_posture/public/components/cloud_security_data_table/additional_controls.tsx +++ b/x-pack/plugins/cloud_security_posture/public/components/cloud_security_data_table/additional_controls.tsx @@ -8,9 +8,9 @@ import React, { FC, PropsWithChildren } from 'react'; import { EuiButtonEmpty, EuiFlexItem } from '@elastic/eui'; import { type DataView } from '@kbn/data-views-plugin/common'; import { FormattedMessage } from '@kbn/i18n-react'; +import { getAbbreviatedNumber } from '@kbn/cloud-security-posture-common'; import { FieldsSelectorModal, useFieldsModal } from './fields_selector'; import { useStyles } from './use_styles'; -import { getAbbreviatedNumber } from '../../common/utils/get_abbreviated_number'; import { CSP_FIELDS_SELECTOR_OPEN_BUTTON } from '../test_subjects'; const GroupSelectorWrapper: FC> = ({ children }) => { diff --git a/x-pack/plugins/cloud_security_posture/public/components/vulnerability_badges.tsx b/x-pack/plugins/cloud_security_posture/public/components/vulnerability_badges.tsx index 7d29cda67e9d4..cb4fbbad83a35 100644 --- a/x-pack/plugins/cloud_security_posture/public/components/vulnerability_badges.tsx +++ b/x-pack/plugins/cloud_security_posture/public/components/vulnerability_badges.tsx @@ -9,8 +9,8 @@ import { EuiBadge, EuiIcon, EuiTextColor } from '@elastic/eui'; import React from 'react'; import { css } from '@emotion/react'; import { float } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { VulnSeverity } from '@kbn/cloud-security-posture-common'; import { getCvsScoreColor, getSeverityStatusColor } from '../common/utils/get_vulnerability_colors'; -import { VulnSeverity } from '../../common/types_old'; import { VULNERABILITIES_CVSS_SCORE_BADGE_SUBJ } from './test_subjects'; interface CVSScoreBadgeProps { diff --git a/x-pack/plugins/cloud_security_posture/public/components/vulnerability_severity_map.tsx b/x-pack/plugins/cloud_security_posture/public/components/vulnerability_severity_map.tsx index b22846b624b9c..74341095caac2 100644 --- a/x-pack/plugins/cloud_security_posture/public/components/vulnerability_severity_map.tsx +++ b/x-pack/plugins/cloud_security_posture/public/components/vulnerability_severity_map.tsx @@ -15,9 +15,9 @@ import { EuiText, } from '@elastic/eui'; import { PaletteColorStop } from '@elastic/eui/src/components/color_picker/color_palette_picker'; +import type { VulnSeverity } from '@kbn/cloud-security-posture-common'; import { i18n } from '@kbn/i18n'; import { getSeverityStatusColor } from '../common/utils/get_vulnerability_colors'; -import { VulnSeverity } from '../../common/types_old'; import { SeverityStatusBadge } from './vulnerability_badges'; interface Props { diff --git a/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/latest_findings_group_renderer.tsx b/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/latest_findings_group_renderer.tsx index e2ea550447af1..b4ad5d15ec8e9 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/latest_findings_group_renderer.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/latest_findings_group_renderer.tsx @@ -17,13 +17,13 @@ import { css } from '@emotion/react'; import { GroupPanelRenderer, GroupStatsItem, RawBucket } from '@kbn/grouping/src'; import React from 'react'; import { i18n } from '@kbn/i18n'; +import { getAbbreviatedNumber } from '@kbn/cloud-security-posture-common'; import { FINDINGS_GROUPING_OPTIONS } from '../../../common/constants'; import { firstNonNullValue, LoadingGroup, NullGroup, } from '../../../components/cloud_security_grouping'; -import { getAbbreviatedNumber } from '../../../common/utils/get_abbreviated_number'; import { CISBenchmarkIcon } from '../../../components/cis_benchmark_icon'; import { ComplianceScoreBar } from '../../../components/compliance_score_bar'; import { FindingsGroupingAggregation } from './use_grouped_findings'; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/configurations/layout/findings_distribution_bar.tsx b/x-pack/plugins/cloud_security_posture/public/pages/configurations/layout/findings_distribution_bar.tsx index f737589aa2a4a..3fe31785f81df 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/configurations/layout/findings_distribution_bar.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/configurations/layout/findings_distribution_bar.tsx @@ -9,7 +9,7 @@ import { css } from '@emotion/react'; import { EuiHealth, EuiBadge, EuiSpacer, EuiFlexGroup, useEuiTheme } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { statusColors } from '@kbn/cloud-security-posture'; -import { getAbbreviatedNumber } from '../../../common/utils/get_abbreviated_number'; +import { getAbbreviatedNumber } from '@kbn/cloud-security-posture-common'; import { RULE_FAILED, RULE_PASSED } from '../../../../common/constants'; import type { Evaluation } from '../../../../common/types_old'; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/_mocks_/vulnerability.mock.ts b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/_mocks_/vulnerability.mock.ts index e66f9b33d7e91..46a6197360de9 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/_mocks_/vulnerability.mock.ts +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/_mocks_/vulnerability.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { CspVulnerabilityFinding } from '../../../../common/schemas'; +import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest'; export const mockVulnerabilityHit: CspVulnerabilityFinding = { '@timestamp': '2023-03-30T10:27:35.013Z', diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_grouped_vulnerabilities.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_grouped_vulnerabilities.tsx index 72815ef434ef9..580926340438f 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_grouped_vulnerabilities.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_grouped_vulnerabilities.tsx @@ -11,7 +11,7 @@ import { GenericBuckets, GroupingQuery, RootAggregation } from '@kbn/grouping/sr import { useQuery } from '@tanstack/react-query'; import { lastValueFrom } from 'rxjs'; import { showErrorToast } from '@kbn/cloud-security-posture'; -import { CDR_VULNERABILITIES_INDEX_PATTERN } from '../../../../common/constants'; +import { CDR_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import { useKibana } from '../../../common/hooks/use_kibana'; // Elasticsearch returns `null` when a sub-aggregation cannot be computed diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities.tsx index c4c73f0ce5db2..3e5bd646e7993 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities.tsx @@ -16,14 +16,14 @@ import { } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { buildDataTableRecord } from '@kbn/discover-utils'; import { EsHitRecord } from '@kbn/discover-utils/types'; -import { MAX_FINDINGS_TO_LOAD } from '@kbn/cloud-security-posture-common'; -import { FindingsBaseEsQuery, showErrorToast } from '@kbn/cloud-security-posture'; -import { VULNERABILITY_FIELDS } from '../../../common/constants'; -import { CspVulnerabilityFinding } from '../../../../common/schemas'; import { + MAX_FINDINGS_TO_LOAD, CDR_VULNERABILITIES_INDEX_PATTERN, LATEST_VULNERABILITIES_RETENTION_POLICY, -} from '../../../../common/constants'; +} from '@kbn/cloud-security-posture-common'; +import { FindingsBaseEsQuery, showErrorToast } from '@kbn/cloud-security-posture'; +import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest'; +import { VULNERABILITY_FIELDS } from '../../../common/constants'; import { useKibana } from '../../../common/hooks/use_kibana'; import { getCaseInsensitiveSortScript } from '../utils/custom_sort_script'; type LatestFindingsRequest = IKibanaSearchRequest; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities_grouping.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities_grouping.tsx index e713a0ad6aad9..f615ccdb4a293 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities_grouping.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities_grouping.tsx @@ -14,6 +14,7 @@ import { parseGroupingQuery, } from '@kbn/grouping/src'; import { useMemo } from 'react'; +import { LATEST_VULNERABILITIES_RETENTION_POLICY } from '@kbn/cloud-security-posture-common'; import { buildEsQuery, Filter } from '@kbn/es-query'; import { LOCAL_STORAGE_VULNERABILITIES_GROUPING_KEY, @@ -21,10 +22,7 @@ import { VULNERABILITY_FIELDS, } from '../../../common/constants'; import { useDataViewContext } from '../../../common/contexts/data_view_context'; -import { - LATEST_VULNERABILITIES_RETENTION_POLICY, - VULNERABILITIES_SEVERITY, -} from '../../../../common/constants'; +import { VULNERABILITIES_SEVERITY } from '../../../../common/constants'; import { VulnerabilitiesGroupingAggregation, VulnerabilitiesRootGroupingAggregation, diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/latest_vulnerabilities_group_renderer.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/latest_vulnerabilities_group_renderer.tsx index 242c61b7276ad..c05cff298fc34 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/latest_vulnerabilities_group_renderer.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/latest_vulnerabilities_group_renderer.tsx @@ -17,11 +17,11 @@ import { css } from '@emotion/react'; import { GroupPanelRenderer, GroupStatsItem, RawBucket } from '@kbn/grouping/src'; import React from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; +import { getAbbreviatedNumber } from '@kbn/cloud-security-posture-common'; import { getCloudProviderNameFromAbbreviation } from '../../../common/utils/helpers'; import { VulnerabilitiesGroupingAggregation } from './hooks/use_grouped_vulnerabilities'; import { VULNERABILITIES_GROUPING_COUNTER } from './test_subjects'; import { NULL_GROUPING_MESSAGES, NULL_GROUPING_UNIT, VULNERABILITIES } from './translations'; -import { getAbbreviatedNumber } from '../../common/utils/get_abbreviated_number'; import { firstNonNullValue, LoadingGroup, diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/latest_vulnerabilities_table.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/latest_vulnerabilities_table.tsx index ac215d4e12cf7..1a6ae8f660bc0 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/latest_vulnerabilities_table.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/latest_vulnerabilities_table.tsx @@ -11,8 +11,8 @@ import { i18n } from '@kbn/i18n'; import { EuiDataGridCellValueElementProps, EuiSpacer } from '@elastic/eui'; import { Filter } from '@kbn/es-query'; import { HttpSetup } from '@kbn/core-http-browser'; +import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest'; import { getDatasetDisplayName } from '../../common/utils/get_dataset_display_name'; -import { CspVulnerabilityFinding } from '../../../common/schemas'; import { CloudSecurityDataTable } from '../../components/cloud_security_data_table'; import { useLatestVulnerabilitiesTable } from './hooks/use_latest_vulnerabilities_table'; import { LATEST_VULNERABILITIES_TABLE } from './test_subjects'; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/types.ts b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/types.ts index e0c97ce6ff76d..22a62a25f8cd4 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/types.ts +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/types.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { VectorScoreBase } from '../../../common/schemas'; +import { VectorScoreBase } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest'; export type Vendor = 'NVD' | 'Red Hat' | 'GHSA'; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/utils/create_detection_rule_from_vulnerability.ts b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/utils/create_detection_rule_from_vulnerability.ts index 3680c7a6af844..7e817a3d56a15 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/utils/create_detection_rule_from_vulnerability.ts +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/utils/create_detection_rule_from_vulnerability.ts @@ -7,9 +7,9 @@ import { HttpSetup } from '@kbn/core/public'; import { i18n } from '@kbn/i18n'; -import type { Vulnerability } from '../../../../common/schemas'; +import { LATEST_VULNERABILITIES_RETENTION_POLICY } from '@kbn/cloud-security-posture-common'; +import type { Vulnerability } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest'; import { - LATEST_VULNERABILITIES_RETENTION_POLICY, VULNERABILITIES_INDEX_PATTERN, VULNERABILITIES_SEVERITY, } from '../../../../common/constants'; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/utils/get_vector_score_list.ts b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/utils/get_vector_score_list.ts index b4f6bd90389fd..c9190a001b3b5 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/utils/get_vector_score_list.ts +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/utils/get_vector_score_list.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { VectorScoreBase } from '../../../../common/schemas'; +import { VectorScoreBase } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest'; import { Vector } from '../types'; export const getVectorScoreList = (vectorBaseScore: VectorScoreBase) => { diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_detection_rule_counter.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_detection_rule_counter.tsx index b05013353b2b8..facb4817cec51 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_detection_rule_counter.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_detection_rule_counter.tsx @@ -7,8 +7,8 @@ import React from 'react'; import type { HttpSetup } from '@kbn/core/public'; +import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest'; import { CSP_VULN_DATASET } from '../../../common/utils/get_dataset_display_name'; -import { CspVulnerabilityFinding } from '../../../../common/schemas'; import { DetectionRuleCounter } from '../../../components/detection_rule_counter'; import { createDetectionRuleFromVulnerabilityFinding } from '../utils/create_detection_rule_from_vulnerability'; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_finding_flyout.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_finding_flyout.tsx index 953d8af6ce7cb..102fc272801ea 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_finding_flyout.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_finding_flyout.tsx @@ -27,13 +27,13 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { euiThemeVars } from '@kbn/ui-theme'; import { css } from '@emotion/react'; import { HttpSetup } from '@kbn/core-http-browser'; +import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest'; import { TakeAction } from '../../../components/take_action'; import { truthy } from '../../../../common/utils/helpers'; import { CspInlineDescriptionList } from '../../../components/csp_inline_description_list'; import { VulnerabilityOverviewTab } from './vulnerability_overview_tab'; import { VulnerabilityJsonTab } from './vulnerability_json_tab'; import { SeverityStatusBadge } from '../../../components/vulnerability_badges'; -import type { CspVulnerabilityFinding } from '../../../../common/schemas'; import { FINDINGS_VULNERABILITY_FLYOUT_DESCRIPTION_LIST, TAB_ID_VULNERABILITY_FLYOUT, diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_json_tab.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_json_tab.tsx index c18571eb975e6..03701ad4ee442 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_json_tab.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_json_tab.tsx @@ -8,7 +8,7 @@ import { CodeEditor } from '@kbn/code-editor'; import React from 'react'; import { XJsonLang } from '@kbn/monaco'; -import { CspVulnerabilityFinding } from '../../../../common/schemas'; +import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest'; import { JSON_TAB_VULNERABILITY_FLYOUT } from '../test_subjects'; interface VulnerabilityJsonTabProps { vulnerabilityRecord: CspVulnerabilityFinding; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_overview_tab.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_overview_tab.tsx index ecff474d5f50f..9848bbd402e50 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_overview_tab.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_overview_tab.tsx @@ -19,8 +19,11 @@ import moment from 'moment'; import React from 'react'; import { euiThemeVars } from '@kbn/ui-theme'; import { i18n } from '@kbn/i18n'; +import { + VectorScoreBase, + CspVulnerabilityFinding, +} from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest'; import { getDatasetDisplayName } from '../../../common/utils/get_dataset_display_name'; -import { VectorScoreBase, CspVulnerabilityFinding } from '../../../../common/schemas'; import { CspFlyoutMarkdown } from '../../configurations/findings_flyout/findings_flyout'; import { NvdLogo } from '../../../assets/icons/nvd_logo_svg'; import { CVSScoreBadge } from '../../../components/vulnerability_badges'; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_table_tab.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_table_tab.tsx index 3d5c5d6c519a7..e84661bd0bcb1 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_table_tab.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_table_tab.tsx @@ -15,7 +15,7 @@ import { import React from 'react'; import { getFlattenedObject } from '@kbn/std'; import { i18n } from '@kbn/i18n'; -import { CspVulnerabilityFinding } from '../../../../common/schemas'; +import { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest'; interface FlattenedItem { key: string; // flattened dot notation object path for Vulnerability; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilties.test.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilties.test.tsx index 07db3f1905167..0c624a215c253 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilties.test.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilties.test.tsx @@ -6,12 +6,12 @@ */ import React from 'react'; import Chance from 'chance'; -import { CDR_MISCONFIGURATIONS_DATA_VIEW_ID_PREFIX } from '@kbn/cloud-security-posture-common'; -import { Vulnerabilities } from './vulnerabilities'; import { + CDR_MISCONFIGURATIONS_DATA_VIEW_ID_PREFIX, CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, - VULN_MGMT_POLICY_TEMPLATE, -} from '../../../common/constants'; +} from '@kbn/cloud-security-posture-common'; +import { Vulnerabilities } from './vulnerabilities'; +import { VULN_MGMT_POLICY_TEMPLATE } from '../../../common/constants'; import { useCspSetupStatusApi } from '@kbn/cloud-security-posture/src/hooks/use_csp_setup_status_api'; import { useDataView } from '@kbn/cloud-security-posture/src/hooks/use_data_view'; import { createReactQueryResponse } from '../../test/fixtures/react_query'; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerability_dashboard/vulnerability_dashboard.test.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerability_dashboard/vulnerability_dashboard.test.tsx index 9ea51de9e5f9d..50f630e6b9376 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerability_dashboard/vulnerability_dashboard.test.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerability_dashboard/vulnerability_dashboard.test.tsx @@ -8,10 +8,8 @@ import React from 'react'; import Chance from 'chance'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; -import { - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, - VULN_MGMT_POLICY_TEMPLATE, -} from '../../../common/constants'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; +import { VULN_MGMT_POLICY_TEMPLATE } from '../../../common/constants'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { discoverPluginMock } from '@kbn/discover-plugin/public/mocks'; import { useCspSetupStatusApi } from '@kbn/cloud-security-posture/src/hooks/use_csp_setup_status_api'; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerability_dashboard/vulnerability_table_panel_section.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerability_dashboard/vulnerability_table_panel_section.tsx index a3d92ab40f08c..42794e91d2036 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerability_dashboard/vulnerability_table_panel_section.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerability_dashboard/vulnerability_table_panel_section.tsx @@ -18,11 +18,11 @@ import { import { i18n } from '@kbn/i18n'; import type { NavFilter } from '@kbn/cloud-security-posture/src/hooks/use_navigate_findings'; import { useNavigateVulnerabilities } from '@kbn/cloud-security-posture/src/hooks/use_navigate_findings'; +import type { VulnSeverity } from '@kbn/cloud-security-posture-common'; import { PatchableVulnerabilityStat, VulnerabilityStat, VulnerableResourceStat, - VulnSeverity, } from '../../../common/types_old'; import { DASHBOARD_TABLE_TYPES } from './vulnerability_table_panel.config'; import { VulnerabilityTablePanel } from './vulnerability_table_panel'; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerability_dashboard/vulnerability_trend_graph.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerability_dashboard/vulnerability_trend_graph.tsx index 89404b0238ece..ca29b18822fae 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerability_dashboard/vulnerability_trend_graph.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerability_dashboard/vulnerability_trend_graph.tsx @@ -20,8 +20,9 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { useNavigateVulnerabilities } from '@kbn/cloud-security-posture/src/hooks/use_navigate_findings'; +import type { VulnSeverity } from '@kbn/cloud-security-posture-common'; import { truthy } from '../../../common/utils/helpers'; -import { VulnStatsTrend, VulnSeverity } from '../../../common/types_old'; +import { VulnStatsTrend } from '../../../common/types_old'; import { useVulnerabilityDashboardApi } from '../../common/api/use_vulnerability_dashboard_api'; import { getSeverityStatusColor } from '../../common/utils/get_vulnerability_colors'; import { ChartPanel } from '../../components/chart_panel'; diff --git a/x-pack/plugins/cloud_security_posture/server/create_indices/latest_indices.ts b/x-pack/plugins/cloud_security_posture/server/create_indices/latest_indices.ts index 5505ea4c42c23..4d91c3f3fc2c5 100644 --- a/x-pack/plugins/cloud_security_posture/server/create_indices/latest_indices.ts +++ b/x-pack/plugins/cloud_security_posture/server/create_indices/latest_indices.ts @@ -5,13 +5,15 @@ * 2.0. */ -import { CDR_LATEST_NATIVE_MISCONFIGURATIONS_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; +import { + CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, + CDR_LATEST_NATIVE_MISCONFIGURATIONS_INDEX_PATTERN, +} from '@kbn/cloud-security-posture-common'; import { FINDINGS_INDEX_NAME, LATEST_FINDINGS_INDEX_TEMPLATE_NAME, LATEST_FINDINGS_INDEX_DEFAULT_NS, VULNERABILITIES_INDEX_NAME, - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, LATEST_VULNERABILITIES_INDEX_TEMPLATE_NAME, } from '../../common/constants'; import { LatestIndexConfig } from './types'; diff --git a/x-pack/plugins/cloud_security_posture/server/create_transforms/latest_vulnerabilities_transforms.ts b/x-pack/plugins/cloud_security_posture/server/create_transforms/latest_vulnerabilities_transforms.ts index 0f116f9635e03..fad6b526c72d7 100644 --- a/x-pack/plugins/cloud_security_posture/server/create_transforms/latest_vulnerabilities_transforms.ts +++ b/x-pack/plugins/cloud_security_posture/server/create_transforms/latest_vulnerabilities_transforms.ts @@ -7,9 +7,11 @@ import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/types'; import { - CLOUD_SECURITY_POSTURE_PACKAGE_NAME, CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, LATEST_VULNERABILITIES_RETENTION_POLICY, +} from '@kbn/cloud-security-posture-common'; +import { + CLOUD_SECURITY_POSTURE_PACKAGE_NAME, VULNERABILITIES_INDEX_PATTERN, } from '../../common/constants'; diff --git a/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/cloud_accounts_stats_collector.ts b/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/cloud_accounts_stats_collector.ts index ab561f515d22f..e416bec9564c4 100644 --- a/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/cloud_accounts_stats_collector.ts +++ b/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/cloud_accounts_stats_collector.ts @@ -6,7 +6,11 @@ */ import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; import type { ISavedObjectsRepository, Logger } from '@kbn/core/server'; -import { KSPM_POLICY_TEMPLATE, CSPM_POLICY_TEMPLATE } from '@kbn/cloud-security-posture-common'; +import { + CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, + KSPM_POLICY_TEMPLATE, + CSPM_POLICY_TEMPLATE, +} from '@kbn/cloud-security-posture-common'; import type { SearchRequest } from '@elastic/elasticsearch/lib/api/types'; import { getPackagePolicyIdRuntimeMapping } from '../../../../common/runtime_mappings/get_package_policy_id_mapping'; import { getIdentifierRuntimeMapping } from '../../../../common/runtime_mappings/get_identifier_runtime_mapping'; @@ -19,7 +23,6 @@ import type { } from './types'; import { LATEST_FINDINGS_INDEX_DEFAULT_NS, - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, VULN_MGMT_POLICY_TEMPLATE, } from '../../../../common/constants'; import { diff --git a/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/indices_stats_collector.ts b/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/indices_stats_collector.ts index c8fb7167eeae1..e5c19c9216be5 100644 --- a/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/indices_stats_collector.ts +++ b/x-pack/plugins/cloud_security_posture/server/lib/telemetry/collectors/indices_stats_collector.ts @@ -6,6 +6,7 @@ */ import type { CoreStart, Logger, SavedObjectsClientContract } from '@kbn/core/server'; import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import { getCspStatus } from '../../../routes/status/status'; import type { CspServerPluginStart, CspServerPluginStartDeps } from '../../../types'; @@ -14,7 +15,6 @@ import { BENCHMARK_SCORE_INDEX_DEFAULT_NS, FINDINGS_INDEX_DEFAULT_NS, LATEST_FINDINGS_INDEX_DEFAULT_NS, - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, VULNERABILITIES_INDEX_DEFAULT_NS, } from '../../../../common/constants'; diff --git a/x-pack/plugins/cloud_security_posture/server/routes/status/status.ts b/x-pack/plugins/cloud_security_posture/server/routes/status/status.ts index 47ad4c32cba6e..659b2ed94f43a 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/status/status.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/status/status.ts @@ -12,6 +12,9 @@ import { STATUS_ROUTE_PATH, LATEST_FINDINGS_RETENTION_POLICY, CDR_MISCONFIGURATIONS_INDEX_PATTERN, + CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, + LATEST_VULNERABILITIES_RETENTION_POLICY, + CDR_VULNERABILITIES_INDEX_PATTERN, } from '@kbn/cloud-security-posture-common'; import type { CspSetupStatus, @@ -36,11 +39,8 @@ import { BENCHMARK_SCORE_INDEX_DEFAULT_NS, VULNERABILITIES_INDEX_PATTERN, POSTURE_TYPES, - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, VULN_MGMT_POLICY_TEMPLATE, POSTURE_TYPE_ALL, - LATEST_VULNERABILITIES_RETENTION_POLICY, - CDR_VULNERABILITIES_INDEX_PATTERN, } from '../../../common/constants'; import type { CspApiRequestHandlerContext, diff --git a/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_top_patchable_vulnerabilities.ts b/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_top_patchable_vulnerabilities.ts index add7eac260c25..565400ec3a6df 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_top_patchable_vulnerabilities.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_top_patchable_vulnerabilities.ts @@ -7,8 +7,8 @@ import { SearchRequest } from '@elastic/elasticsearch/lib/api/types'; import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import { AggFieldBucket, PatchableVulnerabilityStat } from '../../../common/types_old'; -import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '../../../common/constants'; interface VulnerabilityBucket { key: string | undefined; diff --git a/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_top_vulnerabilities.ts b/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_top_vulnerabilities.ts index 5160d0d98fa0c..4ab2ee45ed549 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_top_vulnerabilities.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_top_vulnerabilities.ts @@ -7,8 +7,8 @@ import { SearchRequest } from '@elastic/elasticsearch/lib/api/types'; import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import { VulnerabilityStat } from '../../../common/types_old'; -import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '../../../common/constants'; interface VulnerabilityBucket { key: string | undefined; diff --git a/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_top_vulnerable_resources.ts b/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_top_vulnerable_resources.ts index 6a7f0b17be21b..e04266e214d4c 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_top_vulnerable_resources.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_top_vulnerable_resources.ts @@ -6,9 +6,9 @@ */ import { SearchRequest } from '@elastic/elasticsearch/lib/api/types'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; import { AggFieldBucket, VulnerableResourceStat } from '../../../common/types_old'; -import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '../../../common/constants'; interface ResourceBucket { key: string | undefined; diff --git a/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_vulnerabilities_statistics.ts b/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_vulnerabilities_statistics.ts index 797a69113fc0d..905810f1efc01 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_vulnerabilities_statistics.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/vulnerabilities_dashboard/get_vulnerabilities_statistics.ts @@ -7,10 +7,8 @@ import { SearchRequest } from '@elastic/elasticsearch/lib/api/types'; import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; -import { - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, - VULNERABILITIES_SEVERITY, -} from '../../../common/constants'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; +import { VULNERABILITIES_SEVERITY } from '../../../common/constants'; export interface VulnerabilitiesStatisticsQueryResult { critical: { diff --git a/x-pack/plugins/cloud_security_posture/server/saved_objects/data_views.ts b/x-pack/plugins/cloud_security_posture/server/saved_objects/data_views.ts index 69eef99d7cd43..475afc52a2e03 100644 --- a/x-pack/plugins/cloud_security_posture/server/saved_objects/data_views.ts +++ b/x-pack/plugins/cloud_security_posture/server/saved_objects/data_views.ts @@ -19,11 +19,11 @@ import { CDR_MISCONFIGURATIONS_INDEX_PATTERN, CDR_MISCONFIGURATIONS_DATA_VIEW_ID_PREFIX, CDR_MISCONFIGURATIONS_DATA_VIEW_NAME, + CDR_VULNERABILITIES_INDEX_PATTERN, } from '@kbn/cloud-security-posture-common'; import { CDR_VULNERABILITIES_DATA_VIEW_ID_PREFIX, CDR_VULNERABILITIES_DATA_VIEW_NAME, - CDR_VULNERABILITIES_INDEX_PATTERN, } from '../../common/constants'; const DATA_VIEW_TIME_FIELD = '@timestamp'; diff --git a/x-pack/plugins/cloud_security_posture/server/tasks/findings_stats_task.ts b/x-pack/plugins/cloud_security_posture/server/tasks/findings_stats_task.ts index f04ddd3459fb9..1f8614c6d4a5e 100644 --- a/x-pack/plugins/cloud_security_posture/server/tasks/findings_stats_task.ts +++ b/x-pack/plugins/cloud_security_posture/server/tasks/findings_stats_task.ts @@ -14,6 +14,7 @@ import { import type { SearchRequest } from '@elastic/elasticsearch/lib/api/types'; import { ElasticsearchClient } from '@kbn/core/server'; import { QueryDslQueryContainer } from '@kbn/data-views-plugin/common/types'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import type { ISavedObjectsRepository, Logger } from '@kbn/core/server'; import { getMutedRulesFilterQuery } from '../routes/benchmark_rules/get_states/v1'; import { getSafePostureTypeRuntimeMapping } from '../../common/runtime_mappings/get_safe_posture_type_runtime_mapping'; @@ -24,7 +25,6 @@ import { CSPM_FINDINGS_STATS_INTERVAL, INTERNAL_CSP_SETTINGS_SAVED_OBJECT_TYPE, LATEST_FINDINGS_INDEX_DEFAULT_NS, - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, VULNERABILITIES_SEVERITY, VULN_MGMT_POLICY_TEMPLATE, } from '../../common/constants'; diff --git a/x-pack/plugins/security_solution_serverless/server/cloud_security/constants.ts b/x-pack/plugins/security_solution_serverless/server/cloud_security/constants.ts index c0b95f4de8c32..fa98707e5ebeb 100644 --- a/x-pack/plugins/security_solution_serverless/server/cloud_security/constants.ts +++ b/x-pack/plugins/security_solution_serverless/server/cloud_security/constants.ts @@ -9,11 +9,9 @@ import { CSPM_POLICY_TEMPLATE, KSPM_POLICY_TEMPLATE, CDR_LATEST_NATIVE_MISCONFIGURATIONS_INDEX_PATTERN, -} from '@kbn/cloud-security-posture-common'; -import { - CNVM_POLICY_TEMPLATE, CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, -} from '@kbn/cloud-security-posture-plugin/common/constants'; +} from '@kbn/cloud-security-posture-common'; +import { CNVM_POLICY_TEMPLATE } from '@kbn/cloud-security-posture-plugin/common/constants'; import { INTEGRATION_PACKAGE_NAME } from '@kbn/cloud-defend-plugin/common/constants'; export const CLOUD_DEFEND_HEARTBEAT_INDEX = 'metrics-cloud_defend.heartbeat-*'; diff --git a/x-pack/test/api_integration/apis/cloud_security_posture/status/status_index_timeout.ts b/x-pack/test/api_integration/apis/cloud_security_posture/status/status_index_timeout.ts index 6bce493c3f539..ce0c9014478dc 100644 --- a/x-pack/test/api_integration/apis/cloud_security_posture/status/status_index_timeout.ts +++ b/x-pack/test/api_integration/apis/cloud_security_posture/status/status_index_timeout.ts @@ -7,10 +7,10 @@ import expect from '@kbn/expect'; import type { CspSetupStatus } from '@kbn/cloud-security-posture-common'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import { FINDINGS_INDEX_DEFAULT_NS, LATEST_FINDINGS_INDEX_DEFAULT_NS, - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, VULNERABILITIES_INDEX_DEFAULT_NS, } from '@kbn/cloud-security-posture-plugin/common/constants'; import { generateAgent } from '../../../../fleet_api_integration/helpers'; diff --git a/x-pack/test/api_integration/apis/cloud_security_posture/status/status_indexed.ts b/x-pack/test/api_integration/apis/cloud_security_posture/status/status_indexed.ts index 9205788854869..504bb9f504516 100644 --- a/x-pack/test/api_integration/apis/cloud_security_posture/status/status_indexed.ts +++ b/x-pack/test/api_integration/apis/cloud_security_posture/status/status_indexed.ts @@ -6,11 +6,11 @@ */ import expect from '@kbn/expect'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import type { CspSetupStatus } from '@kbn/cloud-security-posture-common'; import { FINDINGS_INDEX_DEFAULT_NS, LATEST_FINDINGS_INDEX_DEFAULT_NS, - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, VULNERABILITIES_INDEX_DEFAULT_NS, } from '@kbn/cloud-security-posture-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/cloud_security_posture/status/status_indexing.ts b/x-pack/test/api_integration/apis/cloud_security_posture/status/status_indexing.ts index a011d4f5577e8..4d66d8460b9a4 100644 --- a/x-pack/test/api_integration/apis/cloud_security_posture/status/status_indexing.ts +++ b/x-pack/test/api_integration/apis/cloud_security_posture/status/status_indexing.ts @@ -7,10 +7,10 @@ import expect from '@kbn/expect'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import type { CspSetupStatus } from '@kbn/cloud-security-posture-common'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import { FINDINGS_INDEX_DEFAULT_NS, LATEST_FINDINGS_INDEX_DEFAULT_NS, - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, VULNERABILITIES_INDEX_DEFAULT_NS, } from '@kbn/cloud-security-posture-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/cloud_security_posture/status/status_unprivileged.ts b/x-pack/test/api_integration/apis/cloud_security_posture/status/status_unprivileged.ts index 1b576515d4f31..7c09e4b51f679 100644 --- a/x-pack/test/api_integration/apis/cloud_security_posture/status/status_unprivileged.ts +++ b/x-pack/test/api_integration/apis/cloud_security_posture/status/status_unprivileged.ts @@ -6,11 +6,11 @@ */ import expect from '@kbn/expect'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import type { CspSetupStatus } from '@kbn/cloud-security-posture-common'; import { BENCHMARK_SCORE_INDEX_DEFAULT_NS, LATEST_FINDINGS_INDEX_DEFAULT_NS, - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, FINDINGS_INDEX_PATTERN, } from '@kbn/cloud-security-posture-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test/cloud_security_posture_api/routes/helper/user_roles_utilites.ts b/x-pack/test/cloud_security_posture_api/routes/helper/user_roles_utilites.ts index 90a04f3307c61..2aed6367236e4 100644 --- a/x-pack/test/cloud_security_posture_api/routes/helper/user_roles_utilites.ts +++ b/x-pack/test/cloud_security_posture_api/routes/helper/user_roles_utilites.ts @@ -5,10 +5,12 @@ * 2.0. */ -import { CDR_LATEST_NATIVE_MISCONFIGURATIONS_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import { - BENCHMARK_SCORE_INDEX_PATTERN, + CDR_LATEST_NATIVE_MISCONFIGURATIONS_INDEX_PATTERN, CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, +} from '@kbn/cloud-security-posture-common'; +import { + BENCHMARK_SCORE_INDEX_PATTERN, ALERTS_INDEX_PATTERN, FINDINGS_INDEX_PATTERN, } from '@kbn/cloud-security-posture-plugin/common/constants'; diff --git a/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/serverless_metering/cloud_security_metering.ts b/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/serverless_metering/cloud_security_metering.ts index 482e0a571d835..01c2ebf9a64a7 100644 --- a/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/serverless_metering/cloud_security_metering.ts +++ b/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/serverless_metering/cloud_security_metering.ts @@ -6,10 +6,8 @@ */ import expect from '@kbn/expect'; -import { - LATEST_FINDINGS_INDEX_DEFAULT_NS, - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, -} from '@kbn/cloud-security-posture-plugin/common/constants'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; +import { LATEST_FINDINGS_INDEX_DEFAULT_NS } from '@kbn/cloud-security-posture-plugin/common/constants'; import * as http from 'http'; import { deleteIndex, diff --git a/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/status/status_indexed.ts b/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/status/status_indexed.ts index 02340e4f7a8fc..a9da3a42cdfc8 100644 --- a/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/status/status_indexed.ts +++ b/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/status/status_indexed.ts @@ -7,10 +7,10 @@ import expect from '@kbn/expect'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import type { CspSetupStatus } from '@kbn/cloud-security-posture-common'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import { FINDINGS_INDEX_DEFAULT_NS, LATEST_FINDINGS_INDEX_DEFAULT_NS, - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, VULNERABILITIES_INDEX_DEFAULT_NS, } from '@kbn/cloud-security-posture-plugin/common/constants'; import { diff --git a/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/status/status_indexing.ts b/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/status/status_indexing.ts index 6e6f8d128bb35..ec6a5835e6aa3 100644 --- a/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/status/status_indexing.ts +++ b/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/status/status_indexing.ts @@ -7,10 +7,10 @@ import expect from '@kbn/expect'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import type { CspSetupStatus } from '@kbn/cloud-security-posture-common'; +import { CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN } from '@kbn/cloud-security-posture-common'; import { FINDINGS_INDEX_DEFAULT_NS, LATEST_FINDINGS_INDEX_DEFAULT_NS, - CDR_LATEST_NATIVE_VULNERABILITIES_INDEX_PATTERN, VULNERABILITIES_INDEX_DEFAULT_NS, } from '@kbn/cloud-security-posture-plugin/common/constants'; import {