-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solutions][Lists] (Phase 1) Pulls constants from lists and …
…security solutions plugin into its own kbn package (#99149) ## Summary Pulls constants from lists plugin into its own kbn package. Phase 1: Lift and shift small shared constants into kbn package called `kbn-securitysolution-constants` Phase 2: Deprecate existing code now in packages Phase 3+: Strangle/remove existing code and use the code from the kbn package
- Loading branch information
1 parent
6dab2f1
commit 366c16c
Showing
10 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") | ||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") | ||
|
||
PKG_BASE_NAME = "kbn-securitysolution-constants" | ||
|
||
PKG_REQUIRE_NAME = "@kbn/securitysolution-constants" | ||
|
||
SOURCE_FILES = glob( | ||
[ | ||
"src/**/*.ts", | ||
], | ||
exclude = [ | ||
"**/*.test.*", | ||
"**/*.mock.*", | ||
], | ||
) | ||
|
||
SRCS = SOURCE_FILES | ||
|
||
filegroup( | ||
name = "srcs", | ||
srcs = SRCS, | ||
) | ||
|
||
NPM_MODULE_EXTRA_FILES = [ | ||
"package.json", | ||
"README.md", | ||
] | ||
|
||
SRC_DEPS = [ | ||
"@npm//tslib", | ||
] | ||
|
||
TYPES_DEPS = [ | ||
"@npm//@types/jest", | ||
"@npm//@types/node", | ||
] | ||
|
||
DEPS = SRC_DEPS + TYPES_DEPS | ||
|
||
ts_config( | ||
name = "tsconfig", | ||
src = "tsconfig.json", | ||
deps = [ | ||
"//:tsconfig.base.json", | ||
], | ||
) | ||
|
||
ts_project( | ||
name = "tsc", | ||
srcs = SRCS, | ||
args = ["--pretty"], | ||
declaration = True, | ||
declaration_map = True, | ||
incremental = True, | ||
out_dir = "target", | ||
root_dir = "src", | ||
source_map = True, | ||
tsconfig = ":tsconfig", | ||
deps = DEPS, | ||
) | ||
|
||
js_library( | ||
name = PKG_BASE_NAME, | ||
package_name = PKG_REQUIRE_NAME, | ||
srcs = NPM_MODULE_EXTRA_FILES, | ||
visibility = ["//visibility:public"], | ||
deps = [":tsc"] + DEPS, | ||
) | ||
|
||
pkg_npm( | ||
name = "npm_module", | ||
deps = [ | ||
":%s" % PKG_BASE_NAME, | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "build", | ||
srcs = [ | ||
":npm_module", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# kbn-securitysolution-constants | ||
|
||
This is where shared constants for security solution should go that are going to be shared among plugins. | ||
This was originally created to remove the dependencies between security_solution and other projects such as lists. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
module.exports = { | ||
preset: '@kbn/test', | ||
rootDir: '../..', | ||
roots: ['<rootDir>/packages/kbn-securitysolution-constants'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "@kbn/securitysolution-constants", | ||
"version": "1.0.0", | ||
"description": "security solution constants to use across plugins such lists, security_solution, cases, etc...", | ||
"license": "SSPL-1.0 OR Elastic License 2.0", | ||
"main": "./target/index.js", | ||
"types": "./target/index.d.ts", | ||
"private": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
/** | ||
* Value list routes | ||
*/ | ||
export const LIST_URL = '/api/lists'; | ||
export const LIST_INDEX = `${LIST_URL}/index`; | ||
export const LIST_ITEM_URL = `${LIST_URL}/items`; | ||
export const LIST_PRIVILEGES_URL = `${LIST_URL}/privileges`; | ||
|
||
/** | ||
* Exception list routes | ||
*/ | ||
export const EXCEPTION_LIST_URL = '/api/exception_lists'; | ||
export const EXCEPTION_LIST_ITEM_URL = '/api/exception_lists/items'; | ||
|
||
/** | ||
* Exception list spaces | ||
*/ | ||
export const EXCEPTION_LIST_NAMESPACE_AGNOSTIC = 'exception-list-agnostic'; | ||
export const EXCEPTION_LIST_NAMESPACE = 'exception-list'; | ||
|
||
/** | ||
* Specific routes for the single global space agnostic endpoint list | ||
*/ | ||
export const ENDPOINT_LIST_URL = '/api/endpoint_list'; | ||
|
||
/** | ||
* Specific routes for the single global space agnostic endpoint list. These are convenience | ||
* routes where they are going to try and create the global space agnostic endpoint list if it | ||
* does not exist yet or if it was deleted at some point and re-create it before adding items to | ||
* the list | ||
*/ | ||
export const ENDPOINT_LIST_ITEM_URL = '/api/endpoint_list/items'; | ||
|
||
/** | ||
* This ID is used for _both_ the Saved Object ID and for the list_id | ||
* for the single global space agnostic endpoint list | ||
*/ | ||
export const ENDPOINT_LIST_ID = 'endpoint_list'; | ||
|
||
/** The name of the single global space agnostic endpoint list */ | ||
export const ENDPOINT_LIST_NAME = 'Endpoint Security Exception List'; | ||
|
||
/** The description of the single global space agnostic endpoint list */ | ||
export const ENDPOINT_LIST_DESCRIPTION = 'Endpoint Security Exception List'; | ||
|
||
export const MAX_EXCEPTION_LIST_SIZE = 10000; | ||
|
||
/** ID of trusted apps agnostic list */ | ||
export const ENDPOINT_TRUSTED_APPS_LIST_ID = 'endpoint_trusted_apps'; | ||
|
||
/** Name of trusted apps agnostic list */ | ||
export const ENDPOINT_TRUSTED_APPS_LIST_NAME = 'Endpoint Security Trusted Apps List'; | ||
|
||
/** Description of trusted apps agnostic list */ | ||
export const ENDPOINT_TRUSTED_APPS_LIST_DESCRIPTION = 'Endpoint Security Trusted Apps List'; | ||
|
||
/** ID of event filters agnostic list */ | ||
export const ENDPOINT_EVENT_FILTERS_LIST_ID = 'endpoint_event_filters'; | ||
|
||
/** Name of event filters agnostic list */ | ||
export const ENDPOINT_EVENT_FILTERS_LIST_NAME = 'Endpoint Security Event Filters List'; | ||
|
||
/** Description of event filters agnostic list */ | ||
export const ENDPOINT_EVENT_FILTERS_LIST_DESCRIPTION = 'Endpoint Security Event Filters List'; | ||
|
||
/** The default max signals without any additional configuration */ | ||
export const DEFAULT_MAX_SIGNALS = 100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationMap": true, | ||
"incremental": true, | ||
"outDir": "target", | ||
"rootDir": "src", | ||
"sourceMap": true, | ||
"sourceRoot": "../../../../packages/kbn-securitysolution-constants/src", | ||
"types": [ | ||
"jest", | ||
"node" | ||
] | ||
}, | ||
"include": [ | ||
"src/**/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters