forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution][Artifacts][Trusted Apps] Wildcard warning with IS…
… operator for trusted apps creation/editing (elastic#175356) ## Summary - [x] Adds updated warning messaging for trusted apps entries that use wildcards `*?` with the "IS" operator - [x] Three different warnings: callout, individual entry item warnings and a final confirmation modal when the user tries to add a trusted app with ineffective IS / wildcard combination etnry. - [x] Unit tests # Screenshots <img width="829" alt="image" src="https://github.com/elastic/kibana/assets/56409205/c7beec62-a249-4535-ac0b-34f9be57f542"> <img width="1649" alt="image" src="https://github.com/elastic/kibana/assets/56409205/22f38f1b-7e6b-4b69-8d03-4d74d8674fa6"> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
9349f1b
commit 7c5a668
Showing
12 changed files
with
330 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...ritysolution-exception-list-components/src/wildcard_with_wrong_operator_callout/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { EuiCallOut } from '@elastic/eui'; | ||
|
||
export const WildCardWithWrongOperatorCallout = () => { | ||
return ( | ||
<EuiCallOut | ||
title={i18n.translate('exceptionList-components.wildcardWithWrongOperatorCallout.title', { | ||
defaultMessage: 'Please review your entries', | ||
})} | ||
iconType="warning" | ||
color="warning" | ||
size="s" | ||
data-test-subj="wildcardWithWrongOperatorCallout" | ||
> | ||
<p> | ||
<FormattedMessage | ||
id="exceptionList-components.wildcardWithWrongOperatorCallout.body" | ||
defaultMessage="Using a '*' or a '?' in the value with the 'IS' operator can make the entry ineffective. {operator} to '{matches}' to ensure wildcards run properly." | ||
values={{ | ||
operator: ( | ||
<strong> | ||
{i18n.translate( | ||
'exceptionList-components.wildcardWithWrongOperatorCallout.changeTheOperator', | ||
{ defaultMessage: 'Change the operator' } | ||
)} | ||
</strong> | ||
), | ||
matches: ( | ||
<strong> | ||
{i18n.translate( | ||
'exceptionList-components.wildcardWithWrongOperatorCallout.matches', | ||
{ defaultMessage: 'matches' } | ||
)} | ||
</strong> | ||
), | ||
}} | ||
/> | ||
</p> | ||
</EuiCallOut> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...ion/public/management/components/artifact_list_page/components/artifact_confirm_modal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ConfirmArtifactModalProps>( | ||
({ | ||
title, | ||
body, | ||
confirmButton, | ||
cancelButton, | ||
onCancel, | ||
onSuccess, | ||
'data-test-subj': dataTestSubj, | ||
}) => { | ||
const getTestId = useTestIdGenerator(dataTestSubj); | ||
|
||
return ( | ||
<EuiModal onClose={onCancel} data-test-subj={dataTestSubj}> | ||
<EuiModalHeader data-test-subj={getTestId('header')}> | ||
<EuiModalHeaderTitle>{title}</EuiModalHeaderTitle> | ||
</EuiModalHeader> | ||
|
||
<EuiModalBody data-test-subj={getTestId('body')}> | ||
<EuiText> | ||
<p>{body}</p> | ||
</EuiText> | ||
</EuiModalBody> | ||
|
||
<EuiModalFooter> | ||
<EuiButtonEmpty onClick={onCancel} data-test-subj={getTestId('cancelButton')}> | ||
{cancelButton} | ||
</EuiButtonEmpty> | ||
|
||
<EuiButton fill onClick={onSuccess} data-test-subj={getTestId('submitButton')}> | ||
{confirmButton} | ||
</EuiButton> | ||
</EuiModalFooter> | ||
</EuiModal> | ||
); | ||
} | ||
); | ||
ArtifactConfirmModal.displayName = 'ArtifactConfirmModal'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.