From a18cb9ce1b3a317dbb8fd94229318a04a26bced1 Mon Sep 17 00:00:00 2001 From: machadoum Date: Tue, 15 Oct 2024 12:54:07 +0200 Subject: [PATCH] Fix CI issues --- .../asset_criticality_service.mock.ts | 1 - .../asset_criticality/asset_criticality_service.ts | 1 - .../risk_score/calculate_risk_scores.ts | 5 ----- .../execution_logic/custom_query.ts | 5 ----- .../trial_license_complete_tier/execution_logic/eql.ts | 9 +-------- .../execution_logic/eql_alert_suppression.ts | 10 +--------- .../execution_logic/esql.ts | 5 ----- .../execution_logic/esql_suppression.ts | 5 ----- .../execution_logic/indicator_match.ts | 5 ----- .../indicator_match_alert_suppression.ts | 5 ----- .../execution_logic/machine_learning.ts | 9 +-------- .../machine_learning_alert_suppression.ts | 10 +--------- .../execution_logic/new_terms.ts | 6 +----- .../execution_logic/new_terms_alert_suppression.ts | 5 ----- .../execution_logic/threshold.ts | 5 ----- .../execution_logic/threshold_alert_suppression.ts | 5 ----- .../trial_license_complete_tier/asset_criticality.ts | 5 ----- .../asset_criticality_csv_upload.ts | 2 -- .../asset_criticality_privileges.ts | 7 +------ .../trial_license_complete_tier/risk_score_preview.ts | 1 - .../risk_scoring_task/task_execution.ts | 6 ++---- .../entity_analytics/utils/asset_criticality.ts | 7 ++----- 22 files changed, 10 insertions(+), 109 deletions(-) diff --git a/x-pack/plugins/security_solution/server/lib/entity_analytics/asset_criticality/asset_criticality_service.mock.ts b/x-pack/plugins/security_solution/server/lib/entity_analytics/asset_criticality/asset_criticality_service.mock.ts index 9de2d8c6bae2c..9822dfd1dad1f 100644 --- a/x-pack/plugins/security_solution/server/lib/entity_analytics/asset_criticality/asset_criticality_service.mock.ts +++ b/x-pack/plugins/security_solution/server/lib/entity_analytics/asset_criticality/asset_criticality_service.mock.ts @@ -9,7 +9,6 @@ import type { AssetCriticalityService } from './asset_criticality_service'; const buildMockAssetCriticalityService = (): jest.Mocked => ({ getCriticalitiesByIdentifiers: jest.fn().mockResolvedValue([]), - isEnabled: jest.fn().mockReturnValue(true), }); export const assetCriticalityServiceMock = { diff --git a/x-pack/plugins/security_solution/server/lib/entity_analytics/asset_criticality/asset_criticality_service.ts b/x-pack/plugins/security_solution/server/lib/entity_analytics/asset_criticality/asset_criticality_service.ts index c3b224008996d..e56454499a00e 100644 --- a/x-pack/plugins/security_solution/server/lib/entity_analytics/asset_criticality/asset_criticality_service.ts +++ b/x-pack/plugins/security_solution/server/lib/entity_analytics/asset_criticality/asset_criticality_service.ts @@ -23,7 +23,6 @@ export interface AssetCriticalityService { getCriticalitiesByIdentifiers: ( identifiers: CriticalityIdentifier[] ) => Promise; - isEnabled: () => Promise; } const isCriticalityIdentifierValid = (identifier: CriticalityIdentifier): boolean => diff --git a/x-pack/plugins/security_solution/server/lib/entity_analytics/risk_score/calculate_risk_scores.ts b/x-pack/plugins/security_solution/server/lib/entity_analytics/risk_score/calculate_risk_scores.ts index 974ec1a2bf1a2..ff1062393c935 100644 --- a/x-pack/plugins/security_solution/server/lib/entity_analytics/risk_score/calculate_risk_scores.ts +++ b/x-pack/plugins/security_solution/server/lib/entity_analytics/risk_score/calculate_risk_scores.ts @@ -175,11 +175,6 @@ const processScores = async ({ return []; } - - return buckets.map((bucket) => - formatForResponse({ bucket, now, identifierField, includeNewFields: false }) - ); - const identifiers = buckets.map((bucket) => ({ id_field: identifierField, id_value: bucket.key[identifierField], diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/custom_query.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/custom_query.ts index 0b39a7287bacb..32dcef7d04ead 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/custom_query.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/custom_query.ts @@ -45,7 +45,6 @@ import { DETECTION_ENGINE_RULES_BULK_ACTION, DETECTION_ENGINE_RULES_URL, DETECTION_ENGINE_SIGNALS_STATUS_URL as DETECTION_ENGINE_ALERTS_STATUS_URL, - ENABLE_ASSET_CRITICALITY_SETTING, } from '@kbn/security-solution-plugin/common/constants'; import { getMaxSignalsWarning as getMaxAlertsWarning } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/utils'; import { deleteAllExceptions } from '../../../../../lists_and_exception_lists/utils'; @@ -95,7 +94,6 @@ export default ({ getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const es = getService('es'); const log = getService('log'); - const kibanaServer = getService('kibanaServer'); const esDeleteAllIndices = getService('esDeleteAllIndices'); // TODO: add a new service for loading archiver files similar to "getService('es')" const config = getService('config'); @@ -334,9 +332,6 @@ export default ({ getService }: FtrProviderContext) => { describe('with asset criticality', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/eql.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/eql.ts index 9077873274fa5..3be52363b15a1 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/eql.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/eql.ts @@ -34,10 +34,7 @@ import { ALERT_GROUP_ID, } from '@kbn/security-solution-plugin/common/field_maps/field_names'; import { getMaxSignalsWarning as getMaxAlertsWarning } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/utils'; -import { - DETECTION_ENGINE_RULES_URL, - ENABLE_ASSET_CRITICALITY_SETTING, -} from '@kbn/security-solution-plugin/common/constants'; +import { DETECTION_ENGINE_RULES_URL } from '@kbn/security-solution-plugin/common/constants'; import { getEqlRuleForAlertTesting, getAlerts, @@ -71,7 +68,6 @@ export default ({ getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const es = getService('es'); const log = getService('log'); - const kibanaServer = getService('kibanaServer'); const retry = getService('retry'); // TODO: add a new service for loading archiver files similar to "getService('es')" @@ -773,9 +769,6 @@ export default ({ getService }: FtrProviderContext) => { describe('with asset criticality', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/eql_alert_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/eql_alert_suppression.ts index 26764650287fc..0c3069b3c3b62 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/eql_alert_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/eql_alert_suppression.ts @@ -19,10 +19,7 @@ import { TIMESTAMP, ALERT_START, } from '@kbn/rule-data-utils'; -import { - DETECTION_ENGINE_SIGNALS_STATUS_URL as DETECTION_ENGINE_ALERTS_STATUS_URL, - ENABLE_ASSET_CRITICALITY_SETTING, -} from '@kbn/security-solution-plugin/common/constants'; +import { DETECTION_ENGINE_SIGNALS_STATUS_URL as DETECTION_ENGINE_ALERTS_STATUS_URL } from '@kbn/security-solution-plugin/common/constants'; import { getSuppressionMaxSignalsWarning as getSuppressionMaxAlertsWarning } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/utils'; import { RuleExecutionStatusEnum } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_monitoring'; import { ALERT_ORIGINAL_TIME } from '@kbn/security-solution-plugin/common/field_maps/field_names'; @@ -1702,14 +1699,9 @@ export default ({ getService }: FtrProviderContext) => { }); describe('alert enrichment', () => { - const kibanaServer = getService('kibanaServer'); - before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/entity/risks'); await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/esql.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/esql.ts index ee976de14186d..7a78282e92183 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/esql.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/esql.ts @@ -14,7 +14,6 @@ import { getCreateEsqlRulesSchemaMock } from '@kbn/security-solution-plugin/comm import { RuleExecutionStatusEnum } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_monitoring'; import { getMaxSignalsWarning as getMaxAlertsWarning } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/utils'; -import { ENABLE_ASSET_CRITICALITY_SETTING } from '@kbn/security-solution-plugin/common/constants'; import { getPreviewAlerts, previewRule, @@ -40,7 +39,6 @@ export default ({ getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const es = getService('es'); const log = getService('log'); - const kibanaServer = getService('kibanaServer'); const utils = getService('securitySolutionUtils'); const { indexEnhancedDocuments, indexListOfDocuments, indexGeneratedDocuments } = @@ -915,9 +913,6 @@ export default ({ getService }: FtrProviderContext) => { describe('with asset criticality', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/esql_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/esql_suppression.ts index 2d4618a431599..24685cc137f0e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/esql_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/esql_suppression.ts @@ -25,7 +25,6 @@ import { ALERT_ORIGINAL_TIME } from '@kbn/security-solution-plugin/common/field_ import { DETECTION_ENGINE_SIGNALS_STATUS_URL as DETECTION_ENGINE_ALERTS_STATUS_URL } from '@kbn/security-solution-plugin/common/constants'; import { getSuppressionMaxSignalsWarning as getSuppressionMaxAlertsWarning } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/utils'; -import { ENABLE_ASSET_CRITICALITY_SETTING } from '@kbn/security-solution-plugin/common/constants'; import { getPreviewAlerts, previewRule, @@ -48,7 +47,6 @@ export default ({ getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const es = getService('es'); const log = getService('log'); - const kibanaServer = getService('kibanaServer'); const { indexEnhancedDocuments, indexListOfDocuments, indexGeneratedDocuments } = dataGeneratorFactory({ es, @@ -2070,9 +2068,6 @@ export default ({ getService }: FtrProviderContext) => { describe('with asset criticality', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/indicator_match.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/indicator_match.ts index 0dd5a93bb9e60..3637b34baa799 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/indicator_match.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/indicator_match.ts @@ -40,7 +40,6 @@ import { } from '@kbn/security-solution-plugin/common/field_maps/field_names'; import { RuleExecutionStatusEnum } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_monitoring'; import { getMaxSignalsWarning as getMaxAlertsWarning } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/utils'; -import { ENABLE_ASSET_CRITICALITY_SETTING } from '@kbn/security-solution-plugin/common/constants'; import { previewRule, getAlerts, @@ -185,7 +184,6 @@ export default ({ getService }: FtrProviderContext) => { const supertest = getService('supertest'); const es = getService('es'); const log = getService('log'); - const kibanaServer = getService('kibanaServer'); // TODO: add a new service for loading archiver files similar to "getService('es')" const config = getService('config'); const isServerless = config.get('serverless'); @@ -1654,9 +1652,6 @@ export default ({ getService }: FtrProviderContext) => { describe('with asset criticality', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/indicator_match_alert_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/indicator_match_alert_suppression.ts index a6ac2fa6b139e..1ecf949b18951 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/indicator_match_alert_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/indicator_match_alert_suppression.ts @@ -21,7 +21,6 @@ import { import { getSuppressionMaxSignalsWarning as getSuppressionMaxAlertsWarning } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/utils'; import { DETECTION_ENGINE_SIGNALS_STATUS_URL as DETECTION_ENGINE_ALERTS_STATUS_URL } from '@kbn/security-solution-plugin/common/constants'; -import { ENABLE_ASSET_CRITICALITY_SETTING } from '@kbn/security-solution-plugin/common/constants'; import { ThreatMatchRuleCreateProps } from '@kbn/security-solution-plugin/common/api/detection_engine'; import { RuleExecutionStatusEnum } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_monitoring'; @@ -44,7 +43,6 @@ export default ({ getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const es = getService('es'); const log = getService('log'); - const kibanaServer = getService('kibanaServer'); const { indexListOfDocuments: indexListOfSourceDocuments, @@ -2568,9 +2566,6 @@ export default ({ getService }: FtrProviderContext) => { describe('with asset criticality', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/machine_learning.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/machine_learning.ts index 1418d6953177e..2d63847ca0db7 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/machine_learning.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/machine_learning.ts @@ -29,10 +29,7 @@ import { } from '@kbn/security-solution-plugin/common/field_maps/field_names'; import { getMaxSignalsWarning as getMaxAlertsWarning } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/utils'; import { expect } from 'expect'; -import { - DETECTION_ENGINE_RULES_URL, - ENABLE_ASSET_CRITICALITY_SETTING, -} from '@kbn/security-solution-plugin/common/constants'; +import { DETECTION_ENGINE_RULES_URL } from '@kbn/security-solution-plugin/common/constants'; import { createListsIndex, deleteAllExceptions, @@ -63,7 +60,6 @@ export default ({ getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const es = getService('es'); const log = getService('log'); - const kibanaServer = getService('kibanaServer'); // TODO: add a new service for loading archiver files similar to "getService('es')" const config = getService('config'); const request = supertestLib(url.format(config.get('servers.kibana'))); @@ -331,9 +327,6 @@ export default ({ getService }: FtrProviderContext) => { describe('with asset criticality', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/machine_learning_alert_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/machine_learning_alert_suppression.ts index 39a7138451f34..8ebcafcdc46b5 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/machine_learning_alert_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/machine_learning_alert_suppression.ts @@ -22,10 +22,7 @@ import { TIMESTAMP, } from '@kbn/rule-data-utils'; import { ALERT_ORIGINAL_TIME } from '@kbn/security-solution-plugin/common/field_maps/field_names'; -import { - DETECTION_ENGINE_SIGNALS_STATUS_URL as DETECTION_ENGINE_ALERTS_STATUS_URL, - ENABLE_ASSET_CRITICALITY_SETTING, -} from '@kbn/security-solution-plugin/common/constants'; +import { DETECTION_ENGINE_SIGNALS_STATUS_URL as DETECTION_ENGINE_ALERTS_STATUS_URL } from '@kbn/security-solution-plugin/common/constants'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { @@ -1102,14 +1099,9 @@ export default ({ getService }: FtrProviderContext) => { }); describe('with enrichments', () => { - const kibanaServer = getService('kibanaServer'); - before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/entity/risks'); await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/new_terms.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/new_terms.ts index e274366e54aa7..5da2e44301a3d 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/new_terms.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/new_terms.ts @@ -14,7 +14,7 @@ import { orderBy } from 'lodash'; import { getCreateNewTermsRulesSchemaMock } from '@kbn/security-solution-plugin/common/api/detection_engine/model/rule_schema/mocks'; import { getMaxSignalsWarning as getMaxAlertsWarning } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/utils'; -import { ENABLE_ASSET_CRITICALITY_SETTING } from '@kbn/security-solution-plugin/common/constants'; + import { getAlerts, getPreviewAlerts, @@ -43,7 +43,6 @@ export default ({ getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const es = getService('es'); const log = getService('log'); - const kibanaServer = getService('kibanaServer'); const { indexEnhancedDocuments } = dataGeneratorFactory({ es, index: 'new_terms', @@ -1066,9 +1065,6 @@ export default ({ getService }: FtrProviderContext) => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/security_solution/ecs_compliant'); await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/new_terms_alert_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/new_terms_alert_suppression.ts index 285bb81c6ac93..41d88869cdf45 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/new_terms_alert_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/new_terms_alert_suppression.ts @@ -18,7 +18,6 @@ import { TIMESTAMP, ALERT_START, } from '@kbn/rule-data-utils'; -import { ENABLE_ASSET_CRITICALITY_SETTING } from '@kbn/security-solution-plugin/common/constants'; import { getSuppressionMaxSignalsWarning as getSuppressionMaxAlertsWarning } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/utils'; import { getCreateNewTermsRulesSchemaMock } from '@kbn/security-solution-plugin/common/api/detection_engine/model/rule_schema/mocks'; import { NewTermsRuleCreateProps } from '@kbn/security-solution-plugin/common/api/detection_engine'; @@ -2250,15 +2249,11 @@ export default ({ getService }: FtrProviderContext) => { const isServerless = config.get('serverless'); const dataPathBuilder = new EsArchivePathBuilder(isServerless); const path = dataPathBuilder.getPath('auditbeat/hosts'); - const kibanaServer = getService('kibanaServer'); before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/entity/risks'); await esArchiver.load(path); await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/threshold.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/threshold.ts index 46c45a4c94de5..a2a16025696bb 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/threshold.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/threshold.ts @@ -26,7 +26,6 @@ import { ALERT_THRESHOLD_RESULT, } from '@kbn/security-solution-plugin/common/field_maps/field_names'; import { getMaxSignalsWarning as getMaxAlertsWarning } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/utils'; -import { ENABLE_ASSET_CRITICALITY_SETTING } from '@kbn/security-solution-plugin/common/constants'; import { createRule, deleteAllRules, @@ -50,7 +49,6 @@ export default ({ getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const es = getService('es'); const log = getService('log'); - const kibanaServer = getService('kibanaServer'); // TODO: add a new service for loading archiver files similar to "getService('es')" const config = getService('config'); const isServerless = config.get('serverless'); @@ -446,9 +444,6 @@ export default ({ getService }: FtrProviderContext) => { describe('with asset criticality', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/threshold_alert_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/threshold_alert_suppression.ts index 52cf49b711394..ecc97d8615f3f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/threshold_alert_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/execution_logic/threshold_alert_suppression.ts @@ -21,7 +21,6 @@ import { DETECTION_ENGINE_SIGNALS_STATUS_URL as DETECTION_ENGINE_ALERTS_STATUS_U import { ThresholdRuleCreateProps } from '@kbn/security-solution-plugin/common/api/detection_engine'; import { RuleExecutionStatusEnum } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_monitoring'; -import { ENABLE_ASSET_CRITICALITY_SETTING } from '@kbn/security-solution-plugin/common/constants'; import { ALERT_ORIGINAL_TIME } from '@kbn/security-solution-plugin/common/field_maps/field_names'; import { AlertSuppression } from '@kbn/security-solution-plugin/common/api/detection_engine/model/rule_schema'; @@ -44,7 +43,6 @@ export default ({ getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const es = getService('es'); const log = getService('log'); - const kibanaServer = getService('kibanaServer'); // TODO: add a new service for loading archiver files similar to "getService('es')" const config = getService('config'); const isServerless = config.get('serverless'); @@ -994,9 +992,6 @@ export default ({ getService }: FtrProviderContext) => { describe('with asset criticality', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/asset_criticality'); - await kibanaServer.uiSettings.update({ - [ENABLE_ASSET_CRITICALITY_SETTING]: true, - }); }); after(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/asset_criticality.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/asset_criticality.ts index af636fbb8cf39..7c8210e24fcfe 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/asset_criticality.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/asset_criticality.ts @@ -19,7 +19,6 @@ import { assetCriticalityRouteHelpersFactory, getAssetCriticalityDoc, getAssetCriticalityIndex, - enableAssetCriticalityAdvancedSetting, createAssetCriticalityRecords, riskEngineRouteHelpersFactory, } from '../../utils'; @@ -40,10 +39,6 @@ export default ({ getService }: FtrProviderContext) => { await cleanAssetCriticality({ log, es }); }); - beforeEach(async () => { - await enableAssetCriticalityAdvancedSetting(kibanaServer, log); - }); - afterEach(async () => { await riskEngineRoutes.cleanUp(); await cleanAssetCriticality({ log, es }); diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/asset_criticality_csv_upload.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/asset_criticality_csv_upload.ts index bd07734f80f2c..496cde9a79e13 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/asset_criticality_csv_upload.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/asset_criticality_csv_upload.ts @@ -16,7 +16,6 @@ export default ({ getService }: FtrProviderContext) => { const esClient = getService('es'); const supertest = getService('supertest'); const assetCriticalityRoutes = assetCriticalityRouteHelpersFactory(supertest); - const kibanaServer = getService('kibanaServer'); const log = getService('log'); const expectAssetCriticalityDocMatching = async (expectedDoc: { id_field: string; @@ -35,7 +34,6 @@ export default ({ getService }: FtrProviderContext) => { await cleanAssetCriticality({ es: esClient, namespace: 'default', log }); }); - after(async () => { await cleanAssetCriticality({ es: esClient, namespace: 'default', log }); }); diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/asset_criticality_privileges.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/asset_criticality_privileges.ts index b68f96402b4a5..7b35787cafe24 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/asset_criticality_privileges.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/asset_criticality_privileges.ts @@ -6,9 +6,7 @@ */ import expect from '@kbn/expect'; import { ROLES as SERVERLESS_USERNAMES } from '@kbn/security-solution-plugin/common/test'; -import { - assetCriticalityRouteHelpersFactoryNoAuth, -} from '../../utils'; +import { assetCriticalityRouteHelpersFactoryNoAuth } from '../../utils'; import { FtrProviderContext } from '../../../../ftr_provider_context'; import { usersAndRolesFactory } from '../../utils/users_and_roles'; @@ -66,9 +64,6 @@ const USERNAME_TO_ROLES = { }; export default ({ getService }: FtrProviderContext) => { - const kibanaServer = getService('kibanaServer'); - const log = getService('log'); - describe('Entity Analytics - Asset Criticality Privileges API', () => { describe('@ess Asset Criticality Privileges API', () => { const supertestWithoutAuth = getService('supertestWithoutAuth'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_score_preview.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_score_preview.ts index 62b5fc6f4253a..af4567eac3d6d 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_score_preview.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_score_preview.ts @@ -34,7 +34,6 @@ export default ({ getService }: FtrProviderContext): void => { const esArchiver = getService('esArchiver'); const es = getService('es'); const log = getService('log'); - const kibanaServer = getService('kibanaServer'); const createAndSyncRuleAndAlerts = createAndSyncRuleAndAlertsFactory({ supertest, log }); const previewRiskScores = async ({ diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_scoring_task/task_execution.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_scoring_task/task_execution.ts index bf2f8a2b31c18..5c0b3dd99cc23 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_scoring_task/task_execution.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_scoring_task/task_execution.ts @@ -239,7 +239,7 @@ export default ({ getService }: FtrProviderContext): void => { const assetCriticalityRoutes = assetCriticalityRouteHelpersFactory(supertest); beforeEach(async () => { - await assetCriticalityRoutes.upsert({ // TODO: check endpoint for ac routes here + await assetCriticalityRoutes.upsert({ id_field: 'host.name', id_value: 'host-1', criticality_level: 'extreme_impact', @@ -250,13 +250,11 @@ export default ({ getService }: FtrProviderContext): void => { await cleanAssetCriticality({ log, es }); }); - it.only('calculates risk scores with asset criticality data', async () => { + it('calculates risk scores with asset criticality data', async () => { await waitForAssetCriticalityToBePresent({ es, log }); await riskEngineRoutes.init(); await waitForRiskScoresToBePresent({ es, log, scoreCount: 20 }); const riskScores = await readRiskScores(es); - console.log(`es: ${es} log: ${log}`); - console.log(JSON.stringify(riskScores[0], null, 2)); expect(riskScores.length).to.be.greaterThan(0); const assetCriticalityLevels = riskScores.map( (riskScore) => riskScore.host?.risk.criticality_level diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/asset_criticality.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/asset_criticality.ts index 6e131a21a5bec..f4f684aeb7812 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/asset_criticality.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/asset_criticality.ts @@ -27,15 +27,12 @@ import type { import type { Client } from '@elastic/elasticsearch'; import type { ToolingLog } from '@kbn/tooling-log'; import querystring from 'querystring'; -import { KbnClient } from '@kbn/test'; import { SupertestWithoutAuthProviderType } from '@kbn/ftr-common-functional-services'; import { routeWithNamespace, waitFor } from '../../../../common/utils/security_solution'; export const getAssetCriticalityIndex = (namespace?: string) => `.asset-criticality.asset-criticality-${namespace ?? 'default'}`; - - export const cleanAssetCriticality = async ({ log, es, @@ -90,14 +87,14 @@ export const assetCriticalityRouteHelpersFactory = ( body: Record, { expectStatusCode }: { expectStatusCode: number } = { expectStatusCode: 200 } ) => { - console.log('Upsert called with:', body, 'Expect status code:', expectStatusCode); await supertest .post(routeWithNamespace(ASSET_CRITICALITY_PUBLIC_URL, namespace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, API_VERSIONS.public.v1) .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') .send(body) - .expect(expectStatusCode)}, + .expect(expectStatusCode); + }, delete: async ( idField: string, idValue: string,