From 98ed0e51cc3ecbb8e427613a873936bfcac8226c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 7 Nov 2023 05:03:13 -0500 Subject: [PATCH] Only check auth secure on release mode. (#4127) * Only check auth secure on release mode. * Fixing wrong js-client. * Adding is_debug_mode var. --- crates/api/src/lib.rs | 4 +++- crates/apub/src/activities/voting/mod.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/api/src/lib.rs b/crates/api/src/lib.rs index 5621fe2df..e3acae193 100644 --- a/crates/api/src/lib.rs +++ b/crates/api/src/lib.rs @@ -85,7 +85,9 @@ pub fn read_auth_token(req: &HttpRequest) -> Result, LemmyError> // ensure that its marked as httponly and secure let secure = cookie.secure().unwrap_or_default(); let http_only = cookie.http_only().unwrap_or_default(); - if !secure || !http_only { + let is_debug_mode = cfg!(debug_assertions); + + if !is_debug_mode && (!secure || !http_only) { Err(LemmyError::from(LemmyErrorType::AuthCookieInsecure)) } else { Ok(Some(cookie.value().to_string())) diff --git a/crates/apub/src/activities/voting/mod.rs b/crates/apub/src/activities/voting/mod.rs index c60235c05..0f9876f1a 100644 --- a/crates/apub/src/activities/voting/mod.rs +++ b/crates/apub/src/activities/voting/mod.rs @@ -33,7 +33,7 @@ pub(crate) async fn send_like_activity( score: i16, context: Data, ) -> Result<(), LemmyError> { - let object_id: ObjectId = object_id.try_into()?; + let object_id: ObjectId = object_id.into(); let actor: ApubPerson = actor.into(); let community: ApubCommunity = community.into();