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

[SIEM][Detection Engine][Lists] Adds specific endpoint_list REST API and API for abilities to auto-create the endpoint_list if it gets deleted #71792

Merged
merged 9 commits into from
Jul 15, 2020

Conversation

FrankHassanabad
Copy link
Contributor

@FrankHassanabad FrankHassanabad commented Jul 14, 2020

Summary

Adds specific endpoint list REST API and API for abilities to auto-create the endpoint_list if it gets deleted or to auto-provision it when a rule is first created.

When auto-creating the endpoint_list it does so using these values for the saved object:

id: 'endpoint_list'
_tags: [],
comments: undefined,
description: 'Elastic Endpoint Exception List',
list_id: 'endpoint_list',
list_type: 'list',
name: 'Elastic Endpoint Exception List',
tags: [],
type: 'endpoint',

The new API endpoints are as follows below. These endpoints are like the normal exception list item endpoints except you should not pass down any list_id or namespace_type since these are focused specific endpoints against the space agnostic endpoint_list

# This creates the endpoint_list if it does not exist. If it does exist this will return an empty body of {}
POST /api/endpoint_list

# This will create an endpoint_list item. However, if the endpoint_list does not exist then this will auto-create it first.
POST /api/endpoint_list/items

# This will read an endpoint_list item. This will _not_ auto-create the list if it does not exist.
GET /api/endpoint_list/items

# This will update an endpoint_list item. However, if the endpoint_list does not exist then this will auto-create it first.
PUT /api/endpoint_list/items

# This will delete an endpoint_list item. This will _not_ auto-create the list if it does not exist.
DELETE /api/endpoint_list/items

# This will find an endpoint_list item. However, if the endpoint_list does not exist then this will auto-create it first.
GET /api/endpoint_list/items/_find

New API within the exception_list_client plugin are:

// # This creates the endpoint_list if it does not exist. If it does exist this will return an empty body of {}
createEndpointList()
createEndpointListItem()
updateEndpointListItem()
getEndpointListItem()
deleteEndpointListItem()

Scripts for testing are:

delete_endpoint_list_item.sh 
delete_endpoint_list_item_by_id.sh
find_endpoint_list_items.sh
get_endpoint_list_item.sh
get_endpoint_list_item_by_id.sh
post_endpoint_list.sh
post_endpoint_list_item.sh
update_endpoint_item.sh

Checklist

Delete any items that are not applicable to this PR.

Comment on lines +58 to +61

// This will create the endpoint list if it does not exist yet
await context.lists?.getExceptionListClient().createEndpointList();

Copy link
Member

Choose a reason for hiding this comment

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

Thaaaank you! 🙏

@elasticmachine
Copy link
Contributor

Pinging @elastic/siem (Team:SIEM)

Copy link
Contributor

@rylnd rylnd left a comment

Choose a reason for hiding this comment

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

Tested the "create endpoint list during rule creation" flow, along with the "associate endpoint list to rule" flow, and both look great! 👍 👍 👍

Up to you if you wanna merge this now and add tests afterwards. Either way I'm gonna have to circle back on #71794, mainly to use the ENDPOINT_LIST_ID constant.

@spong
Copy link
Member

spong commented Jul 15, 2020

@elasticmachine merge upstream

@peluja1012
Copy link
Contributor

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

@kbn/optimizer bundle module count

id value diff baseline
lists 93 +5 88

miscellaneous assets size

id value diff baseline
lists 55.1KB +744.0B 54.4KB
upgradeAssistant 22.6KB -9.0B 22.6KB
total - +735.0B -

page load bundle size

id value diff baseline
lists 273.2KB +10.6KB 262.5KB

History

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

@peluja1012 peluja1012 merged commit 21156d6 into elastic:master Jul 15, 2020
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 15, 2020
* master: (82 commits)
  Fixed the spacing of child accordion items for policy response dialog. (elastic#71677)
  [SECURITY] Timeline bug 7.9 (elastic#71748)
  use fixed isChromeVisible method (elastic#71813)
  [SIEM][Detection Engine][Lists] Adds specific endpoint_list REST API and API for abilities to auto-create the endpoint_list if it gets deleted (elastic#71792)
  [test] Skips flaky Saved Objects Management test
  [APM] Remove watcher integration (elastic#71655)
  [APM] Increase `xpack.apm.ui.transactionGroupBucketSize` (elastic#71661)
  [test] Skips Ingest Manager test preventing ES promotion
  [test] Skips flaky detection engine tests
  Revert "re-fix navigate path for master add SAML login to login_page (elastic#71337)"
  [tests] Temporarily skipped Fleet tests
  [test] Skipped monitoring test
  [Security Solution][Detections] Associate Endpoint Exceptions List to Rule during rule creation/update (elastic#71794)
  Add endpoint exception creation API validation (elastic#71791)
  Skip jest tests that timeout waiting for react (elastic#71801)
  [Security Solution][Exceptions] - Adds filtering to endpoint index patterns by exceptional fields (elastic#71757)
  [Reporting] Re-delete a file (elastic#71730)
  [Security Solution] [Detections] Fixes bug for determining when we hit max signals after filtering with lists (elastic#71768)
  [Ingest Manager] Better display of Fleet requirements (elastic#71686)
  [tests] Temporarily skipped to promote snapshot
  ...
cnasikas pushed a commit that referenced this pull request Jul 15, 2020
…T API and API for abilities to auto-create the endpoint_list if it gets deleted (#71792) (#71818)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Frank Hassanabad <frank.hassanabad@elastic.co>
@FrankHassanabad FrankHassanabad deleted the add-endpoint-list-creation branch July 15, 2020 12:44
@MindyRS MindyRS added the Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. label Sep 23, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:enhancement Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:SIEM v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants