[Security solution] Second attempt at 8.8.1 GenAi Connector Feature Flag :) (#158939)

This commit is contained in:
Steph Milovic 2023-06-02 14:26:06 -06:00 committed by GitHub
parent b7064bd537
commit d7df21aada
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 11 deletions

View file

@ -129,6 +129,8 @@ export const allowedExperimentalValues = Object.freeze({
*
**/
newUserDetailsFlyout: false,
/* enables the Security Assistant and generative AI connector (.gen-ai) */
assistantEnabled: false,
});
type ExperimentalConfigKeys = Array<keyof ExperimentalFeatures>;

View file

@ -28,6 +28,7 @@ import { Dataset } from '@kbn/rule-registry-plugin/server';
import type { ListPluginSetup } from '@kbn/lists-plugin/server';
import type { ILicense } from '@kbn/licensing-plugin/server';
import { getConnectorType as getGenerativeAiConnectorType } from '@kbn/stack-connectors-plugin/server/connector_types/gen_ai';
import { getScheduleNotificationResponseActionsService } from './lib/detection_engine/rule_response_actions/schedule_notification_response_actions';
import { siemGuideId, siemGuideConfig } from '../common/guided_onboarding/siem_guide_config';
import {
@ -160,7 +161,9 @@ export class Plugin implements ISecuritySolutionPlugin {
initSavedObjects(core.savedObjects);
initUiSettings(core.uiSettings, experimentalFeatures);
if (experimentalFeatures.assistantEnabled ?? false) {
plugins.actions.registerSubActionConnectorType(getGenerativeAiConnectorType());
}
const ruleExecutionLogService = createRuleExecutionLogService(config, logger, core, plugins);
ruleExecutionLogService.registerEventLogProvider();

View file

@ -17,6 +17,7 @@ import type {
PluginStartContract as AlertingPluginStart,
} from '@kbn/alerting-plugin/server';
import type { CasesStart } from '@kbn/cases-plugin/server';
import type { PluginSetupContract as ActionsPluginSetup } from '@kbn/actions-plugin/server';
import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server';
import type { IEventLogClientService, IEventLogService } from '@kbn/event-log-plugin/server';
import type { PluginSetupContract as FeaturesPluginSetup } from '@kbn/features-plugin/server';
@ -43,6 +44,7 @@ import type { GuidedOnboardingPluginSetup } from '@kbn/guided-onboarding-plugin/
import type { PluginSetup as UnifiedSearchServerPluginSetup } from '@kbn/unified-search-plugin/server';
export interface SecuritySolutionPluginSetupDependencies {
actions: ActionsPluginSetup;
alerting: AlertingPluginSetup;
cloud: CloudSetup;
data: DataPluginSetup;

View file

@ -157,5 +157,6 @@
"@kbn/ecs",
"@kbn/url-state",
"@kbn/field-formats-plugin",
"@kbn/stack-connectors-plugin",
]
}

View file

@ -20,6 +20,7 @@ export function getConnectorType(): GenerativeAiConnector {
return {
id: GEN_AI_CONNECTOR_ID,
iconClass: lazy(() => import('./logo')),
isExperimental: true,
selectMessage: i18n.translate('xpack.stackConnectors.components.genAi.selectMessageText', {
defaultMessage: 'Send a request to generative AI systems.',
}),

View file

@ -17,7 +17,6 @@ import { getTinesConnectorType } from './tines';
import { getActionType as getTorqConnectorType } from './torq';
import { getConnectorType as getEmailConnectorType } from './email';
import { getConnectorType as getIndexConnectorType } from './es_index';
import { getConnectorType as getGenerativeAiConnectorType } from './gen_ai';
import { getConnectorType as getPagerDutyConnectorType } from './pagerduty';
import { getConnectorType as getSwimlaneConnectorType } from './swimlane';
import { getConnectorType as getServerLogConnectorType } from './server_log';
@ -99,5 +98,4 @@ export function registerConnectorTypes({
actions.registerSubActionConnectorType(getOpsgenieConnectorType());
actions.registerSubActionConnectorType(getTinesConnectorType());
actions.registerSubActionConnectorType(getGenerativeAiConnectorType());
}

View file

@ -138,7 +138,7 @@ describe('Stack Connectors Plugin', () => {
name: 'Torq',
})
);
expect(actionsSetup.registerSubActionConnectorType).toHaveBeenCalledTimes(3);
expect(actionsSetup.registerSubActionConnectorType).toHaveBeenCalledTimes(2);
expect(actionsSetup.registerSubActionConnectorType).toHaveBeenNthCalledWith(
1,
expect.objectContaining({
@ -153,13 +153,6 @@ describe('Stack Connectors Plugin', () => {
name: 'Tines',
})
);
expect(actionsSetup.registerSubActionConnectorType).toHaveBeenNthCalledWith(
3,
expect.objectContaining({
id: '.gen-ai',
name: 'Generative AI',
})
);
});
});
});

View file

@ -195,6 +195,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions)
...actionsProxyUrl,
...customHostSettings,
...emailSettings,
`--xpack.securitySolution.enableExperimental=${JSON.stringify(['assistantEnabled'])}`,
'--xpack.eventLog.logEntries=true',
'--xpack.task_manager.ephemeral_tasks.enabled=false',
`--xpack.task_manager.unsafe.exclude_task_types=${JSON.stringify([

View file

@ -31,6 +31,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
...integrationConfig.get('kbnTestServer'),
serverArgs: [
...integrationConfig.get('kbnTestServer.serverArgs'),
`--xpack.securitySolution.enableExperimental=${JSON.stringify(['assistantEnabled'])}`,
'--xpack.eventLog.logEntries=true',
'--xpack.eventLog.indexEntries=true',
'--xpack.task_manager.monitored_aggregated_stats_refresh_rate=5000',