fablabbcn / smartcitizen-api

The Smart Citizen Engine
https://developer.smartcitizen.me
GNU Affero General Public License v3.0
10 stars 4 forks source link

RuntimeError: Ransack needs Postprocessing attributes explicitly allowlisted as #254

Closed sentry-io[bot] closed 10 months ago

sentry-io[bot] commented 10 months ago

Sentry Issue: SC-API-BA

RuntimeError: Ransack needs Postprocessing attributes explicitly allowlisted as searchable. Define a ransackable_attributes class method in your Postprocessing model, watching out for items you DON'T want searchable (for example, encrypted_password, password_reset_token, owner or other sensitive information). You can use the following as a base:

class Postprocessing < ApplicationRecord

  # ...

  def self.ransackable_attributes(auth_object = nil)
    ["blueprint_url", "created_at", "device_id", "forwarding_params", "hardware_url", "id", "latest_postprocessing", "meta", "updated_at"]
  end

  # ...

end
  app/controllers/v0/devices_controller.rb:18:in `index'
    .ransack(params[:q], auth_object: (current_user&.is_admin? ? :admin : nil))
...
(91 additional frame(s) were not displayed)
oscgonfer commented 10 months ago

Here is the url in question returning the 500:

https://api.smartcitizen.me/v0/devices/?q[postprocessing_id_not_null]=1