[Security Solution] Fixes custom index fields not appearing in exceptions modal (#122387)

This commit is contained in:
Davis Plumlee 2022-01-17 05:15:07 -05:00 committed by GitHub
parent 683ab102ae
commit fc6b969233
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 1 deletions

View file

@ -74,4 +74,5 @@ export interface Ecs {
Target?: Target;
dll?: DllEcs;
'kibana.alert.workflow_status'?: 'open' | 'acknowledged' | 'in-progress' | 'closed';
'kibana.alert.rule.parameters'?: { index: string[] };
}

View file

@ -29,6 +29,7 @@ import {
LOADING_SPINNER,
EXCEPTION_ITEM_CONTAINER,
ADD_EXCEPTIONS_BTN,
EXCEPTION_FIELD_LIST,
} from '../../screens/exceptions';
import { ALERTS_URL } from '../../urls/navigation';
@ -196,4 +197,13 @@ describe('Exceptions modal', () => {
closeExceptionBuilderModal();
});
it('Contains custom index fields', () => {
cy.get(ADD_EXCEPTIONS_BTN).click({ force: true });
cy.get(FIELD_INPUT).eq(0).click({ force: true });
cy.get(EXCEPTION_FIELD_LIST).contains('unique_value.test');
closeExceptionBuilderModal();
});
});

View file

@ -56,3 +56,6 @@ export const EXCEPTIONS_TABLE_MODAL = '[data-test-subj="referenceErrorModal"]';
export const EXCEPTIONS_TABLE_MODAL_CONFIRM_BTN = '[data-test-subj="confirmModalConfirmButton"]';
export const EXCEPTION_ITEM_CONTAINER = '[data-test-subj="exceptionEntriesContainer"]';
export const EXCEPTION_FIELD_LIST =
'[data-test-subj="comboBoxOptionsList fieldAutocompleteComboBox-optionsList"]';

View file

@ -121,6 +121,9 @@ const AlertContextMenuComponent: React.FC<AlertContextMenuProps & PropsFromRedux
}
}, [timelineId, globalQuery, timelineQuery, routeProps]);
const ruleIndex =
ecsRowData['kibana.alert.rule.parameters']?.index ?? ecsRowData?.signal?.rule?.index;
const {
exceptionModalType,
onAddExceptionCancel,
@ -128,7 +131,7 @@ const AlertContextMenuComponent: React.FC<AlertContextMenuProps & PropsFromRedux
onAddExceptionTypeClick,
ruleIndices,
} = useExceptionModal({
ruleIndex: ecsRowData?.signal?.rule?.index,
ruleIndex,
refetch: refetchAll,
timelineId,
});

View file

@ -8,6 +8,9 @@
"agent": {
"name": "bond"
},
"unique_value": {
"test": "test field"
},
"user" : [
{
"name" : "john",

View file

@ -25,6 +25,14 @@
}
}
},
"unique_value": {
"properties": {
"test": {
"ignore_above": 1024,
"type": "keyword"
}
}
},
"user": {
"type": "nested",
"properties": {