Skip to content

Commit 0eeffd4

Browse files
dependabot[bot]coltfredskeet70giarc3
authored
Bump the dependencies group across 1 directory with 3 updates (#361)
* Bump the dependencies group across 1 directory with 3 updates Updates the requirements on [jsonwebtoken](https://github.com/Keats/jsonwebtoken), [recrypt](https://github.com/IronCoreLabs/recrypt-rs) and [reqwest](https://github.com/seanmonstar/reqwest) to permit the latest version. Updates `jsonwebtoken` to 10.3.0 - [Changelog](https://github.com/Keats/jsonwebtoken/blob/master/CHANGELOG.md) - [Commits](Keats/jsonwebtoken@v9.0.0...v10.3.0) Updates `recrypt` to 0.15.0 - [Changelog](https://github.com/IronCoreLabs/recrypt-rs/blob/main/CHANGELOG.md) - [Commits](https://github.com/IronCoreLabs/recrypt-rs/commits) Updates `reqwest` to 0.12.28 - [Release notes](https://github.com/seanmonstar/reqwest/releases) - [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md) - [Commits](seanmonstar/reqwest@v0.12.0...v0.12.28) --- updated-dependencies: - dependency-name: jsonwebtoken dependency-version: 10.3.0 dependency-type: direct:production dependency-group: dependencies - dependency-name: recrypt dependency-version: 0.15.0 dependency-type: direct:production dependency-group: dependencies - dependency-name: reqwest dependency-version: 0.12.28 dependency-type: direct:production dependency-group: dependencies ... Signed-off-by: dependabot[bot] <support@github.com> * Downgrade jsonwebtoken and recrypt. Update reqwest features * Cargo sort * upgrade to jwt 10 * sort again * format * use aws-lc-rs * Cargo sort * Update Cargo.toml Co-authored-by: Craig Colegrove <34786857+giarc3@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Colt Frederickson <coltfred@gmail.com> Co-authored-by: Murph Murphy <murph@clurictec.com> Co-authored-by: Craig Colegrove <34786857+giarc3@users.noreply.github.com>
1 parent c477f1a commit 0eeffd4

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

Cargo.toml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,22 @@ blocking = []
2929
# enable to use statically compiled openssl on supported OpenSSL platforms; use with 'default-features = false'
3030
tls-vendored-openssl = ["reqwest/native-tls-vendored"]
3131
# enable to use rustls-tls; use with 'default-features = false'
32-
tls-rustls = ["reqwest/rustls-tls"]
32+
tls-rustls = ["reqwest/rustls"]
3333
# dynamically use the target platform's native TLS
34-
tls-default = ["reqwest/default-tls"]
34+
tls-default = ["reqwest/native-tls"]
3535

3636
default = ["tls-default", "tokio/rt-multi-thread"]
3737

3838
[dependencies]
39+
aws-lc-rs = "1"
3940
base64 = "0.22"
4041
base64-serde = "0.8"
4142
bytes = "1"
4243
futures = "0.3.1"
4344
hex = "0.4"
4445
ironcore-search-helpers = { version = "0.2", optional = true }
4546
itertools = "0.14"
46-
jsonwebtoken = "9"
47+
jsonwebtoken = { version = "10", features = ["rust_crypto"] }
4748
lazy_static = "1.4"
4849
log = "0.4"
4950
papaya = "0.2.0"
@@ -54,8 +55,11 @@ rand = "0.8"
5455
rand_chacha = "0.3"
5556
recrypt = "0.14"
5657
regex = "1.4"
57-
reqwest = { version = "0.12", features = ["json"], default-features = false }
58-
ring = { version = "0.17", features = ["std"] }
58+
reqwest = { version = "0.13", features = [
59+
"json",
60+
"query",
61+
"http2",
62+
], default-features = false }
5963
serde = { version = "1.0.126", features = ["derive"] }
6064
serde_json = "1"
6165
time = { version = "0.3.6", features = [

src/crypto/aes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{fmt, num::NonZeroU32};
22

3+
use aws_lc_rs::{aead, aead::BoundKey, digest, error::Unspecified, pbkdf2};
34
use rand::{self, CryptoRng, RngCore};
4-
use ring::{aead, aead::BoundKey, digest, error::Unspecified, pbkdf2};
55

66
use crate::internal::{IronOxideErr, take_lock};
77
use std::{convert::TryFrom, ops::DerefMut, sync::Mutex};
@@ -112,7 +112,7 @@ impl TryFrom<&[u8]> for AesEncryptedValue {
112112
}
113113
}
114114

115-
impl From<ring::error::Unspecified> for IronOxideErr {
115+
impl From<aws_lc_rs::error::Unspecified> for IronOxideErr {
116116
fn from(ring_err: Unspecified) -> Self {
117117
IronOxideErr::AesError(ring_err)
118118
}

src/internal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ quick_error! {
136136
KeyGenerationError {
137137
display("Key generation failed")
138138
}
139-
AesError(err: ring::error::Unspecified) {
139+
AesError(err: aws_lc_rs::error::Unspecified) {
140140
source(err)
141141
}
142142
AesEncryptedDocSizeError{

src/internal/user_api.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{
33
internal::{rest::IronCoreRequest, *},
44
};
55
use itertools::{Either, Itertools};
6-
use jsonwebtoken::{Algorithm, DecodingKey, Validation};
6+
use jsonwebtoken::Algorithm;
77
use rand::rngs::OsRng;
88
use recrypt::prelude::*;
99
use std::{
@@ -318,29 +318,22 @@ pub struct JwtClaims {
318318
/// Must be either ES256 or RS256 and have a payload similar to [JwtClaims](struct.JwtClaims.html), but could be
319319
/// generated from an external source.
320320
#[allow(clippy::derive_partial_eq_without_eq)]
321-
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Hash)]
321+
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
322322
pub struct Jwt {
323323
jwt: String,
324324
header: jsonwebtoken::Header,
325325
claims: JwtClaims,
326326
}
327+
327328
impl Jwt {
328329
/// Constructs a new Jwt.
329330
///
330331
/// Verifies that the provided jwt uses a compatible algorithm and contains the required claims.
331332
pub fn new(jwt: &str) -> Result<Jwt, IronOxideErr> {
332-
let bogus_key = DecodingKey::from_secret(&[]);
333-
let validation = {
334-
let mut temp: Validation = Default::default();
335-
temp.insecure_disable_signature_validation();
336-
temp.validate_aud = false;
337-
temp.validate_exp = false;
338-
temp
339-
};
340-
// This suspect key/validation is acceptable here because the server will do the actual
333+
// This insecure decode is acceptable here because the server will do the actual
341334
// signature verification and validation. We just want to do a little initial validation
342335
// to catch issues earlier.
343-
let token_data = jsonwebtoken::decode::<JwtClaims>(jwt, &bogus_key, &validation)
336+
let token_data = jsonwebtoken::dangerous::insecure_decode::<JwtClaims>(jwt)
344337
.map_err(|e| IronOxideErr::ValidationError("jwt".to_string(), e.to_string()))?;
345338
let JwtClaims {
346339
pid,
@@ -416,6 +409,12 @@ impl std::fmt::Display for Jwt {
416409
write!(f, "{}", self.jwt)
417410
}
418411
}
412+
impl std::hash::Hash for Jwt {
413+
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
414+
// Header and claims are derived from the string
415+
self.jwt.hash(state);
416+
}
417+
}
419418

420419
/// Verify an existing user given a valid JWT.
421420
pub async fn user_verify(

0 commit comments

Comments
 (0)