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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#62979] sanitize the filter values
Tobias Dillmann564035cfd324
diff --git a/app/models/queries/work_packages/filter/project_phase_filter.rb b/app/models/queries/work_packages/filter/project_phase_filter.rbindex cc1607c2858..afb6f339b8b 100644--- a/app/models/queries/work_packages/filter/project_phase_filter.rb+++ b/app/models/queries/work_packages/filter/project_phase_filter.rb@@ -79,23 +79,21 @@ class Queries::WorkPackages::Filter::ProjectPhaseFilter < Queries::WorkPackages:enddef where- if operator_strategy.to_sym == :"="- Arel.sql(- <<~SQL.squish- active_phases.active_phase_definition_id IS NOT NULL AND- active_phases.active_phase_definition_id IN (#{values.join(',')})- SQL- )- elsif operator_strategy.to_sym == :!- Arel.sql(- <<~SQL.squish- active_phases.active_phase_definition_id IS NULL OR- active_phases.active_phase_definition_id NOT IN (#{values.join(',')})- SQL- )- else- ""- end+ placeholders = values.map { "?" }.join(",")++ sql = if operator_strategy.to_sym == :"="+ <<~SQL.squish+ active_phases.active_phase_definition_id IS NOT NULL AND+ active_phases.active_phase_definition_id IN (#{placeholders})+ SQL+ else+ <<~SQL.squish+ active_phases.active_phase_definition_id IS NULL OR+ active_phases.active_phase_definition_id NOT IN (#{placeholders})+ SQL+ end++ ActiveRecord::Base.sanitize_sql_array([sql, *values])endprivate