Skip to content
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

api-server-rest: Responded with 200 OK although providing error in the body #529

Closed
davidhadas opened this issue Apr 6, 2024 · 0 comments · Fixed by #543
Closed

api-server-rest: Responded with 200 OK although providing error in the body #529

davidhadas opened this issue Apr 6, 2024 · 0 comments · Fixed by #543

Comments

@davidhadas
Copy link
Member

davidhadas commented Apr 6, 2024

api-server-rest responds with "200 OK" with a body indicating a timeout error.

The body included:
rpc status: Status { code: INTERNAL, message: "[CDH] [ERROR]: Get Resource failed: get resource failed: get rersource failed: Kbs client error: get resource failed: http request failed: get failed: error sending request for url (http://127.0.0.1:8080/kbs/v0/resource/default/sshclient/publicKey): connection closed before message completed", details: [], special_fields: SpecialFields { unknown_fields: UnknownFields { fields: None }, cached_size: CachedSize { size: 0 } } }

This is probably an example of a broader set of potential errors that lead to a "200 OK" with an error body.

When a. REST service reply with "200 OK" the REST client assumes that the body contains the requested information.
In this case, the REST client will assume that the body contains key material.

The REST client has no way to identify that an issue occurred and will only discover this later when trying to use the information as a key material and fail.

The api-server-rest should respond with a 4XX or 5XX to the client if the key material is not delivered.

The issue was observed when the connection between the CDH and KBS was abruptly disconnected during a key request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant