From 316aaadbd6ecc9c8a6924b241b1b26927e3e74db Mon Sep 17 00:00:00 2001 From: Jason Frey Date: Tue, 22 Oct 2024 13:00:47 -0400 Subject: [PATCH] Fix issue when using kerberos auth with Rails 7 kerberos auth requires a wait_for_task under the covers. When we create this task, we store a backup copy of the incoming request params within the session object, so we can restore it later after the task we are waiting for has completed, and that session object is `Marshal.dump`ed into memcached. In Rails 7, Rails changed the ActionController::Parameters object to include some more objects as context, such as the request, and the request internally has an IO object that cannot be dumped. Since we don't actually need the context and instead only need the parameters, we can use `to_unsafe_h` instead of `deep_dup`, to get a copy of those parameters in HashWithIndifferentAccess form. Later when wait_for_task reconstructs the parameters, they will be placed back into the request object, which will get them back into the ActionController::Parameters format. --- app/controllers/application_controller/wait_for_task.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller/wait_for_task.rb b/app/controllers/application_controller/wait_for_task.rb index b682c6d84ed..9c87f7b6581 100644 --- a/app/controllers/application_controller/wait_for_task.rb +++ b/app/controllers/application_controller/wait_for_task.rb @@ -49,7 +49,7 @@ def initiate_wait_for_task(options = {}) session[:async][:params] ||= {} # save the incoming parms + extra_params - session[:async][:params] = params.deep_dup.merge(options[:extra_params] || {}) + session[:async][:params] = params.to_unsafe_h.merge(options[:extra_params] || {}) session[:async][:params][:task_id] = task_id # override method to be called, when the task is done