Monkey patch Rack::Session to send secure cookies to onions (#15725)

lolsob-rspec
Cecylia Bocovich 2021-02-13 18:10:52 -05:00 committed by GitHub
parent cb478a78b6
commit 6f95d30ef9
1 changed files with 10 additions and 0 deletions

View File

@ -13,3 +13,13 @@ module ActionDispatch
end
ActionDispatch::Cookies::CookieJar.prepend(ActionDispatch::CookieJarExtensions)
module Rack
module SessionPersistedExtensions
def security_matches?(request, options)
request.headers['Host'].ends_with?('.onion') || super
end
end
end
Rack::Session::Abstract::Persisted.prepend(Rack::SessionPersistedExtensions)