[Cloud Security] Fix integrations getting started doc links (#191087)

This commit is contained in:
Jordan 2024-08-26 17:03:53 +03:00 committed by GitHub
parent b144c05e8f
commit 110ec27668
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 60 additions and 50 deletions

View file

@ -7,13 +7,7 @@
import { i18n } from '@kbn/i18n';
import { CSPM_POLICY_TEMPLATE, KSPM_POLICY_TEMPLATE } from '../../../common/constants';
import { PosturePolicyTemplate } from '../../../common/types_old';
import type {
CspBenchmarksPage,
CspIntegrationDocNavigationItem,
CspPage,
CspPageNavigationItem,
} from './types';
import type { CspBenchmarksPage, CspPage, CspPageNavigationItem } from './types';
const NAV_ITEMS_NAMES = {
DASHBOARD: i18n.translate('xpack.csp.navigation.dashboardNavItemLabel', {
@ -116,10 +110,7 @@ export const findingsNavigation = {
const ELASTIC_BASE_SHORT_URL = 'https://ela.st';
export const cspIntegrationDocsNavigation: Record<
PosturePolicyTemplate,
CspIntegrationDocNavigationItem
> = {
export const cspIntegrationDocsNavigation = {
kspm: {
overviewPath: `${ELASTIC_BASE_SHORT_URL}/${KSPM_POLICY_TEMPLATE}`,
getStartedPath: `${ELASTIC_BASE_SHORT_URL}/${KSPM_POLICY_TEMPLATE}-get-started`,
@ -127,5 +118,8 @@ export const cspIntegrationDocsNavigation: Record<
cspm: {
overviewPath: `${ELASTIC_BASE_SHORT_URL}/${CSPM_POLICY_TEMPLATE}`,
getStartedPath: `${ELASTIC_BASE_SHORT_URL}/${CSPM_POLICY_TEMPLATE}-get-started`,
awsGetStartedPath: `https://www.elastic.co/guide/en/security/current/cspm-get-started.html`,
gcpGetStartedPath: `https://www.elastic.co/guide/en/security/current/cspm-get-started-gcp.html`,
azureGetStartedPath: `https://www.elastic.co/guide/en/security/current/cspm-get-started-azure.html`,
},
};

View file

@ -35,8 +35,3 @@ export type CloudSecurityPosturePageId =
| 'cloud_security_posture-findings'
| 'cloud_security_posture-benchmarks'
| 'cloud_security_posture-benchmarks-rules';
export interface CspIntegrationDocNavigationItem {
overviewPath: string;
getStartedPath: string;
}

View file

@ -216,7 +216,7 @@ export const AwsCredentialsForm = ({
setupFormat,
group,
fields,
integrationLink,
elasticDocLink,
hasCloudFormationTemplate,
onSetupFormatChange,
} = useAwsCredentialsForm({
@ -237,7 +237,7 @@ export const AwsCredentialsForm = ({
defaultMessage="Utilize AWS CloudFormation (a built-in AWS tool) or a series of manual steps to set up and deploy CSPM for assessing your AWS environment's security posture. Refer to our {gettingStartedLink} guide for details."
values={{
gettingStartedLink: (
<EuiLink href={integrationLink} target="_blank">
<EuiLink href={elasticDocLink} target="_blank">
<FormattedMessage
id="xpack.csp.awsIntegration.gettingStarted.setupInfoContentLink"
defaultMessage="Getting Started"
@ -281,7 +281,7 @@ export const AwsCredentialsForm = ({
<EuiSpacer size="m" />
{group.info}
<EuiSpacer size="m" />
<ReadDocumentation url={integrationLink} />
<ReadDocumentation url={elasticDocLink} />
<EuiSpacer size="l" />
<AwsInputVarFields
fields={fields}

View file

@ -184,7 +184,7 @@ export const AwsCredentialsFormAgentless = ({
const options = getAwsCredentialsFormOptions();
const group = options[awsCredentialsType];
const fields = getInputVarsFields(input, group.fields);
const integrationLink = cspIntegrationDocsNavigation.cspm.getStartedPath;
const documentationLink = cspIntegrationDocsNavigation.cspm.awsGetStartedPath;
const accountType = input?.streams?.[0].vars?.['aws.account_type']?.value ?? SINGLE_ACCOUNT;
const isValidSemantic = semverValid(packageInfo.version);
@ -209,7 +209,7 @@ export const AwsCredentialsFormAgentless = ({
defaultMessage="Utilize AWS Access Keys to set up and deploy CSPM for assessing your AWS environment's security posture. Refer to our {gettingStartedLink} guide for details."
values={{
gettingStartedLink: (
<EuiLink href={integrationLink} target="_blank">
<EuiLink href={documentationLink} target="_blank">
<FormattedMessage
id="xpack.csp.awsIntegration.gettingStarted.setupInfoContentLink"
defaultMessage="Getting Started"
@ -283,7 +283,7 @@ export const AwsCredentialsFormAgentless = ({
updatePolicy(getPosturePolicy(newPolicy, input.type, { [key]: { value } }));
}}
/>
<ReadDocumentation url={integrationLink} />
<ReadDocumentation url={documentationLink} />
</>
);
};

View file

@ -87,7 +87,7 @@ export const useAwsCredentialsForm = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [setupFormat, input.type]);
const integrationLink = cspIntegrationDocsNavigation.cspm.getStartedPath;
const elasticDocLink = cspIntegrationDocsNavigation.cspm.awsGetStartedPath;
useCloudFormationTemplate({
packageInfo,
@ -136,7 +136,7 @@ export const useAwsCredentialsForm = ({
setupFormat,
group,
fields,
integrationLink,
elasticDocLink,
hasCloudFormationTemplate,
onSetupFormatChange,
};

View file

@ -38,7 +38,7 @@ import { CIS_AZURE_SETUP_FORMAT_TEST_SUBJECTS } from '../../test_subjects';
import { AZURE_CREDENTIALS_TYPE_SELECTOR_TEST_SUBJ } from '../../test_subjects';
interface AzureSetupInfoContentProps {
integrationLink: string;
documentationLink: string;
}
export type SetupFormat = typeof AZURE_SETUP_FORMAT.ARM_TEMPLATE | typeof AZURE_SETUP_FORMAT.MANUAL;
@ -58,7 +58,7 @@ export const AZURE_CREDENTIALS_TYPE = {
MANAGED_IDENTITY: 'managed_identity',
} as const;
export const AzureSetupInfoContent = ({ integrationLink }: AzureSetupInfoContentProps) => {
export const AzureSetupInfoContent = ({ documentationLink }: AzureSetupInfoContentProps) => {
return (
<>
<EuiHorizontalRule margin="xl" />
@ -74,13 +74,13 @@ export const AzureSetupInfoContent = ({ integrationLink }: AzureSetupInfoContent
<EuiText color="subdued" size="s">
<FormattedMessage
id="xpack.csp.azureIntegration.gettingStarted.setupInfoContent"
defaultMessage="Utilize an Azure Resource Manager (ARM) template (a built-in Azure IaC tool) or a series of manual steps to set up and deploy CSPM for assessing your Azure environment's security posture. Refer to our {gettingStartedLink} for details."
defaultMessage="Utilize an Azure Resource Manager (ARM) template (a built-in Azure IaC tool) or a series of manual steps to set up and deploy CSPM for assessing your Azure environment's security posture. Refer to our {gettingStartedLink} guide for details."
values={{
gettingStartedLink: (
<EuiLink href={integrationLink} target="_blank">
<EuiLink href={documentationLink} target="_blank">
<FormattedMessage
id="xpack.csp.azureIntegration.gettingStarted.setupInfoContentLink"
defaultMessage="Getting Started guide"
defaultMessage="Getting Started"
/>
</EuiLink>
),
@ -221,19 +221,19 @@ const AzureCredentialTypeSelector = ({
</EuiFormRow>
);
const TemporaryManualSetup = ({ integrationLink }: { integrationLink: string }) => {
const TemporaryManualSetup = ({ documentationLink }: { documentationLink: string }) => {
return (
<>
<EuiText color="subdued" size="s">
<FormattedMessage
id="xpack.csp.azureIntegration.manualCredentialType.instructions"
defaultMessage="Ensure the agent is deployed on a resource that supports managed identities (e.g., Azure Virtual Machines). No explicit credentials need to be provided; Azure handles the authentication. Refer to our {gettingStartedLink} for details."
defaultMessage="Ensure the agent is deployed on a resource that supports managed identities (e.g., Azure Virtual Machines). No explicit credentials need to be provided; Azure handles the authentication. Refer to our {gettingStartedLink} guide for details."
values={{
gettingStartedLink: (
<EuiLink href={integrationLink} target="_blank">
<EuiLink href={documentationLink} target="_blank">
<FormattedMessage
id="xpack.csp.azureIntegration.gettingStarted.setupInfoContentLink"
defaultMessage="Getting Started guide"
defaultMessage="Getting Started"
/>
</EuiLink>
),
@ -356,7 +356,7 @@ export const AzureCredentialsForm = ({
azureCredentialsType,
setupFormat,
onSetupFormatChange,
integrationLink,
documentationLink,
hasArmTemplateUrl,
} = useAzureCredentialsForm({
newPolicy,
@ -410,7 +410,7 @@ export const AzureCredentialsForm = ({
return (
<>
<AzureSetupInfoContent integrationLink={integrationLink} />
<AzureSetupInfoContent documentationLink={documentationLink} />
<EuiSpacer size="l" />
<RadioGroup
disabled={disabled}
@ -426,7 +426,7 @@ export const AzureCredentialsForm = ({
<ArmTemplateSetup hasArmTemplateUrl={hasArmTemplateUrl} input={input} />
)}
{setupFormat === AZURE_SETUP_FORMAT.MANUAL && !isPackageVersionValidForManualFields && (
<TemporaryManualSetup integrationLink={integrationLink} />
<TemporaryManualSetup documentationLink={documentationLink} />
)}
{setupFormat === AZURE_SETUP_FORMAT.MANUAL && isPackageVersionValidForManualFields && (
<>

View file

@ -31,14 +31,14 @@ export const AzureCredentialsFormAgentless = ({
updatePolicy,
packageInfo,
}: AzureCredentialsFormProps) => {
const integrationLink = cspIntegrationDocsNavigation.cspm.getStartedPath;
const documentationLink = cspIntegrationDocsNavigation.cspm.azureGetStartedPath;
const options = getAzureCredentialsFormOptions();
const group = options[AZURE_CREDENTIALS_TYPE.SERVICE_PRINCIPAL_WITH_CLIENT_SECRET];
const fields = getInputVarsFields(input, group.fields);
return (
<>
<AzureSetupInfoContent integrationLink={integrationLink} />
<AzureSetupInfoContent documentationLink={documentationLink} />
<EuiSpacer size="l" />
<AzureInputVarFields
packageInfo={packageInfo}

View file

@ -137,7 +137,7 @@ export const useAzureCredentialsForm = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [setupFormat, input.type]);
const integrationLink = cspIntegrationDocsNavigation.cspm.getStartedPath;
const documentationLink = cspIntegrationDocsNavigation.cspm.azureGetStartedPath;
useUpdateAzureArmTemplate({
packageInfo,
@ -183,7 +183,7 @@ export const useAzureCredentialsForm = ({
setupFormat,
group,
fields,
integrationLink,
documentationLink,
hasArmTemplateUrl,
onSetupFormatChange,
};

View file

@ -15,6 +15,7 @@ import {
EuiForm,
EuiFormRow,
EuiHorizontalRule,
EuiLink,
EuiLoadingSpinner,
EuiSelect,
EuiSpacer,
@ -74,14 +75,34 @@ export const GCPSetupInfoContent = ({ isAgentless }: { isAgentless: boolean }) =
<FormattedMessage
id="xpack.csp.gcpIntegration.agentlessSetupInfoContent"
defaultMessage="The integration will need elevated access to run some CIS benchmark rules.You can follow these
step-by-step instructions to generate the necessary credentials."
step-by-step instructions to generate the necessary credentials. Refer to our {gettingStartedLink} guide for details."
values={{
gettingStartedLink: (
<EuiLink href={cspIntegrationDocsNavigation.cspm.gcpGetStartedPath} target="_blank">
<FormattedMessage
id="xpack.csp.azureIntegration.gettingStarted.agentlessSetupInfoContentLink"
defaultMessage="Getting Started"
/>
</EuiLink>
),
}}
/>
) : (
<FormattedMessage
id="xpack.csp.gcpIntegration.setupInfoContent"
defaultMessage="The integration will need elevated access to run some CIS benchmark rules. Select your preferred
method of providing the GCP credentials this integration will use. You can follow these
step-by-step instructions to generate the necessary credentials."
step-by-step instructions to generate the necessary credentials. Refer to our {gettingStartedLink} guide for details."
values={{
gettingStartedLink: (
<EuiLink href={cspIntegrationDocsNavigation.cspm.gcpGetStartedPath} target="_blank">
<FormattedMessage
id="xpack.csp.azureIntegration.gettingStarted.setupInfoContentLink"
defaultMessage="Getting Started"
/>
</EuiLink>
),
}}
/>
)}
</EuiText>
@ -510,7 +531,7 @@ export const GcpCredentialsForm = ({
)}
<EuiSpacer size="s" />
<ReadDocumentation url={cspIntegrationDocsNavigation.cspm.getStartedPath} />
<ReadDocumentation url={cspIntegrationDocsNavigation.cspm.gcpGetStartedPath} />
<EuiSpacer />
</>
);

View file

@ -252,7 +252,7 @@ export const GcpCredentialsFormAgentless = ({
packageInfo={packageInfo}
/>
<EuiSpacer size="s" />
<ReadDocumentation url={cspIntegrationDocsNavigation.cspm.getStartedPath} />
<ReadDocumentation url={cspIntegrationDocsNavigation.cspm.gcpGetStartedPath} />
<EuiSpacer />
</>
);

View file

@ -917,7 +917,7 @@ describe('<CspPolicyTemplateForm />', () => {
expect(getByText('Getting Started')).toHaveAttribute(
'href',
'https://ela.st/cspm-get-started'
'https://www.elastic.co/guide/en/security/current/cspm-get-started.html'
);
});
@ -934,7 +934,7 @@ describe('<CspPolicyTemplateForm />', () => {
expect(getByTestId('externalLink')).toHaveAttribute(
'href',
'https://ela.st/cspm-get-started'
'https://www.elastic.co/guide/en/security/current/cspm-get-started.html'
);
});
@ -1224,7 +1224,10 @@ describe('<CspPolicyTemplateForm />', () => {
<WrappedComponent newPolicy={policy} packageInfo={getMockPackageInfoCspmGCP()} />
);
expect(getByText('documentation')).toHaveAttribute('href', 'https://ela.st/cspm-get-started');
expect(getByText('documentation')).toHaveAttribute(
'href',
'https://www.elastic.co/guide/en/security/current/cspm-get-started-gcp.html'
);
});
it(`renders Google Cloud Shell forms when Setup Access is set to Google Cloud Shell`, () => {

View file

@ -14452,7 +14452,6 @@
"xpack.csp.gcpIntegration.projectidFieldLabel": "ID de projet",
"xpack.csp.gcpIntegration.setupFormatOptions.googleCloudShell": "Google Cloud Shell",
"xpack.csp.gcpIntegration.setupFormatOptions.manual": "Manuel",
"xpack.csp.gcpIntegration.setupInfoContent": "L'intégration nécessitera des droits d'accès supérieurs pour l'exécution de certaines règles CIS Benchmarks. Sélectionnez votre méthode préférée pour la fourniture d'informations d'identification Google Cloud que cette intégration utilisera. Vous pouvez suivre ces instructions détaillées pour générer les informations d'identification nécessaires.",
"xpack.csp.gcpIntegration.setupInfoContentTitle": "Configurer l'accès",
"xpack.csp.grouping.loadingGroupPanelTitle": "Chargement",
"xpack.csp.grouping.nullGroupTooltip": "Le champ {groupingTitle} sélectionné, {field}, a une valeur manquante de {unit} pour ce groupe.",

View file

@ -14441,7 +14441,6 @@
"xpack.csp.gcpIntegration.projectidFieldLabel": "プロジェクト ID",
"xpack.csp.gcpIntegration.setupFormatOptions.googleCloudShell": "Google Cloud Shell",
"xpack.csp.gcpIntegration.setupFormatOptions.manual": "手動",
"xpack.csp.gcpIntegration.setupInfoContent": "この統合では、一部のCISベンチマークルールを実行するために昇格されたアクセス権が必要です。この統合で使用するGCP資格情報を提供するための任意の方法を選択します。これらの段階的な手順に従い、必要な資格情報を作成できます。",
"xpack.csp.gcpIntegration.setupInfoContentTitle": "アクセスの設定",
"xpack.csp.grouping.loadingGroupPanelTitle": "読み込み中",
"xpack.csp.grouping.nullGroupTooltip.groupingTitle": "グループ分けの条件",

View file

@ -14463,7 +14463,6 @@
"xpack.csp.gcpIntegration.projectidFieldLabel": "项目 ID",
"xpack.csp.gcpIntegration.setupFormatOptions.googleCloudShell": "Google Cloud Shell",
"xpack.csp.gcpIntegration.setupFormatOptions.manual": "手动",
"xpack.csp.gcpIntegration.setupInfoContent": "该集成需要提升访问权限才能运行某些 CIS 基准规则。选择提供此集成将使用的 GCP 凭据的首选方法。您可以按照这些分步说明生成所需凭据。",
"xpack.csp.gcpIntegration.setupInfoContentTitle": "设置访问权限",
"xpack.csp.grouping.loadingGroupPanelTitle": "正在加载",
"xpack.csp.grouping.nullGroupTooltip": "选定 {groupingTitle} 字段 {field} 缺少此 {unit} 组的值。",