Adds additional logging/reporting options to the strong_parameters gem
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.ruby-gemset
.ruby-version
Gemfile
LICENCE.txt
LICENSE.txt
README.md
Rakefile
params_patrol.gemspec

README.md

Params Patrol

Call for backup!

Keeps an eye out for suspicious parameters... and then calls for backup

Installation

Add this line to your application's Gemfile:

gem 'params_patrol'

And then execute:

$ bundle

Or install it yourself as:

$ gem install params_patrol

Usage

Builds off of strong_parameters (https://github.com/rails/strong_parameters) and is a required dependency. To use ParamsPatrol in your rails 3 app,

At the model level include

include ActiveModel::SuppressForbiddenAttributes

and at the controller level include

include ActionController::HandleUnpermittedParameters`

Also strong parameters needs to be set to raise an exception on unpermitted parameters which can be set in config/application.rb here,

config.action_controller.action_on_unpermitted_parameters = :raise

Once this is set up, unpermitted parameters are logged by default. You can specify how you want to handle unpermitted parameters by defining a handler in ParamsPatrol like:

ParamsPatrol.handle= lambda { |x| Logger.new(STDOUT).warn(x) }

in an initializer file.

Contributors

  • @npj
  • @kellyfelkins
  • @indiebendix
  • jenmei@indiegogo.com
  • @aarongogo
  • @gogojared
  • @jcareyigg
  • @indieblaine
  • and others

Contributing

  1. Fork it ( https://github.com/IndieGoGo/params_patrol/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Licence

MIT License. Copyright 2015 Indiegogo, Inc.