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

[8.2] [Security solution] [Endpoint] Revisit blocklist wrong labels (#128773) #130063

Merged
merged 1 commit into from
Apr 13, 2022
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
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
securitySolution: {
trustedApps: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/trusted-apps-ov.html`,
eventFilters: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/event-filters.html`,
blocklist: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/blocklist.html`,
},
query: {
eql: `${ELASTICSEARCH_DOCS}eql.html`,
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export interface DocLinks {
readonly securitySolution: {
readonly trustedApps: string;
readonly eventFilters: string;
readonly blocklist: string;
};
readonly query: {
readonly eql: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import React, { memo, useCallback, useEffect, useMemo, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { DocLinks } from '@kbn/doc-links';
import { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
import {
EuiButton,
Expand All @@ -20,6 +21,7 @@ import {
EuiFlyoutHeader,
EuiTitle,
} from '@elastic/eui';

import { EuiFlyoutSize } from '@elastic/eui/src/components/flyout/flyout';
import { HttpFetchError } from 'kibana/public';
import { useUrlParams } from '../../hooks/use_url_params';
Expand All @@ -33,7 +35,7 @@ import {
} from '../types';
import { ManagementPageLoader } from '../../management_page_loader';
import { ExceptionsListApiClient } from '../../../services/exceptions_list/exceptions_list_api_client';
import { useToasts } from '../../../../common/lib/kibana';
import { useKibana, useToasts } from '../../../../common/lib/kibana';
import { createExceptionListItemForCreate } from '../../../../../common/endpoint/service/artifacts/utils';
import { useWithArtifactSubmitData } from '../hooks/use_with_artifact_submit_data';
import { useIsArtifactAllowedPerPolicyUsage } from '../hooks/use_is_artifact_allowed_per_policy_usage';
Expand Down Expand Up @@ -96,7 +98,7 @@ export const ARTIFACT_FLYOUT_LABELS = Object.freeze({
* );
* }
*/
flyoutDowngradedLicenseDocsInfo: (): React.ReactNode =>
flyoutDowngradedLicenseDocsInfo: (_: DocLinks['securitySolution']): React.ReactNode =>
i18n.translate('xpack.securitySolution.artifactListPage.flyoutDowngradedLicenseDocsInfo', {
defaultMessage: 'For more information, see our documentation.',
}),
Expand Down Expand Up @@ -188,6 +190,11 @@ export const ArtifactFlyout = memo<ArtifactFlyoutProps>(
'data-test-subj': dataTestSubj,
size = 'm',
}) => {
const {
docLinks: {
links: { securitySolution },
},
} = useKibana().services;
const getTestId = useTestIdGenerator(dataTestSubj);
const toasts = useToasts();
const isFlyoutOpened = useIsFlyoutOpened();
Expand Down Expand Up @@ -364,7 +371,8 @@ export const ArtifactFlyout = memo<ArtifactFlyoutProps>(
iconType="help"
data-test-subj={getTestId('expiredLicenseCallout')}
>
{`${labels.flyoutDowngradedLicenseInfo} ${labels.flyoutDowngradedLicenseDocsInfo()}`}
{labels.flyoutDowngradedLicenseInfo}{' '}
{labels.flyoutDowngradedLicenseDocsInfo(securitySolution)}
</EuiCallOut>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,122 +8,128 @@
import { i18n } from '@kbn/i18n';
import { BlocklistConditionEntryField } from '@kbn/securitysolution-utils';

export const DETAILS_HEADER = i18n.translate('xpack.securitySolution.blocklists.details.header', {
export const DETAILS_HEADER = i18n.translate('xpack.securitySolution.blocklist.details.header', {
defaultMessage: 'Details',
});

export const DETAILS_HEADER_DESCRIPTION = i18n.translate(
'xpack.securitySolution.blocklists.details.header.description',
'xpack.securitySolution.blocklist.details.header.description',
{
defaultMessage:
'The blocklist prevents selected applications from running on your hosts by extending the list of processes the Endpoint considers malicious.',
}
);

export const NAME_LABEL = i18n.translate('xpack.securitySolution.blocklists.name.label', {
export const NAME_LABEL = i18n.translate('xpack.securitySolution.blocklist.name.label', {
defaultMessage: 'Name',
});

export const DESCRIPTION_LABEL = i18n.translate(
'xpack.securitySolution.blocklists.description.label',
'xpack.securitySolution.blocklist.description.label',
{
defaultMessage: 'Description',
}
);

export const CONDITIONS_HEADER = i18n.translate(
'xpack.securitySolution.blocklists.conditions.header',
'xpack.securitySolution.blocklist.conditions.header',
{
defaultMessage: 'Conditions',
}
);

export const CONDITIONS_HEADER_DESCRIPTION = i18n.translate(
'xpack.securitySolution.blocklists.conditions.header.description',
'xpack.securitySolution.blocklist.conditions.header.description',
{
defaultMessage:
'Select an operating system and add conditions. Availability of conditions may depend on your chosen OS.',
}
);

export const SELECT_OS_LABEL = i18n.translate('xpack.securitySolution.blocklists.os.label', {
export const SELECT_OS_LABEL = i18n.translate('xpack.securitySolution.blocklist.os.label', {
defaultMessage: 'Select operating system',
});

export const FIELD_LABEL = i18n.translate('xpack.securitySolution.blocklists.field.label', {
export const FIELD_LABEL = i18n.translate('xpack.securitySolution.blocklist.field.label', {
defaultMessage: 'Field',
});

export const OPERATOR_LABEL = i18n.translate('xpack.securitySolution.blocklists.operator.label', {
export const OPERATOR_LABEL = i18n.translate('xpack.securitySolution.blocklist.operator.label', {
defaultMessage: 'Operator',
});

export const VALUE_LABEL = i18n.translate('xpack.securitySolution.blocklists.value.label', {
export const VALUE_LABEL = i18n.translate('xpack.securitySolution.blocklist.value.label', {
defaultMessage: 'Value',
});

export const VALUE_LABEL_HELPER = i18n.translate(
'xpack.securitySolution.blocklists.value.label.helper',
'xpack.securitySolution.blocklist.value.label.helper',
{
defaultMessage: 'Type or copy & paste one or multiple comma delimited values',
}
);

export const CONDITION_FIELD_TITLE: { [K in BlocklistConditionEntryField]: string } = {
'file.hash.*': i18n.translate('xpack.securitySolution.blocklists.entry.field.hash', {
'file.hash.*': i18n.translate('xpack.securitySolution.blocklist.entry.field.hash', {
defaultMessage: 'Hash',
}),
'file.path': i18n.translate('xpack.securitySolution.blocklists.entry.field.path', {
'file.path': i18n.translate('xpack.securitySolution.blocklist.entry.field.path', {
defaultMessage: 'Path',
}),
'file.Ext.code_signature': i18n.translate(
'xpack.securitySolution.blocklists.entry.field.signature',
'xpack.securitySolution.blocklist.entry.field.signature',
{ defaultMessage: 'Signature' }
),
};

export const CONDITION_FIELD_DESCRIPTION: { [K in BlocklistConditionEntryField]: string } = {
'file.hash.*': i18n.translate('xpack.securitySolution.blocklists.entry.field.description.hash', {
'file.hash.*': i18n.translate('xpack.securitySolution.blocklist.entry.field.description.hash', {
defaultMessage: 'md5, sha1, or sha256',
}),
'file.path': i18n.translate('xpack.securitySolution.blocklists.entry.field.description.path', {
'file.path': i18n.translate('xpack.securitySolution.blocklist.entry.field.description.path', {
defaultMessage: 'The full path of the application',
}),
'file.Ext.code_signature': i18n.translate(
'xpack.securitySolution.blocklists.entry.field.description.signature',
'xpack.securitySolution.blocklist.entry.field.description.signature',
{ defaultMessage: 'The signer of the application' }
),
};

export const POLICY_SELECT_DESCRIPTION = i18n.translate(
'xpack.securitySolution.blocklists.policyAssignmentSectionDescription',
'xpack.securitySolution.blocklist.policyAssignmentSectionDescription',
{
defaultMessage:
'Assign this blocklist globally across all policies, or assign it to specific policies.',
}
);

export const ERRORS = {
NAME_REQUIRED: i18n.translate('xpack.securitySolution.blocklists.errors.name.required', {
NAME_REQUIRED: i18n.translate('xpack.securitySolution.blocklist.errors.name.required', {
defaultMessage: 'Name is required',
}),
VALUE_REQUIRED: i18n.translate('xpack.securitySolution.blocklists.errors.values.required', {
VALUE_REQUIRED: i18n.translate('xpack.securitySolution.blocklist.errors.values.required', {
defaultMessage: 'Field entry must have a value',
}),
INVALID_HASH: i18n.translate('xpack.securitySolution.blocklists.errors.values.invalidHash', {
INVALID_HASH: i18n.translate('xpack.securitySolution.blocklist.errors.values.invalidHash', {
defaultMessage: 'Invalid hash value',
}),
INVALID_PATH: i18n.translate('xpack.securitySolution.blocklists.warnings.values.invalidPath', {
INVALID_PATH: i18n.translate('xpack.securitySolution.blocklist.warnings.values.invalidPath', {
defaultMessage: 'Path may be formed incorrectly; verify value',
}),
WILDCARD_PRESENT: i18n.translate(
'xpack.securitySolution.blocklist.warnings.values.wildcardPresent',
{
defaultMessage: "A wildcard in the filename will affect the endpoint's performance",
}
),
DUPLICATE_VALUE: i18n.translate(
'xpack.securitySolution.blocklists.warnings.values.duplicateValue',
'xpack.securitySolution.blocklist.warnings.values.duplicateValue',
{
defaultMessage: 'This value already exists',
}
),
DUPLICATE_VALUES: i18n.translate(
'xpack.securitySolution.blocklists.warnings.values.duplicateValues',
'xpack.securitySolution.blocklist.warnings.values.duplicateValues',
{
defaultMessage: 'One or more duplicate values removed',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

import React, { memo } from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { DocLinks } from '@kbn/doc-links';
import { EuiLink } from '@elastic/eui';

import { useHttp } from '../../../../common/lib/kibana';
import { ArtifactListPage, ArtifactListPageProps } from '../../../components/artifact_list_page';
Expand Down Expand Up @@ -48,52 +51,47 @@ const BLOCKLIST_PAGE_LABELS: ArtifactListPageProps['labels'] = {
),
flyoutCreateSubmitSuccess: ({ name }) =>
i18n.translate('xpack.securitySolution.blocklist.flyoutCreateSubmitSuccess', {
defaultMessage: '"{name}" has been added to your blocklist.', // FIXME: match this to design (needs count of items)
defaultMessage: '"{name}" has been added to your blocklist.',
values: { name },
}),
flyoutEditSubmitSuccess: ({ name }) =>
i18n.translate('xpack.securitySolution.blocklist.flyoutEditSubmitSuccess', {
defaultMessage: '"{name}" has been updated.',
values: { name },
}),
flyoutDowngradedLicenseDocsInfo: () => {
return 'tbd...';
// FIXME: define docs link for license downgrade message. sample code below

// const { docLinks } = useKibana().services;
// return (
// <FormattedMessage
// id="some-id-1"
// defaultMessage="For more information, see our {link}."
// value={{
// link: (
// <EuiLink target="_blank" href={`${docLinks.links.securitySolution.eventFilters}`}>
// {' '}
// <FormattedMessage
// id="dome-id-2"
// defaultMessage="Event filters documentation"
// />{' '}
// </EuiLink>
// ),
// }}
// />
// );
flyoutDowngradedLicenseDocsInfo: (
securitySolutionDocsLinks: DocLinks['securitySolution']
): React.ReactNode => {
return (
<>
<FormattedMessage
id="xpack.securitySolution.blocklist.flyoutDowngradedLicenseDocsInfo"
defaultMessage="For more information, see our "
/>
<EuiLink target="_blank" href={`${securitySolutionDocsLinks.blocklist}`}>
<FormattedMessage
id="xpack.securitySolution.blocklist.flyoutDowngradedLicenseDocsLink"
defaultMessage="Blocklist documentation"
/>
</EuiLink>
</>
);
},
deleteActionSuccess: (itemName) =>
i18n.translate('xpack.securitySolution.blocklist.deleteSuccess', {
defaultMessage: '"{itemName}" has been removed from blocklist.',
values: { itemName },
}),
emptyStateTitle: i18n.translate('xpack.securitySolution.blocklist.emptyStateTitle', {
defaultMessage: 'Add your first blocklist',
defaultMessage: 'Add your first blocklist entry',
}),
emptyStateInfo: i18n.translate('xpack.securitySolution.blocklist.emptyStateInfo', {
defaultMessage:
'The blocklist prevents selected applications from running on your hosts by extending the list of processes the Endpoint considers malicious.',
}),
emptyStateInfo: i18n.translate(
'xpack.securitySolution.blocklist.emptyStateInfo',
{ defaultMessage: 'Add a blocklist to prevent execution on the endpoint' } // FIXME: need wording here form PM
),
emptyStatePrimaryButtonLabel: i18n.translate(
'xpack.securitySolution.blocklist.emptyStatePrimaryButtonLabel',
{ defaultMessage: 'Add blocklist' }
{ defaultMessage: 'Add blocklist entry' }
),
searchPlaceholderInfo: i18n.translate('xpack.securitySolution.blocklist.searchPlaceholderInfo', {
defaultMessage: 'Search on the fields below: name, description, value',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const BLOCKLISTS_LABELS = {
),
cardTitle: (
<FormattedMessage
id="xpack.securitySolution.endpoint.blocklists.fleetIntegration.title"
id="xpack.securitySolution.endpoint.blocklist.fleetIntegration.title"
defaultMessage="Blocklist"
/>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const BLOCKLISTS_LABELS = {
}),
cardTitle: (
<FormattedMessage
id="xpack.securitySolution.endpoint.blocklists.fleetIntegration.title"
id="xpack.securitySolution.endpoint.blocklist.fleetIntegration.title"
defaultMessage="Blocklist"
/>
),
Expand Down
Loading