Spot the bug in the Rails controller

from Ruby on Rails
Rails 8.1.3.1 / Ruby 4.0.6 intermediate 4 min 1 issue to find

Find the object-authorization flaw in this generated Rails controller.

ruby
class OrdersController < ActionController::API
  def update
    order = Order.find(params[:id])
    order.update!(params.require(:order).permit(:status))
    render json: { id: order.id, status: order.status }
  end
end
Open in playground
Report an error