Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Endpoint] Adding a Resolver component that lets the user click and drag to pan and pinch to zoom #53619

Merged

Conversation

oatkiller
Copy link
Contributor

@oatkiller oatkiller commented Dec 19, 2019

Summary

Resolver is a map. It shows processes that ran on a computer. The processes are drawn as nodes and lines connect processes with their parents.

Resolver is not yet implemented in Kibana. This PR adds a 'map' type UX. The user can click and drag to pan the map and zoom using trackpad pinching (or ctrl and mousewheel.)

There is no code providing actual data. Sample data is included. The sample data is used to draw a map. The fundamental info needed is:

  • process names
  • the parent of a process

With this info we can topologically lay out the processes. The sample data isn't yet in a realistic format. We'll be fixing that soon.

Related issue: https://github.com/elastic/endpoint-app-team/issues/30

panning and zooming

This does not implement accessibility features. Those will be added: https://github.com/elastic/endpoint-app-team/issues/40 and https://github.com/elastic/endpoint-app-team/issues/34
This embeddable is not released or available by default, so this should be fine for now.

We aren't adding documentation yet as this feature has not been developed enough.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@oatkiller oatkiller force-pushed the resolver-harness-without-endpoint-app-pt2 branch from c0054d9 to 61d8ec2 Compare December 19, 2019 19:20
return [rect, ref];
}

const DiagnosticDot = styled(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bkimmel here's where a component can find its position relative to the parent resolver component

@oatkiller oatkiller force-pushed the resolver-harness-without-endpoint-app-pt2 branch from 85d987c to b0c6385 Compare December 20, 2019 18:59
@elasticmachine
Copy link
Contributor

💔 Build Failed

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@oatkiller oatkiller force-pushed the resolver-harness-without-endpoint-app-pt2 branch 7 times, most recently from 26cac31 to 0e4a5a6 Compare January 9, 2020 17:13
@james-elastic james-elastic added the Team:Endpoint Data Visibility Team managing the endpoint resolver label Jan 9, 2020
"license": "Elastic-License",
"scripts": {},
"dependencies": {
"react-redux": "^7.1.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We depend on react-redux's hooks.

@oatkiller oatkiller force-pushed the resolver-harness-without-endpoint-app-pt2 branch from c4ce449 to a02a0d4 Compare January 9, 2020 19:52
const [renderTarget, setRenderTarget] = React.useState<HTMLDivElement | null>(null);

useEffect(() => {
let cleanUp;
Copy link
Contributor

Choose a reason for hiding this comment

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

❔ If you're using cleanUp for something here, it is really not clear what. I see it gets the reject side of the Promise below, but I don't understand where or how it's used at all. Can you explain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added comments to explain but i'll reiterate here. The 'effect' is responsible for waiting for a promise to resolve and then setting component 'state' from that resolved value.

There is complexity because the promise comes in as a React prop. The prop could change at any point. When the prop changes, we call Promise.race. If the value is resolved, we set the value in state. If the prop changes, we cancel the race by rejecting.

@oatkiller oatkiller force-pushed the resolver-harness-without-endpoint-app-pt2 branch from 608d94f to eb1521c Compare January 13, 2020 18:57
package.json Outdated
@@ -99,6 +99,7 @@
"x-pack",
"x-pack/plugins/*",
"x-pack/legacy/plugins/*",
"x-pack/plugins/endpoint",

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

/**
* Return a new matrix which is the sum of the two passed in.
*/
export function add(
Copy link
Contributor

Choose a reason for hiding this comment

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

Since all of these seem to have name collisions between matrix v. vector addition, multiplication, etc. wondering if it makes sense to nest this export under some sort of class or named constant. Just want to avoid littering code with things like:

import { add as matrixAdd } from 'matrix3'
import { add as vectorAdd } from 'vector2'

as well as having to back reference whether we're operating on matrices, vectors, lists, etc. because we've lost all context of what add we're working with at that point...

Copy link
Contributor Author

@oatkiller oatkiller Jan 13, 2020

Choose a reason for hiding this comment

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

a module is already a logical grouping of exports. you can:

import * as matrix3 from 'matrix3'
// ...
matrix3.add(a,b)

if ya want. also you can get context from your editor regardless of how it was imported. In this case it was imported as addMatrix:

image

data_buffer: { event_type_full: type, event_subtype_full: subType },
} = event;

if (type === 'process_event') {
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be nice to have this stuff scoped to particular transforms for endgame v0 events, mainly because none of this stuff is ECS compatible as it stands at the moment

Copy link
Contributor

Choose a reason for hiding this comment

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

This will change once we use real, ECS compatible data, as opposed to sample data. We will hopefully do this soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andrewstucki I've never been able to get the streaming feature to produce a set of events that could be used for resolver. in all of my attempts, enough events are missing that I can't render a resolver graph from it. If you could provide some more realistic sample data we'll use it. Otherwise we can wait for @jonathan-buttner to finish a Resolver data generator. @jonathan-buttner is that ready?

Copy link
Contributor

Choose a reason for hiding this comment

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

So, we should sit down together and see what you actually need, because the events shipped have literally everything in them that are part of our raw events--so if there's not enough data, we have a problem, because it means that the endpoint itself isn't shipping data compatible with what you're trying to visualize.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry for the confusing explanation. the events have enough data, I just can't get the streaming feature to send all of the events.

Copy link
Contributor

Choose a reason for hiding this comment

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

@oatkiller the data generator is close but still working out some issues. We haven't started on a backend implementation yet but that's next on the list.

}

export function uniqueParentPidForProcess(event: ProcessEvent) {
return event.data_buffer.source_id;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be very careful with nomenclature here, because this doesn't look like an "event" to me--"event"s are our raw data sources, for which we don't have a "source_id" field. This looks more like some sort of investigation or alert, something that originally came from the hunt_data_schema--if that's true then the applications for resolver out of the box are going to be very limited. Instead this should be working on the raw event data if possible. In which case:

  1. v0 (data coming from the SMP) will be looking at the field endgame.unique_ppid for process events
  2. v1 (data coming from Elastic-native sensor) will be looking at the field endpoint.process.parent.entity_id for events with event.category == 'process'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's sync on all of this. But basically, this is using some random sample data that has pids, unique ppids, and process names. that's all that we need to test the layout logic. Once we get a BE, we'll get this stuff working against real data.

}

export function uniquePidForProcess(event: ProcessEvent) {
return event.data_buffer.node_id;
Copy link
Contributor

Choose a reason for hiding this comment

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

see comment about source_id stuff:

  1. v0 -- endgame.unique_pid
  2. v1 -- endpoint.process.entity_id

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not totally sure how types will work with events, but I image having a single Event type which encompasses all of the events that we'll ever deal with. When we change that type, ts will help us fix all the code that references it. If we get sample data that has the right format, we'll change the type and all of the code then.


export function mockProcessEvent(
parts: {
data_buffer: { node_id: ProcessEvent['data_buffer']['node_id'] };
Copy link
Contributor

Choose a reason for hiding this comment

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

See comments about what a "process event" is -- none of these fields exist in process events that we ship today to Elasticsearch or in the events we'll ship in the future.

@oatkiller oatkiller force-pushed the resolver-harness-without-endpoint-app-pt2 branch 2 times, most recently from 2ed5a47 to 9d61b26 Compare January 14, 2020 13:22
@elastic elastic deleted a comment from peluja1012 Jan 14, 2020
@elastic elastic deleted a comment from peluja1012 Jan 14, 2020
@elastic elastic deleted a comment from peluja1012 Jan 14, 2020
@oatkiller oatkiller added Feature:Resolver Security Solution Resolver feature release_note:skip Skip the PR/issue when compiling release notes v7.6.0 v8.0.0 labels Jan 14, 2020
@elastic elastic deleted a comment from peluja1012 Jan 14, 2020
@elastic elastic deleted a comment from peluja1012 Jan 14, 2020
@oatkiller oatkiller force-pushed the resolver-harness-without-endpoint-app-pt2 branch from 9d61b26 to b5df646 Compare January 14, 2020 17:58
@oatkiller oatkiller merged commit 387da98 into elastic:master Jan 14, 2020
@oatkiller oatkiller deleted the resolver-harness-without-endpoint-app-pt2 branch January 14, 2020 20:38
jkelastic pushed a commit to jkelastic/kibana that referenced this pull request Jan 17, 2020
Resolver is a map. It shows processes that ran on a computer. The processes are drawn as nodes and lines connect processes with their parents.

Resolver is not yet implemented in Kibana. This PR adds a 'map' type UX. The user can click and drag to pan the map and zoom using trackpad pinching (or ctrl and mousewheel.)

There is no code providing actual data. Sample data is included. The sample data is used to draw a map. The fundamental info needed is:

process names
the parent of a process
With this info we can topologically lay out the processes. The sample data isn't yet in a realistic format. We'll be fixing that soon.

Related issue: elastic/endpoint-app-team#30
@kevinlog kevinlog added the Feature:Endpoint Elastic Endpoint feature label Feb 18, 2020
@kevinlog kevinlog changed the title Adding a Resolver component that lets the user click and drag to pan and pinch to zoom [Endpoint] Adding a Resolver component that lets the user click and drag to pan and pinch to zoom Feb 18, 2020
@kibanamachine
Copy link
Contributor

💔 Build Failed

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

oatkiller pushed a commit that referenced this pull request Feb 18, 2020
* Add Endpoint plugin and Resolver embeddable (#51994)

* Add functional tests for plugins to x-pack (so we can do a functional test of the Resolver embeddable)
* Add Endpoint plugin
* Add Resolver embeddable
* Test that Resolver embeddable can be rendered

 Conflicts:
	x-pack/.i18nrc.json
	x-pack/test/api_integration/apis/index.js

* [Endpoint] Register endpoint app (#53527)

* register app, create functional test

* formatting

* update tests

* adjust test data for endpoint

* add endpoint tests for testing spaces, app enabled, disabled, etc

* linting

* add read privileges to endpoint

* rename variable since its used now

* remove deprecated context

* remove unused variable

* fix type check

* correct test suite message

Co-Authored-By: Larry Gregory <lgregorydev@gmail.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Larry Gregory <lgregorydev@gmail.com>

* [Endpoint] add react router to endpoint app (#53808)

* add react router to endpoint app

* linting

* linting

* linting

* correct tests

* change history from hash to browser, add new test util

* remove default values in helper functions

* fix type check, use FunctionComponent as oppsed to FC

* use BrowserRouter component

* use BrowserRouter component lin

* add comments to test framework, change function name to include browserHistory

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* EMT-issue-65: add endpoint list api (#53861)

add endpoint list api

* EMT-65:always return accurate endpoint count (#54423)

EMT-65:always return accurate endpoint count, independent of paging properties

* Resolver component w/ sample data (#53619)

Resolver is a map. It shows processes that ran on a computer. The processes are drawn as nodes and lines connect processes with their parents.

Resolver is not yet implemented in Kibana. This PR adds a 'map' type UX. The user can click and drag to pan the map and zoom using trackpad pinching (or ctrl and mousewheel.)

There is no code providing actual data. Sample data is included. The sample data is used to draw a map. The fundamental info needed is:

process names
the parent of a process
With this info we can topologically lay out the processes. The sample data isn't yet in a realistic format. We'll be fixing that soon.

Related issue: elastic/endpoint-app-team#30

* Resolver test plugin not using mount context. (#54933)

Mount context was deprecated. Use core.getStartServices() instead.

* Resolver nonlinear zoom (#54936)

* [Endpoint] add Redux saga Middleware and app Store (#53906)

* Added saga library
* Initialize endpoint app redux store

* Resolver is overflow: hidden to prevent obscured elements from showing up (#55076)

* [Endpoint] Fix saga to start only after store is created and stopped on app unmount (#55245)

- added `stop()`/`start()` methods to the Saga Middleware creator factory
- adjust tests based on changes
- changed application `renderApp` to stop sagas when react app is unmounted

* Resolver zoom, pan, and center controls (#55221)

* Resolver zoom, pan, and center controls

* add tests, fix north panning

* fix type issue

* update west and east panning to behave like google maps

* [Endpoint] FIX: Increase tests `sleep` default duration back to 100ms (#55492)

Revert `sleep()` default duration, in the saga tests, back to 100ms in order to prevent intermittent failures during CI runs.

Fixes #55464
Fixes #55465

* [Endpoint] EMT-65: make endpoint data types common, restructure (#54772)

[Endpoint] EMT-65: make endpoint data types common, use schema changes

* Basic Functionality Alert List (#55800)

* sets up initial grid and data type

* data feeds in from backend but doesnt update

* sample data feeding in correctly

* Fix combineReducers issue by importing Redux type from 'redux' package

* Add usePageId hook that fires action when user navigates to page

* Strict typing for middleware

* addresses comments and uses better types

* move types to common/types.ts

* Move types to endpoint/types.ts, address PR comments

blah 2

Co-authored-by: Pedro Jaramillo <peluja1012@gmail.com>

* [Endpoint] Add Endpoint Details route (#55746)

* Add Endpoint Details route

* add Endpoint Details tests

* sacrifices to the Type gods

* update to latest endpoint schema

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* [Endpoint] EMT-67: add kql support for endpoint list (#56328)

[Endpoint] EMT-67: add kql support for endpoint list

* [Endpoint] ERT-82 ERT-83 ERT-84: Alert list API with pagination (#56538)

* ERT-82 ERT-83 ERT-84 (partial): Add Alert List API with pagination

* Better type safety for alert list API

* Add Test to Verify Endpoint App Landing Page (#57129)

 Conflicts:
	x-pack/test/functional/page_objects/index.ts

* fixes render bug in alert list (#57152)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* Resolver: Animate camera, add sidebar (#55590)

This PR adds a sidebar navigation. clicking the icons in the nav will focus the camera on the different nodes. There is an animation effect when the camera moves.

 Conflicts:
	yarn.lock

* [Endpoint] Task/basic endpoint list (#55623)

* Adds host management list to endpoint security plugin

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* [Endpoint] Policy List UI route and initial view (#56918)

* Initial Policy List view

* Add `endpoint/policy` route and displays Policy List
* test cases (both unit and functional)

Does not yet interact with API (Ingest).

* Add ApplicationService app status management (#50223)

This was already backported, but changes to endpoint app could not be
backported, since endpoint app itself hadn't been backported. Now that
the endpoint app is backported, reapply the endpoint specific changes
from the original commit.

* Implements `getStartServices` on server-side (#55156)

This was already backported, but changes to endpoint app could not be
backported, since endpoint app itself hadn't been backported. Now that
the endpoint app is backported, reapply the endpoint specific changes
from the original commit.

* [ui/utils/query_string]: Remove unused methods & migrate apps to querystring lib (#56957)

This was already backported, but changes to endpoint app could not be
backported, since endpoint app itself hadn't been backported. Now that
the endpoint app is backported, reapply the endpoint specific changes
from the original commit.

Co-authored-by: Kevin Logan <56395104+kevinlog@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Larry Gregory <lgregorydev@gmail.com>
Co-authored-by: nnamdifrankie <56440728+nnamdifrankie@users.noreply.github.com>
Co-authored-by: Davis Plumlee <56367316+dplumlee@users.noreply.github.com>
Co-authored-by: Paul Tavares <56442535+paul-tavares@users.noreply.github.com>
Co-authored-by: Pedro Jaramillo <peluja1012@gmail.com>
Co-authored-by: Dan Panzarella <pzl@users.noreply.github.com>
Co-authored-by: Madison Caldwell <madison.rey.caldwell@gmail.com>
Co-authored-by: Charlie Pichette <56399229+charlie-pichette@users.noreply.github.com>
Co-authored-by: Candace Park <56409205+parkiino@users.noreply.github.com>
Co-authored-by: Pierre Gayvallet <pierre.gayvallet@gmail.com>
Co-authored-by: Alexey Antonov <alexwizp@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Endpoint Elastic Endpoint feature Feature:Resolver Security Solution Resolver feature release_note:skip Skip the PR/issue when compiling release notes Team:Endpoint Data Visibility Team managing the endpoint resolver v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet