Skip to content

Commit c0f1e8c

Browse files
committed
fix: dont log sensible information
1 parent dc4592e commit c0f1e8c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/logic_ask.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,23 @@ async fn handle_via_tasks(req: Request<Incoming>, config: &Config, target: &AppI
140140
}
141141
}
142142

143-
let mut task_results = resp.json::<Vec<TaskResult<HttpResponse>>>().await
143+
let mut task_results = resp.json::<Vec<TaskResult<beam_lib::RawString>>>().await
144144
.map_err(|e| {
145-
warn!("Unable to parse HTTP result: {}", e);
146-
StatusCode::BAD_GATEWAY
145+
warn!("Unable to parse beam results: {e}");
146+
StatusCode::INTERNAL_SERVER_ERROR
147147
})?;
148148
let Some(result) = task_results.pop() else {
149149
error!("Reply had more than one answer (namely: {}). This should not happen; discarding request.", task_results.len());
150150
return Err(StatusCode::INTERNAL_SERVER_ERROR.into());
151151
};
152152
debug!("Got reply with status {:?}: {:#?}", result.status, result.body);
153-
let response_inner = match result.status {
153+
let response_inner: HttpResponse = match result.status {
154154
WorkStatus::Succeeded => {
155-
result.body
155+
serde_json::from_str(&result.body.0)
156+
.map_err(|e| {
157+
warn!("Unable to parse HTTP response: {e}");
158+
StatusCode::BAD_GATEWAY
159+
})?
156160
},
157161
e => {
158162
warn!("Reply had unexpected workresult code: {e:?}: {:#?}", result.body);

src/msg.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ impl std::fmt::Debug for HttpResponse {
2828
f.debug_struct("HttpResponse")
2929
.field("status", &self.status)
3030
.field("headers", &self.headers)
31-
.field("body", &String::from_utf8_lossy(&self.body).as_ref())
3231
.finish()
3332
}
3433
}

0 commit comments

Comments
 (0)