ExceptionNotification undocumented filtering

ExceptionNotification has an undocumented parameter filtering feature. Defining the callback filter_parameters(parameters) in a controller will cause ExceptionNotification to replace the printed parameters with the returned hash. Unfortunately it can't selectively filter the RAW_POST_DATA, so it just checks to see it would have been filtered, and replaces it wholesale with "[FILTERED]"

1
2
3
4
5
6
7
8
  public

  # Filter sensitive data.
  def filter_parameters(parameters)
    p = parameters.dup
    p['naughty_bits'] = ExceptionNotifierHelper::PARAM_FILTER_REPLACEMENT unless p['naughty_bits'].blank?
    p
  end

Leave a Reply