Ruby5 #2 – Rails Securing Passwords

It's important to filter out any sensitive data such as passwords from your log files. You can easily filter out data across your while application by calling filter_paramter_logging from your ApplicationController. In the example below I'm passing :password and :password_confirmation to remove their values from being placed in the logs.

ActionController::Base

 
class ApplicationController < ActionController::Base
  filter_parameter_logging :password, :password_confirmation
end
 

You will now see "FILTERED" in place of sensitive data.

 
  Parameters: {"x"=>"37", "y"=>"14", "action"=>"login", "authenticity_token"=>"JRFNcG9chNIpcsHoJzcQRRy1D6lIenjl7cWmvp3UpaI=", "controller"=>"videos", "user_id"=>"7-Jonathan-SpoonerJune", "video"=>{"password"=>"[FILTERED]", "email"=>"june@gmail.com"}}
 

Leave a Reply

You must be logged in to post a comment.