Click to see the query in the CodeQL repository
Operations that allow for mass assignment (setting multiple attributes of an object using a hash), such as ActiveRecord::Base.new, should take care not to allow arbitrary parameters to be set by the user. Otherwise, unintended attributes may be set, such as an is_admin field for a User object.
When using a mass assignment operation from user supplied parameters, use ActionController::Parameters#permit to restrict the possible parameters a user can supply, rather than ActionController::Parameters#permit!, which permits arbitrary parameters to be used for mass assignment.
In the following example, permit! is used which allows arbitrary parameters to be supplied by the user.
In the following example, only specific parameters are permitted, so the mass assignment is safe.
Rails guides: Strong Parameters.
Common Weakness Enumeration: CWE-915.