From 7ea50c9d8eca87a12efd74ed092c5ec196d87604 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 26 Jan 2025 00:03:38 +0000 Subject: [PATCH 1/2] chore(deps): update rust crate axum to 0.8.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1114f27..e71a0f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ async_zip = { path = "crates/async_zip", features = [ "tokio-fs", "deflate", ] } -axum = { version = "0.7.5", default-features = false, features = [ +axum = { version = "0.8.0", default-features = false, features = [ "http1", "http2", "json", From ebda78f83eccedff6d13fb374b0600c9e855d0de Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Sun, 26 Jan 2025 16:07:34 +0100 Subject: [PATCH 2/2] chore: upgrade to axum 0.8.0 --- Cargo.lock | 87 +++++++----------------------------------------------- Cargo.toml | 2 +- src/app.rs | 5 ++-- 3 files changed, 15 insertions(+), 79 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d163c9..c29992a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -159,7 +159,7 @@ name = "artifactview" version = "0.4.7" dependencies = [ "async_zip", - "axum 0.7.9", + "axum", "axum-extra", "axum-test", "comrak", @@ -235,17 +235,6 @@ dependencies = [ "zstd-safe", ] -[[package]] -name = "async-trait" -version = "0.1.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", -] - [[package]] name = "async_zip" version = "0.0.17" @@ -282,13 +271,13 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "axum" -version = "0.7.9" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" +checksum = "6d6fd624c75e18b3b4c6b9caf42b1afe24437daaee904069137d8bab077be8b8" dependencies = [ - "async-trait", - "axum-core 0.4.5", + "axum-core", "bytes", + "form_urlencoded", "futures-util", "http 1.2.0", "http-body", @@ -296,7 +285,7 @@ dependencies = [ "hyper", "hyper-util", "itoa", - "matchit 0.7.3", + "matchit", "memchr", "mime", "percent-encoding", @@ -314,54 +303,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "axum" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d6fd624c75e18b3b4c6b9caf42b1afe24437daaee904069137d8bab077be8b8" -dependencies = [ - "axum-core 0.5.0", - "bytes", - "futures-util", - "http 1.2.0", - "http-body", - "http-body-util", - "itoa", - "matchit 0.8.4", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "sync_wrapper", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "axum-core" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http 1.2.0", - "http-body", - "http-body-util", - "mime", - "pin-project-lite", - "rustversion", - "sync_wrapper", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "axum-core" version = "0.5.0" @@ -388,8 +329,8 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fc6f625a1f7705c6cf62d0d070794e94668988b1c38111baeec177c715f7b" dependencies = [ - "axum 0.8.1", - "axum-core 0.5.0", + "axum", + "axum-core", "bytes", "futures-util", "headers", @@ -406,14 +347,14 @@ dependencies = [ [[package]] name = "axum-test" -version = "16.4.1" +version = "17.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e3a443d2608936a02a222da7b746eb412fede7225b3030b64fe9be99eab8dc" +checksum = "375ec4f6db373ce6d696839249203c57049aefe1213cfa77bb2e12e10ed43d08" dependencies = [ "anyhow", "assert-json-diff", "auto-future", - "axum 0.7.9", + "axum", "bytes", "bytesize", "cookie", @@ -1697,12 +1638,6 @@ dependencies = [ "tendril", ] -[[package]] -name = "matchit" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" - [[package]] name = "matchit" version = "0.8.4" diff --git a/Cargo.toml b/Cargo.toml index e71a0f4..9c1e914 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,7 +80,7 @@ yarte = { version = "0.15.7", features = ["json"] } yarte_helpers = "0.15.8" [dev-dependencies] -axum-test = "16.0.0" +axum-test = "17.0.0" flate2 = "1.0.30" httpdate = "1.0.3" insta = { version = "1.39.0", features = ["json"] } diff --git a/src/app.rs b/src/app.rs index a3a15c9..85e446f 100644 --- a/src/app.rs +++ b/src/app.rs @@ -11,12 +11,13 @@ use std::{ use async_zip::tokio::read::ZipEntryReader; use axum::{ body::Body, - extract::{Host, Query as XQuery, Request, State}, + extract::{Query as XQuery, Request, State}, http::{Response, Uri}, response::{IntoResponse, Redirect}, routing::{any, get, post}, Json, RequestExt, Router, }; +use axum_extra::extract::Host; use futures_lite::AsyncReadExt as LiteAsyncReadExt; use governor::{Quota, RateLimiter}; use headers::{ContentType, HeaderMapExt}; @@ -175,7 +176,7 @@ impl App { .route("/.well-known/api/prComment", post(Self::pr_comment)) // Prevent access to the .well-known folder since it enables abuse // (e.g. SSL certificate registration by an attacker) - .route("/.well-known/*path", any(|| async { Error::Inaccessible })) + .route("/.well-known/{*path}", any(|| async { Error::Inaccessible })) // Serve artifact pages .route("/", get(Self::get_page)) .fallback(get(Self::get_page))