Skip to content

Commit

Permalink
[8.x] [Security Solution][Endpoint] Updated Response Console display …
Browse files Browse the repository at this point in the history
…of Tech. Preview badge (#193182) (#193213)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution][Endpoint] Updated Response Console display of
Tech. Preview badge
(#193182)](#193182)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Paul
Tavares","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-17T17:56:05Z","message":"[Security
Solution][Endpoint] Updated Response Console display of Tech. Preview
badge (#193182)\n\n## Summary\r\n\r\nPR updates the Response Console and
Isolate/Release flyouts with:\r\n\r\n- Removes the \"Technical Preview\"
badge from the page/flyout title\r\n- Adds [EUI's
Beta\r\nbadge](https://eui.elastic.co/#/display/badge#beta-badge-type)
to the\r\nAgent Type Integration with labels of \"Technical
Preview\"\r\n\r\n___________\r\n\r\n#### Response
Console\r\n\r\n|Display|Hover on icon|\r\n|------|------|\r\n|<img
width=\"716\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/838a7609-aaa2-439b-98d6-09cce2d1c4b4\">|<img\r\nwidth=\"835\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/948a0516-31dd-456b-8025-3a5a79dd7815\">|\r\n\r\n\r\n\r\n\r\n####
Isolate/Release Flyout\r\n\r\n|Display|Hover on
icon|\r\n|------|------|\r\n|<img width=\"800\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/01767b5d-4e4c-403b-a31b-ae7c960a5288\">|<img\r\nwidth=\"799\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/577b0513-6a5d-486c-bcd3-38541022a818\">|\r\n\r\n\r\n\r\n####
Elastic Defend (no tech preview badge)\r\n\r\n\r\n|Responder|Isolation
panel from alerts|\r\n|------|------|\r\n|<img width=\"757\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/a5de5be5-2e04-4d8c-8c32-139b155fba22\">|<img\r\nwidth=\"812\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/3ea854a3-f44e-4b76-ac9b-91862c0ae964\">|\r\n\r\n\r\n\r\n___________\r\n\r\n\r\n\r\n\r\n\r\n###
Checklist\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"090d9a2adf018a53fee56184a1788427e6054835","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Defend
Workflows","v8.16.0","v8.15.2"],"title":"[Security Solution][Endpoint]
Updated Response Console display of Tech. Preview
badge","number":193182,"url":"https://github.com/elastic/kibana/pull/193182","mergeCommit":{"message":"[Security
Solution][Endpoint] Updated Response Console display of Tech. Preview
badge (#193182)\n\n## Summary\r\n\r\nPR updates the Response Console and
Isolate/Release flyouts with:\r\n\r\n- Removes the \"Technical Preview\"
badge from the page/flyout title\r\n- Adds [EUI's
Beta\r\nbadge](https://eui.elastic.co/#/display/badge#beta-badge-type)
to the\r\nAgent Type Integration with labels of \"Technical
Preview\"\r\n\r\n___________\r\n\r\n#### Response
Console\r\n\r\n|Display|Hover on icon|\r\n|------|------|\r\n|<img
width=\"716\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/838a7609-aaa2-439b-98d6-09cce2d1c4b4\">|<img\r\nwidth=\"835\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/948a0516-31dd-456b-8025-3a5a79dd7815\">|\r\n\r\n\r\n\r\n\r\n####
Isolate/Release Flyout\r\n\r\n|Display|Hover on
icon|\r\n|------|------|\r\n|<img width=\"800\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/01767b5d-4e4c-403b-a31b-ae7c960a5288\">|<img\r\nwidth=\"799\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/577b0513-6a5d-486c-bcd3-38541022a818\">|\r\n\r\n\r\n\r\n####
Elastic Defend (no tech preview badge)\r\n\r\n\r\n|Responder|Isolation
panel from alerts|\r\n|------|------|\r\n|<img width=\"757\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/a5de5be5-2e04-4d8c-8c32-139b155fba22\">|<img\r\nwidth=\"812\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/3ea854a3-f44e-4b76-ac9b-91862c0ae964\">|\r\n\r\n\r\n\r\n___________\r\n\r\n\r\n\r\n\r\n\r\n###
Checklist\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"090d9a2adf018a53fee56184a1788427e6054835"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193182","number":193182,"mergeCommit":{"message":"[Security
Solution][Endpoint] Updated Response Console display of Tech. Preview
badge (#193182)\n\n## Summary\r\n\r\nPR updates the Response Console and
Isolate/Release flyouts with:\r\n\r\n- Removes the \"Technical Preview\"
badge from the page/flyout title\r\n- Adds [EUI's
Beta\r\nbadge](https://eui.elastic.co/#/display/badge#beta-badge-type)
to the\r\nAgent Type Integration with labels of \"Technical
Preview\"\r\n\r\n___________\r\n\r\n#### Response
Console\r\n\r\n|Display|Hover on icon|\r\n|------|------|\r\n|<img
width=\"716\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/838a7609-aaa2-439b-98d6-09cce2d1c4b4\">|<img\r\nwidth=\"835\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/948a0516-31dd-456b-8025-3a5a79dd7815\">|\r\n\r\n\r\n\r\n\r\n####
Isolate/Release Flyout\r\n\r\n|Display|Hover on
icon|\r\n|------|------|\r\n|<img width=\"800\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/01767b5d-4e4c-403b-a31b-ae7c960a5288\">|<img\r\nwidth=\"799\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/577b0513-6a5d-486c-bcd3-38541022a818\">|\r\n\r\n\r\n\r\n####
Elastic Defend (no tech preview badge)\r\n\r\n\r\n|Responder|Isolation
panel from alerts|\r\n|------|------|\r\n|<img width=\"757\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/a5de5be5-2e04-4d8c-8c32-139b155fba22\">|<img\r\nwidth=\"812\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/3ea854a3-f44e-4b76-ac9b-91862c0ae964\">|\r\n\r\n\r\n\r\n___________\r\n\r\n\r\n\r\n\r\n\r\n###
Checklist\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"090d9a2adf018a53fee56184a1788427e6054835"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Paul Tavares <[email protected]>
  • Loading branch information
kibanamachine and paul-tavares authored Sep 17, 2024
1 parent 3c9beb0 commit 4376d9b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,19 @@ describe('AgentTypeIntegration component', () => {

expect(getByTestId('test-tooltipAnchor'));
});

if (agentType === 'sentinel_one' || agentType === 'crowdstrike') {
it('should display tech preview badge', () => {
const { getByTestId } = render();

expect(getByTestId('test-betaBadge')).not.toBeNull();
});
} else {
it('should NOT display tech preview badge', () => {
const { queryByTestId } = render();

expect(queryByTestId('test-betaBadge')).toBeNull();
});
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
* 2.0.
*/

import React, { memo } from 'react';
import React, { memo, useMemo } from 'react';
import type { EuiTextProps } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiIconTip, EuiText } from '@elastic/eui';
import { EuiBetaBadge, EuiFlexGroup, EuiFlexItem, EuiIconTip, EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { i18n } from '@kbn/i18n';
import { useTestIdGenerator } from '../../../../../management/hooks/use_test_id_generator';
import { AgentTypeVendorLogo } from '../agent_type_vendor_logo';
import { getAgentTypeName } from '../../../../translations';
import {
getAgentTypeName,
TECHNICAL_PREVIEW,
TECHNICAL_PREVIEW_TOOLTIP,
} from '../../../../translations';
import type { ResponseActionAgentType } from '../../../../../../common/endpoint/service/response_actions/constants';

export const INTEGRATION_SECTION_LABEL = i18n.translate(
Expand All @@ -38,6 +42,10 @@ export const AgentTypeIntegration = memo<AgentTypeIntegrationProps>(
({ agentType, textSize = 's', layout = 'vertical', 'data-test-subj': dataTestSubj }) => {
const testId = useTestIdGenerator(dataTestSubj);

const isTechPreview = useMemo(() => {
return agentType === 'sentinel_one' || agentType === 'crowdstrike';
}, [agentType]);

return (
<EuiFlexGroup
direction={layout === 'horizontal' ? 'row' : 'column'}
Expand Down Expand Up @@ -69,6 +77,17 @@ export const AgentTypeIntegration = memo<AgentTypeIntegrationProps>(
{getAgentTypeName(agentType)}
</EuiText>
</EuiFlexItem>
{isTechPreview && (
<EuiFlexItem grow={false}>
<EuiBetaBadge
label={TECHNICAL_PREVIEW}
tooltipContent={TECHNICAL_PREVIEW_TOOLTIP}
iconType="beaker"
size="s"
data-test-subj={testId('betaBadge')}
/>
</EuiFlexItem>
)}
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { createAppRootMockRenderer, endpointAlertDataMock } from '../../../commo
import type { ResponseActionAgentType } from '../../../../common/endpoint/service/response_actions/constants';
import { RESPONSE_ACTION_AGENT_TYPE } from '../../../../common/endpoint/service/response_actions/constants';
import { ISOLATE_HOST, UNISOLATE_HOST } from '../../../common/components/endpoint/host_isolation';
import { TECHNICAL_PREVIEW } from '../../../common/translations';

jest.mock('./context');

Expand Down Expand Up @@ -58,8 +57,6 @@ describe('Isolation Flyout PanelHeader', () => {
action: IsolateHostPanelContext['isolateAction'];
agentType: ResponseActionAgentType;
title: string;
// if `expectedBadgeText` is `undefined`, then it validates that the badge is not displayed
expectedBadgeText: string | undefined;
}> = [];

for (const agentType of RESPONSE_ACTION_AGENT_TYPE) {
Expand All @@ -69,33 +66,22 @@ describe('Isolation Flyout PanelHeader', () => {
action,
agentType,
title: action === 'isolateHost' ? ISOLATE_HOST : UNISOLATE_HOST,
expectedBadgeText:
agentType === 'crowdstrike' || agentType === 'sentinel_one'
? TECHNICAL_PREVIEW
: undefined,
});
}
);
}

it.each(testConditions)(
'should display correct flyout header title for $action on agentType $agentType',
({ action, agentType, title, expectedBadgeText }) => {
({ action, agentType, title }) => {
setUseIsolateHostPanelContext({
isolateAction: action,
dataFormattedForFieldBrowser:
endpointAlertDataMock.generateAlertDetailsItemDataForAgentType(agentType),
});
const { getByTestId, queryByTestId } = render();
const { getByTestId } = render();

expect(getByTestId('flyoutHostIsolationHeaderTitle')).toHaveTextContent(title);

if (expectedBadgeText) {
expect(getByTestId('flyoutHostIsolationHeaderBadge')).toHaveTextContent(expectedBadgeText);
} else {
expect(queryByTestId('flyoutHostIsolationHeaderBadge')).toBeNull();
}

expect(getByTestId('flyoutHostIsolationHeaderIntegration'));
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
* 2.0.
*/

import { EuiBetaBadge, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui';
import type { FC } from 'react';
import React, { useMemo } from 'react';
import React from 'react';
import { FlyoutHeader } from '@kbn/security-solution-common';
import { AgentTypeIntegration } from '../../../common/components/endpoint/agents/agent_type_integration';
import { useAlertResponseActionsSupport } from '../../../common/hooks/endpoint/use_alert_response_actions_support';
import { TECHNICAL_PREVIEW, TECHNICAL_PREVIEW_TOOLTIP } from '../../../common/translations';
import { useIsolateHostPanelContext } from './context';
import { FLYOUT_HEADER_TITLE_TEST_ID } from './test_ids';
import { ISOLATE_HOST, UNISOLATE_HOST } from '../../../common/components/endpoint';
Expand All @@ -22,14 +21,9 @@ import { ISOLATE_HOST, UNISOLATE_HOST } from '../../../common/components/endpoin
export const PanelHeader: FC = () => {
const { isolateAction, dataFormattedForFieldBrowser: data } = useIsolateHostPanelContext();
const {
isSupported: supportsResponseActions,
details: { agentType },
} = useAlertResponseActionsSupport(data);

const showTechPreviewBadge: boolean = useMemo(() => {
return supportsResponseActions && (agentType === 'sentinel_one' || agentType === 'crowdstrike');
}, [agentType, supportsResponseActions]);

const title = (
<EuiFlexGroup responsive gutterSize="s">
<EuiFlexItem grow={false} data-test-subj="flyoutHostIsolationHeaderTitle">
Expand All @@ -41,15 +35,6 @@ export const PanelHeader: FC = () => {
data-test-subj="flyoutHostIsolationHeaderIntegration"
/>
</EuiFlexItem>
{showTechPreviewBadge && (
<EuiFlexItem grow={false}>
<EuiBetaBadge
data-test-subj="flyoutHostIsolationHeaderBadge"
label={TECHNICAL_PREVIEW}
tooltipContent={TECHNICAL_PREVIEW_TOOLTIP}
/>
</EuiFlexItem>
)}
</EuiFlexGroup>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
*/

import React, { useCallback } from 'react';
import { EuiBetaBadge, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { TECHNICAL_PREVIEW, TECHNICAL_PREVIEW_TOOLTIP } from '../../common/translations';
import { useLicense } from '../../common/hooks/use_license';
import type { MaybeImmutable } from '../../../common/endpoint/types';
import type { EndpointCapabilities } from '../../../common/endpoint/service/response_actions/constants';
Expand All @@ -23,7 +21,6 @@ import {
import { useConsoleManager } from '../components/console';
import { MissingEncryptionKeyCallout } from '../components/missing_encryption_key_callout';
import { RESPONDER_PAGE_TITLE } from './translations';
import { useIsExperimentalFeatureEnabled } from '../../common/hooks/use_experimental_features';

type ShowResponseActionsConsole = (props: ResponderInfoProps) => void;

Expand All @@ -47,19 +44,10 @@ export const useWithShowResponder = (): ShowResponseActionsConsole => {
const consoleManager = useConsoleManager();
const endpointPrivileges = useUserPrivileges().endpointPrivileges;
const isEnterpriseLicense = useLicense().isEnterprise();
const isSentinelOneV1Enabled = useIsExperimentalFeatureEnabled(
'responseActionsSentinelOneV1Enabled'
);
const responseActionsCrowdstrikeManualHostIsolationEnabled = useIsExperimentalFeatureEnabled(
'responseActionsCrowdstrikeManualHostIsolationEnabled'
);

return useCallback(
(props: ResponderInfoProps) => {
const { agentId, agentType, capabilities, hostName, platform } = props;
const isExternalEdr =
(isSentinelOneV1Enabled && agentType === 'sentinel_one') ||
(responseActionsCrowdstrikeManualHostIsolationEnabled && agentType === 'crowdstrike');

// If no authz, just exit and log something to the console
if (agentType === 'endpoint' && !endpointPrivileges.canAccessResponseConsole) {
Expand Down Expand Up @@ -109,19 +97,6 @@ export const useWithShowResponder = (): ShowResponseActionsConsole => {
},
consoleProps,
PageTitleComponent: () => {
if (isExternalEdr) {
return (
<EuiFlexGroup>
<EuiFlexItem>{RESPONDER_PAGE_TITLE}</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiBetaBadge
label={TECHNICAL_PREVIEW}
tooltipContent={TECHNICAL_PREVIEW_TOOLTIP}
/>
</EuiFlexItem>
</EuiFlexGroup>
);
}
return <>{RESPONDER_PAGE_TITLE}</>;
},
ActionComponents: endpointPrivileges.canReadActionsLogManagement
Expand All @@ -141,12 +116,6 @@ export const useWithShowResponder = (): ShowResponseActionsConsole => {
.show();
}
},
[
isSentinelOneV1Enabled,
responseActionsCrowdstrikeManualHostIsolationEnabled,
endpointPrivileges,
isEnterpriseLicense,
consoleManager,
]
[endpointPrivileges, isEnterpriseLicense, consoleManager]
);
};

0 comments on commit 4376d9b

Please sign in to comment.