Include base error for json decode error responses#5069
Include base error for json decode error responses#5069michel-laterman merged 6 commits intoelastic:mainfrom
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
cmacknz
left a comment
There was a problem hiding this comment.
Thanks, doing a quick paranoia check I don't see any places where nextErr could contain anything we wouldn't want to give back to a client: https://github.com/search?q=repo%3Aelastic%2Ffleet-server%20nextErr&type=code
pkoutsovasilis
left a comment
There was a problem hiding this comment.
The code changes look good to me, but could you please update the unit-tests to have a green CI @michel-laterman ? 🙂
|
Current e2e failure is dues to the version bump, the test needs |
|
buildkite test this |
|
|
@Mergifyio backport 8.17 8.18 8.19 9.0 9.1 |
✅ Backports have been createdDetails
|
* Include base error for json decode error responses (cherry picked from commit 966c4f8) # Conflicts: # internal/pkg/api/handleEnroll_test.go
* Include base error for json decode error responses (cherry picked from commit 966c4f8)
* Include base error for json decode error responses (cherry picked from commit 966c4f8) # Conflicts: # internal/pkg/api/handleEnroll_test.go
* Include base error for json decode error responses (cherry picked from commit 966c4f8)
* Include base error for json decode error responses (cherry picked from commit 966c4f8)
…nses (#5085) * Include base error for json decode error responses (#5069) * Include base error for json decode error responses (cherry picked from commit 966c4f8) # Conflicts: # internal/pkg/api/handleEnroll_test.go * Fix backport --------- Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com> Co-authored-by: michel-laterman <michel.laterman@elastic.co>
…nses (#5083) * Include base error for json decode error responses (#5069) * Include base error for json decode error responses (cherry picked from commit 966c4f8) # Conflicts: # internal/pkg/api/handleEnroll_test.go * Fix backport * remove FIPS unit test --------- Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com> Co-authored-by: michel-laterman <michel.laterman@elastic.co>




What is the problem this PR solves?
There is no information on why request bodies fail to decode as JSON
How does this PR solve the problem?
Include the base json decode error as part of the response.
Design Checklist
I have ensured my design is stateless and will work when multiple fleet-server instances are behind a load balancer.I have or intend to scale test my changes, ensuring it will work reliably with 100K+ agents connected.I have included fail safe mechanisms to limit the load on fleet-server: rate limiting, circuit breakers, caching, load shedding, etc.Checklist
I have commented my code, particularly in hard-to-understand areasI have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added tests that prove my fix is effective or that my feature works./changelog/fragmentsusing the changelog tool