diff --git a/Cargo.lock b/Cargo.lock index 2f33ebb3..cf3f6400 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -121,28 +121,6 @@ version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" -[[package]] -name = "async-stream" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "async-trait" version = "0.1.89" @@ -186,11 +164,10 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "axum" -version = "0.7.9" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" +checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" dependencies = [ - "async-trait", "axum-core", "bytes", "futures-util", @@ -203,29 +180,26 @@ dependencies = [ "mime", "percent-encoding", "pin-project-lite", - "rustversion", - "serde", + "serde_core", "sync_wrapper", - "tower 0.5.2", + "tower", "tower-layer", "tower-service", ] [[package]] name = "axum-core" -version = "0.4.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" dependencies = [ - "async-trait", "bytes", - "futures-util", + "futures-core", "http", "http-body", "http-body-util", "mime", "pin-project-lite", - "rustversion", "sync_wrapper", "tower-layer", "tower-service", @@ -928,7 +902,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.11.0", + "indexmap", "slab", "tokio", "tokio-util", @@ -945,12 +919,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.15.5" @@ -968,7 +936,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ - "hashbrown 0.15.5", + "hashbrown", ] [[package]] @@ -1280,16 +1248,6 @@ dependencies = [ "icu_properties", ] -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - [[package]] name = "indexmap" version = "2.11.0" @@ -1297,7 +1255,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9" dependencies = [ "equivalent", - "hashbrown 0.15.5", + "hashbrown", ] [[package]] @@ -1478,9 +1436,9 @@ dependencies = [ [[package]] name = "matchit" -version = "0.7.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" [[package]] name = "md-5" @@ -1869,7 +1827,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3af6b589e163c5a788fab00ce0c0366f6efbb9959c2f9874b224936af7fce7e1" dependencies = [ "base64", - "indexmap 2.11.0", + "indexmap", "quick-xml", "serde", "time", @@ -2213,7 +2171,7 @@ dependencies = [ "sync_wrapper", "tokio", "tokio-native-tls", - "tower 0.5.2", + "tower", "tower-http", "tower-service", "url", @@ -2472,30 +2430,39 @@ dependencies = [ [[package]] name = "sentry_protos" -version = "0.2.1" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be2c62ff48b9afa01c26cb3cd8123057c99cc6608075d65baf3bbcff85d84b34" +checksum = "db6b0a26106f3a2fae5791618daafbdde92502c09dcbf48006db07c7fa0ba733" dependencies = [ "prost", "prost-types", - "tokio", "tonic", ] [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -2532,7 +2499,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.11.0", + "indexmap", "itoa", "ryu", "serde", @@ -2679,9 +2646,9 @@ dependencies = [ "futures-intrusive", "futures-io", "futures-util", - "hashbrown 0.15.5", + "hashbrown", "hashlink", - "indexmap 2.11.0", + "indexmap", "log", "memchr", "once_cell", @@ -2936,7 +2903,7 @@ dependencies = [ "tokio-util", "tonic", "tonic-health", - "tower 0.5.2", + "tower", "tracing", "tracing-subscriber", "uuid", @@ -3148,18 +3115,17 @@ version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ - "indexmap 2.11.0", + "indexmap", "toml_datetime", "winnow", ] [[package]] name = "tonic" -version = "0.12.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" +checksum = "7e581ba15a835f4d9ea06c55ab1bd4dce26fc53752c69a04aac00703bfb49ba9" dependencies = [ - "async-stream", "async-trait", "axum", "base64", @@ -3177,7 +3143,7 @@ dependencies = [ "socket2 0.5.10", "tokio", "tokio-stream", - "tower 0.4.13", + "tower", "tower-layer", "tower-service", "tracing", @@ -3185,37 +3151,16 @@ dependencies = [ [[package]] name = "tonic-health" -version = "0.12.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eaf34ddb812120f5c601162d5429933c9b527d901ab0e7f930d3147e33a09b2" +checksum = "cb87334d340313fefa513b6e60794d44a86d5f039b523229c99c323e4e19ca4b" dependencies = [ - "async-stream", "prost", "tokio", "tokio-stream", "tonic", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "indexmap 1.9.3", - "pin-project", - "pin-project-lite", - "rand 0.8.5", - "slab", - "tokio", - "tokio-util", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "tower" version = "0.5.2" @@ -3224,11 +3169,15 @@ checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", + "indexmap", "pin-project-lite", + "slab", "sync_wrapper", "tokio", + "tokio-util", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -3244,7 +3193,7 @@ dependencies = [ "http-body", "iri-string", "pin-project-lite", - "tower 0.5.2", + "tower", "tower-layer", "tower-service", ] diff --git a/Cargo.toml b/Cargo.toml index 6ef48e26..4ca8308f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ sentry = { version = "0.41.0", default-features = false, features = [ "tracing", "logs" ] } -sentry_protos = "0.2.0" +sentry_protos = "0.4.10" serde = "1.0.214" serde_yaml = "0.9.34" sha2 = "0.10.8" @@ -47,8 +47,8 @@ sqlx = { version = "0.8.3", features = ["sqlite", "runtime-tokio", "chrono"] } tokio = { version = "1.43.1", features = ["full"] } tokio-stream = { version = "0.1.16", features = ["full"] } tokio-util = "0.7.12" -tonic = "0.12" -tonic-health = "0.12.3" +tonic = "0.13" +tonic-health = "0.13" tower = "0.5.1" tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = [ diff --git a/src/grpc/auth_middleware.rs b/src/grpc/auth_middleware.rs index 1b481efc..173d5214 100644 --- a/src/grpc/auth_middleware.rs +++ b/src/grpc/auth_middleware.rs @@ -2,11 +2,11 @@ use anyhow::Context; use bytes::Bytes; use futures_util::future::BoxFuture; use hmac::{Hmac, Mac}; -use http_body_util::combinators::UnsyncBoxBody; use http_body_util::{BodyExt, Full}; use sha2::Sha256; use std::mem; use std::task::{self, Poll}; +use tonic::body::Body; use tower::{Layer, Service}; use crate::config::Config; @@ -57,14 +57,10 @@ impl AuthService { // We need to narrow the request trait bounds so that we can read the request body // and set the response body. -type TonicBody = UnsyncBoxBody; -impl Service> for AuthService +impl Service> for AuthService where - Inner: Service, Response = http::Response> - + Clone - + Send - + 'static, + Inner: Service, Response = http::Response> + Clone + Send + 'static, Inner::Future: Send, { type Response = Inner::Response; @@ -75,7 +71,7 @@ where self.inner.poll_ready(cx) } - fn call(&mut self, req: http::Request) -> Self::Future { + fn call(&mut self, req: http::Request) -> Self::Future { let secret = self.secret.clone(); let mut inner = self.inner.clone(); mem::swap(&mut inner, &mut self.inner); @@ -89,10 +85,8 @@ where match validate_signature(&secret, &parts, body_bytes) { Ok(body) => { // reconstruct a request with the bytes we read from the request. - // tonic::body::boxed satifies the TonicBody trait bounds. - let new_body = Full::new(body); - let boxed_body = tonic::body::boxed(new_body); - let new_req = http::Request::from_parts(parts, boxed_body); + let body = Body::new(Full::new(body)); + let new_req = http::Request::from_parts(parts, body); inner.call(new_req).await } @@ -301,7 +295,7 @@ mod tests { #[tokio::test] async fn test_auth_middleware_no_signature() { let mut service = AuthLayer::default().layer(tower::service_fn(|_req| async { - let body = tonic::body::empty_body(); + let body = Body::empty(); Ok::<_, http::Error>( http::Response::builder() .status(StatusCode::OK) @@ -310,7 +304,7 @@ mod tests { ) })); - let req_body = tonic::body::empty_body(); + let req_body = Body::empty(); let req = http::Request::builder() .uri("http://localhost:8080/test") .body(req_body) @@ -327,7 +321,7 @@ mod tests { shared_secret: secret, }; let mut service = layer.layer(tower::service_fn(|_req| async { - let body = tonic::body::empty_body(); + let body = Body::empty(); Ok::<_, http::Error>( http::Response::builder() .status(StatusCode::OK) @@ -345,11 +339,11 @@ mod tests { ); let body_bytes = Bytes::from("\0\0\0\0&A request data that is 38 bytes long.."); - let request_body = tonic::body::boxed(Full::new(body_bytes)); + let request_body = Body::new(Full::new(body_bytes)); let req = http::Request::builder() .uri("http://localhost:8080/rpc/service/method") .header("sentry-signature", signature) - .body(tonic::body::boxed(request_body)) + .body(request_body) .unwrap(); let res = service.call(req).await.unwrap(); @@ -367,7 +361,7 @@ mod tests { shared_secret: secret, }; let mut service = layer.layer(tower::service_fn(|_req| async { - let body = tonic::body::empty_body(); + let body = Body::empty(); let res = http::Response::builder() .status(StatusCode::OK) .body(body) @@ -376,11 +370,11 @@ mod tests { })); let body_bytes = Bytes::from("\0\0\0\0&A request data that is 38 bytes long.."); - let request_body = tonic::body::boxed(Full::new(body_bytes)); + let request_body = Body::new(Full::new(body_bytes)); let req = http::Request::builder() .uri("http://localhost:8080/rpc/service/method") .header("sentry-signature", "lol nope") - .body(tonic::body::boxed(request_body)) + .body(request_body) .unwrap(); let res = service.call(req).await.unwrap(); diff --git a/src/main.rs b/src/main.rs index b7fb2161..3998e116 100644 --- a/src/main.rs +++ b/src/main.rs @@ -92,7 +92,7 @@ async fn main() -> Result<(), Error> { // Taskbroker exposes a grpc.v1.health endpoint. We use upkeep to track the health // of the application. - let (mut health_reporter, health_service) = tonic_health::server::health_reporter(); + let (health_reporter, health_service) = tonic_health::server::health_reporter(); health_reporter .set_service_status(SERVICE_NAME, ServingStatus::Serving) .await; diff --git a/src/upkeep.rs b/src/upkeep.rs index 898522f8..1ee91215 100644 --- a/src/upkeep.rs +++ b/src/upkeep.rs @@ -481,7 +481,7 @@ fn create_retry_activation(activation: &TaskActivation) -> TaskActivation { pub async fn check_health( last_run: Instant, config: &Config, - mut health_reporter: HealthReporter, + health_reporter: HealthReporter, ) -> Instant { let now = Instant::now(); if config.health_check_killswitched {