DEV: revert upgrade of rack to version 2.0.8

DEV: revert upgrade of rack to version 2.0.8

We can not upgrade rack cause it breaks Sidekiq web.

I can not find a trivial fix short of disabling sessions in Sidekiq which is a security concern.

We need to figure out how to reuse sessions with our Rails application in Sidekiq.

This gets extra complex cause we use a special cookie store for sessions.

https://github.com/discourse/discourse/blob/9e399b42b96f115a8367c368862d62aeecfac680/lib/discourse_cookie_store.rb#L3-L21

diff --git a/Gemfile b/Gemfile
index 205de4ccbe..1c801d8f3f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -131,6 +131,12 @@ gem 'mini_racer'
 # TODO: determine why highline is being held back and upgrade to latest
 gem 'highline', '~> 1.7.0', require: false
 
+# TODO: Upgrading breaks Sidekiq Web
+# This is a bit of a hornets nest cause in an ideal world we much prefer
+# if Sidekiq reused session and CSRF mitigation with Discourse on the
+# _forum_session cookie instead of a rack.session cookie
+gem 'rack', '2.0.8'
+
 gem 'rack-protection' # security
 gem 'cbor', require: false
 gem 'cose', require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index ce471e4d66..8f38740bd1 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -271,7 +271,7 @@ GEM
     puma (4.3.1)
       nio4r (~> 2.0)
     r2 (0.2.7)
-    rack (2.1.1)
+    rack (2.0.8)
     rack-mini-profiler (1.1.4)
       rack (>= 1.2.0)
     rack-openid (1.3.1)
@@ -511,6 +511,7 @@ DEPENDENCIES
   pry-rails
   puma
   r2
+  rack (= 2.0.8)
   rack-mini-profiler
   rack-protection
   rails_multisite

GitHub sha: eb105ba7

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there:

deleted some error comments here, see alse: Sidekiq failing to render after rack gem upgrade - bug - Discourse Meta

1 Like