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
ti_crowdstrike: improve error reporting for unsuccessful API requests #9059
Conversation
Previously, failed requests would continue through the standard happy path, potentially resulting in an uninfortive CEL error when the data shape does not match the program's expectations. We have the HTTP status code, so make use of this to return an error object in the case that we get a non-success.
}, | ||
})) | ||
).do_request().as(resp, | ||
resp.StatusCode == 200 ? |
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.
Query whether we know for sure that Crowdstrike always returns a 200 status for success.
🚀 Benchmarks reportTo see the full report comment with |
💚 Build Succeeded
cc @efd6 |
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
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.
Looks good if it is always 200 for success. If we can't confirm, I think 200 would be an okay assumption and 2XX would be a good assumption.
This could be tested if system tests allowed us to tolerate errors and make assertions about index documents. |
Customer (and CrowdStrike user) here... per their API specification swagger page, it will always return a 200 for both API endpoints that I believe are being used by this integration. This corresponds to what I have seen in my testing as well. I hope this is helpful! |
@NateUT99 Thank you, this is very helpful. |
Proposed commit message
Previously, failed requests would continue through the standard happy path, potentially resulting in an uninformative CEL error when the data shape does not match the program's expectations. We have the HTTP status code, so make use of this to return an error object in the case that we get a non-success.
Checklist
changelog.yml
file.Author's Checklist
How to test this PR locally
Related issues
Screenshots