From 6fd7a867ea7ba56db8beb3210b7893288f191915 Mon Sep 17 00:00:00 2001 From: Ash <1849116+ashokaditya@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:47:14 +0200 Subject: [PATCH 1/2] [Security Solution] [Endpoint] Upload action endpoint tests and other missing workflow tests for response console (#168005) ## Summary Adds missing tests for upload response action workflows. Adds tests for - [x] upload response action - [x] responder action from Alerts -> Alert details - [x] responder action from Cases -> Alert details - [x] responder action from Timeline view -> Alert Details ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Patryk Kopycinski Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../fleet/server/services/files/mocks.ts | 4 +- .../history_log.cy.ts | 6 +- .../alerts_response_console.cy.ts | 115 +++++++++++++++++ .../cases_response_console.cy.ts | 122 ++++++++++++++++++ .../endpoints_list_response_console.cy.ts | 69 ++++++++++ .../e2e/response_actions/isolate.cy.ts | 10 +- .../isolate_mocked_data.cy.ts | 8 +- ...e.cy.ts => response_console_actions.cy.ts} | 20 ++- .../management/cypress/screens/alerts.ts | 21 ++- .../management/cypress/screens/responder.ts | 2 +- .../public/management/cypress/support/e2e.ts | 12 +- .../management/cypress/tasks/isolate.ts | 8 +- 12 files changed, 372 insertions(+), 25 deletions(-) create mode 100644 x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/alerts_response_console.cy.ts create mode 100644 x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/cases_response_console.cy.ts create mode 100644 x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/endpoints_list_response_console.cy.ts rename x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/{response_console.cy.ts => response_console_actions.cy.ts} (94%) diff --git a/x-pack/plugins/fleet/server/services/files/mocks.ts b/x-pack/plugins/fleet/server/services/files/mocks.ts index 23c0482b7e111..2000f8eefc02b 100644 --- a/x-pack/plugins/fleet/server/services/files/mocks.ts +++ b/x-pack/plugins/fleet/server/services/files/mocks.ts @@ -10,12 +10,12 @@ import { Readable } from 'stream'; import type { estypes } from '@elastic/elasticsearch'; import type { + FleetFile, FleetFromHostFileClientInterface, FleetToHostFileClientInterface, HapiReadableStream, + HostUploadedFileMetadata, } from './types'; -import type { FleetFile } from './types'; -import type { HostUploadedFileMetadata } from './types'; export const createFleetFromHostFilesClientMock = (): jest.Mocked => { diff --git a/x-pack/plugins/security_solution/public/management/cypress/e2e/automated_response_actions/history_log.cy.ts b/x-pack/plugins/security_solution/public/management/cypress/e2e/automated_response_actions/history_log.cy.ts index b2f99a51087be..dbe75b576ac9c 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/e2e/automated_response_actions/history_log.cy.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/e2e/automated_response_actions/history_log.cy.ts @@ -22,8 +22,6 @@ describe( const [endpointAgentId, endpointHostname] = generateRandomStringName(2); before(() => { - login(ROLE.endpoint_response_actions_access); - indexEndpointHosts({ numResponseActions: 2 }).then((indexEndpoints) => { endpointData = indexEndpoints; }); @@ -59,6 +57,10 @@ describe( } }); + beforeEach(() => { + login(ROLE.endpoint_response_actions_access); + }); + it('enable filtering by type', () => { cy.visit(`/app/security/administration/response_actions_history`); diff --git a/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/alerts_response_console.cy.ts b/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/alerts_response_console.cy.ts new file mode 100644 index 0000000000000..a736e05c33145 --- /dev/null +++ b/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/alerts_response_console.cy.ts @@ -0,0 +1,115 @@ +/* + * 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 { closeAllToasts } from '../../tasks/toasts'; +import { + getAlertsTableRows, + openAlertDetailsView, + openInvestigateInTimelineView, + openResponderFromEndpointAlertDetails, +} from '../../screens/alerts'; +import { ensureOnResponder } from '../../screens/responder'; +import { cleanupRule, loadRule } from '../../tasks/api_fixtures'; +import type { PolicyData } from '../../../../../common/endpoint/types'; +import type { CreateAndEnrollEndpointHostResponse } from '../../../../../scripts/endpoint/common/endpoint_host_services'; +import { waitForEndpointListPageToBeLoaded } from '../../tasks/response_console'; +import type { IndexedFleetEndpointPolicyResponse } from '../../../../../common/endpoint/data_loaders/index_fleet_endpoint_policy'; +import { createAgentPolicyTask, getEndpointIntegrationVersion } from '../../tasks/fleet'; +import { toggleRuleOffAndOn, visitRuleAlerts } from '../../tasks/isolate'; + +import { login } from '../../tasks/login'; +import { enableAllPolicyProtections } from '../../tasks/endpoint_policy'; +import { createEndpointHost } from '../../tasks/create_endpoint_host'; +import { deleteAllLoadedEndpointData } from '../../tasks/delete_all_endpoint_data'; + +describe('Response console', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { + let indexedPolicy: IndexedFleetEndpointPolicyResponse; + let policy: PolicyData; + let createdHost: CreateAndEnrollEndpointHostResponse; + + beforeEach(() => { + login(); + }); + + before(() => { + getEndpointIntegrationVersion().then((version) => + createAgentPolicyTask(version).then((data) => { + indexedPolicy = data; + policy = indexedPolicy.integrationPolicies[0]; + + return enableAllPolicyProtections(policy.id).then(() => { + // Create and enroll a new Endpoint host + return createEndpointHost(policy.policy_id).then((host) => { + createdHost = host as CreateAndEnrollEndpointHostResponse; + }); + }); + }) + ); + }); + + after(() => { + if (createdHost) { + cy.task('destroyEndpointHost', createdHost); + } + + if (indexedPolicy) { + cy.task('deleteIndexedFleetEndpointPolicies', indexedPolicy); + } + + if (createdHost) { + deleteAllLoadedEndpointData({ endpointAgentIds: [createdHost.agentId] }); + } + }); + + describe('From Alerts', () => { + let ruleId: string; + let ruleName: string; + + before(() => { + loadRule( + { query: `agent.name: ${createdHost.hostname} and agent.type: endpoint` }, + false + ).then((data) => { + ruleId = data.id; + ruleName = data.name; + }); + }); + + after(() => { + if (ruleId) { + cleanupRule(ruleId); + } + }); + + it('should open responder from alert details flyout', () => { + waitForEndpointListPageToBeLoaded(createdHost.hostname); + toggleRuleOffAndOn(ruleName); + visitRuleAlerts(ruleName); + closeAllToasts(); + getAlertsTableRows().should('have.length.greaterThan', 0); + openAlertDetailsView(); + + openResponderFromEndpointAlertDetails(); + ensureOnResponder(); + }); + + it('should open responder from timeline view alert details flyout', () => { + waitForEndpointListPageToBeLoaded(createdHost.hostname); + toggleRuleOffAndOn(ruleName); + visitRuleAlerts(ruleName); + closeAllToasts(); + + getAlertsTableRows().should('have.length.greaterThan', 0); + openInvestigateInTimelineView(); + cy.getByTestSubj('timeline-flyout').within(() => { + openAlertDetailsView(); + }); + openResponderFromEndpointAlertDetails(); + ensureOnResponder(); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/cases_response_console.cy.ts b/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/cases_response_console.cy.ts new file mode 100644 index 0000000000000..a33d325d5443a --- /dev/null +++ b/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/cases_response_console.cy.ts @@ -0,0 +1,122 @@ +/* + * 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 { loadPage } from '../../tasks/common'; +import { closeAllToasts } from '../../tasks/toasts'; +import { + addAlertToCase, + getAlertsTableRows, + openAlertDetailsView, + openResponderFromEndpointAlertDetails, +} from '../../screens/alerts'; +import { ensureOnResponder } from '../../screens/responder'; +import { cleanupCase, cleanupRule, loadCase, loadRule } from '../../tasks/api_fixtures'; +import type { PolicyData } from '../../../../../common/endpoint/types'; +import type { CreateAndEnrollEndpointHostResponse } from '../../../../../scripts/endpoint/common/endpoint_host_services'; +import { waitForEndpointListPageToBeLoaded } from '../../tasks/response_console'; +import type { IndexedFleetEndpointPolicyResponse } from '../../../../../common/endpoint/data_loaders/index_fleet_endpoint_policy'; +import { createAgentPolicyTask, getEndpointIntegrationVersion } from '../../tasks/fleet'; +import { openCaseAlertDetails, toggleRuleOffAndOn, visitRuleAlerts } from '../../tasks/isolate'; + +import { login } from '../../tasks/login'; +import { enableAllPolicyProtections } from '../../tasks/endpoint_policy'; +import { createEndpointHost } from '../../tasks/create_endpoint_host'; +import { deleteAllLoadedEndpointData } from '../../tasks/delete_all_endpoint_data'; +import { APP_CASES_PATH } from '../../../../../common/constants'; + +describe('Response console', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { + let indexedPolicy: IndexedFleetEndpointPolicyResponse; + let policy: PolicyData; + let createdHost: CreateAndEnrollEndpointHostResponse; + + before(() => { + getEndpointIntegrationVersion().then((version) => + createAgentPolicyTask(version).then((data) => { + indexedPolicy = data; + policy = indexedPolicy.integrationPolicies[0]; + + return enableAllPolicyProtections(policy.id).then(() => { + // Create and enroll a new Endpoint host + return createEndpointHost(policy.policy_id).then((host) => { + createdHost = host as CreateAndEnrollEndpointHostResponse; + }); + }); + }) + ); + }); + + beforeEach(() => { + login(); + }); + + after(() => { + if (createdHost) { + cy.task('destroyEndpointHost', createdHost); + } + + if (indexedPolicy) { + cy.task('deleteIndexedFleetEndpointPolicies', indexedPolicy); + } + + if (createdHost) { + deleteAllLoadedEndpointData({ endpointAgentIds: [createdHost.agentId] }); + } + }); + + describe('From Cases', () => { + let ruleId: string; + let ruleName: string; + let caseId: string; + const caseOwner = 'securitySolution'; + + beforeEach(() => { + loadRule( + { query: `agent.name: ${createdHost.hostname} and agent.type: endpoint` }, + false + ).then((data) => { + ruleId = data.id; + ruleName = data.name; + }); + loadCase(caseOwner).then((data) => { + caseId = data.id; + }); + }); + + afterEach(() => { + if (ruleId) { + cleanupRule(ruleId); + } + if (caseId) { + cleanupCase(caseId); + } + }); + + it('should open responder', () => { + waitForEndpointListPageToBeLoaded(createdHost.hostname); + toggleRuleOffAndOn(ruleName); + visitRuleAlerts(ruleName); + closeAllToasts(); + + getAlertsTableRows().should('have.length.greaterThan', 0); + openAlertDetailsView(); + addAlertToCase(caseId, caseOwner); + + // visit case details page + cy.intercept('GET', `/api/cases/${caseId}/user_actions/_find*`).as('case'); + loadPage(`${APP_CASES_PATH}/${caseId}`); + + cy.wait('@case', { timeout: 30000 }).then(({ response: res }) => { + const caseAlertId = res?.body.userActions[1].id; + closeAllToasts(); + openCaseAlertDetails(caseAlertId); + }); + + openResponderFromEndpointAlertDetails(); + ensureOnResponder(); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/endpoints_list_response_console.cy.ts b/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/endpoints_list_response_console.cy.ts new file mode 100644 index 0000000000000..75074b0d3f94a --- /dev/null +++ b/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/endpoints_list_response_console.cy.ts @@ -0,0 +1,69 @@ +/* + * 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 { ensureOnResponder } from '../../screens/responder'; +import type { PolicyData } from '../../../../../common/endpoint/types'; +import type { CreateAndEnrollEndpointHostResponse } from '../../../../../scripts/endpoint/common/endpoint_host_services'; +import { + openResponseConsoleFromEndpointList, + waitForEndpointListPageToBeLoaded, +} from '../../tasks/response_console'; +import type { IndexedFleetEndpointPolicyResponse } from '../../../../../common/endpoint/data_loaders/index_fleet_endpoint_policy'; +import { createAgentPolicyTask, getEndpointIntegrationVersion } from '../../tasks/fleet'; + +import { login } from '../../tasks/login'; +import { enableAllPolicyProtections } from '../../tasks/endpoint_policy'; +import { createEndpointHost } from '../../tasks/create_endpoint_host'; +import { deleteAllLoadedEndpointData } from '../../tasks/delete_all_endpoint_data'; + +describe('Response console', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { + beforeEach(() => { + login(); + }); + + describe('From endpoint list', () => { + let indexedPolicy: IndexedFleetEndpointPolicyResponse; + let policy: PolicyData; + let createdHost: CreateAndEnrollEndpointHostResponse; + + before(() => { + getEndpointIntegrationVersion().then((version) => + createAgentPolicyTask(version).then((data) => { + indexedPolicy = data; + policy = indexedPolicy.integrationPolicies[0]; + + return enableAllPolicyProtections(policy.id).then(() => { + // Create and enroll a new Endpoint host + return createEndpointHost(policy.policy_id).then((host) => { + createdHost = host as CreateAndEnrollEndpointHostResponse; + }); + }); + }) + ); + }); + + after(() => { + if (createdHost) { + cy.task('destroyEndpointHost', createdHost); + } + + if (indexedPolicy) { + cy.task('deleteIndexedFleetEndpointPolicies', indexedPolicy); + } + + if (createdHost) { + deleteAllLoadedEndpointData({ endpointAgentIds: [createdHost.agentId] }); + } + }); + + it('should open responder', () => { + waitForEndpointListPageToBeLoaded(createdHost.hostname); + openResponseConsoleFromEndpointList(); + ensureOnResponder(); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/isolate.cy.ts b/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/isolate.cy.ts index f09e0b462a75d..ada452213b74d 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/isolate.cy.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/isolate.cy.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { openAlertDetailsView } from '../../screens/alerts'; import type { PolicyData } from '../../../../../common/endpoint/types'; import { APP_CASES_PATH, APP_ENDPOINTS_PATH } from '../../../../../common/constants'; import { closeAllToasts } from '../../tasks/toasts'; @@ -14,7 +15,6 @@ import { checkFlyoutEndpointIsolation, filterOutIsolatedHosts, isolateHostWithComment, - openAlertDetails, openCaseAlertDetails, releaseHostWithComment, toggleRuleOffAndOn, @@ -139,7 +139,7 @@ describe.skip('Isolate command', { tags: ['@ess', '@serverless', '@brokenInServe visitRuleAlerts(ruleName); closeAllToasts(); - openAlertDetails(); + openAlertDetailsView(); isolateHostWithComment(isolateComment, createdHost.hostname); @@ -147,7 +147,7 @@ describe.skip('Isolate command', { tags: ['@ess', '@serverless', '@brokenInServe cy.contains(`Isolation on host ${createdHost.hostname} successfully submitted`); cy.getByTestSubj('euiFlyoutCloseButton').click(); - openAlertDetails(); + openAlertDetailsView(); checkFlyoutEndpointIsolation(); @@ -156,7 +156,7 @@ describe.skip('Isolate command', { tags: ['@ess', '@serverless', '@brokenInServe cy.contains(`Release on host ${createdHost.hostname} successfully submitted`); cy.getByTestSubj('euiFlyoutCloseButton').click(); - openAlertDetails(); + openAlertDetailsView(); cy.getByTestSubj('event-field-agent.status').within(() => { cy.get('[title="Isolated"]').should('not.exist'); }); @@ -205,7 +205,7 @@ describe.skip('Isolate command', { tags: ['@ess', '@serverless', '@brokenInServe visitRuleAlerts(ruleName); closeAllToasts(); - openAlertDetails(); + openAlertDetailsView(); cy.getByTestSubj('add-to-existing-case-action').click(); cy.getByTestSubj(`cases-table-row-select-${caseId}`).click(); diff --git a/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/isolate_mocked_data.cy.ts b/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/isolate_mocked_data.cy.ts index 00bca7e3864af..a630d8fc4ec01 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/isolate_mocked_data.cy.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/isolate_mocked_data.cy.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { openAlertDetailsView } from '../../screens/alerts'; import { getEndpointListPath } from '../../../common/routing'; import { checkEndpointIsIsolated, @@ -12,7 +13,6 @@ import { filterOutIsolatedHosts, interceptActionRequests, isolateHostWithComment, - openAlertDetails, openCaseAlertDetails, releaseHostWithComment, sendActionResponse, @@ -148,7 +148,7 @@ describe('Isolate command', { tags: ['@ess', '@serverless'] }, () => { }); }); - openAlertDetails(); + openAlertDetailsView(); isolateHostWithComment(isolateComment, hostname); @@ -167,7 +167,7 @@ describe('Isolate command', { tags: ['@ess', '@serverless'] }, () => { cy.getByTestSubj('euiFlyoutCloseButton').click(); // eslint-disable-next-line cypress/no-unnecessary-waiting cy.wait(1000); - openAlertDetails(); + openAlertDetailsView(); checkFlyoutEndpointIsolation(); @@ -185,7 +185,7 @@ describe('Isolate command', { tags: ['@ess', '@serverless'] }, () => { cy.contains(`Release on host ${hostname} successfully submitted`); cy.getByTestSubj('euiFlyoutCloseButton').click(); - openAlertDetails(); + openAlertDetailsView(); cy.getByTestSubj('event-field-agent.status').within(() => { cy.get('[title="Isolated"]').should('not.exist'); }); diff --git a/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/response_console.cy.ts b/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/response_console_actions.cy.ts similarity index 94% rename from x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/response_console.cy.ts rename to x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/response_console_actions.cy.ts index 9690107c2d218..b727697da17be 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/response_console.cy.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/e2e/response_actions/response_console_actions.cy.ts @@ -16,7 +16,7 @@ import { waitForEndpointListPageToBeLoaded, } from '../../tasks/response_console'; import type { IndexedFleetEndpointPolicyResponse } from '../../../../../common/endpoint/data_loaders/index_fleet_endpoint_policy'; -import { getEndpointIntegrationVersion, createAgentPolicyTask } from '../../tasks/fleet'; +import { createAgentPolicyTask, getEndpointIntegrationVersion } from '../../tasks/fleet'; import { checkEndpointListForOnlyIsolatedHosts, checkEndpointListForOnlyUnIsolatedHosts, @@ -188,7 +188,7 @@ describe('Response console', { tags: ['@ess', '@serverless', '@brokenInServerles }); }); - describe('File operations: get-file and execute', () => { + describe('File operations: get-file, upload and execute', () => { const homeFilePath = process.env.CI || true ? '/home/vagrant' : `/home/ubuntu`; const fileContent = 'This is a test file for the get-file command.'; @@ -271,6 +271,22 @@ describe('Response console', { tags: ['@ess', '@serverless', '@brokenInServerles submitCommand(); waitForCommandToBeExecuted('execute'); }); + + it('"upload --file" - should upload a file', () => { + waitForEndpointListPageToBeLoaded(createdHost.hostname); + openResponseConsoleFromEndpointList(); + inputConsoleCommand(`upload --file`); + cy.getByTestSubj('console-arg-file-picker').selectFile( + { + contents: Cypress.Buffer.from('upload file content here!'), + fileName: 'upload_file.txt', + lastModified: Date.now(), + }, + { force: true } + ); + submitCommand(); + waitForCommandToBeExecuted('upload'); + }); }); // FLAKY: https://github.com/elastic/kibana/issues/168296 diff --git a/x-pack/plugins/security_solution/public/management/cypress/screens/alerts.ts b/x-pack/plugins/security_solution/public/management/cypress/screens/alerts.ts index a1e53cee9b09a..b434458c4dc1d 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/screens/alerts.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/screens/alerts.ts @@ -13,7 +13,7 @@ export const navigateToAlertsList = (urlQueryParams: string = '') => { }; export const clickAlertListRefreshButton = (): Cypress.Chainable => { - cy.getByTestSubj('querySubmitButton').click(); + cy.getByTestSubj('querySubmitButton').first().click(); return cy.getByTestSubj('querySubmitButton').should('be.enabled'); }; @@ -41,3 +41,22 @@ export const getAlertsTableRows = (timeout?: number): Cypress.Chainable $rows); }; + +export const openAlertDetailsView = (rowIndex: number = 0): void => { + cy.getByTestSubj('expand-event').eq(rowIndex).click(); + cy.getByTestSubj('take-action-dropdown-btn').click(); +}; + +export const openInvestigateInTimelineView = (): void => { + cy.getByTestSubj('send-alert-to-timeline-button').first().click(); +}; + +export const openResponderFromEndpointAlertDetails = (): void => { + cy.getByTestSubj('endpointResponseActions-action-item').click(); +}; + +export const addAlertToCase = (caseId: string, caseOwner: string): void => { + cy.getByTestSubj('add-to-existing-case-action').click(); + cy.getByTestSubj(`cases-table-row-select-${caseId}`).click(); + cy.contains(`An alert was added to \"Test ${caseOwner} case`); +}; diff --git a/x-pack/plugins/security_solution/public/management/cypress/screens/responder.ts b/x-pack/plugins/security_solution/public/management/cypress/screens/responder.ts index c9e320728ee23..c612c99db17b3 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/screens/responder.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/screens/responder.ts @@ -30,7 +30,7 @@ export const getConsoleHelpPanelResponseActionTestSubj = (): Record< }; }; -const ensureOnResponder = (): Cypress.Chainable> => { +export const ensureOnResponder = (): Cypress.Chainable> => { return cy.getByTestSubj(TEST_SUBJ.responderPage).should('exist'); }; diff --git a/x-pack/plugins/security_solution/public/management/cypress/support/e2e.ts b/x-pack/plugins/security_solution/public/management/cypress/support/e2e.ts index 7c8bf5104524b..67c2a3ef0375e 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/support/e2e.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/support/e2e.ts @@ -23,12 +23,13 @@ // *********************************************************** import { subj as testSubjSelector } from '@kbn/test-subj-selector'; - import 'cypress-react-selector'; - // @ts-ignore import registerCypressGrep from '@cypress/grep'; +import { login, ROLE } from '../tasks/login'; +import { loadPage } from '../tasks/common'; + registerCypressGrep(); Cypress.Commands.addQuery<'getByTestSubj'>( @@ -100,3 +101,10 @@ Cypress.Commands.add( ); Cypress.on('uncaught:exception', () => false); + +// Login as a Platform Engineer to properly initialize Security Solution App +before(() => { + login(ROLE.soc_manager); + loadPage('/app/security/alerts'); + cy.getByTestSubj('manage-alert-detection-rules').should('exist'); +}); diff --git a/x-pack/plugins/security_solution/public/management/cypress/tasks/isolate.ts b/x-pack/plugins/security_solution/public/management/cypress/tasks/isolate.ts index a15a71f1362eb..e13bb832adce5 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/tasks/isolate.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/tasks/isolate.ts @@ -7,6 +7,7 @@ /* eslint-disable cypress/no-unnecessary-waiting */ +import { openAlertDetailsView } from '../screens/alerts'; import type { ActionDetails } from '../../../../common/endpoint/types'; import { loadPage } from './common'; @@ -46,11 +47,6 @@ export const releaseHostWithComment = (comment: string, hostname: string): void cy.getByTestSubj('host_isolation_comment').type(comment); }; -export const openAlertDetails = (): void => { - cy.getByTestSubj('expand-event').first().click(); - cy.getByTestSubj('take-action-dropdown-btn').click(); -}; - export const openCaseAlertDetails = (alertId: string): void => { cy.getByTestSubj(`comment-action-show-alert-${alertId}`).click(); cy.getByTestSubj('take-action-dropdown-btn').click(); @@ -84,7 +80,7 @@ export const checkFlyoutEndpointIsolation = (): void => { } else { cy.getByTestSubj('euiFlyoutCloseButton').click(); cy.wait(5000); - openAlertDetails(); + openAlertDetailsView(); cy.getByTestSubj('event-field-agent.status').within(() => { cy.contains('Isolated'); }); From 8fd827f8683cc0312ba957e384d82bab5ab217c7 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 18 Oct 2023 16:59:15 -0400 Subject: [PATCH 2/2] Upgrade babel/traverse to 7.23.2 (#169174) ## Summary Upgrading `@babel/traverse` form 7.21.2 to 7.23.2 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 90 +++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 83 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 8947a3c3680b0..d2ce2ddb94eab 100644 --- a/package.json +++ b/package.json @@ -1093,7 +1093,7 @@ "@babel/preset-react": "^7.18.6", "@babel/preset-typescript": "^7.21.0", "@babel/register": "^7.21.0", - "@babel/traverse": "^7.21.2", + "@babel/traverse": "^7.23.2", "@babel/types": "^7.21.2", "@bazel/ibazel": "^0.16.2", "@bazel/typescript": "4.6.2", diff --git a/yarn.lock b/yarn.lock index 1dcea68abfd5b..751fcd443ce48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -196,6 +196,16 @@ "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" +"@babel/generator@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420" + integrity sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g== + dependencies: + "@babel/types" "^7.23.0" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + "@babel/helper-annotate-as-pure@^7.16.0", "@babel/helper-annotate-as-pure@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb" @@ -275,6 +285,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be" integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg== +"@babel/helper-environment-visitor@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" + integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== + "@babel/helper-explode-assignable-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.18.6.tgz#41f8228ef0a6f1a036b8dfdfec7ce94f9a6bc096" @@ -290,6 +305,14 @@ "@babel/template" "^7.20.7" "@babel/types" "^7.21.0" +"@babel/helper-function-name@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" + integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== + dependencies: + "@babel/template" "^7.22.15" + "@babel/types" "^7.23.0" + "@babel/helper-hoist-variables@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" @@ -297,6 +320,13 @@ dependencies: "@babel/types" "^7.18.6" +"@babel/helper-hoist-variables@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" + integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-member-expression-to-functions@^7.20.7", "@babel/helper-member-expression-to-functions@^7.21.0": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.21.0.tgz#319c6a940431a133897148515877d2f3269c3ba5" @@ -385,11 +415,23 @@ dependencies: "@babel/types" "^7.18.6" +"@babel/helper-split-export-declaration@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" + integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-string-parser@^7.19.4": version "7.19.4" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63" integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw== +"@babel/helper-string-parser@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" + integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== + "@babel/helper-validator-identifier@^7.19.1", "@babel/helper-validator-identifier@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz#9544ef6a33999343c8740fa51350f30eeaaaf193" @@ -452,6 +494,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.5.tgz#721fd042f3ce1896238cf1b341c77eb7dee7dbea" integrity sha512-DFZMC9LJUG9PLOclRC32G63UXwzqS2koQC8dkx+PLdmt1xSePYpbT/NbsrJy8Q/muXz7o/h/d4A7Fuyixm559Q== +"@babel/parser@^7.22.15", "@babel/parser@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719" + integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw== + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2" @@ -1261,6 +1308,15 @@ "@babel/parser" "^7.20.7" "@babel/types" "^7.20.7" +"@babel/template@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" + integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== + dependencies: + "@babel/code-frame" "^7.22.13" + "@babel/parser" "^7.22.15" + "@babel/types" "^7.22.15" + "@babel/traverse@^7.10.3", "@babel/traverse@^7.12.11", "@babel/traverse@^7.12.9", "@babel/traverse@^7.13.0", "@babel/traverse@^7.19.0", "@babel/traverse@^7.20.7", "@babel/traverse@^7.21.0", "@babel/traverse@^7.21.2", "@babel/traverse@^7.4.5": version "7.21.2" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.21.2.tgz#ac7e1f27658750892e815e60ae90f382a46d8e75" @@ -1277,6 +1333,22 @@ debug "^4.1.0" globals "^11.1.0" +"@babel/traverse@^7.23.2": + version "7.23.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" + integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== + dependencies: + "@babel/code-frame" "^7.22.13" + "@babel/generator" "^7.23.0" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.23.0" + "@babel/types" "^7.23.0" + debug "^4.1.0" + globals "^11.1.0" + "@babel/types@^7.0.0", "@babel/types@^7.10.3", "@babel/types@^7.12.11", "@babel/types@^7.12.7", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.2", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": version "7.21.2" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.21.2.tgz#92246f6e00f91755893c2876ad653db70c8310d1" @@ -1286,6 +1358,15 @@ "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" +"@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.0.tgz#8c1f020c9df0e737e4e247c0619f58c68458aaeb" + integrity sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg== + dependencies: + "@babel/helper-string-parser" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + "@base2/pretty-print-object@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@base2/pretty-print-object/-/pretty-print-object-1.0.1.tgz#371ba8be66d556812dc7fb169ebc3c08378f69d4" @@ -27155,7 +27236,7 @@ semver@5.6.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== -semver@7.5.4: +semver@7.5.4, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.0, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== @@ -27167,13 +27248,6 @@ semver@^6.0.0, semver@^6.1.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semve resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.0, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4: - version "7.5.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" - integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== - dependencies: - lru-cache "^6.0.0" - send@0.17.2: version "0.17.2" resolved "https://registry.yarnpkg.com/send/-/send-0.17.2.tgz#926622f76601c41808012c8bf1688fe3906f7820"