diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap index 4e19c9bf62690..b0c7fd0f37289 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap @@ -46,6 +46,11 @@ Object { "type": "cases-sub-case", }, }, + Object { + "term": Object { + "type": "csp_rule", + }, + }, Object { "term": Object { "type": "file-upload-telemetry", @@ -227,6 +232,11 @@ Object { "type": "cases-sub-case", }, }, + Object { + "term": Object { + "type": "csp_rule", + }, + }, Object { "term": Object { "type": "file-upload-telemetry", @@ -412,6 +422,11 @@ Object { "type": "cases-sub-case", }, }, + Object { + "term": Object { + "type": "csp_rule", + }, + }, Object { "term": Object { "type": "file-upload-telemetry", @@ -601,6 +616,11 @@ Object { "type": "cases-sub-case", }, }, + Object { + "term": Object { + "type": "csp_rule", + }, + }, Object { "term": Object { "type": "file-upload-telemetry", @@ -832,6 +852,11 @@ Object { "type": "cases-sub-case", }, }, + Object { + "term": Object { + "type": "csp_rule", + }, + }, Object { "term": Object { "type": "file-upload-telemetry", @@ -1024,6 +1049,11 @@ Object { "type": "cases-sub-case", }, }, + Object { + "term": Object { + "type": "csp_rule", + }, + }, Object { "term": Object { "type": "file-upload-telemetry", diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts index 7dbcf2c270ba4..60ace4e28de0e 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts @@ -39,6 +39,8 @@ export const REMOVED_TYPES: string[] = [ 'ui-counter', // Deprecated, no longer used since 7.13 https://github.com/elastic/kibana/pull/94923/files 'application_usage_transactional', + // Deprecated, no longer used since 8.7 https://github.com/elastic/kibana/pull/148530 + 'csp_rule', ].sort(); // When migrating from the outdated index we use a read query which excludes diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts index 35d22e69f724e..ee99e599a998a 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts @@ -83,6 +83,11 @@ describe('createInitialState', () => { "type": "cases-sub-case", }, }, + Object { + "term": Object { + "type": "csp_rule", + }, + }, Object { "term": Object { "type": "file-upload-telemetry", diff --git a/src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts b/src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts index 569e8b81afd2d..5f148325d6f5a 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts @@ -80,7 +80,6 @@ describe('checking migration metadata changes on all registered SO types', () => "connector_token": "fa5301aa5a2914795d3b1b82d0a49939444009da", "core-usage-stats": "f40a213da2c597b0de94e364a4326a5a1baa4ca9", "csp-rule-template": "d6104585d0b032355c64a7dbf2a834163351cb1c", - "csp_rule": "d2bb53ea5d2bdfba1a835ad8956dfcd2b2c32e19", "dashboard": "7e37790f802b39c852f905c010e13674e893105a", "endpoint:user-artifact": "f94c250a52b30d0a2d32635f8b4c5bdabd1e25c0", "endpoint:user-artifact-manifest": "8c14d49a385d5d1307d956aa743ec78de0b2be88", diff --git a/x-pack/plugins/cloud_security_posture/common/constants.ts b/x-pack/plugins/cloud_security_posture/common/constants.ts index 794ec8b912294..7cc587df5d499 100644 --- a/x-pack/plugins/cloud_security_posture/common/constants.ts +++ b/x-pack/plugins/cloud_security_posture/common/constants.ts @@ -41,7 +41,6 @@ export const INTERNAL_FEATURE_FLAGS = { showFindingsGroupBy: true, } as const; -export const CSP_RULE_SAVED_OBJECT_TYPE = 'csp_rule'; export const CSP_RULE_TEMPLATE_SAVED_OBJECT_TYPE = 'csp-rule-template'; export const CLOUDBEAT_VANILLA = 'cloudbeat/cis_k8s'; // Integration input diff --git a/x-pack/plugins/cloud_security_posture/common/schemas/csp_finding.ts b/x-pack/plugins/cloud_security_posture/common/schemas/csp_finding.ts index af99c609832d6..27690c714c0ce 100644 --- a/x-pack/plugins/cloud_security_posture/common/schemas/csp_finding.ts +++ b/x-pack/plugins/cloud_security_posture/common/schemas/csp_finding.ts @@ -7,7 +7,7 @@ // TODO: this needs to be defined in a versioned schema import type { EcsEvent } from '@kbn/ecs'; -import type { CspRuleMetadata } from './csp_rule_metadata'; +import type { CspRuleTemplateMetadata } from './csp_rule_template_metadata'; export interface CspFinding { '@timestamp': string; @@ -19,7 +19,7 @@ export interface CspFinding { }; result: CspFindingResult; resource: CspFindingResource; - rule: CspRuleMetadata; + rule: CspRuleTemplateMetadata; host: CspFindingHost; event: EcsEvent; agent: CspFindingAgent; diff --git a/x-pack/plugins/cloud_security_posture/common/schemas/csp_rule.ts b/x-pack/plugins/cloud_security_posture/common/schemas/csp_rule.ts deleted file mode 100644 index 13e237ef5637b..0000000000000 --- a/x-pack/plugins/cloud_security_posture/common/schemas/csp_rule.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ -import { schema as rt, TypeOf } from '@kbn/config-schema'; -import { cspRuleMetadataSchema } from './csp_rule_metadata'; - -export const cspRuleSchemaV830 = rt.object({ - audit: rt.string(), - benchmark: rt.object({ name: rt.string(), version: rt.string() }), - default_value: rt.nullable(rt.string()), - description: rt.string(), - enabled: rt.boolean(), - id: rt.string(), - impact: rt.nullable(rt.string()), - muted: rt.boolean(), - name: rt.string(), - package_policy_id: rt.string(), - policy_id: rt.string(), - profile_applicability: rt.string(), - rationale: rt.string(), - references: rt.nullable(rt.string()), - rego_rule_id: rt.string(), - remediation: rt.string(), - section: rt.string(), - tags: rt.arrayOf(rt.string()), - version: rt.string(), -}); - -export const cspRuleSchemaV840 = rt.object({ - enabled: rt.boolean(), - metadata: cspRuleMetadataSchema, - muted: rt.boolean(), - package_policy_id: rt.string(), - policy_id: rt.string(), -}); - -export type CspRuleV830 = TypeOf; -export type CspRuleV840 = TypeOf; -export type CspRule = CspRuleV840; diff --git a/x-pack/plugins/cloud_security_posture/common/schemas/csp_rule_template.ts b/x-pack/plugins/cloud_security_posture/common/schemas/csp_rule_template.ts index c1c92f7bd690d..d2ccff064eb58 100644 --- a/x-pack/plugins/cloud_security_posture/common/schemas/csp_rule_template.ts +++ b/x-pack/plugins/cloud_security_posture/common/schemas/csp_rule_template.ts @@ -5,7 +5,7 @@ * 2.0. */ import { schema as rt, TypeOf } from '@kbn/config-schema'; -import { cspRuleMetadataSchema } from './csp_rule_metadata'; +import { cspRuleTemplateMetadataSchema } from './csp_rule_template_metadata'; export const cspRuleTemplateSchemaV830 = rt.object({ audit: rt.string(), @@ -29,12 +29,12 @@ export const cspRuleTemplateSchemaV830 = rt.object({ export const cspRuleTemplateSchemaV840 = rt.object({ enabled: rt.boolean(), - metadata: cspRuleMetadataSchema, + metadata: cspRuleTemplateMetadataSchema, muted: rt.boolean(), }); export const cspRuleTemplateSchemaV870 = rt.object({ - metadata: cspRuleMetadataSchema, + metadata: cspRuleTemplateMetadataSchema, }); export type CspRuleTemplateV830 = TypeOf; diff --git a/x-pack/plugins/cloud_security_posture/common/schemas/csp_rule_metadata.ts b/x-pack/plugins/cloud_security_posture/common/schemas/csp_rule_template_metadata.ts similarity index 85% rename from x-pack/plugins/cloud_security_posture/common/schemas/csp_rule_metadata.ts rename to x-pack/plugins/cloud_security_posture/common/schemas/csp_rule_template_metadata.ts index 40d84e9524337..aa6c8347b8215 100644 --- a/x-pack/plugins/cloud_security_posture/common/schemas/csp_rule_metadata.ts +++ b/x-pack/plugins/cloud_security_posture/common/schemas/csp_rule_template_metadata.ts @@ -6,7 +6,7 @@ */ import { schema as rt, TypeOf } from '@kbn/config-schema'; -export const cspRuleMetadataSchema = rt.object({ +export const cspRuleTemplateMetadataSchema = rt.object({ audit: rt.string(), benchmark: rt.object({ name: rt.string(), @@ -29,4 +29,4 @@ export const cspRuleMetadataSchema = rt.object({ version: rt.string(), }); -export type CspRuleMetadata = TypeOf; +export type CspRuleTemplateMetadata = TypeOf; diff --git a/x-pack/plugins/cloud_security_posture/common/schemas/csp_rules_configuration.ts b/x-pack/plugins/cloud_security_posture/common/schemas/csp_rules_configuration.ts deleted file mode 100644 index 13726e1f34ea6..0000000000000 --- a/x-pack/plugins/cloud_security_posture/common/schemas/csp_rules_configuration.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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. - */ -import { schema as rt, TypeOf } from '@kbn/config-schema'; - -// cspRulesConfigSchema has to match the 'RuntimeCfg' struct in https://github.com/elastic/cloudbeat/blob/main/config/config.go#L45-L51 -export const cspRulesConfigSchema = rt.object({ - runtime_cfg: rt.object({ - activated_rules: rt.recordOf(rt.string(), rt.arrayOf(rt.string())), - }), -}); - -export type CspRulesConfiguration = TypeOf; diff --git a/x-pack/plugins/cloud_security_posture/common/schemas/index.ts b/x-pack/plugins/cloud_security_posture/common/schemas/index.ts index 5b681a5450c26..9b6034b4489f5 100644 --- a/x-pack/plugins/cloud_security_posture/common/schemas/index.ts +++ b/x-pack/plugins/cloud_security_posture/common/schemas/index.ts @@ -5,7 +5,5 @@ * 2.0. */ -export * from './csp_rule'; -export * from './csp_rule_metadata'; +export * from './csp_rule_template_metadata'; export * from './csp_rule_template'; -export * from './csp_rules_configuration'; diff --git a/x-pack/plugins/cloud_security_posture/common/types.ts b/x-pack/plugins/cloud_security_posture/common/types.ts index 797cb5ddc86c4..a922d363d9dbc 100644 --- a/x-pack/plugins/cloud_security_posture/common/types.ts +++ b/x-pack/plugins/cloud_security_posture/common/types.ts @@ -7,7 +7,7 @@ import type { PackagePolicy, AgentPolicy } from '@kbn/fleet-plugin/common'; import { SUPPORTED_CLOUDBEAT_INPUTS, SUPPORTED_POLICY_TEMPLATES } from './constants'; -import type { CspRuleMetadata } from './schemas/csp_rule_metadata'; +import type { CspRuleTemplateMetadata } from './schemas/csp_rule_template_metadata'; export type Evaluation = 'passed' | 'failed' | 'NA'; /** number between 1-100 */ @@ -100,8 +100,8 @@ export interface Benchmark { rules_count: number; } -export type BenchmarkId = CspRuleMetadata['benchmark']['id']; -export type BenchmarkName = CspRuleMetadata['benchmark']['name']; +export type BenchmarkId = CspRuleTemplateMetadata['benchmark']['id']; +export type BenchmarkName = CspRuleTemplateMetadata['benchmark']['name']; // Fleet Integration types export type PostureInput = typeof SUPPORTED_CLOUDBEAT_INPUTS[number]; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/rules/rules_container.test.tsx b/x-pack/plugins/cloud_security_posture/public/pages/rules/rules_container.test.tsx index 66c6a820b99eb..3311fd8b81fb2 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/rules/rules_container.test.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/rules/rules_container.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { RulesContainer } from './rules_container'; import { render, screen } from '@testing-library/react'; import { QueryClient } from '@tanstack/react-query'; -import { useFindCspRules, type RuleSavedObject } from './use_csp_rules'; +import { useFindCspRuleTemplates, type RuleSavedObject } from './use_csp_rules'; import * as TEST_SUBJECTS from './test_subjects'; import { Chance } from 'chance'; import { TestProvider } from '../../test/test_provider'; @@ -19,8 +19,8 @@ import { coreMock } from '@kbn/core/public/mocks'; const chance = new Chance(); jest.mock('./use_csp_rules', () => ({ - useFindCspRules: jest.fn(), - useBulkUpdateCspRules: jest.fn(), + useFindCspRuleTemplates: jest.fn(), + useBulkUpdateCspRuleTemplates: jest.fn(), })); jest.mock('react-router-dom', () => ({ @@ -103,7 +103,7 @@ describe('', () => { const Wrapper = getWrapper(); const rule1 = getRuleMock({ enabled: true }); - (useFindCspRules as jest.Mock).mockReturnValue({ + (useFindCspRuleTemplates as jest.Mock).mockReturnValue({ status: 'success', data: { total: 1, diff --git a/x-pack/plugins/cloud_security_posture/public/pages/rules/rules_container.tsx b/x-pack/plugins/cloud_security_posture/public/pages/rules/rules_container.tsx index 1f0d4ae84be9e..6351071bc496f 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/rules/rules_container.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/rules/rules_container.tsx @@ -11,7 +11,7 @@ import { extractErrorMessage, isNonNullable } from '../../../common/utils/helper import { RulesTable } from './rules_table'; import { RulesTableHeader } from './rules_table_header'; import { - useFindCspRules, + useFindCspRuleTemplates, type RuleSavedObject, type RulesQuery, type RulesQueryResult, @@ -74,7 +74,7 @@ export const RulesContainer = () => { perPage: pageSize || 10, }); - const { data, status, error } = useFindCspRules( + const { data, status, error } = useFindCspRuleTemplates( { filter: rulesQuery.filter, search: rulesQuery.search, diff --git a/x-pack/plugins/cloud_security_posture/public/pages/rules/rules_table.tsx b/x-pack/plugins/cloud_security_posture/public/pages/rules/rules_table.tsx index 9dca77a4d017c..968cece8b40ee 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/rules/rules_table.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/rules/rules_table.tsx @@ -54,7 +54,7 @@ export const RulesTable = ({ }; const rowProps = (row: RuleSavedObject) => ({ - ['data-test-subj']: TEST_SUBJECTS.getCspRulesTableRowItemTestId(row.id), + ['data-test-subj']: TEST_SUBJECTS.getCspRuleTemplatesTableRowItemTestId(row.id), style: { background: row.id === selectedRuleId ? euiTheme.colors.highlight : undefined }, onClick: (e: MouseEvent) => { const tag = (e.target as HTMLDivElement).tagName; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/rules/test_subjects.ts b/x-pack/plugins/cloud_security_posture/public/pages/rules/test_subjects.ts index a40ccff5b5e6e..dbbc6877e2dcf 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/rules/test_subjects.ts +++ b/x-pack/plugins/cloud_security_posture/public/pages/rules/test_subjects.ts @@ -13,5 +13,5 @@ export const CSP_RULES_TABLE = 'csp_rules_table'; export const CSP_RULES_TABLE_ROW_ITEM_NAME = 'csp_rules_table_row_item_name'; export const CSP_RULES_FLYOUT_CONTAINER = 'csp_rules_flyout_container'; -export const getCspRulesTableRowItemTestId = (id: string) => +export const getCspRuleTemplatesTableRowItemTestId = (id: string) => `${CSP_RULES_TABLE_ROW_ITEM_NAME}_${id}`; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/rules/use_csp_rules.ts b/x-pack/plugins/cloud_security_posture/public/pages/rules/use_csp_rules.ts index 3e9f6594a7f4d..818dbeba76c70 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/rules/use_csp_rules.ts +++ b/x-pack/plugins/cloud_security_posture/public/pages/rules/use_csp_rules.ts @@ -24,9 +24,9 @@ export type RuleSavedObject = Omit< export type RulesQuery = Required< Pick >; -export type RulesQueryResult = ReturnType; +export type RulesQueryResult = ReturnType; -export const useFindCspRules = ( +export const useFindCspRuleTemplates = ( { search, page, perPage, filter }: RulesQuery, packagePolicyId: string ) => { diff --git a/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/benchmarks.test.ts b/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/benchmarks.test.ts index 656d34462464b..d8b432bb0391e 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/benchmarks.test.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/benchmarks.test.ts @@ -258,7 +258,7 @@ describe('benchmarks API', () => { }); }); - describe('test addPackagePolicyCspRules', () => { + describe('test addPackagePolicyCspRuleTemplates', () => { it('should retrieve the rules count by the filtered benchmark type', async () => { const benchmark = 'cis_k8s'; mockSoClient.find.mockResolvedValueOnce({ diff --git a/x-pack/plugins/cloud_security_posture/server/saved_objects/mappings.ts b/x-pack/plugins/cloud_security_posture/server/saved_objects/mappings.ts index f0b21b1cb9806..445e839d41628 100644 --- a/x-pack/plugins/cloud_security_posture/server/saved_objects/mappings.ts +++ b/x-pack/plugins/cloud_security_posture/server/saved_objects/mappings.ts @@ -7,39 +7,6 @@ import { SavedObjectsTypeMappingDefinition } from '@kbn/core/server'; -export const cspRuleSavedObjectMapping: SavedObjectsTypeMappingDefinition = { - dynamic: false, - properties: { - metadata: { - type: 'object', - properties: { - name: { - type: 'keyword', - fields: { - text: { - type: 'text', - }, - }, - }, - }, - }, - package_policy_id: { - type: 'keyword', - }, - policy_id: { - type: 'keyword', - }, - enabled: { - type: 'boolean', - fields: { - keyword: { - type: 'keyword', - }, - }, - }, - }, -}; - export const cspRuleTemplateSavedObjectMapping: SavedObjectsTypeMappingDefinition = { dynamic: false, properties: { diff --git a/x-pack/plugins/cloud_security_posture/server/saved_objects/migrations/csp_rule.ts b/x-pack/plugins/cloud_security_posture/server/saved_objects/migrations/csp_rule.ts deleted file mode 100644 index 1ebb4199231e9..0000000000000 --- a/x-pack/plugins/cloud_security_posture/server/saved_objects/migrations/csp_rule.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ - -import { - SavedObjectMigrationMap, - SavedObjectUnsanitizedDoc, - SavedObjectMigrationContext, -} from '@kbn/core/server'; -import { CspRuleV830, CspRuleV840 } from '../../../common/schemas/csp_rule'; - -function migrateCspRuleMetadata( - doc: SavedObjectUnsanitizedDoc, - context: SavedObjectMigrationContext -): SavedObjectUnsanitizedDoc { - // eslint-disable-next-line @typescript-eslint/naming-convention - const { enabled, muted, package_policy_id, policy_id, benchmark, ...metadata } = doc.attributes; - - return { - ...doc, - attributes: { - enabled, - muted, - package_policy_id, - policy_id, - metadata: { - ...metadata, - benchmark: { ...benchmark, id: 'cis_k8s', rule_number: '' }, - impact: metadata.impact || undefined, - default_value: metadata.default_value || undefined, - references: metadata.references || undefined, - }, - }, - }; -} - -export const cspRuleMigrations: SavedObjectMigrationMap = { - '8.4.0': migrateCspRuleMetadata, -}; diff --git a/x-pack/plugins/cloud_security_posture/server/saved_objects/migrations/csp_rule_template.ts b/x-pack/plugins/cloud_security_posture/server/saved_objects/migrations/csp_rule_template.ts index bd46457c76281..10f693e9ea7c3 100644 --- a/x-pack/plugins/cloud_security_posture/server/saved_objects/migrations/csp_rule_template.ts +++ b/x-pack/plugins/cloud_security_posture/server/saved_objects/migrations/csp_rule_template.ts @@ -16,7 +16,7 @@ import { CspRuleTemplateV870, } from '../../../common/schemas/csp_rule_template'; -function migrateCspRuleMetadata( +function migrateCspRuleTemplatesToV840( doc: SavedObjectUnsanitizedDoc, context: SavedObjectMigrationContext ): SavedObjectUnsanitizedDoc { @@ -37,7 +37,7 @@ function migrateCspRuleMetadata( }; } -function migrateCspRuleTemplateDeprecateState( +function migrateCspRuleTemplatesToV870( doc: SavedObjectUnsanitizedDoc, context: SavedObjectMigrationContext ): SavedObjectUnsanitizedDoc { @@ -50,6 +50,6 @@ function migrateCspRuleTemplateDeprecateState( } export const cspRuleTemplateMigrations: SavedObjectMigrationMap = { - '8.4.0': migrateCspRuleMetadata, - '8.7.0': migrateCspRuleTemplateDeprecateState, + '8.4.0': migrateCspRuleTemplatesToV840, + '8.7.0': migrateCspRuleTemplatesToV870, }; diff --git a/x-pack/plugins/cloud_security_posture/server/saved_objects/migrations/index.ts b/x-pack/plugins/cloud_security_posture/server/saved_objects/migrations/index.ts index 01120e57d4efb..991b7469a9129 100644 --- a/x-pack/plugins/cloud_security_posture/server/saved_objects/migrations/index.ts +++ b/x-pack/plugins/cloud_security_posture/server/saved_objects/migrations/index.ts @@ -5,5 +5,4 @@ * 2.0. */ -export * from './csp_rule'; export * from './csp_rule_template'; diff --git a/x-pack/plugins/cloud_security_posture/server/saved_objects/saved_objects.ts b/x-pack/plugins/cloud_security_posture/server/saved_objects/saved_objects.ts index 29c25e4789aec..92b709db1825c 100644 --- a/x-pack/plugins/cloud_security_posture/server/saved_objects/saved_objects.ts +++ b/x-pack/plugins/cloud_security_posture/server/saved_objects/saved_objects.ts @@ -5,47 +5,19 @@ * 2.0. */ -import { i18n } from '@kbn/i18n'; import { SavedObjectsServiceSetup } from '@kbn/core/server'; -import { cspRuleSavedObjectMapping, cspRuleTemplateSavedObjectMapping } from './mappings'; -import { cspRuleMigrations, cspRuleTemplateMigrations } from './migrations'; +import { cspRuleTemplateSavedObjectMapping } from './mappings'; +import { cspRuleTemplateMigrations } from './migrations'; import { - cspRuleSchemaV830, - cspRuleSchemaV840, cspRuleTemplateSchemaV830, cspRuleTemplateSchemaV840, - CspRuleTemplate, - CspRule, cspRuleTemplateSchemaV870, + CspRuleTemplate, } from '../../common/schemas'; -import { - CSP_RULE_SAVED_OBJECT_TYPE, - CSP_RULE_TEMPLATE_SAVED_OBJECT_TYPE, -} from '../../common/constants'; +import { CSP_RULE_TEMPLATE_SAVED_OBJECT_TYPE } from '../../common/constants'; export function setupSavedObjects(savedObjects: SavedObjectsServiceSetup) { - savedObjects.registerType({ - name: CSP_RULE_SAVED_OBJECT_TYPE, - hidden: false, - namespaceType: 'agnostic', - management: { - importableAndExportable: true, - visibleInManagement: true, - getTitle: (savedObject) => - `${i18n.translate('xpack.csp.cspSettings.rules', { - defaultMessage: `CSP Security Rules - `, - })} ${savedObject.attributes.metadata.benchmark.name} ${ - savedObject.attributes.metadata.benchmark.version - } ${savedObject.attributes.metadata.name}`, - }, - schemas: { - '8.3.0': cspRuleSchemaV830, - '8.4.0': cspRuleSchemaV840, - }, - migrations: cspRuleMigrations, - mappings: cspRuleSavedObjectMapping, - }); savedObjects.registerType({ name: CSP_RULE_TEMPLATE_SAVED_OBJECT_TYPE, hidden: false, diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index a178a7b0014fa..fd10f3281b25b 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -10172,7 +10172,6 @@ "xpack.csp.createPackagePolicy.customAssetsTab.rulesViewLabel": "Afficher les règles CSP ", "xpack.csp.cspEvaluationBadge.failLabel": "Échec", "xpack.csp.cspEvaluationBadge.passLabel": "Réussite", - "xpack.csp.cspSettings.rules": "Règles de sécurité du CSP - ", "xpack.csp.dashboard.benchmarkSection.clusterTitleTooltip.clusterPrefixTitle": "Afficher tous les résultats pour ", "xpack.csp.dashboard.benchmarkSection.defaultClusterTitle": "ID cluster", "xpack.csp.dashboard.benchmarkSection.manageRulesButton": "Gérer les règles", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 3cfdf2f6d9093..f7fe9e893d3d6 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -10161,7 +10161,6 @@ "xpack.csp.createPackagePolicy.customAssetsTab.rulesViewLabel": "CSPルールを表示 ", "xpack.csp.cspEvaluationBadge.failLabel": "失敗", "xpack.csp.cspEvaluationBadge.passLabel": "合格", - "xpack.csp.cspSettings.rules": "CSPセキュリティルール - ", "xpack.csp.dashboard.benchmarkSection.clusterTitleTooltip.clusterPrefixTitle": "すべての調査結果を表示 ", "xpack.csp.dashboard.benchmarkSection.defaultClusterTitle": "クラスターID", "xpack.csp.dashboard.benchmarkSection.manageRulesButton": "ルールの管理", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 6f7c68de2494c..64b94583cc67f 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -10176,7 +10176,6 @@ "xpack.csp.createPackagePolicy.customAssetsTab.rulesViewLabel": "查看 CSP 规则 ", "xpack.csp.cspEvaluationBadge.failLabel": "失败", "xpack.csp.cspEvaluationBadge.passLabel": "通过", - "xpack.csp.cspSettings.rules": "CSP 安全规则 - ", "xpack.csp.dashboard.benchmarkSection.clusterTitleTooltip.clusterPrefixTitle": "显示以下所有结果 ", "xpack.csp.dashboard.benchmarkSection.defaultClusterTitle": "集群 ID", "xpack.csp.dashboard.benchmarkSection.manageRulesButton": "管理规则",