Skip to content

Commit

Permalink
Update parameter filter logging guides [ci-skip]
Browse files Browse the repository at this point in the history
The `filter_parameters` configuration includes a list of filters in the
latest `filter_parameter_logging` initializer template.
This updates the guides to reflect those changes.
  • Loading branch information
p8 committed Feb 10, 2022
1 parent b961af3 commit e3beba1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
10 changes: 8 additions & 2 deletions guides/source/action_controller_overview.md
Expand Up @@ -1166,13 +1166,19 @@ Rails keeps a log file for each environment in the `log` folder. These are extre

### Parameters Filtering

You can filter out sensitive request parameters from your log files by appending them to `config.filter_parameters` in the application configuration. These parameters will be marked [FILTERED] in the log.
You can filter out sensitive request parameters from your log files by
appending them to `config.filter_parameters` in the application configuration.
These parameters will be marked [FILTERED] in the log.

```ruby
config.filter_parameters << :password
```

NOTE: Provided parameters will be filtered out by partial matching regular expression. Rails adds default `:password` in the appropriate initializer (`initializers/filter_parameter_logging.rb`) and cares about typical application parameters `password` and `password_confirmation`.
NOTE: Provided parameters will be filtered out by partial matching regular
expression. Rails adds a list of default filters, including `:passw`,
`:secret`, and `:token`, in the appropriate
initializer(`initializers/filter_parameter_logging.rb`), to handle typical
application parameters like `password`, `password_confirmation` and `my_token`.

### Redirects Filtering

Expand Down
15 changes: 13 additions & 2 deletions guides/source/configuring.md
Expand Up @@ -247,8 +247,19 @@ Is the class used to detect file updates in the file system when `config.reload_

#### `config.filter_parameters`

Used for filtering out the parameters that you don't want shown in the logs, such as passwords or credit card
numbers. It also filters out sensitive values of database columns when calling `#inspect` on an Active Record object. By default, Rails filters out passwords by adding `Rails.application.config.filter_parameters += [:password]` in `config/initializers/filter_parameter_logging.rb`. Parameters filter works by partial matching regular expression.
Used for filtering out the parameters that you don't want shown in the logs,
such as passwords or credit card numbers. It also filters out sensitive values
of database columns when calling `#inspect` on an Active Record object. By
default, Rails filters out passwords by adding the following filters in
`config/initializers/filter_parameter_logging.rb`.

```ruby
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]
```

Parameters filter works by partial matching regular expression.

#### `config.force_ssl`

Expand Down
6 changes: 5 additions & 1 deletion guides/source/security.md
Expand Up @@ -510,7 +510,11 @@ By default, Rails logs all requests being made to the web application. But log f
config.filter_parameters << :password
```

NOTE: Provided parameters will be filtered out by partial matching regular expression. Rails adds default `:password` in the appropriate initializer (`initializers/filter_parameter_logging.rb`) and cares about typical application parameters `password` and `password_confirmation`.
NOTE: Provided parameters will be filtered out by partial matching regular
expression. Rails adds a list of default filters, including `:passw`,
`:secret`, and `:token`, in the appropriate
initializer(`initializers/filter_parameter_logging.rb`), to handle typical
application parameters like `password`, `password_confirmation` and `my_token`.

### Regular Expressions

Expand Down

0 comments on commit e3beba1

Please sign in to comment.