Skip to content

Commit 391addb

Browse files
authored
chore(deps): upgrade hmac and related deps (#2300)
KeyInit is no longer bundled in the Mac trait so we need to import KeyInit for new_from_slice.
1 parent 55170dd commit 391addb

7 files changed

Lines changed: 102 additions & 22 deletions

File tree

Cargo.lock

Lines changed: 93 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ futures-util = { version = "0.3", features = [
5252
] }
5353
hex = "0.4"
5454
hostname = "0.4"
55-
hkdf = "0.12"
56-
hmac = "0.12"
55+
hkdf = "0.13"
56+
hmac = "0.13"
5757
http = "1.4"
5858
jsonwebtoken = { version = "10.3", default-features = false, features = ["aws_lc_rs"] }
5959
lazy_static = "1.5"
@@ -71,7 +71,7 @@ sentry-backtrace = "0.46.2"
7171
serde = "1.0"
7272
serde_derive = "1.0"
7373
serde_json = { version = "1.0", features = ["arbitrary_precision"] }
74-
sha2 = "0.10"
74+
sha2 = "0.11"
7575
slog = { version = "2.8", features = [
7676
"max_level_trace",
7777
"release_max_level_info",

syncserver/src/server/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use actix_web::{
1212
use base64::{Engine, engine};
1313
use chrono::offset::Utc;
1414
use hawk::{self, Credentials, Key, RequestBuilder};
15-
use hmac::{Hmac, Mac};
15+
use hmac::{Hmac, KeyInit, Mac};
1616
use http::StatusCode;
1717
use lazy_static::lazy_static;
1818
use serde::de::DeserializeOwned;

syncserver/src/tokenserver/extractors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use actix_web::{
1515
use base64::{Engine, engine};
1616
use futures::future::LocalBoxFuture;
1717
use hex;
18-
use hmac::{Hmac, Mac};
18+
use hmac::{Hmac, KeyInit, Mac};
1919
use http::StatusCode;
2020
use lazy_static::lazy_static;
2121
use regex::Regex;

syncserver/src/web/auth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use base64::{Engine, engine};
1010
use chrono::{TimeDelta, offset::Utc};
1111
use hawk::{self, Header as HawkHeader, Key, RequestBuilder};
12-
use hmac::{Hmac, Mac};
12+
use hmac::{Hmac, KeyInit, Mac};
1313
use serde::{Deserialize, Serialize};
1414
use sha2::Sha256;
1515
use syncserver_common;
@@ -201,7 +201,7 @@ impl HawkPayload {
201201
fn verify_hmac(info: &[u8], key: &[u8], expected: &[u8]) -> ApiResult<()> {
202202
let mut hmac = Hmac::<Sha256>::new_from_slice(key)?;
203203
hmac.update(info);
204-
hmac.verify(expected.into()).map_err(From::from)
204+
hmac.verify_slice(expected).map_err(From::from)
205205
}
206206

207207
#[cfg(test)]

syncserver/src/web/extractors/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use base64::{Engine, engine};
1212
use futures::executor::block_on;
1313
use glean::server_events::GleanEventsLogger;
1414
use hawk::{Credentials, Key, RequestBuilder};
15-
use hmac::{Hmac, Mac};
15+
use hmac::{Hmac, KeyInit, Mac};
1616
use lazy_static::lazy_static;
1717
use sha2::Sha256;
1818
use tokio::sync::RwLock;

tokenserver-auth/src/crypto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use hkdf::Hkdf;
2-
use hmac::{Hmac, Mac};
2+
use hmac::{Hmac, KeyInit, Mac};
33
use jsonwebtoken::{Algorithm, DecodingKey, Validation, errors::ErrorKind, jwk::Jwk};
44
use ring::rand::{SecureRandom, SystemRandom};
55
use serde::de::DeserializeOwned;

0 commit comments

Comments
 (0)