[SECURITY_SOLUTION][ENDPOINT] Trusted Apps Create API#76178
[SECURITY_SOLUTION][ENDPOINT] Trusted Apps Create API#76178paul-tavares merged 9 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/endpoint-app-team (Feature:Endpoint) |
|
Pinging @elastic/endpoint-management (Team:Endpoint Management) |
|
|
||
| try { | ||
| // Ensure list is created if it does not exist | ||
| await exceptionsListService?.createTrustedAppsList(); |
There was a problem hiding this comment.
this will check if the list is created first?
There was a problem hiding this comment.
Yes - the createTrustedAppsLists() method will not create it if it already exists - a warning is logged to the kibana log. Ref:
(FYI: I just noticed the ? in the above code - will remove it (no longer needed)
| router.post( | ||
| { | ||
| path: TRUSTED_APPS_CREATE_API, | ||
| validate: PostTrustedAppCreateRequestSchema, |
There was a problem hiding this comment.
if the schema doesn't validate here, we get a 400 error? Do we get a meaningful message from the error? From your tests, it looks like an error will be thrown as expected - expect(() => body.validate(bodyMsg)).toThrow() - just wondering what the error actually looks like
There was a problem hiding this comment.
they are "typical" errors thrown by the schema lib. Here are a few examples:
// entries was an empty array
{
'statusCode': 400,
'error': 'Bad Request',
'message': '[request body.entries]: array size is [0], but cannot be smaller than [1]',
}// enty had os set to `winz`
{
'statusCode': 400,
'error': 'Bad Request',
'message': '[request body.os]: types that failed validation:\n- [request body.os.0]: expected value to equal [linux]\n- [request body.os.1]: expected value to equal [macos]\n- [request body.os.2]: expected value to equal [windows]',
}
💚 Build SucceededBuild metrics
History
To update your PR or re-run it, just comment with: |
* Create Trusted App API
* master: (223 commits) skip flaky suite (elastic#75724) [Reporting] Add functional test for Reports in non-default spaces (elastic#76053) [Enterprise Search] Fix various icons in dark mode (elastic#76430) skip flaky suite (elastic#76245) Add `auto` interval to histogram AggConfig (elastic#76001) [Resolver] generator uses setup_node_env (elastic#76422) [Ingest Manager] Support both zip & tar archives from Registry (elastic#76197) [Ingest Manager] Improve agent vs kibana version checks (elastic#76238) Manually building `KueryNode` for Fleet's routes (elastic#75693) remove dupe tinymath section (elastic#76093) Create APM issue template (elastic#76362) Delete unused file. (elastic#76386) [SECURITY_SOLUTION][ENDPOINT] Trusted Apps Create API (elastic#76178) [Detections Engine] Add Alert actions to the Timeline (elastic#73228) [Dashboard First] Library Notification (elastic#76122) [Maps] Add mvt support for ES doc sources (elastic#75698) Add setHeaderActionMenu API to AppMountParameters (elastic#75422) [ML] Remove "Are you sure" from data frame analytics jobs (elastic#76214) [yarn] remove typings-tester, use @ts-expect-error (elastic#76341) [Reporting/CSV] Do not fail the job if scroll ID can not be cleared (elastic#76014) ...
Summary
Adds HTTP
POSTsupport to the Trusted Apps API for creating a new Trusted App entry.Request:
Response:
HTTP
200withbodyset to:{ "data": { "entries": [ { "field": "path", "operator": "included", "type": "match", "value": "one/two" } ], "description": "", "created_at": "2020-08-27T19:22:57.526Z", "created_by": "kibana", "name": "new exception", "os": "windows", "id": "b6a7a870-e89a-11ea-98dd-29138fd9cf52" } }Checklist
Delete any items that are not applicable to this PR.