Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions httpsig-hyper/src/hyper_content_digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ where
.map_err(|_e| HyperDigestError::HttpBodyError("Failed to get body bytes".to_string()))?;
let digest = derive_digest(&body_bytes, &cd_type);

if matches!(digest, _expected_digest) {
if digest == _expected_digest {
Copy link
Owner

Choose a reason for hiding this comment

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

In the next release, I will switch the digest comparison to a constant-time comparison as defense-in-depth, and add regression tests to ensure this class of bug cannot be reintroduced.

let new_body = Full::new(body_bytes).map_err(|never| match never {}).boxed();
let res = Request::from_parts(header, new_body);
Ok(res)
Expand Down Expand Up @@ -192,7 +192,7 @@ where
.map_err(|_e| HyperDigestError::HttpBodyError("Failed to get body bytes".to_string()))?;
let digest = derive_digest(&body_bytes, &cd_type);

if matches!(digest, _expected_digest) {
if digest == _expected_digest {
Copy link
Owner

Choose a reason for hiding this comment

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

Same as above

let new_body = Full::new(body_bytes).map_err(|never| match never {}).boxed();
let res = Response::from_parts(header, new_body);
Ok(res)
Expand Down