ruby-grape / ruby-grape/grape

api.request.input and param filtering

Open
#556 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request needs info
Dominant language
Ruby
Stars
10k
Forks
1.2k
Avg merge
14h 38m
Merged PRs (30d)
92

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing Rails' filter_parameters handling and how Grape populates env['api.request.input']; no repository file or test is named. Resolve whether the intended outcome is a documentation warning or a code-level filtering change, then validate the chosen behavior against error logging and sensitive request data.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, backend, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.