Skip to content

Commit

Permalink
[Security Solution][Exceptions] - Fix bug displaying filepath warning…
Browse files Browse the repository at this point in the history
… for non endpoint exception items (elastic#151570)

## Summary

Addresses elastic#145970

Fix bug displaying filepath warning for non endpoint exception items
  • Loading branch information
yctercero committed Feb 22, 2023
1 parent 250dcff commit 7a03aea
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,44 @@ describe('BuilderEntryItem', () => {
expect(wrapper.find('[data-test-subj="exceptionBuilderEntryFieldWildcard"]').text()).toEqual(
'1234*'
);
// doesnt show warning label for non endpoint exception items
expect(
wrapper.find('[data-test-subj="valuesAutocompleteWildcardLabel"] .euiFormHelpText')
).toHaveLength(0);
});

test('it does not render matches filepath warning message for rule default list item', () => {
wrapper = mount(
<BuilderEntryItem
autocompleteService={autocompleteStartMock}
entry={{
correspondingKeywordField: undefined,
entryIndex: 0,
field: getField('@tags'),
id: '123',
nested: undefined,
operator: matchesOperator,
parent: undefined,
value: '1234*',
}}
httpService={mockKibanaHttpService}
indexPattern={{
fields,
id: '1234',
title: 'logstash-*',
}}
listType="rule_default"
onChange={jest.fn()}
setErrorsExist={jest.fn()}
setWarningsExist={jest.fn()}
showLabel={false}
/>
);

// doesnt show warning label for non endpoint exception items
expect(
wrapper.find('[data-test-subj="valuesAutocompleteWildcardLabel"] .euiFormHelpText')
).toHaveLength(0);
});

test('it renders field values correctly when operator is "doesNotMatchOperator"', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ export const BuilderEntryItem: React.FC<EntryItemProps> = ({
case OperatorTypeEnum.WILDCARD:
const wildcardValue = typeof entry.value === 'string' ? entry.value : undefined;
let actualWarning: React.ReactNode | string | undefined;
if (listType !== 'detection') {
if (listType !== 'detection' && listType !== 'rule_default') {
let os: OperatingSystem = OperatingSystem.WINDOWS;
if (osTypes) {
[os] = osTypes as OperatingSystem[];
Expand Down

0 comments on commit 7a03aea

Please sign in to comment.