Fix cookies not having a SameSite attribute (#15098)
This commit is contained in:
parent
9b1f2a4b61
commit
acc1c03861
|
@ -10,6 +10,7 @@ Warden::Manager.after_set_user except: :fetch do |user, warden|
|
||||||
expires: 1.year.from_now,
|
expires: 1.year.from_now,
|
||||||
httponly: true,
|
httponly: true,
|
||||||
secure: (Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true'),
|
secure: (Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true'),
|
||||||
|
same_site: :lax,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,6 +21,7 @@ Warden::Manager.after_fetch do |user, warden|
|
||||||
expires: 1.year.from_now,
|
expires: 1.year.from_now,
|
||||||
httponly: true,
|
httponly: true,
|
||||||
secure: (Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true'),
|
secure: (Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true'),
|
||||||
|
same_site: :lax,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
warden.logout
|
warden.logout
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Makara::Cookie::DEFAULT_OPTIONS[:same_site] = :lax
|
||||||
|
Makara::Cookie::DEFAULT_OPTIONS[:secure] = Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true'
|
|
@ -1,3 +1,7 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
Rails.application.config.session_store :cookie_store, key: '_mastodon_session', secure: (Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true')
|
Rails.application.config.session_store :cookie_store, {
|
||||||
|
key: '_mastodon_session',
|
||||||
|
secure: (Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true'),
|
||||||
|
same_site: :lax,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue