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] Add Endpoint Details route #55746

Merged
merged 5 commits into from
Jan 30, 2020
Merged

[Endpoint] Add Endpoint Details route #55746

merged 5 commits into from
Jan 30, 2020

Conversation

pzl
Copy link
Member

@pzl pzl commented Jan 23, 2020

Summary

Adds API route for getting a single Endpoint by ID

note: WIP, unit tests are missing. Functionality is otherwise there.

Checklist

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

For maintainers


Example:

curl -s -H 'kbn-xsrf: xxx' \
  --user elastic:changeme -H "Content-Type: application/json" \
  http://localhost:5601/api/endpoint/endpoints/57ec37ff-9318-4652-8efa-db615ef40779 \
   | jq .
{
  "@timestamp": 1580395815407,
  "event": {
    "created": "2020-01-30T14:50:15.407Z"
  },
  "endpoint": {
    "policy": {
      "id": "00000000-0000-0000-0000-000000000000"
    }
  },
  "agent": {
    "version": "6.2.5",
    "id": "89ea71c2-d461-4bd3-8de5-c95b75a54626"
  },
  "host": {
    "id": "57ec37ff-9318-4652-8efa-db615ef40779",
    "hostname": "gaspard-9.example.com",
    "ip": [
      "10.147.107.88"
    ],
    "mac": [
      "a2-ea-e7-60-13-8a",
      "88-a4-c9-30-15-2b",
      "8a-81-97-f9-2d-90"
    ],
    "architecture": "x86",
    "os": {
      "name": "windows 6.3",
      "full": "Windows Server 2012R2",
      "version": "6.3"
    }
  }
}

Response when not getting any results:

{
  "statusCode": 404,
  "error": "Not Found",
  "message": "Endpoint Not Found"
}

Resolves: elastic/endpoint-app-team#100

@kevinlog
Copy link
Contributor

to get by the label checks:

image

only, put 7.7 instead of 7.6

The Team labels help us track.

Also, add [Endpoint] to the title at some point before merging

@pzl pzl added Team:Endpoint Data Visibility Team managing the endpoint resolver Team:Endpoint Management Team:Endpoint Response Endpoint Response Team v7.7.0 v8.0.0 release_note:skip Skip the PR/issue when compiling release notes labels Jan 23, 2020
@pzl pzl changed the title [WIP] Add Endpoint Details route [WIP] [Endpoint] Add Endpoint Details route Jan 23, 2020
@nnamdifrankie
Copy link
Contributor

nnamdifrankie commented Jan 26, 2020

Please can we add some simple api integration tests, we already have some data that can be used? Ideally we may want to create a different data set for the feature. But I think it is fine to add it to the already existing test. https://github.com/elastic/kibana/blob/master/x-pack/test/api_integration/apis/endpoint/endpoints.ts

@pzl pzl changed the title [WIP] [Endpoint] Add Endpoint Details route [Endpoint] Add Endpoint Details route Jan 29, 2020
@charlie-pichette
Copy link
Contributor

@pzl can you add a test where an endpoint doesn't exist?

@@ -120,4 +120,82 @@ describe('test endpoint route', () => {
expect(endpointResultList.request_page_index).toEqual(10);
expect(endpointResultList.request_page_size).toEqual(10);
});

describe('Endpoint Details route', () => {
it('should return 404 on no results', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

@charlie-pichette I believe this tests the case where the endpoint doesn't exist

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we all agree it should be 404, I think so going by what I have seen about REST the appropriate response is missing data should be 404.

Copy link
Contributor

Choose a reason for hiding this comment

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

@pzl what is 'BADID'? That seems to me to be a malformed id instead of an id that doesn't exist. If we are not doing any validation on the id, such as if it is supposed to be a UUID that is a valid UUID format, then this seems ok.

Copy link
Contributor

Choose a reason for hiding this comment

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

We are not doing any validation on the endpoint id being submitted. I'm fine with this test.

Copy link
Contributor

@charlie-pichette charlie-pichette left a comment

Choose a reason for hiding this comment

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

The tests are good.

@pzl
Copy link
Member Author

pzl commented Jan 30, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@kevinlog
Copy link
Contributor

@pzl can you add "Feature:Endpoint" label? Also, we should start linking the original GitHub issue to the PR. Can you edit the original description and add "Resolves: https://github.com/elastic/endpoint-app-team/issues/100" ?

@pzl pzl added the Feature:Endpoint Elastic Endpoint feature label Jan 30, 2020
@pzl pzl merged commit 8398a1c into elastic:master Jan 30, 2020
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 31, 2020
* master: (53 commits)
  Fix setting filters without $store value (elastic#56304)
  kuery_autocomplete -> convert remaining items to TS/Jest (elastic#56316)
  [Reporting] New Platform: moves most of our libs/constants and utils to np shims (elastic#55935)
  [reporting] remove a legacy cross-plugin import (elastic#56354)
  [DOCS] Updates example in Timelion doc (elastic#56444)
  [APM] Service map center button (elastic#56434)
  [skip-ci] Add example for migrating pre-handlers (elastic#56080)
  [ML] Fix Data Visualizer responsive layout  (elastic#56372)
  Add missing docker settings (elastic#56411)
  [Endpoint] Add Endpoint Details route (elastic#55746)
  chore(NA): delete data/optimize with kbn clean (elastic#55890)
  System index templates can't be edited (elastic#55229)
  Sync badge (elastic#55113)
  Only fire appState changes when there is a change (elastic#56183)
  Import appropriate files to setup plugin system at the correct time (elastic#55956)
  [Monitoring] Change all configs to `monitoring.*` (elastic#56215)
  [ML] conditional rison encoding for query params (elastic#56380)
  Move tsvb server to new platform (elastic#55310)
  exclude tutorial resources from code ownership (elastic#55987)
  [Watcher] Follow up on flaky functional test (elastic#56384)
  ...
jfsiii pushed a commit to jfsiii/kibana that referenced this pull request Feb 4, 2020
* Add Endpoint Details route

* add Endpoint Details tests

* sacrifices to the Type gods

* update to latest endpoint schema

Co-authored-by: Elastic Machine <[email protected]>
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 <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Larry Gregory <[email protected]>

* [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 <[email protected]>

* 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 <[email protected]>

* [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 <[email protected]>

* [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 <[email protected]>

* 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 <[email protected]>

* [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 <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Larry Gregory <[email protected]>
Co-authored-by: nnamdifrankie <[email protected]>
Co-authored-by: Davis Plumlee <[email protected]>
Co-authored-by: Paul Tavares <[email protected]>
Co-authored-by: Pedro Jaramillo <[email protected]>
Co-authored-by: Dan Panzarella <[email protected]>
Co-authored-by: Madison Caldwell <[email protected]>
Co-authored-by: Charlie Pichette <[email protected]>
Co-authored-by: Candace Park <[email protected]>
Co-authored-by: Pierre Gayvallet <[email protected]>
Co-authored-by: Alexey Antonov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Endpoint Elastic Endpoint feature release_note:skip Skip the PR/issue when compiling release notes Team:Endpoint Data Visibility Team managing the endpoint resolver Team:Endpoint Response Endpoint Response Team v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants