-
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] Fix error message for all SentinelOne response actions so that its consistent when no stack connector is setup #208405
Conversation
/ci |
Pinging @elastic/security-defend-workflows (Team:Defend Workflows) |
|
||
let s1ApiResponse: SentinelOneGetAgentsResponse | undefined; | ||
|
||
try { | ||
const response = await this.sendAction< | ||
SentinelOneGetAgentsResponse, | ||
SentinelOneGetAgentsParams | ||
>(SUB_ACTION.GET_AGENTS, { ids: agentId }); | ||
|
||
s1ApiResponse = response.data; | ||
} catch (err) { | ||
throw new ResponseActionsClientError( | ||
`Error while attempting to retrieve SentinelOne host with agent id [${agentId}]: ${err.message}`, | ||
500, | ||
err | ||
); | ||
} | ||
const s1ApiResponse = ( | ||
await this.sendAction<SentinelOneGetAgentsResponse, SentinelOneGetAgentsParams>( | ||
SUB_ACTION.GET_AGENTS, | ||
{ ids: agentId } | ||
) | ||
).data; | ||
|
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.
Could you please double-check if the error thrown by sendAction is properly handled? From reviewing the code, it’s not immediately clear.
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, I did. The sendAction()
will already handles errors correctly and (more important) returns a ResponseActionsClientError
that has the desired HTTP status code (400
)
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/13019534636 |
💚 Build Succeeded
Metrics [docs]Async chunks
History
|
…esponse actions so that its consistent when no stack connector is setup (elastic#208405) ## Summary - Fixes the API error messages for SentinelOne so that they are consistent when there is no stack connector setup for it - All commands now return a `400: Bad Request, statusCode: 400, error: Bad Request, message: No stack connector instance configured for [.sentinelone]` for this condition - Improve the error message title on the UI (console) to clarify that the Action Request failed to be created - Background: Before this change, all failures showed a title of `Action failed` regardless if the action request API call failed **-OR-** the response of the action was a failure - The UI will now show a message title of `Failed to create action request.` when the API call to create the action fails - Response actions that were successful created, but the result of them is an error will continue to show `Action failed.` (cherry picked from commit 19f8506)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…lOne response actions so that its consistent when no stack connector is setup (#208405) (#208631) # Backport This will backport the following commits from `main` to `8.x`: - [[Security Solution][Endpoint] Fix error message for all SentinelOne response actions so that its consistent when no stack connector is setup (#208405)](#208405) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Paul Tavares","email":"56442535+paul-tavares@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-01-28T21:05:35Z","message":"[Security Solution][Endpoint] Fix error message for all SentinelOne response actions so that its consistent when no stack connector is setup (#208405)\n\n## Summary\r\n\r\n- Fixes the API error messages for SentinelOne so that they are\r\nconsistent when there is no stack connector setup for it\r\n- All commands now return a `400: Bad Request, statusCode: 400, error:\r\nBad Request, message: No stack connector instance configured for\r\n[.sentinelone]` for this condition\r\n- Improve the error message title on the UI (console) to clarify that\r\nthe Action Request failed to be created\r\n- Background: Before this change, all failures showed a title of `Action\r\nfailed` regardless if the action request API call failed **-OR-** the\r\nresponse of the action was a failure\r\n- The UI will now show a message title of `Failed to create action\r\nrequest.` when the API call to create the action fails\r\n- Response actions that were successful created, but the result of them\r\nis an error will continue to show `Action failed.`","sha":"19f8506d7fea351b27af457ff484914f042c070f","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Defend Workflows","backport:prev-minor","v8.18.0"],"title":"[Security Solution][Endpoint] Fix error message for all SentinelOne response actions so that its consistent when no stack connector is setup","number":208405,"url":"https://github.com/elastic/kibana/pull/208405","mergeCommit":{"message":"[Security Solution][Endpoint] Fix error message for all SentinelOne response actions so that its consistent when no stack connector is setup (#208405)\n\n## Summary\r\n\r\n- Fixes the API error messages for SentinelOne so that they are\r\nconsistent when there is no stack connector setup for it\r\n- All commands now return a `400: Bad Request, statusCode: 400, error:\r\nBad Request, message: No stack connector instance configured for\r\n[.sentinelone]` for this condition\r\n- Improve the error message title on the UI (console) to clarify that\r\nthe Action Request failed to be created\r\n- Background: Before this change, all failures showed a title of `Action\r\nfailed` regardless if the action request API call failed **-OR-** the\r\nresponse of the action was a failure\r\n- The UI will now show a message title of `Failed to create action\r\nrequest.` when the API call to create the action fails\r\n- Response actions that were successful created, but the result of them\r\nis an error will continue to show `Action failed.`","sha":"19f8506d7fea351b27af457ff484914f042c070f"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208405","number":208405,"mergeCommit":{"message":"[Security Solution][Endpoint] Fix error message for all SentinelOne response actions so that its consistent when no stack connector is setup (#208405)\n\n## Summary\r\n\r\n- Fixes the API error messages for SentinelOne so that they are\r\nconsistent when there is no stack connector setup for it\r\n- All commands now return a `400: Bad Request, statusCode: 400, error:\r\nBad Request, message: No stack connector instance configured for\r\n[.sentinelone]` for this condition\r\n- Improve the error message title on the UI (console) to clarify that\r\nthe Action Request failed to be created\r\n- Background: Before this change, all failures showed a title of `Action\r\nfailed` regardless if the action request API call failed **-OR-** the\r\nresponse of the action was a failure\r\n- The UI will now show a message title of `Failed to create action\r\nrequest.` when the API call to create the action fails\r\n- Response actions that were successful created, but the result of them\r\nis an error will continue to show `Action failed.`","sha":"19f8506d7fea351b27af457ff484914f042c070f"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Paul Tavares <56442535+paul-tavares@users.noreply.github.com>
Summary
400: Bad Request, statusCode: 400, error: Bad Request, message: No stack connector instance configured for [.sentinelone]
for this conditionAction failed
regardless if the action request API call failed -OR- the response of the action was a failureFailed to create action request.
when the API call to create the action failsAction failed.
Checklist