about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-02-22 15:23:46 +0100
committerClaire <claire.github-309c@sitedethib.com>2021-02-22 15:23:46 +0100
commit679642e26c20bf04ceb1a90349c23eb5950bd029 (patch)
treebfe48773e2fcf9e0fa3a7753b3d8fa2de7217f52 /lib
parent8792128f38e19b0d7882468a4f1f9362b98793a0 (diff)
parent2127f40e6bf6deab62f48030263c459d14fed364 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Diffstat (limited to 'lib')
-rw-r--r--lib/action_dispatch/cookie_jar_extensions.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/action_dispatch/cookie_jar_extensions.rb b/lib/action_dispatch/cookie_jar_extensions.rb
index 44c39c1f8..1be9053ba 100644
--- a/lib/action_dispatch/cookie_jar_extensions.rb
+++ b/lib/action_dispatch/cookie_jar_extensions.rb
@@ -7,9 +7,19 @@ module ActionDispatch
     # Monkey-patch ActionDispatch to serve secure cookies to Tor Hidden Service
     # users. Otherwise, ActionDispatch would drop the cookie over HTTP.
     def write_cookie?(*)
-      request.headers['Host'].ends_with?('.onion') || super
+      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)