Skip to content

Commit

Permalink
Fixes #22168 - Fix ActiveModel::ForbiddenAttributesError
Browse files Browse the repository at this point in the history
Due to a change in Foreman core if we call triggering_params in REX, we
receive a Hash instead of ActiveController::Params. Merging a Hash into
unpermitted Params leads to the merged Hash not being #permitted? and
causing ActiveModel::ForbiddenAttributesError when trying to mass-assign
the triggering_params when creating a new job.

Related to theforeman/foreman commit 1ccf4df
  • Loading branch information
adamruzicka committed Jan 7, 2018
1 parent 3896876 commit 63f26c5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/controllers/job_invocations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ def prepare_composer
if params[:feature].present?
JobInvocationComposer.for_feature(params[:feature], params[:host_ids], {})
else
JobInvocationComposer.from_ui_params(params.merge(:triggering => triggering_params))
# triggering_params is a Hash
# when a hash is merged into ActionController::Parameters,
# it is assumed not to be #permitted?
with_triggering = params.merge(:triggering => triggering_params)
with_triggering[:triggering].permit!
JobInvocationComposer.from_ui_params(with_triggering)
end
end
end

0 comments on commit 63f26c5

Please sign in to comment.