diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-04-08 12:47:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-08 12:47:18 +0200 |
commit | 6e418bf3465d2df6b47e9b43d3b960504b81e8fb (patch) | |
tree | 8c57fbb98431dcfa477872cae3581f08102212b6 /lib/action_dispatch | |
parent | 46633f1de1dafb860ee444d041f8454c4a0bd62f (diff) |
Fix cookies secure flag being set when served over Tor (#17992)
Diffstat (limited to 'lib/action_dispatch')
-rw-r--r-- | lib/action_dispatch/cookie_jar_extensions.rb | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/lib/action_dispatch/cookie_jar_extensions.rb b/lib/action_dispatch/cookie_jar_extensions.rb deleted file mode 100644 index 1be9053ba..000000000 --- a/lib/action_dispatch/cookie_jar_extensions.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -module ActionDispatch - module CookieJarExtensions - private - - # Monkey-patch ActionDispatch to serve secure cookies to Tor Hidden Service - # users. Otherwise, ActionDispatch would drop the cookie over HTTP. - def write_cookie?(*) - request.host.end_with?('.onion') || super - end - end -end - -ActionDispatch::Cookies::CookieJar.prepend(ActionDispatch::CookieJarExtensions) - -module Rack - module SessionPersistedExtensions - def security_matches?(request, options) - request.host.end_with?('.onion') || super - end - end -end - -Rack::Session::Abstract::Persisted.prepend(Rack::SessionPersistedExtensions) |