Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

filter workflow params

ulferts02c0481b3d4a
diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb
index bf78196c288..cc4f51081d4 100644
--- a/app/controllers/workflows_controller.rb
+++ b/app/controllers/workflows_controller.rb
@@ -57,7 +57,7 @@ class WorkflowsController < ApplicationController
def update
call = Workflows::BulkUpdateService
.new(role: @role, type: @type)
- .call(params["status"])
+ .call(permitted_status_params)
if call.success?
flash[:notice] = I18n.t(:notice_successful_update)
@@ -148,4 +148,10 @@ class WorkflowsController < ApplicationController
roles
end
end
+
+ def permitted_status_params
+ params["status"]
+ .to_unsafe_h
+ .select { |key, value| /\A\d+\z/.match?(key) && /\A\d+\z/.match?(value) }
+ end
end