-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[SECURITY_SOLUTION][ENDPOINT] Trusted Apps Create API #76178
[SECURITY_SOLUTION][ENDPOINT] Trusted Apps Create API #76178
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will check if the list is created first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - the createTrustedAppsLists()
method will not create it if it already exists - a warning is logged to the kibana log. Ref:
kibana/x-pack/plugins/lists/server/services/exception_lists/create_endpoint_trusted_apps_list.ts
Lines 70 to 72 in d462274
} catch (err) { | |
if (savedObjectsClient.errors.isConflictError(err)) { | |
return null; |
(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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
POST
support to the Trusted Apps API for creating a new Trusted App entry.Request:
Response:
HTTP
200
withbody
set to:Checklist
Delete any items that are not applicable to this PR.