+
+
+ {i18n.translate(
+ 'exceptionList-components.wildcardWithWrongOperatorCallout.changeTheOperator',
+ { defaultMessage: 'Change the operator' }
+ )}
+
+ ),
+ matches: (
+
+ {i18n.translate(
+ 'exceptionList-components.wildcardWithWrongOperatorCallout.matches',
+ { defaultMessage: 'matches' }
+ )}
+
+ ),
+ }}
+ />
+
+
+ );
+};
diff --git a/packages/kbn-securitysolution-exception-list-components/tsconfig.json b/packages/kbn-securitysolution-exception-list-components/tsconfig.json
index 988ad42191b7..b3df3a2aa208 100644
--- a/packages/kbn-securitysolution-exception-list-components/tsconfig.json
+++ b/packages/kbn-securitysolution-exception-list-components/tsconfig.json
@@ -19,6 +19,7 @@
"@kbn/securitysolution-autocomplete",
"@kbn/ui-theme",
"@kbn/i18n",
+ "@kbn/i18n-react",
],
"exclude": [
"target/**/*",
diff --git a/packages/kbn-securitysolution-utils/src/path_validations/index.test.ts b/packages/kbn-securitysolution-utils/src/path_validations/index.test.ts
index f877683caec1..4cb502c1e921 100644
--- a/packages/kbn-securitysolution-utils/src/path_validations/index.test.ts
+++ b/packages/kbn-securitysolution-utils/src/path_validations/index.test.ts
@@ -11,6 +11,7 @@ import {
hasSimpleExecutableName,
OperatingSystem,
ConditionEntryField,
+ hasWildcardAndInvalidOperator,
validatePotentialWildcardInput,
validateFilePathInput,
validateWildcardInput,
@@ -128,6 +129,21 @@ describe('validateFilePathInput', () => {
});
});
+describe('Wildcard and invalid operator', () => {
+ it('should return TRUE when operator is not "WILDCARD" and value contains a wildcard', () => {
+ expect(hasWildcardAndInvalidOperator({ operator: 'match', value: 'asdf*' })).toEqual(true);
+ });
+ it('should return FALSE when operator is not "WILDCARD" and value does not contain a wildcard', () => {
+ expect(hasWildcardAndInvalidOperator({ operator: 'match', value: 'asdf' })).toEqual(false);
+ });
+ it('should return FALSE when operator is "WILDCARD" and value contains a wildcard', () => {
+ expect(hasWildcardAndInvalidOperator({ operator: 'wildcard', value: 'asdf*' })).toEqual(false);
+ });
+ it('should return FALSE when operator is "WILDCARD" and value does not contain a wildcard', () => {
+ expect(hasWildcardAndInvalidOperator({ operator: 'wildcard', value: 'asdf' })).toEqual(false);
+ });
+});
+
describe('No Warnings', () => {
it('should not show warnings on non path entries ', () => {
expect(
diff --git a/packages/kbn-securitysolution-utils/src/path_validations/index.ts b/packages/kbn-securitysolution-utils/src/path_validations/index.ts
index b2ae2d9fbceb..761321ba9497 100644
--- a/packages/kbn-securitysolution-utils/src/path_validations/index.ts
+++ b/packages/kbn-securitysolution-utils/src/path_validations/index.ts
@@ -106,6 +106,20 @@ export const validateWildcardInput = (value?: string): string | undefined => {
}
};
+export const hasWildcardAndInvalidOperator = ({
+ operator,
+ value,
+}: {
+ operator: EntryTypes | TrustedAppEntryTypes;
+ value: string;
+}): boolean => {
+ if (operator !== 'wildcard' && validateWildcardInput(value)) {
+ return true;
+ } else {
+ return false;
+ }
+};
+
export const hasSimpleExecutableName = ({
os,
type,
diff --git a/x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/artifact_confirm_modal.tsx b/x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/artifact_confirm_modal.tsx
new file mode 100644
index 000000000000..be44d16e3dc2
--- /dev/null
+++ b/x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/artifact_confirm_modal.tsx
@@ -0,0 +1,68 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+import React, { memo } from 'react';
+import {
+ EuiButton,
+ EuiButtonEmpty,
+ EuiModal,
+ EuiModalBody,
+ EuiModalFooter,
+ EuiModalHeader,
+ EuiModalHeaderTitle,
+ EuiText,
+} from '@elastic/eui';
+import { useTestIdGenerator } from '../../../hooks/use_test_id_generator';
+
+interface ConfirmArtifactModalProps {
+ title: string;
+ body: string;
+ confirmButton: string;
+ cancelButton: string;
+ onCancel: () => void;
+ onSuccess: () => void;
+ 'data-test-subj'?: string;
+}
+
+export const ArtifactConfirmModal = memo