From 77ad05ec8f94dcc4d67b3f3ec2a42b184dae0597 Mon Sep 17 00:00:00 2001 From: Rickyanto Ang Date: Tue, 20 Aug 2024 14:50:12 -0700 Subject: [PATCH] [Cloud Security] Misconfiguration preview & Refactor CSP Plugin to include new package PHASE 1 (#190832) ## Summary The previous [PR ](https://github.com/elastic/kibana/pull/190105) was way too big and made it hard to review without missing any bugs or potential bugs, Thus we decided we are going to make series of smaller PR to make things more manageable We will be splitting it into 4 PR Phase 1: Creating empty packages for csp and csp-common Phase 2: Move Types from CSP plugin to the Package + Deleting duplicates in the CSP plugin where possible Phase 3: Move Functions, Utils or Helpers, Hooks to Package Phase 4: Misconfiguration Preview feature (with Cypress test and other required test) This is Phase 1 of the initiative --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .github/CODEOWNERS | 2 ++ package.json | 2 ++ tsconfig.base.json | 4 ++++ x-pack/.i18nrc.json | 6 +++++- .../packages/kbn-cloud-security-posture-common/README.md | 9 +++++++++ .../kbn-cloud-security-posture-common/kibana.jsonc | 6 ++++++ .../kbn-cloud-security-posture-common/package.json | 7 +++++++ x-pack/packages/kbn-cloud-security-posture/README.md | 9 +++++++++ x-pack/packages/kbn-cloud-security-posture/kibana.jsonc | 5 +++++ x-pack/packages/kbn-cloud-security-posture/package.json | 7 +++++++ yarn.lock | 8 ++++++++ 11 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 x-pack/packages/kbn-cloud-security-posture-common/README.md create mode 100644 x-pack/packages/kbn-cloud-security-posture-common/kibana.jsonc create mode 100644 x-pack/packages/kbn-cloud-security-posture-common/package.json create mode 100644 x-pack/packages/kbn-cloud-security-posture/README.md create mode 100644 x-pack/packages/kbn-cloud-security-posture/kibana.jsonc create mode 100644 x-pack/packages/kbn-cloud-security-posture/package.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c3cab77ee695..7bd95ba51601 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -87,6 +87,8 @@ x-pack/plugins/cloud_integrations/cloud_full_story @elastic/kibana-core x-pack/test/cloud_integration/plugins/saml_provider @elastic/kibana-core x-pack/plugins/cloud_integrations/cloud_links @elastic/kibana-core x-pack/plugins/cloud @elastic/kibana-core +x-pack/packages/kbn-cloud-security-posture @elastic/kibana-cloud-security-posture +x-pack/packages/kbn-cloud-security-posture-common @elastic/kibana-cloud-security-posture x-pack/plugins/cloud_security_posture @elastic/kibana-cloud-security-posture packages/shared-ux/code_editor/impl @elastic/appex-sharedux packages/shared-ux/code_editor/mocks @elastic/appex-sharedux diff --git a/package.json b/package.json index 97af92f92c67..f1782572d764 100644 --- a/package.json +++ b/package.json @@ -211,6 +211,8 @@ "@kbn/cloud-integration-saml-provider-plugin": "link:x-pack/test/cloud_integration/plugins/saml_provider", "@kbn/cloud-links-plugin": "link:x-pack/plugins/cloud_integrations/cloud_links", "@kbn/cloud-plugin": "link:x-pack/plugins/cloud", + "@kbn/cloud-security-posture": "link:x-pack/packages/kbn-cloud-security-posture", + "@kbn/cloud-security-posture-common": "link:x-pack/packages/kbn-cloud-security-posture-common", "@kbn/cloud-security-posture-plugin": "link:x-pack/plugins/cloud_security_posture", "@kbn/code-editor": "link:packages/shared-ux/code_editor/impl", "@kbn/code-editor-mock": "link:packages/shared-ux/code_editor/mocks", diff --git a/tsconfig.base.json b/tsconfig.base.json index d063f6a88044..a94e45a8c5f2 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -168,6 +168,10 @@ "@kbn/cloud-links-plugin/*": ["x-pack/plugins/cloud_integrations/cloud_links/*"], "@kbn/cloud-plugin": ["x-pack/plugins/cloud"], "@kbn/cloud-plugin/*": ["x-pack/plugins/cloud/*"], + "@kbn/cloud-security-posture": ["x-pack/packages/kbn-cloud-security-posture"], + "@kbn/cloud-security-posture/*": ["x-pack/packages/kbn-cloud-security-posture/*"], + "@kbn/cloud-security-posture-common": ["x-pack/packages/kbn-cloud-security-posture-common"], + "@kbn/cloud-security-posture-common/*": ["x-pack/packages/kbn-cloud-security-posture-common/*"], "@kbn/cloud-security-posture-plugin": ["x-pack/plugins/cloud_security_posture"], "@kbn/cloud-security-posture-plugin/*": ["x-pack/plugins/cloud_security_posture/*"], "@kbn/code-editor": ["packages/shared-ux/code_editor/impl"], diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 7ff0f3e3ef76..97a7a92c93b5 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -22,7 +22,11 @@ "xpack.cloudDefend": "plugins/cloud_defend", "xpack.cloudLinks": "plugins/cloud_integrations/cloud_links", "xpack.cloudDataMigration": "plugins/cloud_integrations/cloud_data_migration", - "xpack.csp": "plugins/cloud_security_posture", + "xpack.csp": [ + "plugins/cloud_security_posture", + "packages/kbn-cloud-security-posture-common", + "packages/kbn-cloud-security-posture" + ], "xpack.customBranding": "plugins/custom_branding", "xpack.dashboard": "plugins/dashboard_enhanced", "xpack.dataQuality": "plugins/data_quality", diff --git a/x-pack/packages/kbn-cloud-security-posture-common/README.md b/x-pack/packages/kbn-cloud-security-posture-common/README.md new file mode 100644 index 000000000000..8f4b7fb4be9d --- /dev/null +++ b/x-pack/packages/kbn-cloud-security-posture-common/README.md @@ -0,0 +1,9 @@ +# @kbn/cloud-security-posture-common + +This package provides common code consumed in both the browser, i.e. the +`packages/kbn-cloud-security-posture` package and `plugins/cloud_security_posture` plugin, and on the server, i.e. the +`plugins/cloud_security_posture` plugin. + +## Maintainers + +Maintained by the Cloud Security Team \ No newline at end of file diff --git a/x-pack/packages/kbn-cloud-security-posture-common/kibana.jsonc b/x-pack/packages/kbn-cloud-security-posture-common/kibana.jsonc new file mode 100644 index 000000000000..21721cfb69f4 --- /dev/null +++ b/x-pack/packages/kbn-cloud-security-posture-common/kibana.jsonc @@ -0,0 +1,6 @@ + +{ + "id": "@kbn/cloud-security-posture-common", + "owner": "@elastic/kibana-cloud-security-posture", + "type": "shared-common" + } \ No newline at end of file diff --git a/x-pack/packages/kbn-cloud-security-posture-common/package.json b/x-pack/packages/kbn-cloud-security-posture-common/package.json new file mode 100644 index 000000000000..9010e267fe5d --- /dev/null +++ b/x-pack/packages/kbn-cloud-security-posture-common/package.json @@ -0,0 +1,7 @@ +{ + "name": "@kbn/cloud-security-posture-common", + "private": true, + "version": "1.0.0", + "license": "Elastic License 2.0", + "description": "Shared components for cloud security posture, both client and server side" + } \ No newline at end of file diff --git a/x-pack/packages/kbn-cloud-security-posture/README.md b/x-pack/packages/kbn-cloud-security-posture/README.md new file mode 100644 index 000000000000..204ff85e41a4 --- /dev/null +++ b/x-pack/packages/kbn-cloud-security-posture/README.md @@ -0,0 +1,9 @@ +# @kbn/cloud-security-posture + +This package includes +- Hooks that's used on Flyout component that's used in Alerts page on Security Solution Plugins as well as components on CSP plugin +- Utilities and types thats used for the Hooks above as well as in CSP plugins + +## Maintainers + +Maintained by the Cloud Security Team \ No newline at end of file diff --git a/x-pack/packages/kbn-cloud-security-posture/kibana.jsonc b/x-pack/packages/kbn-cloud-security-posture/kibana.jsonc new file mode 100644 index 000000000000..4c5a4f1f0165 --- /dev/null +++ b/x-pack/packages/kbn-cloud-security-posture/kibana.jsonc @@ -0,0 +1,5 @@ +{ + "id": "@kbn/cloud-security-posture", + "owner": "@elastic/kibana-cloud-security-posture", + "type": "shared-browser" +} \ No newline at end of file diff --git a/x-pack/packages/kbn-cloud-security-posture/package.json b/x-pack/packages/kbn-cloud-security-posture/package.json new file mode 100644 index 000000000000..c9d9081d1b6b --- /dev/null +++ b/x-pack/packages/kbn-cloud-security-posture/package.json @@ -0,0 +1,7 @@ +{ + "name": "@kbn/cloud-security-posture", + "private": true, + "version": "1.0.0", + "license": "Elastic License 2.0", + "description": "Shared components for cloud security posture, client side" +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 0c90c13c9349..20fdce284bbc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3628,10 +3628,18 @@ version "0.0.0" uid "" +"@kbn/cloud-security-posture-common@link:x-pack/packages/kbn-cloud-security-posture-common": + version "0.0.0" + uid "" + "@kbn/cloud-security-posture-plugin@link:x-pack/plugins/cloud_security_posture": version "0.0.0" uid "" +"@kbn/cloud-security-posture@link:x-pack/packages/kbn-cloud-security-posture": + version "0.0.0" + uid "" + "@kbn/cloud@link:packages/cloud": version "0.0.0" uid ""