[8.x] [Cloud Security] Refactoring cloud-security-posture packages' folder structure (#196008) (#196267)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Cloud Security] Refactoring cloud-security-posture packages' folder
structure (#196008)](https://github.com/elastic/kibana/pull/196008)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kfir
Peled","email":"61654899+kfirpeled@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-14T14:43:08Z","message":"[Cloud
Security] Refactoring cloud-security-posture packages' folder structure
(#196008)\n\n## Summary\r\n\r\nOrganized the team's packages under the
same root folder\r\n\r\n```\r\n \"@kbn/cloud-security-posture\":
\"link:x-pack/packages/cloud_security_posture/public\",\r\n
\"@kbn/cloud-security-posture-common\":
\"link:x-pack/packages/kbn-cloud-security-posture/common\",\r\n
\"@kbn/cloud-security-posture-graph\":
\"link:x-pack/packages/kbn-cloud-security-posture/graph\",\r\n```\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"96eff23f50f68a161b85d6d05309fa3ea6a287b4","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor"],"number":196008,"url":"https://github.com/elastic/kibana/pull/196008","mergeCommit":{"message":"[Cloud
Security] Refactoring cloud-security-posture packages' folder structure
(#196008)\n\n## Summary\r\n\r\nOrganized the team's packages under the
same root folder\r\n\r\n```\r\n \"@kbn/cloud-security-posture\":
\"link:x-pack/packages/cloud_security_posture/public\",\r\n
\"@kbn/cloud-security-posture-common\":
\"link:x-pack/packages/kbn-cloud-security-posture/common\",\r\n
\"@kbn/cloud-security-posture-graph\":
\"link:x-pack/packages/kbn-cloud-security-posture/graph\",\r\n```\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"96eff23f50f68a161b85d6d05309fa3ea6a287b4"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196008","number":196008,"mergeCommit":{"message":"[Cloud
Security] Refactoring cloud-security-posture packages' folder structure
(#196008)\n\n## Summary\r\n\r\nOrganized the team's packages under the
same root folder\r\n\r\n```\r\n \"@kbn/cloud-security-posture\":
\"link:x-pack/packages/cloud_security_posture/public\",\r\n
\"@kbn/cloud-security-posture-common\":
\"link:x-pack/packages/kbn-cloud-security-posture/common\",\r\n
\"@kbn/cloud-security-posture-graph\":
\"link:x-pack/packages/kbn-cloud-security-posture/graph\",\r\n```\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"96eff23f50f68a161b85d6d05309fa3ea6a287b4"}}]}]
BACKPORT-->
This commit is contained in:
Kfir Peled 2024-10-15 12:51:18 +01:00 committed by GitHub
parent ba5a8fc816
commit 06d98dc490
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
73 changed files with 44 additions and 30 deletions

View file

@ -218,8 +218,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": "link:x-pack/packages/kbn-cloud-security-posture/public",
"@kbn/cloud-security-posture-common": "link:x-pack/packages/kbn-cloud-security-posture/common",
"@kbn/cloud-security-posture-graph": "link:x-pack/packages/kbn-cloud-security-posture/graph",
"@kbn/cloud-security-posture-plugin": "link:x-pack/plugins/cloud_security_posture",
"@kbn/code-editor": "link:packages/shared-ux/code_editor/impl",

View file

@ -174,10 +174,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": ["x-pack/packages/kbn-cloud-security-posture/public"],
"@kbn/cloud-security-posture/*": ["x-pack/packages/kbn-cloud-security-posture/public/*"],
"@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-graph": ["x-pack/packages/kbn-cloud-security-posture/graph"],
"@kbn/cloud-security-posture-graph/*": ["x-pack/packages/kbn-cloud-security-posture/graph/*"],
"@kbn/cloud-security-posture-plugin": ["x-pack/plugins/cloud_security_posture"],

View file

@ -4,6 +4,20 @@ 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
The code is under the `public` folder.
# @kbn/cloud-security-posture-common
Common types of `cloud-security-posture` plugin.
The code is under the `common` folder.
# @kbn/cloud-security-posture-graph
Reusable graph component to present entities' relationships and exploration.
The code is under the `graph` folder.
## Storybook
General look of the component can be checked visually running the following storybook:
@ -11,6 +25,6 @@ General look of the component can be checked visually running the following stor
Note that all the interactions are mocked.
## Maintainers
# Maintainers
Maintained by the Cloud Security Team

View file

@ -7,6 +7,6 @@
module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/x-pack/packages/kbn-cloud-security-posture-common'],
rootDir: '../../../..',
roots: ['<rootDir>/x-pack/packages/kbn-cloud-security-posture/common'],
};

View file

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [

View file

@ -2,12 +2,12 @@
## Motivation
The idea behind this package is to have a reusable graph component, embedding the features available to alerts flyout in
The idea behind this package is to have a reusable graph component, embedding the features available to the alert's flyout in
security solution plugin.
## How to use this
Standalone examples will follow. In the meantime checkout storybook to view the graphs progress.
Standalone examples will follow. In the meantime check out storybook to view the graph's progress.
## The most important public api members

View file

@ -12,6 +12,7 @@
],
"kbn_references": [
"@kbn/cloud-security-posture-common",
"@kbn/utility-types"
"@kbn/utility-types",
"@kbn/storybook"
]
}

View file

@ -5,9 +5,9 @@
* 2.0.
*/
export * from './type';
export * from './constants/component_constants';
export * from './constants/navigation';
export * from './src/types';
export * from './src/constants/component_constants';
export * from './src/constants/navigation';
export type { NavFilter } from './src/hooks/use_navigate_findings';
export { showErrorToast } from './src/utils/show_error_toast';
export { encodeQuery, decodeQuery } from './src/utils/query_utils';

View file

@ -7,6 +7,6 @@
module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/x-pack/packages/kbn-cloud-security-posture'],
rootDir: '../../../..',
roots: ['<rootDir>/x-pack/packages/kbn-cloud-security-posture/public'],
};

View file

@ -9,7 +9,7 @@ import React from 'react';
import { EuiBadge, type EuiBadgeProps } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { css } from '@emotion/react';
import { statusColors } from '../../constants/component_constants';
import { statusColors } from '../constants/component_constants';
interface Props {
type?: 'passed' | 'failed';

View file

@ -15,7 +15,7 @@ import type {
LatestFindingsRequest,
LatestFindingsResponse,
UseCspOptions,
} from '../../type';
} from '../types';
import { useGetCspBenchmarkRulesStatesApi } from './use_get_benchmark_rules_state_api';
import {

View file

@ -14,7 +14,7 @@ import type {
LatestFindingsRequest,
LatestFindingsResponse,
UseCspOptions,
} from '../../type';
} from '../types';
import { useGetCspBenchmarkRulesStatesApi } from './use_get_benchmark_rules_state_api';
import {
buildMisconfigurationsFindingsQuery,

View file

@ -14,7 +14,7 @@ import {
} from '@kbn/cloud-security-posture-common';
import type { CoreStart } from '@kbn/core/public';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { findingsNavigation } from '../../constants/navigation';
import { findingsNavigation } from '../constants/navigation';
import { useDataView } from './use_data_view';
import { CspClientPluginStartDeps } from '../..';
import { encodeQuery } from '../utils/query_utils';

View file

@ -16,7 +16,7 @@ import {
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest';
import type { CoreStart } from '@kbn/core/public';
import type { CspClientPluginStartDeps, UseCspOptions } from '../../type';
import type { CspClientPluginStartDeps, UseCspOptions } from '../types';
import { showErrorToast } from '../..';
import { getVulnerabilitiesAggregationCount, getVulnerabilitiesQuery } from '../utils/hooks_utils';

View file

@ -16,7 +16,7 @@ import {
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest';
import type { CoreStart } from '@kbn/core/public';
import type { CspClientPluginStartDeps, UseCspOptions } from '../../type';
import type { CspClientPluginStartDeps, UseCspOptions } from '../types';
import { showErrorToast } from '../..';
import { getVulnerabilitiesAggregationCount, getVulnerabilitiesQuery } from '../utils/hooks_utils';

View file

@ -13,7 +13,7 @@ import {
} from '@kbn/cloud-security-posture-common';
import type { CspBenchmarkRulesStates } from '@kbn/cloud-security-posture-common/schema/rules/latest';
import { buildMutedRulesFilter } from '@kbn/cloud-security-posture-common';
import type { UseCspOptions } from '../../type';
import type { UseCspOptions } from '../types';
const MISCONFIGURATIONS_SOURCE_FIELDS = ['result.*', 'rule.*', 'resource.*'];
interface AggregationBucket {

View file

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
},
@ -35,6 +35,5 @@
"@kbn/ui-theme",
"@kbn/i18n-react",
"@kbn/rison",
"@kbn/storybook",
]
}

View file

@ -10,7 +10,7 @@ import {
KSPM_POLICY_TEMPLATE,
CLOUD_SECURITY_POSTURE_BASE_PATH,
} from '@kbn/cloud-security-posture-common';
import { NAV_ITEMS_NAMES } from '@kbn/cloud-security-posture/constants/navigation';
import { NAV_ITEMS_NAMES } from '@kbn/cloud-security-posture/src/constants/navigation';
import { CNVM_POLICY_TEMPLATE } from '../../../common/constants';
import type { CspBenchmarksPage, CspPage, CspPageNavigationItem } from './types';

View file

@ -3639,7 +3639,7 @@
version "0.0.0"
uid ""
"@kbn/cloud-security-posture-common@link:x-pack/packages/kbn-cloud-security-posture-common":
"@kbn/cloud-security-posture-common@link:x-pack/packages/kbn-cloud-security-posture/common":
version "0.0.0"
uid ""
@ -3651,7 +3651,7 @@
version "0.0.0"
uid ""
"@kbn/cloud-security-posture@link:x-pack/packages/kbn-cloud-security-posture":
"@kbn/cloud-security-posture@link:x-pack/packages/kbn-cloud-security-posture/public":
version "0.0.0"
uid ""