Skip to content

Commit 6465766

Browse files
Add error logging for signature validation failures in optional middleware
1 parent f48cfb9 commit 6465766

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/validate_incoming.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ impl MAuthInfo {
7373
// anyways since we just did here.
7474
let body_bytes = match axum::body::to_bytes(body, usize::MAX).await {
7575
Ok(bytes) => bytes,
76-
Err(err) => {
76+
Err(error) => {
7777
error!(
78-
error = ?err,
78+
?error,
7979
"Failed to retrieve request body, continuing with empty body"
8080
);
8181
Bytes::new()
@@ -88,20 +88,26 @@ impl MAuthInfo {
8888
app_uuid: host_app_uuid,
8989
});
9090
}
91-
Err(err) => {
91+
Err(error_v2) => {
9292
if self.allow_v1_auth {
9393
match self.validate_request_v1(&parts, &body_bytes).await {
9494
Ok(host_app_uuid) => {
9595
parts.extensions.insert(ValidatedRequestDetails {
9696
app_uuid: host_app_uuid,
9797
});
9898
}
99-
Err(err) => {
100-
parts.extensions.insert(err);
99+
Err(error_v1) => {
100+
error!(
101+
?error_v2,
102+
?error_v1,
103+
"Error attempting to validate MAuth signatures"
104+
);
105+
parts.extensions.insert(error_v1);
101106
}
102107
}
103108
} else {
104-
parts.extensions.insert(err);
109+
error!(?error_v2, "Error attempting to validate MAuth V2 signature");
110+
parts.extensions.insert(error_v2);
105111
}
106112
}
107113
}

0 commit comments

Comments
 (0)