]> git.openstreetmap.org Git - rails.git/commitdiff
Remove form_action restrictions for sessions#login
authorTom Hughes <tom@compton.nu>
Mon, 17 Jan 2022 11:01:07 +0000 (11:01 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 17 Jan 2022 11:01:07 +0000 (11:01 +0000)
Login may redirect to ouath2_authorizations#create which may then
redirect to arbitrary schemes if the application is already authorized
so we need to allow login to redirect to any scheme.

Fixes #3424

app/controllers/sessions_controller.rb

index bb3854e69b3d48348c394faa8dbc4ec6b2b2ac48..5b46d67d0bf78e733e5d50af9af8d2fbdfe8ce3d 100644 (file)
@@ -12,9 +12,7 @@ class SessionsController < ApplicationController
   authorize_resource :class => false
 
   def new
-    append_content_security_policy_directives(
-      :form_action => %w[*]
-    )
+    override_content_security_policy_directives(:form_action => []) if Settings.csp_enforce || Settings.key?(:csp_report_url)
 
     session[:referer] = safe_referer(params[:referer]) if params[:referer]
   end