Bug #1444
Updated by liaham over 2 years ago
🐛 Thanks for taking the time to fill out this bug report! 😊 ## What did you expect? Navigating to `Administration » Configuration` should render the respective page. ## What has happened instead? The browser stopped with a message about an infinitive loop. ## What could be a possible solution? The solution is not quite clear. But I investigated the problem so far that I can say it occurs only if * Redmine 4.2.9 is installed * redmine_message_customized v0.1.6 is installed * and some of our plugins is installed Within the callback `:requires_admin` it occurs that the `RequestStore.store` is empty although allthough the `session[:user_id]` exists. This leads to an assignment of the Anonymous User to `RequestStore.store` what again represents the current user. If the current user is anonymous in a `:requires_admin` callback the user will be redirected to the back_url. This causes the infinite loop from which the browser stops after some time. ## How can we reproduce the problem? Install the following: * Redmine 4.2.9 * redmine_email_customizer 0.1.2 * redmine_message_customize v0.1.6 * redmine_email_customizer 0.1.2 (or any other of ours) Navigate as admin to `Administration » Settings` or `Administration » Plugins » (any plugin settings page)`. Configuration`. Then your browser should stop the request due to the infinite loop. ## In what environment are you running the plugin? Please copy and paste your environment information as displayed in Administration » Information or run `bin/about` in the root dir of your Redmine instance. ``` shell Environment: Redmine version 4.2.9.stable Ruby version 2.7.7 Rails version 5.2.8 Environment development Database adapter PostgreSQL Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp SCM: Subversion 1.14.2 Mercurial 6.3.1 Git 2.38.2 Filesystem Redmine plugins: advanced_plugin_helper 0.3.1 redmine_base_deface 1.8.1-xmr-1 redmine_email_customizer 0.1.2 redmine_message_customize 0.1.6 ``` ## What browsers are you seeing the problem on? * [x] Firefox * [ ] Chrome * [ ] Safari ## Relevant log output ``` shell # Copy your log output (log/production.log) here ``` ruby Started GET "/settings" for 192.168.2.117 at 2023-01-17 13:46:37 +0100 Processing by SettingsController#index as HTML [1m[36mAnonymousUser Load (0.5ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."type" IN ('AnonymousUser') AND "users"."lastname" = $1 LIMIT $2[0m [["lastname", "Anonymous"], ["LIMIT", 1]] Redirected to http://devmac:3000/login?back_url=http%3A%2F%2Fdevmac%3A3000%2Fsettings Filter chain halted as :require_admin rendered or redirected Completed 302 Found in 3ms (ActiveRecord: 0.5ms) Started GET "/login?back_url=http%3A%2F%2Fdevmac%3A3000%2Fsettings" for 192.168.2.117 at 2023-01-17 13:46:37 +0100 Processing by AccountController#login as HTML Parameters: {"back_url"=>"http://devmac:3000/settings"} [1m[36mToken Update All (1.2ms)[0m [1m[33mUPDATE "tokens" SET "updated_on" = '2023-01-17 13:46:37.035662' WHERE "tokens"."user_id" = $1 AND "tokens"."value" = $2 AND "tokens"."action" = $3[0m [["user_id", 1], ["value", "e6295246f75e000883dbbfaeef9eca8258f6119d"], ["action", "session"]] [1m[35m (0.3ms)[0m [1m[34mSELECT MAX("settings"."updated_on") FROM "settings"[0m [1m[36mUser Load (0.4ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."type" IN ('User', 'AnonymousUser') AND "users"."status" = $1 AND "users"."id" = $2 LIMIT $3[0m [["status", 1], ["id", 1], ["LIMIT", 1]] Current user: admin (id=1) Redirected to http://devmac:3000/settings Completed 302 Found in 6ms (ActiveRecord: 1.9ms) Started GET "/settings" for 192.168.2.117 at 2023-01-17 13:46:37 +0100 Processing by SettingsController#index as HTML [1m[36mAnonymousUser Load (0.6ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."type" IN ('AnonymousUser') AND "users"."lastname" = $1 LIMIT $2[0m [["lastname", "Anonymous"], ["LIMIT", 1]] Redirected to http://devmac:3000/login?back_url=http%3A%2F%2Fdevmac%3A3000%2Fsettings Filter chain halted as :require_admin rendered or redirected Completed 302 Found in 3ms (ActiveRecord: 0.6ms) ```