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

[Cloud Security] Refactoring cloud-security-posture packages' folder structure #196008

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,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/packages/kbn-cloud-security-posture/public @elastic/kibana-cloud-security-posture
x-pack/packages/kbn-cloud-security-posture/common @elastic/kibana-cloud-security-posture
x-pack/packages/kbn-cloud-security-posture/graph @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
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
16 changes: 15 additions & 1 deletion x-pack/packages/kbn-cloud-security-posture/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,27 @@ 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:
`yarn storybook cloud_security_posture_graph`

Note that all the interactions are mocked.

## Maintainers
# Maintainers

Maintained by the Cloud Security Team
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
Expand Down
4 changes: 2 additions & 2 deletions x-pack/packages/kbn-cloud-security-posture/graph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
],
"kbn_references": [
"@kbn/cloud-security-posture-common",
"@kbn/utility-types"
"@kbn/utility-types",
"@kbn/storybook"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
};
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {
LatestFindingsRequest,
LatestFindingsResponse,
UseCspOptions,
} from '../../type';
} from '../types';

import { useGetCspBenchmarkRulesStatesApi } from './use_get_benchmark_rules_state_api';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
LatestFindingsRequest,
LatestFindingsResponse,
UseCspOptions,
} from '../../type';
} from '../types';
import { useGetCspBenchmarkRulesStatesApi } from './use_get_benchmark_rules_state_api';
import {
buildMisconfigurationsFindingsQuery,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
},
Expand Down Expand Up @@ -35,6 +35,5 @@
"@kbn/ui-theme",
"@kbn/i18n-react",
"@kbn/rison",
"@kbn/storybook",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""

Expand All @@ -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 ""

Expand Down