Skip to content

Commit 03fad3f

Browse files
authored
[Cloud Security] CloudSetup component integrated with Cloud Asset Discovery (#231343)
1 parent d391e02 commit 03fad3f

File tree

94 files changed

+2110
-7355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2110
-7355
lines changed

x-pack/platform/plugins/private/translations/translations/de-DE.json

Lines changed: 117 additions & 122 deletions
Large diffs are not rendered by default.

x-pack/platform/plugins/private/translations/translations/fr-FR.json

Lines changed: 118 additions & 123 deletions
Large diffs are not rendered by default.

x-pack/platform/plugins/private/translations/translations/ja-JP.json

Lines changed: 120 additions & 125 deletions
Large diffs are not rendered by default.

x-pack/platform/plugins/private/translations/translations/zh-CN.json

Lines changed: 120 additions & 125 deletions
Large diffs are not rendered by default.

x-pack/solutions/security/packages/kbn-cloud-security-posture/common/constants.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
import type { VulnSeverity } from './types/vulnerabilities';
88
import type { MisconfigurationEvaluationStatus } from './types/misconfigurations';
99

10+
export const ORGANIZATION_ACCOUNT = 'organization-account';
11+
export const SINGLE_ACCOUNT = 'single-account';
12+
export const AZURE_SINGLE_ACCOUNT = SINGLE_ACCOUNT;
13+
export const AZURE_ORGANIZATION_ACCOUNT = ORGANIZATION_ACCOUNT;
14+
export const AWS_SINGLE_ACCOUNT = SINGLE_ACCOUNT;
15+
export const AWS_ORGANIZATION_ACCOUNT = ORGANIZATION_ACCOUNT;
16+
export const GCP_SINGLE_ACCOUNT = SINGLE_ACCOUNT;
17+
export const GCP_ORGANIZATION_ACCOUNT = ORGANIZATION_ACCOUNT;
18+
1019
export const KSPM_POLICY_TEMPLATE = 'kspm';
1120
export const CSPM_POLICY_TEMPLATE = 'cspm';
1221
export const CDR_LATEST_NATIVE_MISCONFIGURATIONS_INDEX_ALIAS =

x-pack/solutions/security/packages/kbn-cloud-security-posture/common/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ export {
4848
getFindingsDetectionRuleSearchTags,
4949
} from './rules/detection_rules';
5050
export type { RuleResponse } from './rules/rule';
51+
export * from './test_subjects';
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
export const AWS_PROVIDER_TEST_SUBJ = 'cloudSetupAwsTestId';
9+
export const AWS_CLOUD_FORMATION_ACCORDION_TEST_SUBJ =
10+
'launchAwsCloudFormationAccordianInstructions';
11+
export const AWS_LAUNCH_CLOUD_FORMATION_TEST_SUBJ = 'launchCloudFormationAgentlessButton';
12+
export const AWS_CREDENTIALS_TYPE_SELECTOR_TEST_SUBJ = 'aws-credentials-type-selector';
13+
export const AWS_CREDENTIALS_TYPE_OPTIONS_TEST_SUBJECTS = {
14+
CLOUDFORMATION: 'aws-cloudformation-setup-option',
15+
MANUAL: 'aws-manual-setup-option',
16+
};
17+
18+
export const AWS_ORGANIZATION_ACCOUNT_TEST_SUBJ = 'awsOrganizationTestId';
19+
export const AWS_SINGLE_ACCOUNT_TEST_SUBJ = 'awsSingleTestId';
20+
21+
export const AWS_INPUT_TEST_SUBJECTS = {
22+
ROLE_ARN: 'awsRoleArnInput',
23+
DIRECT_ACCESS_KEY_ID: 'awsDirectAccessKeyId',
24+
DIRECT_ACCESS_SECRET_KEY: 'passwordInput-secret-access-key',
25+
TEMP_ACCESS_KEY_ID: 'awsTemporaryKeysAccessKeyId',
26+
TEMP_ACCESS_SECRET_KEY: 'passwordInput-secret-access-key',
27+
TEMP_ACCESS_SESSION_TOKEN: 'awsTemporaryKeysSessionToken',
28+
SHARED_CREDENTIALS_FILE: 'awsSharedCredentialFile',
29+
SHARED_CREDENTIALS_PROFILE_NAME: 'awsCredentialProfileName',
30+
};
31+
32+
export const GCP_PROVIDER_TEST_SUBJ = 'cloudSetupGcpTestId';
33+
export const GCP_ORGANIZATION_ACCOUNT_TEST_SUBJ = 'gcpOrganizationAccountTestId';
34+
export const GCP_SINGLE_ACCOUNT_TEST_SUBJ = 'gcpSingleAccountTestId';
35+
36+
export const GCP_INPUT_FIELDS_TEST_SUBJECTS = {
37+
GOOGLE_CLOUD_SHELL_SETUP: 'google_cloud_shell_setup_test_id',
38+
PROJECT_ID: 'project_id_test_id',
39+
ORGANIZATION_ID: 'organization_id_test_id',
40+
CREDENTIALS_TYPE: 'credentials_type_test_id',
41+
CREDENTIALS_FILE: 'credentials_file_test_id',
42+
CREDENTIALS_JSON: 'textAreaInput-credentials-json',
43+
CREDENTIALS_JSON_SECRET_PANEL: 'credentials_json_secret_panel_test_id',
44+
};
45+
46+
export const GCP_CREDENTIALS_TYPE_OPTIONS_TEST_SUBJECTS = {
47+
CLOUD_SHELL: 'gcpGoogleCloudShellOptionTestId',
48+
MANUAL: 'gcpManualOptionTestId',
49+
};
50+
51+
export const AZURE_PROVIDER_TEST_SUBJ = 'cloudSetupAzureTestId';
52+
export const AZURE_ORGANIZATION_ACCOUNT_TEST_SUBJ = 'azureOrganizationAccountTestId';
53+
export const AZURE_SINGLE_ACCOUNT_TEST_SUBJ = 'azureSingleAccountTestId';
54+
export const AZURE_CREDENTIALS_TYPE_SELECTOR_TEST_SUBJ = 'azure-credentials-type-selector';
55+
56+
export const AZURE_SETUP_FORMAT_TEST_SUBJECTS = {
57+
ARM_TEMPLATE: 'cloudSetupAzureArmTemplate',
58+
MANUAL: 'cloudSetupAzureManual',
59+
};
60+
61+
export const AZURE_INPUT_FIELDS_TEST_SUBJECTS = {
62+
TENANT_ID: 'cloudSetupAzureTenantId',
63+
CLIENT_ID: 'cloudSetupAzureClientId',
64+
CLIENT_SECRET: 'passwordInput-client-secret',
65+
CLIENT_CERTIFICATE_PATH: 'cloudSetupAzureClientCertificatePath',
66+
CLIENT_CERTIFICATE_PASSWORD: 'passwordInput-client-certificate-password',
67+
CLIENT_USERNAME: 'cloudSetupAzureClientUsername',
68+
CLIENT_PASSWORD: 'cloudSetupAzureClientPassword',
69+
};
70+
71+
export const ADVANCED_OPTION_ACCORDION_TEST_SUBJ = 'advancedOptionsAccordion';
72+
export const NAMESPACE_INPUT_TEST_SUBJ = 'namespaceInputTestId';

x-pack/solutions/security/packages/kbn-cloud-security-posture/public/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77

88
export type * from './src/types';
99
export * from './src/constants/navigation';
10-
export {
11-
AWS_ORGANIZATION_ACCOUNT,
12-
AWS_SINGLE_ACCOUNT,
13-
GCP_ORGANIZATION_ACCOUNT,
14-
GCP_SINGLE_ACCOUNT,
15-
} from './src/components/fleet_extensions/constants';
10+
1611
export type { CloudSetupConfig } from './src/components/fleet_extensions/types';
1712
export type { NavFilter } from './src/utils/query_utils';
1813
export { showErrorToast } from './src/utils/show_error_toast';

x-pack/solutions/security/packages/kbn-cloud-security-posture/public/src/components/fleet_extensions/aws_credentials_form/aws_account_type_selector.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import React from 'react';
88
import { render, screen, waitFor } from '@testing-library/react';
99
import userEvent from '@testing-library/user-event';
1010
import { I18nProvider } from '@kbn/i18n-react';
11+
import { AWS_ORGANIZATION_ACCOUNT, AWS_SINGLE_ACCOUNT } from '@kbn/cloud-security-posture-common';
1112
import { AwsAccountTypeSelect } from './aws_account_type_selector';
12-
import { AWS_ORGANIZATION_ACCOUNT, AWS_SINGLE_ACCOUNT } from '../constants';
1313
import { useCloudSetup } from '../hooks/use_cloud_setup_context';
1414
import type {
1515
NewPackagePolicy,

x-pack/solutions/security/packages/kbn-cloud-security-posture/public/src/components/fleet_extensions/aws_credentials_form/aws_account_type_selector.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@ import type { NewPackagePolicyInput, PackageInfo } from '@kbn/fleet-plugin/commo
1111
import type { NewPackagePolicy } from '@kbn/fleet-plugin/public';
1212
import { EuiCallOut, EuiSpacer, EuiText } from '@elastic/eui';
1313
import { FormattedMessage } from '@kbn/i18n-react';
14+
import {
15+
AWS_ORGANIZATION_ACCOUNT_TEST_SUBJ,
16+
AWS_SINGLE_ACCOUNT_TEST_SUBJ,
17+
AWS_ORGANIZATION_ACCOUNT,
18+
AWS_SINGLE_ACCOUNT,
19+
} from '@kbn/cloud-security-posture-common';
1420
import { updatePolicyWithInputs } from '../utils';
1521
import type { CspRadioGroupProps } from '../../csp_boxed_radio_group';
1622
import { RadioGroup } from '../../csp_boxed_radio_group';
1723
import type { AwsAccountType, UpdatePolicy } from '../types';
18-
import { AWS_ORGANIZATION_ACCOUNT, AWS_SINGLE_ACCOUNT } from '../constants';
1924
import { useCloudSetup } from '../hooks/use_cloud_setup_context';
2025

2126
const getAwsAccountType = (input: NewPackagePolicyInput): AwsAccountType | undefined =>
@@ -25,31 +30,31 @@ const getAwsAccountTypeOptions = (isAwsOrgDisabled: boolean): CspRadioGroupProps
2530
{
2631
id: AWS_ORGANIZATION_ACCOUNT,
2732
label: i18n.translate(
28-
'securitySolutionPackages.fleetIntegration.awsAccountType.awsOrganizationLabel',
33+
'securitySolutionPackages.cloudSecurityPosture.cloudSetup.aws.accountType.organizationLabel',
2934
{
3035
defaultMessage: 'AWS Organization',
3136
}
3237
),
3338
disabled: isAwsOrgDisabled,
3439
tooltip: isAwsOrgDisabled
3540
? i18n.translate(
36-
'securitySolutionPackages.fleetIntegration.awsAccountType.awsOrganizationDisabledTooltip',
41+
'securitySolutionPackages.cloudSecurityPosture.cloudSetup.aws.accountType.organizationDisabledTooltip',
3742
{
3843
defaultMessage: 'Supported from integration version 1.5.0 and above',
3944
}
4045
)
4146
: undefined,
42-
testId: 'awsOrganizationTestId',
47+
testId: AWS_ORGANIZATION_ACCOUNT_TEST_SUBJ,
4348
},
4449
{
4550
id: AWS_SINGLE_ACCOUNT,
4651
label: i18n.translate(
47-
'securitySolutionPackages.fleetIntegration.awsAccountType.singleAccountLabel',
52+
'securitySolutionPackages.cloudSecurityPosture.cloudSetup.aws.accountType.singleAccountLabel',
4853
{
4954
defaultMessage: 'Single Account',
5055
}
5156
),
52-
testId: 'awsSingleTestId',
57+
testId: AWS_SINGLE_ACCOUNT_TEST_SUBJ,
5358
},
5459
];
5560

@@ -66,7 +71,7 @@ export const AwsAccountTypeSelect = ({
6671
packageInfo: PackageInfo;
6772
disabled: boolean;
6873
}) => {
69-
const { awsOrganizationEnabled, awsPolicyType } = useCloudSetup();
74+
const { awsOrganizationEnabled, awsPolicyType, shortName } = useCloudSetup();
7075

7176
const awsAccountTypeOptions = useMemo(
7277
() => getAwsAccountTypeOptions(!awsOrganizationEnabled),
@@ -97,7 +102,7 @@ export const AwsAccountTypeSelect = ({
97102
<>
98103
<EuiText color="subdued" size="s">
99104
<FormattedMessage
100-
id="securitySolutionPackages.fleetIntegration.awsAccountTypeDescriptionLabel"
105+
id="securitySolutionPackages.cloudSecurityPosture.cloudSetup.aws.accountType.descriptionLabel"
101106
defaultMessage="Select between single account or organization, and then fill in the name and description to help identify this integration."
102107
/>
103108
</EuiText>
@@ -106,7 +111,7 @@ export const AwsAccountTypeSelect = ({
106111
<>
107112
<EuiCallOut color="warning">
108113
<FormattedMessage
109-
id="securitySolutionPackages.fleetIntegration.awsAccountType.awsOrganizationNotSupportedMessage"
114+
id="securitySolutionPackages.cloudSecurityPosture.cloudSetup.aws.accountType.awsOrganizationNotSupportedMessage"
110115
defaultMessage="AWS Organization not supported in current integration version. Please upgrade to the latest version to enable AWS Organizations integration."
111116
/>
112117
</EuiCallOut>
@@ -135,7 +140,7 @@ export const AwsAccountTypeSelect = ({
135140
<EuiSpacer size="l" />
136141
<EuiText color="subdued" size="s">
137142
<FormattedMessage
138-
id="securitySolutionPackages.fleetIntegration.awsAccountType.awsOrganizationDescription"
143+
id="securitySolutionPackages.cloudSecurityPosture.cloudSetup.aws.accountType.awsOrganizationDescription"
139144
defaultMessage="Connect Elastic to every AWS Account (current and future) in your environment by providing Elastic with read-only (configuration) access to your AWS organization."
140145
/>
141146
</EuiText>
@@ -146,8 +151,9 @@ export const AwsAccountTypeSelect = ({
146151
<EuiSpacer size="l" />
147152
<EuiText color="subdued" size="s">
148153
<FormattedMessage
149-
id="securitySolutionPackages.fleetIntegration.awsAccountType.singleAccountDescription"
150-
defaultMessage="Deploying to a single account is suitable for an initial POC. To ensure complete coverage, it is strongly recommended to deploy CSPM at the organization-level, which automatically connects all accounts (both current and future)."
154+
id="securitySolutionPackages.cloudSecurityPosture.cloudSetup.aws.accountType.singleAccountDescription"
155+
defaultMessage="Deploying to a single account is suitable for an initial POC. To ensure complete coverage, it is strongly recommended to deploy {shortName} at the organization-level, which automatically connects all accounts (both current and future)."
156+
values={{ shortName }}
151157
/>
152158
</EuiText>
153159
</>

0 commit comments

Comments
 (0)