mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
fix: Use SameSite=Lax for session cookie
This commit is contained in:
+6
-2
@@ -10,7 +10,7 @@ use axum::{
|
|||||||
use conduwuit_service::{Services, state};
|
use conduwuit_service::{Services, state};
|
||||||
use tower_http::{catch_panic::CatchPanicLayer, set_header::SetResponseHeaderLayer};
|
use tower_http::{catch_panic::CatchPanicLayer, set_header::SetResponseHeaderLayer};
|
||||||
use tower_sec_fetch::SecFetchLayer;
|
use tower_sec_fetch::SecFetchLayer;
|
||||||
use tower_sessions::{ExpiredDeletion, SessionManagerLayer};
|
use tower_sessions::{ExpiredDeletion, SessionManagerLayer, cookie::SameSite};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
pages::TemplateContext,
|
pages::TemplateContext,
|
||||||
@@ -134,7 +134,11 @@ pub fn build(services: &Services) -> Router<state::State> {
|
|||||||
.merge(threepid::build())
|
.merge(threepid::build())
|
||||||
.fallback(async || WebError::NotFound),
|
.fallback(async || WebError::NotFound),
|
||||||
)
|
)
|
||||||
.layer(SessionManagerLayer::new(store).with_name("_c10y_session"))
|
.layer(
|
||||||
|
SessionManagerLayer::new(store)
|
||||||
|
.with_name("_c10y_session")
|
||||||
|
.with_same_site(SameSite::Lax),
|
||||||
|
)
|
||||||
.layer(CatchPanicLayer::custom(|panic: Box<dyn Any + Send + 'static>| {
|
.layer(CatchPanicLayer::custom(|panic: Box<dyn Any + Send + 'static>| {
|
||||||
let details = if let Some(s) = panic.downcast_ref::<String>() {
|
let details = if let Some(s) = panic.downcast_ref::<String>() {
|
||||||
s.clone()
|
s.clone()
|
||||||
|
|||||||
Reference in New Issue
Block a user