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

Suggestion 7: Improve HTTP Error Handling #484

Open
mpguerra opened this issue Feb 18, 2025 · 0 comments
Open

Suggestion 7: Improve HTTP Error Handling #484

mpguerra opened this issue Feb 18, 2025 · 0 comments

Comments

@mpguerra
Copy link
Contributor

Location

src/comms/http.rs#L496

Synopsis

In the following lines of code, _r is not checked. Consequently, if the server responds with HTTP 400 or 500, the code will not detect it:

let _r = self.client
    .post(format!("{}/send", self.host_port)) 
    .json(&frostd::SendArgs { ... }) 
    .send().await?;

Mitigation

One possible solution could be to implement the following:

let resp = self.client.post(...).send().await?; 
if !resp.status().is_success() { 
    return Err(eyre!("send failed: {}", resp.status()).into()); 
}
@mpguerra mpguerra added this to the FROST Demo Audit milestone Feb 18, 2025
@mpguerra mpguerra moved this to Product Backlog in FROST Feb 18, 2025
@mpguerra mpguerra moved this from Product Backlog to Sprint Backlog in FROST Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Sprint Backlog
Development

No branches or pull requests

1 participant