Socket
Book a DemoInstallSign in
Socket

parameter_filter

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parameter_filter

1.0.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

parameter_filter

Summary

ParameterFilter is a module to mix into ActionController subclasses. It inserts a before_filter which will automatically remove any fields in params that are not explicitly allowed.

Installation

Include the following in your Gemfile:

gem "parameter_filter"

Usage

For global security, include the following in your ApplicationController:

include ParameterFilter

Then, inside each of you controllers, specify what fields you want each action to receive:

# Accept user[email] and user[password] on the create and update actions.
accepts :fields => { :user => [ :email, :password ] }, :on => [ :create, :update ]

# Accept user[email] and user[password] on all actions.
accepts fields: { user: %w( email password ) } 

# Accept q on the search action.
accepts field: "q", on: "search"

# Accept q and sort on the search and index actions.
accepts fields: [ :q, :sort ], on: %w( search index )

ParameterFilter should be pretty flexible in what you throw at it.

NOTE: All actions are automatically allowed to receive :controller, :action and :id.

FAQs

Package last updated on 26 Mar 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.