Only check auth secure on release mode. (#4127)

* Only check auth secure on release mode.

* Fixing wrong js-client.

* Adding is_debug_mode var.
primary-keys-dess^2
Dessalines 8 months ago committed by GitHub
parent cb01427dcf
commit 98ed0e51cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -85,7 +85,9 @@ pub fn read_auth_token(req: &HttpRequest) -> Result<Option<String>, LemmyError>
// ensure that its marked as httponly and secure // ensure that its marked as httponly and secure
let secure = cookie.secure().unwrap_or_default(); let secure = cookie.secure().unwrap_or_default();
let http_only = cookie.http_only().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)) Err(LemmyError::from(LemmyErrorType::AuthCookieInsecure))
} else { } else {
Ok(Some(cookie.value().to_string())) Ok(Some(cookie.value().to_string()))

@ -33,7 +33,7 @@ pub(crate) async fn send_like_activity(
score: i16, score: i16,
context: Data<LemmyContext>, context: Data<LemmyContext>,
) -> Result<(), LemmyError> { ) -> Result<(), LemmyError> {
let object_id: ObjectId<PostOrComment> = object_id.try_into()?; let object_id: ObjectId<PostOrComment> = object_id.into();
let actor: ApubPerson = actor.into(); let actor: ApubPerson = actor.into();
let community: ApubCommunity = community.into(); let community: ApubCommunity = community.into();

Loading…
Cancel
Save