Skip to content

Commit

Permalink
fix: dont log sensible information
Browse files Browse the repository at this point in the history
  • Loading branch information
Threated committed Oct 30, 2024
1 parent 987ef21 commit 1802211
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/logic_ask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,23 @@ async fn handle_via_tasks(req: Request<Incoming>, config: &Config, target: &AppI
}
}

let mut task_results = resp.json::<Vec<TaskResult<HttpResponse>>>().await
let mut task_results = resp.json::<Vec<TaskResult<beam_lib::RawString>>>().await
.map_err(|e| {
warn!("Unable to parse HTTP result: {}", e);
StatusCode::BAD_GATEWAY
warn!("Unable to parse beam results: {e}");
StatusCode::INTERNAL_SERVER_ERROR
})?;
let Some(result) = task_results.pop() else {
error!("Reply had more than one answer (namely: {}). This should not happen; discarding request.", task_results.len());
return Err(StatusCode::INTERNAL_SERVER_ERROR.into());
};
debug!("Got reply with status {:?}: {:#?}", result.status, result.body);
let response_inner = match result.status {
let response_inner: HttpResponse = match result.status {
WorkStatus::Succeeded => {
result.body
serde_json::from_str(&result.body.0)
.map_err(|e| {
warn!("Unable to parse HTTP response: {e}");
StatusCode::BAD_GATEWAY
})?
},
e => {
warn!("Reply had unexpected workresult code: {e:?}: {:#?}", result.body);
Expand Down
1 change: 0 additions & 1 deletion src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ impl std::fmt::Debug for HttpResponse {
f.debug_struct("HttpResponse")
.field("status", &self.status)
.field("headers", &self.headers)
.field("body", &String::from_utf8_lossy(&self.body).as_ref())
.finish()
}
}
Expand Down

0 comments on commit 1802211

Please sign in to comment.