Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api.request.input and param filtering #556

Open
swils opened this issue Jan 23, 2014 · 4 comments
Open

api.request.input and param filtering #556

swils opened this issue Jan 23, 2014 · 4 comments

Comments

@swils
Copy link

swils commented Jan 23, 2014

Rails' filter_parameters system is used by e.g. Rails logging and error notification APIs like Airbrake to avoid sensitive information leaking out. It works by running over a hash and overwriting it for certain keys. However, Grape puts the entire request body in env['api.request.input'] as a string, which means the param filtering doesn't operate on it. This can lead to e.g. plaintext passwords getting logged in error catchers.

This can be solved by adding 'api.request.input' to filter_parameters in Rails application configuration. Should I adapt the documentation to warn people about this, or should we look for other ways to avoid this behaviour?

@ujjwalt
Copy link
Contributor

ujjwalt commented Jan 23, 2014

I think a solution has to be built into Grape for this and set on Grape's config since it effectively has it's own mechanism for routing and everything.

@blakeperdue
Copy link

Any update on this? I've noticed we're seeing sensitive auth tokens being stored in our logs. We had filter_parameters working before implementing Grape.

@blakeperdue
Copy link

Adding 'api.request.input' to filter_parameters is not working for me in Rails 4. Here's my config line:

config.filter_parameters += [:authentication_token, 'api.request.input'] in config/application.rb

Any ideas @swils or @ujjwalt ? Thanks.

@dblock
Copy link
Member

dblock commented Apr 16, 2015

For Rails, it should work, maybe you want to add to https://github.com/dblock/grape-on-rails to demonstrate?

For an implementation in Grape, I think the next step is to write a test that shows the intent of what we want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants