From 377969ea6769bccd008203c5464eb361f685b787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Sun, 16 Jun 2024 22:05:17 +0200 Subject: [PATCH] Update rust and remove unused header values (#4645) * Update rust and remove unused header values * Missed one unused var --- docker/DockerSettings.yaml | 2 +- docker/Dockerfile.alpine | 8 ++++---- docker/Dockerfile.debian | 2 +- rust-toolchain.toml | 2 +- src/auth.rs | 12 ------------ 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/docker/DockerSettings.yaml b/docker/DockerSettings.yaml index 3d2b7d40..64fedb63 100644 --- a/docker/DockerSettings.yaml +++ b/docker/DockerSettings.yaml @@ -4,7 +4,7 @@ vault_image_digest: "sha256:784838b15c775c81b29e8979aaac36dc5ef44ea18ff0adb7fc56 # Cross Compile Docker Helper Scripts v1.4.0 # We use the linux/amd64 platform shell scripts since there is no difference between the different platform scripts xx_image_digest: "sha256:0cd3f05c72d6c9b038eb135f91376ee1169ef3a330d34e418e65e2a5c2e9c0d4" -rust_version: 1.78.0 # Rust version to be used +rust_version: 1.79.0 # Rust version to be used debian_version: bookworm # Debian release name to be used alpine_version: "3.20" # Alpine version to be used # For which platforms/architectures will we try to build images diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index 11eaafa6..0744590c 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -31,10 +31,10 @@ FROM --platform=linux/amd64 docker.io/vaultwarden/web-vault@sha256:784838b15c775 ########################## ALPINE BUILD IMAGES ########################## ## NOTE: The Alpine Base Images do not support other platforms then linux/amd64 ## And for Alpine we define all build images here, they will only be loaded when actually used -FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:x86_64-musl-stable-1.78.0 as build_amd64 -FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:aarch64-musl-stable-1.78.0 as build_arm64 -FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:armv7-musleabihf-stable-1.78.0 as build_armv7 -FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:arm-musleabi-stable-1.78.0 as build_armv6 +FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:x86_64-musl-stable-1.79.0 as build_amd64 +FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:aarch64-musl-stable-1.79.0 as build_arm64 +FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:armv7-musleabihf-stable-1.79.0 as build_armv7 +FROM --platform=linux/amd64 ghcr.io/blackdex/rust-musl:arm-musleabi-stable-1.79.0 as build_armv6 ########################## BUILD IMAGE ########################## # hadolint ignore=DL3006 diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian index 9e9aa116..fe5ef861 100644 --- a/docker/Dockerfile.debian +++ b/docker/Dockerfile.debian @@ -35,7 +35,7 @@ FROM --platform=linux/amd64 docker.io/tonistiigi/xx@sha256:0cd3f05c72d6c9b038eb1 ########################## BUILD IMAGE ########################## # hadolint ignore=DL3006 -FROM --platform=$BUILDPLATFORM docker.io/library/rust:1.78.0-slim-bookworm as build +FROM --platform=$BUILDPLATFORM docker.io/library/rust:1.79.0-slim-bookworm as build COPY --from=xx / / ARG TARGETARCH ARG TARGETVARIANT diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 39b61517..58c631f0 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.78.0" +channel = "1.79.0" components = [ "rustfmt", "clippy" ] profile = "minimal" diff --git a/src/auth.rs b/src/auth.rs index f05eba65..c8060a28 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -405,7 +405,6 @@ impl<'r> FromRequest<'r> for Host { } pub struct ClientHeaders { - pub host: String, pub device_type: i32, pub ip: ClientIp, } @@ -415,7 +414,6 @@ impl<'r> FromRequest<'r> for ClientHeaders { type Error = &'static str; async fn from_request(request: &'r Request<'_>) -> Outcome { - let host = try_outcome!(Host::from_request(request).await).host; let ip = match ClientIp::from_request(request).await { Outcome::Success(ip) => ip, _ => err_handler!("Error getting Client IP"), @@ -425,7 +423,6 @@ impl<'r> FromRequest<'r> for ClientHeaders { request.headers().get_one("device-type").map(|d| d.parse().unwrap_or(14)).unwrap_or_else(|| 14); Outcome::Success(ClientHeaders { - host, device_type, ip, }) @@ -531,7 +528,6 @@ pub struct OrgHeaders { pub user: User, pub org_user_type: UserOrgType, pub org_user: UserOrganization, - pub org_id: String, pub ip: ClientIp, } @@ -594,7 +590,6 @@ impl<'r> FromRequest<'r> for OrgHeaders { } }, org_user, - org_id: String::from(org_id), ip: headers.ip, }) } @@ -671,7 +666,6 @@ pub struct ManagerHeaders { pub host: String, pub device: Device, pub user: User, - pub org_user_type: UserOrgType, pub ip: ClientIp, } @@ -700,7 +694,6 @@ impl<'r> FromRequest<'r> for ManagerHeaders { host: headers.host, device: headers.device, user: headers.user, - org_user_type: headers.org_user_type, ip: headers.ip, }) } else { @@ -727,7 +720,6 @@ pub struct ManagerHeadersLoose { pub device: Device, pub user: User, pub org_user: UserOrganization, - pub org_user_type: UserOrgType, pub ip: ClientIp, } @@ -743,7 +735,6 @@ impl<'r> FromRequest<'r> for ManagerHeadersLoose { device: headers.device, user: headers.user, org_user: headers.org_user, - org_user_type: headers.org_user_type, ip: headers.ip, }) } else { @@ -782,14 +773,12 @@ impl ManagerHeaders { host: h.host, device: h.device, user: h.user, - org_user_type: h.org_user_type, ip: h.ip, }) } } pub struct OwnerHeaders { - pub host: String, pub device: Device, pub user: User, pub ip: ClientIp, @@ -803,7 +792,6 @@ impl<'r> FromRequest<'r> for OwnerHeaders { let headers = try_outcome!(OrgHeaders::from_request(request).await); if headers.org_user_type == UserOrgType::Owner { Outcome::Success(Self { - host: headers.host, device: headers.device, user: headers.user, ip: headers.ip,