Profiler doesn't work with auth now
Since https://gitlab.com/gitlab-org/gitlab-ce/issues/51113, we can't authenticate in this way any more: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/profiler.rb#L51
Looking at https://api.rubyonrails.org/v5.1/classes/ActionDispatch/Integration/Session.html#method-i-process, we can pass additional items to be merged into env
. I thought shoving something like warden.user.user.key
should work, but it doesn't from a quick test:
[1] pry(main)> app = ActionDispatch::Integration::Session.new(Rails.application) ; nil
=> nil
[2] pry(main)> app.send(:process, :get, '/dashboard/todos', env: { 'warden.user.user.key' => User.serialize_into_session(User.find_by(username: 'root')) })
User Load (14.1ms) SELECT "users".* FROM "users" WHERE "users"."username" = $1 LIMIT $2 [["username", "root"], ["LIMIT", 1]]
↳ (pry):2
Started GET "/dashboard/todos" for 127.0.0.1 at 2018-11-21 10:36:28 +0000
ActiveRecord::SchemaMigration Load (0.7ms) SELECT "schema_migrations".* FROM "schema_migrations"
↳ lib/gitlab/middleware/basic_health_check.rb:25
ApplicationSetting Load (8.1ms) SELECT "application_settings".* FROM "application_settings" ORDER BY "application_settings"."id" DESC LIMIT $1 [["LIMIT", 1]]
↳ app/models/concerns/cacheable_attributes.rb:17
CACHE (0.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
↳ lib/gitlab/current_settings.rb:52
Processing by Dashboard::TodosController#index as HTML
Completed 401 Unauthorized in 13ms (ActiveRecord: 0.0ms)
=> 302