mirror of
https://github.com/element-hq/matrix-authentication-service.git
synced 2026-10-22 17:32:47 +00:00
build(deps): bump rust-toolchain from 1.96.0 to 1.98.1 (#5966)
This commit is contained in:
9 files changed
+62
-41
No files matched your search
@@ -1,3 +1,4 @@
|
||||
// Copyright 2025, 2026 Element Creations Ltd.
|
||||
// Copyright 2024, 2025 New Vector Ltd.
|
||||
// Copyright 2022-2024 The Matrix.org Foundation C.I.C.
|
||||
//
|
||||
@@ -6,7 +7,7 @@
|
||||
|
||||
//! Private (encrypted) cookie jar, based on axum-extra's cookie jar
|
||||
|
||||
use std::convert::Infallible;
|
||||
use std::{convert::Infallible, future::ready};
|
||||
|
||||
use axum::{
|
||||
extract::{FromRef, FromRequestParts},
|
||||
@@ -71,9 +72,12 @@ where
|
||||
{
|
||||
type Rejection = Infallible;
|
||||
|
||||
async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {
|
||||
fn from_request_parts(
|
||||
parts: &mut Parts,
|
||||
state: &S,
|
||||
) -> impl Future<Output = Result<Self, Self::Rejection>> + Send {
|
||||
let cookie_manager = CookieManager::from_ref(state);
|
||||
Ok(cookie_manager.cookie_jar_from_headers(&parts.headers))
|
||||
ready(Ok(cookie_manager.cookie_jar_from_headers(&parts.headers)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-11
@@ -1,11 +1,11 @@
|
||||
// Copyright 2026 Element Creations Ltd.
|
||||
// Copyright 2025, 2026 Element Creations Ltd.
|
||||
// Copyright 2024, 2025 New Vector Ltd.
|
||||
// Copyright 2022-2024 The Matrix.org Foundation C.I.C.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
|
||||
use std::{convert::Infallible, net::IpAddr, sync::Arc};
|
||||
use std::{convert::Infallible, future::ready, net::IpAddr, sync::Arc};
|
||||
|
||||
use axum::extract::{FromRef, FromRequestParts, State};
|
||||
use ipnetwork::IpNetwork;
|
||||
@@ -224,28 +224,30 @@ impl FromRef<AppState> for AppVersion {
|
||||
impl FromRequestParts<AppState> for BoxClock {
|
||||
type Rejection = Infallible;
|
||||
|
||||
async fn from_request_parts(
|
||||
fn from_request_parts(
|
||||
_parts: &mut axum::http::request::Parts,
|
||||
_state: &AppState,
|
||||
) -> Result<Self, Self::Rejection> {
|
||||
) -> impl Future<Output = Result<Self, Self::Rejection>> + Send {
|
||||
let clock = SystemClock::default();
|
||||
Ok(Box::new(clock))
|
||||
let clock: Self = Box::new(clock);
|
||||
ready(Ok(clock))
|
||||
}
|
||||
}
|
||||
|
||||
impl FromRequestParts<AppState> for BoxRng {
|
||||
type Rejection = Infallible;
|
||||
|
||||
async fn from_request_parts(
|
||||
fn from_request_parts(
|
||||
_parts: &mut axum::http::request::Parts,
|
||||
_state: &AppState,
|
||||
) -> Result<Self, Self::Rejection> {
|
||||
) -> impl Future<Output = Result<Self, Self::Rejection>> + Send {
|
||||
// This rng is used to source the local rng
|
||||
#[expect(clippy::disallowed_methods)]
|
||||
let rng = rand::thread_rng();
|
||||
|
||||
let rng = rand_chacha::ChaChaRng::from_rng(rng).expect("Failed to seed RNG");
|
||||
Ok(Box::new(rng))
|
||||
let rng: Self = Box::new(rng);
|
||||
ready(Ok(rng))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,11 +266,11 @@ impl FromRequestParts<AppState> for Policy {
|
||||
impl FromRequestParts<AppState> for ActivityTracker {
|
||||
type Rejection = Infallible;
|
||||
|
||||
async fn from_request_parts(
|
||||
fn from_request_parts(
|
||||
_parts: &mut axum::http::request::Parts,
|
||||
state: &AppState,
|
||||
) -> Result<Self, Self::Rejection> {
|
||||
Ok(state.activity_tracker.clone())
|
||||
) -> impl Future<Output = Result<Self, Self::Rejection>> + Send {
|
||||
ready(Ok(state.activity_tracker.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright 2025, 2026 Element Creations Ltd.
|
||||
// Copyright 2024, 2025 New Vector Ltd.
|
||||
// Copyright 2024 The Matrix.org Foundation C.I.C.
|
||||
//
|
||||
@@ -29,11 +30,11 @@ macro_rules! impl_from_request_parts {
|
||||
impl axum::extract::FromRequestParts<DummyState> for $type {
|
||||
type Rejection = std::convert::Infallible;
|
||||
|
||||
async fn from_request_parts(
|
||||
fn from_request_parts(
|
||||
_parts: &mut axum::http::request::Parts,
|
||||
_state: &DummyState,
|
||||
) -> Result<Self, Self::Rejection> {
|
||||
unimplemented!("This is a dummy state, it should never be used")
|
||||
) -> impl Future<Output = Result<Self, Self::Rejection>> + Send {
|
||||
async { unimplemented!("This is a dummy state, it should never be used") }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,7 +5,12 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
|
||||
#![allow(clippy::module_name_repetitions)]
|
||||
#![allow(
|
||||
clippy::module_name_repetitions,
|
||||
// async-graphql's `#[Object]` requires resolvers to be `async fn`, and its
|
||||
// `Enum` derive emits async trait impls without awaits
|
||||
clippy::unused_async_trait_impl,
|
||||
)]
|
||||
|
||||
use std::{net::IpAddr, ops::Deref, sync::Arc};
|
||||
|
||||
|
||||
@@ -515,7 +515,7 @@ pub(crate) async fn post(
|
||||
.ok_or(RouteError::CantLoadUser(session.user_id))?;
|
||||
|
||||
if !user.is_valid() {
|
||||
return Err(RouteError::InvalidUser(user.id))?;
|
||||
return Err(RouteError::InvalidUser(user.id));
|
||||
}
|
||||
|
||||
// Grant the synapse admin scope if the session has the admin flag set.
|
||||
@@ -599,7 +599,7 @@ pub(crate) async fn post(
|
||||
.ok_or(RouteError::CantLoadUser(session.user_id))?;
|
||||
|
||||
if !user.is_valid() {
|
||||
return Err(RouteError::InvalidUser(user.id))?;
|
||||
return Err(RouteError::InvalidUser(user.id));
|
||||
}
|
||||
|
||||
// Grant the synapse admin scope if the session has the admin flag set.
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// Copyright 2025, 2026 Element Creations Ltd.
|
||||
// Copyright 2024, 2025 New Vector Ltd.
|
||||
// Copyright 2023, 2024 The Matrix.org Foundation C.I.C.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
|
||||
use std::{convert::Infallible, sync::Arc};
|
||||
use std::{convert::Infallible, future::ready, sync::Arc};
|
||||
|
||||
use axum::{
|
||||
extract::{FromRef, FromRequestParts},
|
||||
@@ -23,7 +24,10 @@ where
|
||||
{
|
||||
type Rejection = Infallible;
|
||||
|
||||
async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {
|
||||
fn from_request_parts(
|
||||
parts: &mut Parts,
|
||||
state: &S,
|
||||
) -> impl Future<Output = Result<Self, Self::Rejection>> + Send {
|
||||
let translator: Arc<Translator> = FromRef::from_ref(state);
|
||||
let accept_language = parts.headers.typed_get::<AcceptLanguage>();
|
||||
|
||||
@@ -45,6 +49,6 @@ where
|
||||
|
||||
let locale = translator.choose_locale(iter);
|
||||
|
||||
Ok(PreferredLanguage(locale))
|
||||
ready(Ok(PreferredLanguage(locale)))
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2026 Element Creations Ltd.
|
||||
// Copyright 2025, 2026 Element Creations Ltd.
|
||||
// Copyright 2024, 2025 New Vector Ltd.
|
||||
// Copyright 2024 The Matrix.org Foundation C.I.C.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
|
||||
use std::{convert::Infallible, net::IpAddr, sync::Arc, time::Duration};
|
||||
use std::{convert::Infallible, future::ready, net::IpAddr, sync::Arc, time::Duration};
|
||||
|
||||
use axum::extract::FromRequestParts;
|
||||
use governor::{RateLimiter, clock::QuantaClock, state::keyed::DashMapStateStore};
|
||||
@@ -82,22 +82,24 @@ impl RequesterFingerprint {
|
||||
impl<S: Send + Sync> FromRequestParts<S> for RequesterFingerprint {
|
||||
type Rejection = Infallible;
|
||||
|
||||
async fn from_request_parts(
|
||||
fn from_request_parts(
|
||||
parts: &mut axum::http::request::Parts,
|
||||
_state: &S,
|
||||
) -> Result<Self, Self::Rejection> {
|
||||
) -> impl Future<Output = Result<Self, Self::Rejection>> + Send {
|
||||
let ip = parts.extensions.get::<ClientIp>().and_then(|ip| ip.0);
|
||||
|
||||
if let Some(ip) = ip {
|
||||
Ok(Self::new(ip))
|
||||
let fingerprint = if let Some(ip) = ip {
|
||||
Self::new(ip)
|
||||
} else {
|
||||
// If we can't infer the IP address, we'll just use an empty fingerprint and
|
||||
// warn about it
|
||||
tracing::warn!(
|
||||
"Could not infer client IP address for an operation which rate-limits based on IP addresses"
|
||||
);
|
||||
Ok(Self::EMPTY)
|
||||
}
|
||||
Self::EMPTY
|
||||
};
|
||||
|
||||
ready(Ok(fingerprint))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
use std::{
|
||||
convert::Infallible,
|
||||
future::ready,
|
||||
net::IpAddr,
|
||||
sync::{Arc, Mutex, RwLock},
|
||||
task::{Context, Poll},
|
||||
@@ -655,35 +656,37 @@ impl FromRef<TestState> for AppVersion {
|
||||
impl FromRequestParts<TestState> for ActivityTracker {
|
||||
type Rejection = Infallible;
|
||||
|
||||
async fn from_request_parts(
|
||||
fn from_request_parts(
|
||||
_parts: &mut axum::http::request::Parts,
|
||||
state: &TestState,
|
||||
) -> Result<Self, Self::Rejection> {
|
||||
Ok(state.activity_tracker.clone())
|
||||
) -> impl Future<Output = Result<Self, Self::Rejection>> + Send {
|
||||
ready(Ok(state.activity_tracker.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
impl FromRequestParts<TestState> for BoxClock {
|
||||
type Rejection = Infallible;
|
||||
|
||||
async fn from_request_parts(
|
||||
fn from_request_parts(
|
||||
_parts: &mut axum::http::request::Parts,
|
||||
state: &TestState,
|
||||
) -> Result<Self, Self::Rejection> {
|
||||
Ok(Box::new(state.clock.clone()))
|
||||
) -> impl Future<Output = Result<Self, Self::Rejection>> + Send {
|
||||
let clock: Self = Box::new(state.clock.clone());
|
||||
ready(Ok(clock))
|
||||
}
|
||||
}
|
||||
|
||||
impl FromRequestParts<TestState> for BoxRng {
|
||||
type Rejection = Infallible;
|
||||
|
||||
async fn from_request_parts(
|
||||
fn from_request_parts(
|
||||
_parts: &mut axum::http::request::Parts,
|
||||
state: &TestState,
|
||||
) -> Result<Self, Self::Rejection> {
|
||||
) -> impl Future<Output = Result<Self, Self::Rejection>> + Send {
|
||||
let mut parent_rng = state.rng.lock().expect("Failed to lock RNG");
|
||||
let rng = ChaChaRng::from_rng(&mut *parent_rng).expect("Failed to seed RNG");
|
||||
Ok(Box::new(rng))
|
||||
let rng: Self = Box::new(rng);
|
||||
ready(Ok(rng))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
# Please see LICENSE files in the repository root for full details.
|
||||
|
||||
[toolchain]
|
||||
channel = "1.96.0"
|
||||
channel = "1.98.1"
|
||||
profile = "minimal"
|
||||
# No rustfmt: .rustfmt.toml uses nightly-only options, so formatting runs as `cargo +nightly fmt`.
|
||||
# No cross-compilation targets: the Dockerfile and build.yaml add the ones they need.
|
||||
|
||||
Reference in new issue
Block a user