]> source.dussan.org Git - redmine.git/commitdiff
Avoid passing ActionController::Parameters outside of MailHandlerController (#36394).
authorMarius Balteanu <marius.balteanu@zitec.com>
Fri, 18 Mar 2022 18:42:55 +0000 (18:42 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Fri, 18 Mar 2022 18:42:55 +0000 (18:42 +0000)
Patch by Felix Schäfer.

git-svn-id: http://svn.redmine.org/redmine/trunk@21464 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/mail_handler_controller.rb
extra/mail_handler/rdm-mailhandler.rb

index 649714bcca56c29d3145e64830361503a3ecf0fb..aabc3cbac18073ec8422ef0ae7deb54fc506c392 100644 (file)
@@ -28,7 +28,32 @@ class MailHandlerController < ActionController::Base
 
   # Submits an incoming email to MailHandler
   def index
-    options = params.dup
+    # MailHandlerController#index should permit all options set by
+    # RedmineMailHandler#submit in rdm-mailhandler.rb.
+    # It must be kept in sync.
+    options = params.permit(
+      :key,
+      :email,
+      :allow_override,
+      :unknown_user,
+      :default_group,
+      :no_account_notice,
+      :no_notification,
+      :no_permission_check,
+      :project_from_subaddress,
+      {
+        issue: [
+          :project,
+          :status,
+          :tracker,
+          :category,
+          :priority,
+          :assigned_to,
+          :fixed_version,
+          :is_private
+        ]
+      }
+    ).to_h
     email = options.delete(:email)
     if MailHandler.safe_receive(email, options)
       head :created
index 2289ab5c1b288b69548a50411f17c7662561d2dc..c8394d99f8699fa5cc7134f04d27e6443fc24b91 100644 (file)
@@ -153,6 +153,9 @@ END_DESC
 
     headers = { 'User-Agent' => "Redmine mail handler/#{VERSION}" }
 
+    # MailHandlerController#index should permit all options set by
+    # RedmineMailHandler#submit in rdm-mailhandler.rb.
+    # It must be kept in sync.
     data = { 'key' => key, 'email' => email.gsub(/(?<!\r)\n|\r(?!\n)/, "\r\n"),
                            'allow_override' => allow_override,
                            'unknown_user' => unknown_user,