Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
af077cd
Cherry-pick security/timelines changes
kqualters-elastic Mar 10, 2022
0abc22b
Changes to make session_view work with generated data
kqualters-elastic Mar 10, 2022
821c0c2
Demo tweaks
kqualters-elastic Mar 17, 2022
21889d3
Merge branch 'main' into session-view-updated
kqualters-elastic Mar 21, 2022
86aa348
Cherry-pick security/timelines changes
kqualters-elastic Mar 10, 2022
c3e7708
Changes to make session_view work with generated data
kqualters-elastic Mar 10, 2022
d7cbe6a
create detail panel hook for session view
michaelolo24 Mar 23, 2022
dd9452c
add some tests
michaelolo24 Mar 23, 2022
19ad8df
Merge branch 'main' of github.com:elastic/kibana into session-view-up…
kqualters-elastic Mar 24, 2022
fa00f8b
Changes to make session_view work with generated data
kqualters-elastic Mar 10, 2022
b6d2b49
Merge branch 'safest-session-view-flyout' of github.com:michaelolo24/…
michaelolo24 Mar 24, 2022
c811902
Merge branch 'session-view-updated' into safest-session-view-flyout
michaelolo24 Mar 24, 2022
8e9c818
remove duplicate sessionViewId prop
michaelolo24 Mar 25, 2022
a8d9d13
Update with main
kqualters-elastic Mar 25, 2022
608f7c8
Merge remote-tracking branch 'upstream/main' into session-view-updated
kqualters-elastic Mar 25, 2022
638bcfe
Merge branch 'session-view-updated' into integrate-session-view-with-…
michaelolo24 Mar 25, 2022
9b18ccd
Merge pull request #3 from michaelolo24/integrate-session-view-with-d…
kqualters-elastic Mar 25, 2022
ebe4d56
Update tests and types, improve styles around full screen
kqualters-elastic Mar 29, 2022
63d2a5d
Merge remote-tracking branch 'upstream/main' into session-view-updated
kqualters-elastic Mar 29, 2022
e99a71b
Fix mistake in intl message, clean up tests
kqualters-elastic Mar 29, 2022
9b592b5
Create a hook for session view components and handlers
kqualters-elastic Mar 29, 2022
169e9d0
Use hook to share logic between tgrid and timeline, clean up css
kqualters-elastic Mar 29, 2022
794efea
Merge remote-tracking branch 'upstream/main' into session-view-updated
kqualters-elastic Mar 29, 2022
545cddd
Fix flyout usage with new hook
kqualters-elastic Mar 29, 2022
83502cd
Update failing snapshot
kqualters-elastic Mar 29, 2022
678fdc6
Remove feature flag
kqualters-elastic Mar 29, 2022
5293a14
Use correct sourcerer scope for panel
kqualters-elastic Mar 29, 2022
bf284c6
Fix embarrassment
kqualters-elastic Mar 29, 2022
bac80f5
Merge branch 'main' into session-view-updated
opauloh Mar 29, 2022
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
9 changes: 9 additions & 0 deletions x-pack/plugins/security_solution/common/ecs/process/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export interface ProcessEcs {
Ext?: Ext;
command_line?: string[];
entity_id?: string[];
entry_leader?: ProcessSessionData;
session_leader?: ProcessSessionData;
group_leader?: ProcessSessionData;
exit_code?: number[];
hash?: ProcessHashData;
parent?: ProcessParentData;
Expand All @@ -25,6 +28,12 @@ export interface ProcessEcs {
working_directory?: string[];
}

export interface ProcessSessionData {
entity_id?: string[];
pid?: string[];
name?: string[];
}

export interface ProcessHashData {
md5?: string[];
sha1?: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ export enum TimelineTabs {
notes = 'notes',
pinned = 'pinned',
eql = 'eql',
session = 'session',
}

/**
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/security_solution/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"licensing",
"maps",
"ruleRegistry",
"sessionView",
"taskManager",
"timelines",
"triggersActionsUi",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const AlertsTableComponent: React.FC<Props> = ({
const dispatch = useDispatch();
const alertsFilter = useMemo(() => [...defaultAlertsFilters, ...pageFilters], [pageFilters]);
const { filterManager } = useKibana().services.data.query;
const ACTION_BUTTON_COUNT = 4;
const ACTION_BUTTON_COUNT = 5;

const tGridEnabled = useIsExperimentalFeatureEnabled('tGridEnabled');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const EventsQueryTabBodyComponent: React.FC<EventsQueryTabBodyComponentProps> =
}) => {
const dispatch = useDispatch();
const { globalFullScreen } = useGlobalFullScreen();
const ACTION_BUTTON_COUNT = 4;
const ACTION_BUTTON_COUNT = 5;
const tGridEnabled = useIsExperimentalFeatureEnabled('tGridEnabled');

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import React from 'react';
import useResizeObserver from 'use-resize-observer/polyfilled';

import '../../mock/match_media';
import { waitFor } from '@testing-library/react';
import { render } from '@testing-library/react';
import { TestProviders } from '../../mock';
import { useMountAppended } from '../../utils/use_mount_appended';

import { mockEventViewerResponse } from './mock';
import { StatefulEventsViewer } from '.';
Expand Down Expand Up @@ -61,37 +60,27 @@ const testProps = {
start: from,
};
describe('StatefulEventsViewer', () => {
const mount = useMountAppended();

(useTimelineEvents as jest.Mock).mockReturnValue([false, mockEventViewerResponse]);

test('it renders the events viewer', async () => {
const wrapper = mount(
const wrapper = render(
<TestProviders>
<StatefulEventsViewer {...testProps} />
</TestProviders>
);

await waitFor(() => {
wrapper.update();

expect(wrapper.text()).toMatchInlineSnapshot(`"hello grid"`);
});
expect(wrapper.getByText('hello grid')).toBeTruthy();
});

// InspectButtonContainer controls displaying InspectButton components
test('it renders InspectButtonContainer', async () => {
const wrapper = mount(
const wrapper = render(
<TestProviders>
<StatefulEventsViewer {...testProps} />
</TestProviders>
);

await waitFor(() => {
wrapper.update();

expect(wrapper.find(`InspectButtonContainer`).exists()).toBe(true);
});
expect(wrapper.getByTestId(`hoverVisibilityContainer`)).toBeTruthy();
});

test('it closes field editor when unmounted', async () => {
Expand All @@ -101,14 +90,14 @@ describe('StatefulEventsViewer', () => {
return {};
});

const wrapper = mount(
const { unmount } = render(
<TestProviders>
<StatefulEventsViewer {...testProps} />
</TestProviders>
);
expect(mockCloseEditor).not.toHaveBeenCalled();

wrapper.unmount();
unmount();
expect(mockCloseEditor).toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { SourcererScopeName } from '../../store/sourcerer/model';
import { useSourcererDataView } from '../../containers/sourcerer';
import type { EntityType } from '../../../../../timelines/common';
import { TGridCellAction } from '../../../../../timelines/common/types';
import { DetailsPanel } from '../../../timelines/components/side_panel';
import { CellValueElementProps } from '../../../timelines/components/timeline/cell_rendering';
import { FIELDS_WITHOUT_CELL_ACTIONS } from '../../lib/cell_actions/constants';
import { useGetUserCasesPermissions, useKibana } from '../../lib/kibana';
Expand All @@ -33,6 +32,7 @@ import {
useFieldBrowserOptions,
FieldEditorActions,
} from '../../../timelines/components/fields_browser';
import { useSessionView } from '../../../timelines/components/timeline/session_tab_content/use_session_view';

const EMPTY_CONTROL_COLUMNS: ControlColumnProps[] = [];

Expand Down Expand Up @@ -105,6 +105,7 @@ const StatefulEventsViewerComponent: React.FC<Props> = ({
itemsPerPage,
itemsPerPageOptions,
kqlMode,
sessionViewId,
showCheckboxes,
sort,
} = defaultModel,
Expand Down Expand Up @@ -155,11 +156,19 @@ const StatefulEventsViewerComponent: React.FC<Props> = ({

const globalFilters = useMemo(() => [...filters, ...(pageFilters ?? [])], [filters, pageFilters]);
const trailingControlColumns: ControlColumnProps[] = EMPTY_CONTROL_COLUMNS;
const graphOverlay = useMemo(
() =>
graphEventId != null && graphEventId.length > 0 ? <GraphOverlay timelineId={id} /> : null,
[graphEventId, id]
);

const { DetailsPanel, SessionView, Navigation } = useSessionView({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, not sure if DetailsPanel and SessionView should be tied together like this, but I would have to think about it more...

entityType,
timelineId: id,
});

const graphOverlay = useMemo(() => {
const shouldShowOverlay =
(graphEventId != null && graphEventId.length > 0) || sessionViewId !== null;
Copy link
Copy Markdown
Contributor

@michaelolo24 michaelolo24 Mar 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need graphEventId.length > 0 ? Can we get away with shouldShowOverlay = graphEventId ?? sessionViewId?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we unify the != and !== approach in this statement just to use one? Could be graphEventId or sessionViewId as undefined?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm nervous to change it, for whatever reason, graph event id is set to empty string sometimes and is undefined at other times

return shouldShowOverlay ? (
<GraphOverlay timelineId={id} SessionView={SessionView} Navigation={Navigation} />
) : null;
}, [graphEventId, id, sessionViewId, SessionView, Navigation]);
const setQuery = useCallback(
(inspect, loading, refetch) => {
dispatch(inputsActions.setQuery({ id, inputId: 'global', inspect, loading, refetch }));
Expand Down Expand Up @@ -239,14 +248,7 @@ const StatefulEventsViewerComponent: React.FC<Props> = ({
})}
</InspectButtonContainer>
</FullScreenContainer>
<DetailsPanel
browserFields={browserFields}
entityType={entityType}
docValueFields={docValueFields}
isFlyoutView
runtimeMappings={runtimeMappings}
timelineId={id}
/>
{DetailsPanel}
</CasesContext>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ export const mockGlobalState: State = {
end: '2020-07-08T08:20:18.966Z',
},
selectedEventIds: {},
sessionViewId: null,
show: false,
showCheckboxes: false,
pinnedEventIds: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,7 @@ export const mockTimelineModel: TimelineModel = {
savedObjectId: 'ef579e40-jibber-jabber',
selectAll: false,
selectedEventIds: {},
sessionViewId: null,
show: false,
showCheckboxes: false,
sort: [
Expand Down Expand Up @@ -2132,6 +2133,7 @@ export const defaultTimelineProps: CreateTimelineProps = {
savedObjectId: null,
selectAll: false,
selectedEventIds: {},
sessionViewId: null,
show: false,
showCheckboxes: false,
sort: [{ columnId: '@timestamp', columnType: 'number', sortDirection: Direction.desc }],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ describe('alert actions', () => {
savedObjectId: null,
selectAll: false,
selectedEventIds: {},
sessionViewId: null,
show: true,
showCheckboxes: false,
sort: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,5 @@ export const requiredFieldsForActions = [
'file.hash.sha256',
'host.os.family',
'event.code',
'process.entry_leader.entity_id',
];
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const AlertsTableComponent: React.FC<AlertsTableComponentProps> = ({
const kibana = useKibana();
const [, dispatchToaster] = useStateToaster();
const { addWarning } = useAppToasts();
const ACTION_BUTTON_COUNT = 4;
const ACTION_BUTTON_COUNT = 5;

const getGlobalQuery = useCallback(
(customFilters: Filter[]) => {
Expand Down
Loading