Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Serverless][Security Solution][Endpoint] Restrict endpoint exceptions on serverless via plugin sub-features #164107

Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
e41200e
poc
semd Aug 11, 2023
54b4b6a
Merge remote-tracking branch 'upstream/main' into poc/extract_kibana_…
semd Aug 11, 2023
70c0ac6
some fixes
semd Aug 12, 2023
86ac364
fix capability name
semd Aug 12, 2023
aefb49c
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Aug 12, 2023
779a41b
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 12, 2023
89c8f9d
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine Aug 12, 2023
011f919
Merge remote-tracking branch 'upstream/main' into poc/extract_kibana_…
YulNaumenko Aug 15, 2023
e5aa367
gate endpoint exceptions for non-endpoint PLIs
ashokaditya Aug 16, 2023
6995d6e
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
ashokaditya Aug 17, 2023
d55b9c8
fix tests
ashokaditya Aug 17, 2023
ced8b80
Merge branch 'task/dw-serverless-endpoint-exceptions-pli-with-plugin-…
ashokaditya Aug 17, 2023
c57a3ce
fix test
ashokaditya Aug 17, 2023
d6c32e9
fix imports
ashokaditya Aug 17, 2023
c454c0f
fix test
ashokaditya Aug 17, 2023
44f0f62
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 17, 2023
966ab0c
Merge remote-tracking branch 'upstream/main' into task/dw-serverless-…
YulNaumenko Aug 21, 2023
a8c0e50
Fixed tests and added security assistant
YulNaumenko Aug 21, 2023
81bedeb
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 21, 2023
b3f853b
fix missing configurator error
ashokaditya Aug 21, 2023
e4b3d6c
fix type check
ashokaditya Aug 21, 2023
4c844c9
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
ashokaditya Aug 21, 2023
186df52
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
YulNaumenko Aug 22, 2023
db955bd
changed rules links capabilities to default
YulNaumenko Aug 22, 2023
16e8a34
fix type error
ashokaditya Aug 22, 2023
0c72a02
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 22, 2023
8ca4ccf
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
ashokaditya Aug 22, 2023
e8e1cdc
fix
ashokaditya Aug 22, 2023
211f58b
revert type changes for now
ashokaditya Aug 22, 2023
1562d5c
remove redundant package inclusion
ashokaditya Aug 22, 2023
df5a06a
Merge remote-tracking branch 'upstream/main' into task/dw-serverless-…
YulNaumenko Aug 23, 2023
ea18c84
fixed unit tests and type check
YulNaumenko Aug 23, 2023
5a7d3ae
updated limits
YulNaumenko Aug 23, 2023
1efedad
fixed unit test server
YulNaumenko Aug 23, 2023
160742c
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
YulNaumenko Aug 23, 2023
06ed066
fix test
ashokaditya Aug 23, 2023
761f291
Cleanup - Delete old app_features folder
machadoum Aug 23, 2023
5a6b3ec
Cleanup - Delete rule test sample code
machadoum Aug 23, 2023
ec4287f
fix type
ashokaditya Aug 23, 2023
157fe3b
cleanup unused ts directives
ashokaditya Aug 23, 2023
3dd8ea7
fix
ashokaditya Aug 23, 2023
3699dcb
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
ashokaditya Aug 23, 2023
1a48700
rename
ashokaditya Aug 24, 2023
47412a8
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
ashokaditya Aug 25, 2023
944743c
cleanup
ashokaditya Aug 25, 2023
d2196bd
fix manage_list cypress test
ashokaditya Aug 25, 2023
97d4dee
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
YulNaumenko Aug 26, 2023
d616d13
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
machadoum Aug 28, 2023
e2c9ebc
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
ashokaditya Aug 28, 2023
5b08c02
small improvements
semd Aug 28, 2023
21e8f77
Fix manage_lists cypress test
machadoum Aug 28, 2023
48d6d2e
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
kibanamachine Aug 28, 2023
79e19a5
app features configs relocation to package
semd Aug 28, 2023
43f4c1d
fix mock
semd Aug 28, 2023
619266f
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 28, 2023
ebf07ff
translations
semd Aug 28, 2023
94d31c4
fix circular dependency
semd Aug 28, 2023
594d65d
Merge remote-tracking branch 'upstream/main' into task/dw-serverless-…
semd Aug 28, 2023
5c93286
split package exports for optimization
semd Aug 28, 2023
4119d61
distinguish type from enum and fix imports
ashokaditya Aug 29, 2023
abdf0e9
remove unused param
ashokaditya Aug 29, 2023
e246ddc
fix missing arguments in `register upselling` test
ashokaditya Aug 29, 2023
cc2c630
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
ashokaditya Aug 29, 2023
f058869
Merge branch 'main' into task/dw-serverless-endpoint-exceptions-pli-w…
ashokaditya Aug 29, 2023
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
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,7 @@ module.exports = {
overrides: [
{
files: [
'x-pack/packages/security-solution/features/**/*.{js,mjs,ts,tsx}',
'x-pack/packages/security-solution/navigation/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/security_solution/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/security_solution_ess/**/*.{js,mjs,ts,tsx}',
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ x-pack/plugins/searchprofiler @elastic/platform-deployment-management
x-pack/test/security_api_integration/packages/helpers @elastic/kibana-security
x-pack/plugins/security @elastic/kibana-security
x-pack/plugins/security_solution_ess @elastic/security-solution
x-pack/packages/security-solution/features @elastic/security-threat-hunting-explore
x-pack/test/cases_api_integration/common/plugins/security_solution @elastic/response-ops
x-pack/packages/security-solution/navigation @elastic/security-threat-hunting-explore
x-pack/plugins/security_solution @elastic/security-solution
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@
"@kbn/searchprofiler-plugin": "link:x-pack/plugins/searchprofiler",
"@kbn/security-plugin": "link:x-pack/plugins/security",
"@kbn/security-solution-ess": "link:x-pack/plugins/security_solution_ess",
"@kbn/security-solution-features": "link:x-pack/packages/security-solution/features",
"@kbn/security-solution-fixtures-plugin": "link:x-pack/test/cases_api_integration/common/plugins/security_solution",
"@kbn/security-solution-navigation": "link:x-pack/packages/security-solution/navigation",
"@kbn/security-solution-plugin": "link:x-pack/plugins/security_solution",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pageLoadAssetSize:
security: 81771
securitySolution: 66738
securitySolutionEss: 16573
securitySolutionServerless: 40000
securitySolutionServerless: 45000
serverless: 16573
serverlessObservability: 68747
serverlessSearch: 71995
Expand Down
20 changes: 20 additions & 0 deletions packages/kbn-utility-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,23 @@ export type ArrayElement<A> = A extends ReadonlyArray<infer T> ? T : never;
export type WithRequiredProperty<Type, Key extends keyof Type> = Omit<Type, Key> & {
[Property in Key]-?: Type[Property];
};

// Recursive partial object type. inspired by EUI RecursivePartial
export type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends NonAny[]
? T[P]
: T[P] extends readonly NonAny[]
? T[P]
: T[P] extends Array<infer U>
? Array<RecursivePartial<U>>
: T[P] extends ReadonlyArray<infer U>
? ReadonlyArray<RecursivePartial<U>>
: T[P] extends Set<infer V>
? Set<RecursivePartial<V>>
: T[P] extends Map<infer K, infer V>
? Map<K, RecursivePartial<V>>
: T[P] extends NonAny
? T[P]
: RecursivePartial<T[P]>;
};
type NonAny = number | boolean | string | symbol | null;
8 changes: 7 additions & 1 deletion src/plugins/files/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
* Side Public License, v 1.
*/

export { FILE_SO_TYPE, PLUGIN_ID, PLUGIN_NAME, ES_FIXED_SIZE_INDEX_BLOB_STORE } from './constants';
export {
PLUGIN_ID,
PLUGIN_NAME,
ES_FIXED_SIZE_INDEX_BLOB_STORE,
FILE_SO_TYPE,
FILE_SHARE_SO_TYPE,
} from './constants';

export type {
File,
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,8 @@
"@kbn/security-plugin/*": ["x-pack/plugins/security/*"],
"@kbn/security-solution-ess": ["x-pack/plugins/security_solution_ess"],
"@kbn/security-solution-ess/*": ["x-pack/plugins/security_solution_ess/*"],
"@kbn/security-solution-features": ["x-pack/packages/security-solution/features"],
"@kbn/security-solution-features/*": ["x-pack/packages/security-solution/features/*"],
"@kbn/security-solution-fixtures-plugin": ["x-pack/test/cases_api_integration/common/plugins/security_solution"],
"@kbn/security-solution-fixtures-plugin/*": ["x-pack/test/cases_api_integration/common/plugins/security_solution/*"],
"@kbn/security-solution-navigation": ["x-pack/packages/security-solution/navigation"],
Expand Down
4 changes: 4 additions & 0 deletions x-pack/packages/security-solution/features/README.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Security Solution App Features

This package provides resources to be used for Security Solution app features

20 changes: 20 additions & 0 deletions x-pack/packages/security-solution/features/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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.
*/
export { AppFeaturesPrivileges } from './src/app_features_privileges';
export { ASSISTANT_FEATURE_ID, CASES_FEATURE_ID } from './src/constants';
export * from './src/app_features_keys';
export * from './src/types';

export { getSecurityFeature } from './src/security';
export { getCasesFeature } from './src/cases';
export { getAssistantFeature } from './src/assistant';

export { securityDefaultAppFeaturesConfig } from './src/security/app_feature_config';
export { getCasesDefaultAppFeaturesConfig } from './src/cases/app_feature_config';
export { assistantDefaultAppFeaturesConfig } from './src/assistant/app_feature_config';

export { createEnabledAppFeaturesConfigMap } from './src/helpers';
12 changes: 12 additions & 0 deletions x-pack/packages/security-solution/features/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/x-pack/packages/security-solution/features'],
};
5 changes: 5 additions & 0 deletions x-pack/packages/security-solution/features/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/security-solution-features",
"owner": "@elastic/security-threat-hunting-explore"
}
6 changes: 6 additions & 0 deletions x-pack/packages/security-solution/features/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@kbn/security-solution-features",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,60 +6,48 @@
*/

export enum AppFeatureSecurityKey {
/**
* Enables Advanced Insights (Entity Risk, GenAI)
*/
/** Enables Advanced Insights (Entity Risk, GenAI) */
advancedInsights = 'advanced_insights',

/**
* Enables Investigation guide in Timeline
*/
investigationGuide = 'investigation_guide',

/**
* Enables access to the Endpoint List and associated views that allows management of hosts
* running endpoint security
*/
endpointHostManagement = 'endpoint_host_management',

/**
* Enables endpoint policy views that enables user to manage endpoint security policies
*/
endpointPolicyManagement = 'endpoint_policy_management',

/**
* Enables Endpoint Policy protections (like Malware, Ransomware, etc)
*/
endpointPolicyProtections = 'endpoint_policy_protections',

/**
* Enables management of all endpoint related artifacts (ex. Trusted Applications, Event Filters,
* Host Isolation Exceptions, Blocklist.
*/
endpointArtifactManagement = 'endpoint_artifact_management',

/**
* Enables all of endpoint's supported response actions - like host isolation, file operations,
* process operations, command execution, etc.
*/
endpointResponseActions = 'endpoint_response_actions',

/**
* Enables Threat Intelligence
*/
threatIntelligence = 'threat-intelligence',

/**
* Enables Osquery Response Actions
*/
osqueryAutomatedResponseActions = 'osquery_automated_response_actions',
}

export enum AppFeatureAssistantKey {
/**
* Enables Elastic AI Assistant
* Enables managing endpoint exceptions on rules and alerts
*/
assistant = 'assistant',
endpointExceptions = 'endpointExceptions',
}

export enum AppFeatureCasesKey {
Expand All @@ -69,14 +57,46 @@ export enum AppFeatureCasesKey {
casesConnectors = 'cases_connectors',
}

// Merges the two enums.
export type AppFeatureKey = AppFeatureSecurityKey | AppFeatureCasesKey | AppFeatureAssistantKey;
export type AppFeatureKeys = AppFeatureKey[];
export enum AppFeatureAssistantKey {
/**
* Enables Elastic AI Assistant
*/
assistant = 'assistant',
}

// We need to merge the value and the type and export both to replicate how enum works.
// Merges the two enums.
export const AppFeatureKey = {
...AppFeatureSecurityKey,
...AppFeatureCasesKey,
...AppFeatureAssistantKey,
};
// We need to merge the value and the type and export both to replicate how enum works.
export type AppFeatureKey = AppFeatureSecurityKey | AppFeatureCasesKey | AppFeatureAssistantKey;

export const ALL_APP_FEATURE_KEYS = Object.freeze(Object.values(AppFeatureKey));

/** Sub-features IDs for Security */
export enum SecuritySubFeatureId {
endpointList = 'endpointListSubFeature',
endpointExceptions = 'endpointExceptionsSubFeature',
trustedApplications = 'trustedApplicationsSubFeature',
hostIsolationExceptions = 'hostIsolationExceptionsSubFeature',
blocklist = 'blocklistSubFeature',
eventFilters = 'eventFiltersSubFeature',
policyManagement = 'policyManagementSubFeature',
responseActionsHistory = 'responseActionsHistorySubFeature',
hostIsolation = 'hostIsolationSubFeature',
processOperations = 'processOperationsSubFeature',
fileOperations = 'fileOperationsSubFeature',
executeAction = 'executeActionSubFeature',
}

/** Sub-features IDs for Cases */
export enum CasesSubFeatureId {
deleteCases = 'deleteCasesSubFeature',
}

/** Sub-features IDs for Security Assistant */
export enum AssistantSubFeatureId {
createConversation = 'createConversationSubFeature',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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 { APP_ID } from './constants';

export enum AppFeaturesPrivilegeId {
endpointExceptions = 'endpoint_exceptions',
}

/**
* This is the mapping of the privileges that are registered
* using a different Kibana feature configuration (sub-feature, main feature privilege, etc)
* in each offering type (ess, serverless)
*/
export const AppFeaturesPrivileges = {
[AppFeaturesPrivilegeId.endpointExceptions]: {
all: {
ui: ['showEndpointExceptions', 'crudEndpointExceptions'],
api: [`${APP_ID}-showEndpointExceptions`, `${APP_ID}-crudEndpointExceptions`],
},
read: {
ui: ['showEndpointExceptions'],
api: [`${APP_ID}-showEndpointExceptions`],
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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 type { AssistantSubFeatureId } from '../app_features_keys';
import { AppFeatureAssistantKey } from '../app_features_keys';
import type { AppFeatureKibanaConfig } from '../types';

/**
* App features privileges configuration for the Security Assistant Kibana Feature app.
* These are the configs that are shared between both offering types (ess and serverless).
* They can be extended on each offering plugin to register privileges using different way on each offering type.
*
* Privileges can be added in different ways:
* - `privileges`: the privileges that will be added directly into the main Security feature.
* - `subFeatureIds`: the ids of the sub-features that will be added into the Security subFeatures entry.
* - `subFeaturesPrivileges`: the privileges that will be added into the existing Security subFeature with the privilege `id` specified.
*/
export const assistantDefaultAppFeaturesConfig: Record<
AppFeatureAssistantKey,
AppFeatureKibanaConfig<AssistantSubFeatureId>
> = {
[AppFeatureAssistantKey.assistant]: {
privileges: {
all: {
ui: ['ai-assistant'],
},
},
},
};
19 changes: 19 additions & 0 deletions x-pack/packages/security-solution/features/src/assistant/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* 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 type { AssistantSubFeatureId } from '../app_features_keys';
import type { AppFeatureParams } from '../types';
import { getAssistantBaseKibanaFeature } from './kibana_features';
import {
getAssistantBaseKibanaSubFeatureIds,
assistantSubFeaturesMap,
} from './kibana_sub_features';

export const getAssistantFeature = (): AppFeatureParams<AssistantSubFeatureId> => ({
baseKibanaFeature: getAssistantBaseKibanaFeature(),
baseKibanaSubFeatureIds: getAssistantBaseKibanaSubFeatureIds(),
subFeaturesMap: assistantSubFeaturesMap,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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 { i18n } from '@kbn/i18n';

import { DEFAULT_APP_CATEGORIES } from '@kbn/core-application-common';
import { type BaseKibanaFeatureConfig } from '../types';
import { APP_ID, ASSISTANT_FEATURE_ID } from '../constants';

export const getAssistantBaseKibanaFeature = (): BaseKibanaFeatureConfig => ({
id: ASSISTANT_FEATURE_ID,
name: i18n.translate(
'xpack.securitySolution.featureRegistry.linkSecuritySolutionAssistantTitle',
{
defaultMessage: 'Elastic AI Assistant',
}
),
order: 1100,
category: DEFAULT_APP_CATEGORIES.security,
app: [ASSISTANT_FEATURE_ID, 'kibana'],
catalogue: [APP_ID],
minimumLicense: 'enterprise',
privileges: {
all: {
api: [],
app: [ASSISTANT_FEATURE_ID, 'kibana'],
catalogue: [APP_ID],
savedObject: {
all: [],
read: [],
},
ui: [],
},
read: {
// No read-only mode currently supported
disabled: true,
savedObject: {
all: [],
read: [],
},
ui: [],
},
},
});
Loading