Skip to content

Handle tasks asynchronously #62

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

Merged
merged 4 commits into from
Oct 30, 2024
Merged

Handle tasks asynchronously #62

merged 4 commits into from
Oct 30, 2024

Conversation

Threated
Copy link
Member

@Threated Threated commented Oct 29, 2024

Review commit by commit.

I will test this branch on the DNPM server before merging

@Threated Threated requested a review from TKussel October 29, 2024 15:56
@Threated
Copy link
Member Author

Running flawlessly on the central dnpm servers

let response_inner = match result.status {
WorkStatus::Succeeded => {
result.body
},
e => {
warn!("Reply had unexpected workresult code: {e:?}");
warn!("Reply had unexpected workresult code: {e:?}: {:#?}", result.body);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit concerned about his. It only triggers at an error status code, right? So we don't run into the risk of logging sensitive data by printing the body?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes although I just realized we won't even get here as a few lines earlier we try to deserialize into a Something<HttpResponse> which won't work and error early so to improve the error messages I will change that to deserialize into serde_json::Values first and if the status is success then into the HttpResponse. What do you think?

src/msg.rs Outdated
f.debug_struct("HttpResponse")
.field("status", &self.status)
.field("headers", &self.headers)
.field("body", &String::from_utf8_lossy(&self.body).as_ref())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, please check if we debug print the respones somewhere, where sensitive data might be in the body

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will double check good catch

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would logging headers still be fine?
We could also have it include the body if its build in debug mode and skip it in release builds

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are logging the response, there should be no e.g. Authorization header present. So I think that should be fine?
Not logging the bodies in release builds is certainly the secure path forward.

@Threated Threated merged commit 1802211 into develop Oct 30, 2024
23 checks passed
@Threated Threated deleted the feat/async-tasks branch October 30, 2024 14:22
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 this pull request may close these issues.

2 participants