From eaf1a3b0721dd5a116b4cb6754d172ff612ea510 Mon Sep 17 00:00:00 2001 From: EleisonC Date: Tue, 19 May 2026 00:29:06 -0400 Subject: [PATCH 1/4] update alpine version and logout & login return type --- app-service/Dockerfile | 2 +- auth-service/Dockerfile | 2 +- auth-service/src/routes/login.rs | 14 +++++++------- auth-service/src/routes/logout.rs | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app-service/Dockerfile b/app-service/Dockerfile index 23441cc26..e06f453a8 100644 --- a/app-service/Dockerfile +++ b/app-service/Dockerfile @@ -1,5 +1,5 @@ # Start with image that has the Rust toolchain installed -FROM rust:1.90-alpine AS chef +FROM rust:1.91-alpine AS chef USER root # Add cargo-chef to cache dependencies RUN apk add --no-cache musl-dev & cargo install cargo-chef diff --git a/auth-service/Dockerfile b/auth-service/Dockerfile index 8dac2d5aa..e124fbf47 100644 --- a/auth-service/Dockerfile +++ b/auth-service/Dockerfile @@ -1,5 +1,5 @@ # Start with image that has the Rust toolchain installed -FROM rust:1.90-alpine AS chef +FROM rust:1.91-alpine AS chef USER root # Add cargo-chef to cache dependencies RUN apk add --no-cache musl-dev & cargo install cargo-chef diff --git a/auth-service/src/routes/login.rs b/auth-service/src/routes/login.rs index 770834608..775665646 100644 --- a/auth-service/src/routes/login.rs +++ b/auth-service/src/routes/login.rs @@ -12,36 +12,36 @@ pub async fn login( State(state): State, jar: CookieJar, Json(request): Json, -) -> (CookieJar, Result) { +) -> Result<(CookieJar, impl IntoResponse), AuthAPIError> { let password = match Password::parse(request.password) { Ok(password) => password, - Err(_) => return (jar, Err(AuthAPIError::InvalidCredentials)), + Err(_) => return Err(AuthAPIError::InvalidCredentials), }; let email = match Email::parse(request.email) { Ok(email) => email, - Err(_) => return (jar, Err(AuthAPIError::InvalidCredentials)), + Err(_) => return Err(AuthAPIError::InvalidCredentials), }; let user_store = &state.user_store.read().await; if user_store.validate_user(&email, &password).await.is_err() { - return (jar, Err(AuthAPIError::IncorrectCredentials)); + return Err(AuthAPIError::IncorrectCredentials); } let user = match user_store.get_user(&email).await { Ok(user) => user, - Err(_) => return (jar, Err(AuthAPIError::IncorrectCredentials)), + Err(_) => return Err(AuthAPIError::IncorrectCredentials), }; let auth_cookie = match generate_auth_cookie(&user.email) { Ok(cookie) => cookie, - Err(_) => return (jar, Err(AuthAPIError::UnexpectedError)), + Err(_) => return Err(AuthAPIError::UnexpectedError), }; let updated_jar = jar.add(auth_cookie); - (updated_jar, Ok(StatusCode::OK.into_response())) + Ok((updated_jar, StatusCode::OK.into_response())) } #[derive(Deserialize)] diff --git a/auth-service/src/routes/logout.rs b/auth-service/src/routes/logout.rs index 66de33789..9b1d4b5c0 100644 --- a/auth-service/src/routes/logout.rs +++ b/auth-service/src/routes/logout.rs @@ -10,17 +10,17 @@ use crate::{ pub async fn logout( State(state): State, jar: CookieJar, -) -> (CookieJar, Result) { +) -> Result<(CookieJar, impl IntoResponse), AuthAPIError> { let cookie = match jar.get(JWT_COOKIE_NAME) { Some(cookie) => cookie, - None => return (jar, Err(AuthAPIError::MissingToken)), + None => return Err(AuthAPIError::MissingToken), }; // Validate token let token = cookie.value().to_owned(); let _ = match validate_token(&token, state.banned_token_store.clone()).await { Ok(claims) => claims, - Err(_) => return (jar, Err(AuthAPIError::InvalidToken)), + Err(_) => return Err(AuthAPIError::InvalidToken), }; // Add token to banned list @@ -32,11 +32,11 @@ pub async fn logout( .await .is_err() { - return (jar, Err(AuthAPIError::UnexpectedError)); + return Err(AuthAPIError::UnexpectedError); } // Remove jwt cookie let jar = jar.remove(cookie::Cookie::from(JWT_COOKIE_NAME)); - (jar, Ok(StatusCode::OK)) + Ok((jar, StatusCode::OK)) } From 771b74f884f1c073d0716e68ac31e250eb771439 Mon Sep 17 00:00:00 2001 From: christopher k Date: Tue, 19 May 2026 23:59:12 -0400 Subject: [PATCH 2/4] Fix Dockerfile syntax for installing cargo-chef --- app-service/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-service/Dockerfile b/app-service/Dockerfile index e06f453a8..8d8556b0a 100644 --- a/app-service/Dockerfile +++ b/app-service/Dockerfile @@ -2,7 +2,7 @@ FROM rust:1.91-alpine AS chef USER root # Add cargo-chef to cache dependencies -RUN apk add --no-cache musl-dev & cargo install cargo-chef +RUN apk add --no-cache musl-dev && cargo install cargo-chef WORKDIR /app FROM chef AS planner From a0742523d6bca147fa9e1c36846bb526de35a1fa Mon Sep 17 00:00:00 2001 From: christopher k Date: Wed, 20 May 2026 16:01:16 -0400 Subject: [PATCH 3/4] Lock cargo-chef installation in Dockerfile --- app-service/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-service/Dockerfile b/app-service/Dockerfile index 8d8556b0a..7c647dc7f 100644 --- a/app-service/Dockerfile +++ b/app-service/Dockerfile @@ -2,7 +2,7 @@ FROM rust:1.91-alpine AS chef USER root # Add cargo-chef to cache dependencies -RUN apk add --no-cache musl-dev && cargo install cargo-chef +RUN apk add --no-cache musl-dev && cargo install cargo-chef --locked WORKDIR /app FROM chef AS planner From 0ec3adcfef27a70c188a9324a3877bc8b10696a3 Mon Sep 17 00:00:00 2001 From: christopher k Date: Wed, 20 May 2026 16:01:40 -0400 Subject: [PATCH 4/4] Update Dockerfile to use locked cargo-chef installation Ensure cargo-chef is installed with locked dependencies. --- auth-service/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth-service/Dockerfile b/auth-service/Dockerfile index e124fbf47..e40355abd 100644 --- a/auth-service/Dockerfile +++ b/auth-service/Dockerfile @@ -2,7 +2,7 @@ FROM rust:1.91-alpine AS chef USER root # Add cargo-chef to cache dependencies -RUN apk add --no-cache musl-dev & cargo install cargo-chef +RUN apk add --no-cache musl-dev && cargo install cargo-chef --locked WORKDIR /app FROM chef AS planner