Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ export type AssistantFeatureKey = keyof AssistantFeatures;
*/
export const defaultAssistantFeatures = Object.freeze({
assistantModelEvaluation: false,
defendInsights: true,
defendInsightsPolicyResponseFailure: false,
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ import { z } from '@kbn/zod';
export type GetCapabilitiesResponse = z.infer<typeof GetCapabilitiesResponse>;
export const GetCapabilitiesResponse = z.object({
assistantModelEvaluation: z.boolean(),
defendInsights: z.boolean(),
defendInsightsPolicyResponseFailure: z.boolean(),
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ paths:
properties:
assistantModelEvaluation:
type: boolean
defendInsights:
defendInsightsPolicyResponseFailure:
type: boolean
required:
- assistantModelEvaluation
- defendInsights
- defendInsightsPolicyResponseFailure
'400':
description: Generic Error
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ export const getSecurityV2SubFeaturesMap = ({
if (!experimentalFeatures.endpointManagementSpaceAwarenessEnabled) {
securitySubFeaturesMap.delete(SecuritySubFeatureId.globalArtifactManagement);
}
if (!experimentalFeatures.defendInsights) {
securitySubFeaturesMap.delete(SecuritySubFeatureId.workflowInsights);
}

return Object.freeze(securitySubFeaturesMap);
};
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ export const getSecurityV3SubFeaturesMap = ({
);

// Remove disabled experimental features
if (!experimentalFeatures.defendInsights) {
securitySubFeaturesMap.delete(SecuritySubFeatureId.workflowInsights);
}
if (!experimentalFeatures.trustedDevices) {
securitySubFeaturesMap.delete(SecuritySubFeatureId.trustedDevices);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('AssistantProvider', () => {
}),
assistantFeatures: expect.objectContaining({
assistantModelEvaluation: expect.any(Boolean),
defendInsights: expect.any(Boolean),
defendInsightsPolicyResponseFailure: expect.any(Boolean),
}),
assistantStreamingEnabled: expect.any(Boolean),
assistantTelemetry: expect.any(Object),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,6 @@ function addGenerationInterval(
return newGenerationIntervals;
}

export function isDefendInsightsEnabled({
request,
logger,
assistantContext,
}: {
request: KibanaRequest;
logger: Logger;
assistantContext: ElasticAssistantApiRequestHandlerContext;
}): boolean {
const pluginName = getPluginNameFromRequest({
request,
logger,
defaultPluginName: DEFAULT_PLUGIN_NAME,
});

return assistantContext.getRegisteredFeatures(pluginName).defendInsights;
}

export function isDefendInsightsPolicyResponseFailureEnabled({
request,
logger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ describe('AppContextService', () => {
appContextService.start(mockAppContext);
appContextService.registerFeatures('super', {
assistantModelEvaluation: true,
defendInsights: true,
});
appContextService.stop();

Expand Down Expand Up @@ -126,7 +125,6 @@ describe('AppContextService', () => {
const features: AssistantFeatures = {
...defaultAssistantFeatures,
assistantModelEvaluation: true,
defendInsights: true,
};

appContextService.start(mockAppContext);
Expand All @@ -142,13 +140,11 @@ describe('AppContextService', () => {
const featuresOne: AssistantFeatures = {
...defaultAssistantFeatures,
assistantModelEvaluation: true,
defendInsights: true,
};
const pluginTwo = 'plugin2';
const featuresTwo: AssistantFeatures = {
...defaultAssistantFeatures,
assistantModelEvaluation: false,
defendInsights: false,
};

appContextService.start(mockAppContext);
Expand All @@ -164,12 +160,10 @@ describe('AppContextService', () => {
const featuresOne: AssistantFeatures = {
...defaultAssistantFeatures,
assistantModelEvaluation: true,
defendInsights: true,
};
const featuresTwo: AssistantFeatures = {
...defaultAssistantFeatures,
assistantModelEvaluation: false,
defendInsights: false,
};

appContextService.start(mockAppContext);
Expand All @@ -191,7 +185,6 @@ describe('AppContextService', () => {
const pluginName = 'pluginName';
const featuresSubset: Partial<AssistantFeatures> = {
assistantModelEvaluation: true,
defendInsights: true,
};

appContextService.start(mockAppContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,6 @@ export const allowedExperimentalValues = Object.freeze({
*/
siemMigrationsDisabled: false,

/**
* Enables the Defend Insights feature
*/
defendInsights: true,

/**
* Enables the Defend Insights Policy Response Failure feature
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,12 @@
* 2.0.
*/

import {
EuiAccordion,
EuiSpacer,
EuiText,
EuiBetaBadge,
EuiFlexItem,
EuiFlexGroup,
} from '@elastic/eui';
import { EuiAccordion, EuiSpacer, EuiText, EuiFlexItem, EuiFlexGroup } from '@elastic/eui';
import React, { useState, useEffect, useCallback, useMemo } from 'react';
import moment from 'moment';

import type { DefendInsightType } from '@kbn/elastic-assistant-common';
import { ActionType } from '../../../../../../../../common/endpoint/types/workflow_insights';
import {
TECHNICAL_PREVIEW_TOOLTIP,
TECHNICAL_PREVIEW,
} from '../../../../../../../common/translations';
import { useIsExperimentalFeatureEnabled } from '../../../../../../../common/hooks/use_experimental_features';
import { useFetchInsights } from '../../../hooks/insights/use_fetch_insights';
import { useTriggerScan } from '../../../hooks/insights/use_trigger_scan';
Expand Down Expand Up @@ -177,16 +166,6 @@ export const WorkflowInsights = React.memo(({ endpointId }: WorkflowInsightsProp
<h4>{WORKFLOW_INSIGHTS.title}</h4>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiBetaBadge
alignment={'middle'}
label={TECHNICAL_PREVIEW}
tooltipContent={TECHNICAL_PREVIEW_TOOLTIP}
size="s"
iconType={'beaker'}
data-test-subj={'workflow-insights-tech-preview-badge'}
/>
</EuiFlexItem>
</EuiFlexGroup>
}
initialIsOpen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
} from '@elastic/eui';
import React, { memo, useMemo } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features';
import { WorkflowInsights } from './components/insights/workflow_insights';
import { isPolicyOutOfDate } from '../../utils';
import { AgentStatus } from '../../../../../common/components/endpoint/agents/agent_status';
Expand Down Expand Up @@ -45,14 +44,7 @@ interface EndpointDetailsContentProps {
export const EndpointDetailsContent = memo<EndpointDetailsContentProps>(
({ hostInfo, policyInfo }) => {
// Access control
const isWorkflowInsightsFeatureFlagEnabled = useIsExperimentalFeatureEnabled('defendInsights');
const { canReadWorkflowInsights } = useUserPrivileges().endpointPrivileges;
const canAccessWorkflowInsights = useMemo(() => {
if (!isWorkflowInsightsFeatureFlagEnabled) {
return false;
}
return canReadWorkflowInsights;
}, [canReadWorkflowInsights, isWorkflowInsightsFeatureFlagEnabled]);

const queryParams = useEndpointSelector(uiQueryParams);
const policyStatus = useMemo(
Expand Down Expand Up @@ -195,7 +187,7 @@ export const EndpointDetailsContent = memo<EndpointDetailsContentProps>(
}, [hostInfo, policyInfo, missingPolicies, policyStatus, policyStatusClickHandler]);
return (
<div>
{canAccessWorkflowInsights && <WorkflowInsights endpointId={hostInfo.metadata.agent.id} />}
{canReadWorkflowInsights && <WorkflowInsights endpointId={hostInfo.metadata.agent.id} />}
<EuiDescriptionList
columnWidths={[1, 3]}
compressed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export const registerWorkflowInsightsRoutes = (
config: ConfigType,
endpointContext: EndpointAppContext
) => {
if (config.experimentalFeatures.defendInsights) {
registerGetInsightsRoute(router, endpointContext);
registerUpdateInsightsRoute(router, endpointContext);
}
registerGetInsightsRoute(router, endpointContext);
registerUpdateInsightsRoute(router, endpointContext);
};
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ describe('SecurityWorkflowInsightsService', () => {
securityWorkflowInsightsService.setup({
kibanaVersion: kibanaPackageJson.version,
logger,
isFeatureEnabled: true,
endpointContext: mockEndpointAppContextService,
});

Expand All @@ -166,7 +165,6 @@ describe('SecurityWorkflowInsightsService', () => {
securityWorkflowInsightsService.setup({
kibanaVersion: kibanaPackageJson.version,
logger,
isFeatureEnabled: true,
endpointContext: mockEndpointAppContextService,
});

Expand All @@ -191,7 +189,6 @@ describe('SecurityWorkflowInsightsService', () => {
securityWorkflowInsightsService.setup({
kibanaVersion: kibanaPackageJson.version,
logger,
isFeatureEnabled: true,
endpointContext: mockEndpointAppContextService,
});
expect(createDatastreamMock).toHaveBeenCalledTimes(1);
Expand All @@ -218,7 +215,6 @@ describe('SecurityWorkflowInsightsService', () => {
securityWorkflowInsightsService.setup({
kibanaVersion: kibanaPackageJson.version,
logger,
isFeatureEnabled: true,
endpointContext: mockEndpointAppContextService,
});

Expand Down Expand Up @@ -518,7 +514,6 @@ describe('SecurityWorkflowInsightsService', () => {
securityWorkflowInsightsService.setup({
kibanaVersion: kibanaPackageJson.version,
logger,
isFeatureEnabled: true,
endpointContext: mockEndpointAppContextService,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const DEFAULT_PAGE_SIZE = 10;
interface SetupInterface {
kibanaVersion: string;
logger: Logger;
isFeatureEnabled: boolean;
endpointContext: EndpointAppContextService;
}

Expand All @@ -64,7 +63,6 @@ class SecurityWorkflowInsightsService {
private _isInitialized: Promise<[void, void]> = firstValueFrom(
combineLatest<[void, void]>([this.setup$, this.start$])
);
private isFeatureEnabled = false;

/**
* Lifecycle
Expand All @@ -74,12 +72,7 @@ class SecurityWorkflowInsightsService {
return this._isInitialized;
}

public setup({ kibanaVersion, logger, isFeatureEnabled, endpointContext }: SetupInterface) {
this.isFeatureEnabled = isFeatureEnabled;
if (!isFeatureEnabled) {
return;
}

public setup({ kibanaVersion, logger, endpointContext }: SetupInterface) {
this._logger = logger;
this._endpointContext = endpointContext;

Expand All @@ -94,10 +87,6 @@ class SecurityWorkflowInsightsService {
}

public async start({ esClient, registerDefendInsightsCallback }: StartInterface) {
if (!this.isFeatureEnabled) {
return;
}

this._esClient = esClient;
await firstValueFrom(this.setup$);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@ export class Plugin implements ISecuritySolutionPlugin {
securityWorkflowInsightsService.setup({
kibanaVersion: pluginContext.env.packageInfo.version,
logger: this.logger,
isFeatureEnabled: config.experimentalFeatures.defendInsights,
endpointContext: this.endpointContext.service,
});

Expand Down