-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] server-side standard interface for response actions clients #171755
[Security Solution][Endpoint] server-side standard interface for response actions clients #171755
Conversation
keep PR speicific to introducing a well defined interface for Response Actions clients
Pinging @elastic/security-defend-workflows (Team:Defend Workflows) |
…onal-response-actions-data-persist
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
ImmutableObject, | ||
} from '../../../../../common/endpoint/types'; | ||
|
||
export class EndpointActionsClient extends BaseResponseActionsClient { |
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.
FYI: testing of this client is covered by existing tests for both the Route handler for response actions and the individual service functions under services/actions/*
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.
Thanks for this. I've a couple suggestions, please feel free to address them in a later PR.
file_size: 0, | ||
}; | ||
|
||
const createdFile = await fleetFiles.create(fileStream, actionPayload.endpoint_ids); |
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.
We should handle errors for create file failures.
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.
There is really nothing we have to do if this fails here, so we just would be re-throwing the error again. The catch()
block below attempts to delete the file (since they can be large) if there is a failure after it is created/stored (ex. a failure while indexing the documents for the action request).
@@ -17,7 +16,7 @@ import type { ResponseActionsApiCommandNames } from '../../../../../common/endpo | |||
|
|||
export type CreateActionPayload = TypeOf<typeof ResponseActionBodySchema> & { | |||
command: ResponseActionsApiCommandNames; | |||
user?: ReturnType<AuthenticationServiceStart['getCurrentUser']>; | |||
user?: { username: string } | null | undefined; |
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.
Q: Should we just change user
to be not optional for automated actions.
user?: { username: string } | null | undefined; | |
user: { username: string } | undefined; |
else just optional user should be okay?
user?: { username: string } | null | undefined; | |
user?: { username: string } ; |
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.
I'm not sure what the impact would be. for now, i'm thinking that we just leave it as is since I was not trying to change much about the existing logic. are you ok with that?
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.
Yeah that sounds okay about not changing too much. We can clean it up as we go later.
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.
🙇
Summary
PR introduces a standard interface for Response Actions clients - currently only Endpoint, but in the near future, other clients will be introduced like SentinelOne. This PR is in preperation for that feature in a post v8.12 release.
Changes include:
EndpointActionsClient
class (first Actions client using new standard interface)EndpointActionsClient
for processing response actionsupload
response action (previously a separate handler)upload
specific API HTTP handler - no longer needed as common handler will now also processupload
response actionsNOTE: No changes in functionality as a result of this PR. Just preparation work needed to support Bi-Directional Response Actions.