aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/filter_parameters.rb
diff options
context:
space:
mode:
authorBart de Water <bart@somnilocode.nl>2016-02-29 11:00:48 +0100
committerBart de Water <bart@somnilocode.nl>2016-02-29 11:00:48 +0100
commitaa7690560525f1eb6e5d303ce59d742581517da8 (patch)
tree9ab41a9549a3cc06e5464ddd28880fb261e9fe84 /actionpack/lib/action_dispatch/http/filter_parameters.rb
parentb884ee6fa90a0fa96bb40322393815ec78ff805c (diff)
downloadrails-aa7690560525f1eb6e5d303ce59d742581517da8.tar.gz
rails-aa7690560525f1eb6e5d303ce59d742581517da8.tar.bz2
rails-aa7690560525f1eb6e5d303ce59d742581517da8.zip
Add documentation for #13897 [skip ci]
Diffstat (limited to 'actionpack/lib/action_dispatch/http/filter_parameters.rb')
-rw-r--r--actionpack/lib/action_dispatch/http/filter_parameters.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/http/filter_parameters.rb b/actionpack/lib/action_dispatch/http/filter_parameters.rb
index 9dcab79c3a..041eca48ca 100644
--- a/actionpack/lib/action_dispatch/http/filter_parameters.rb
+++ b/actionpack/lib/action_dispatch/http/filter_parameters.rb
@@ -4,9 +4,11 @@ module ActionDispatch
module Http
# Allows you to specify sensitive parameters which will be replaced from
# the request log by looking in the query string of the request and all
- # sub-hashes of the params hash to filter. If a block is given, each key and
- # value of the params hash and all sub-hashes is passed to it, the value
- # or key can be replaced using String#replace or similar method.
+ # sub-hashes of the params hash to filter. Filtering only certain sub-keys
+ # from a hash is possible by using the dot notation: 'credit_card.number'.
+ # If a block is given, each key and value of the params hash and all
+ # sub-hashes is passed to it, the value or key can be replaced using
+ # String#replace or similar method.
#
# env["action_dispatch.parameter_filter"] = [:password]
# => replaces the value to all keys matching /password/i with "[FILTERED]"
@@ -14,6 +16,10 @@ module ActionDispatch
# env["action_dispatch.parameter_filter"] = [:foo, "bar"]
# => replaces the value to all keys matching /foo|bar/i with "[FILTERED]"
#
+ # env["action_dispatch.parameter_filter"] = [ "credit_card.code" ]
+ # => replaces { credit_card: {code: "xxxx"} } with "[FILTERED]", does not
+ # change { file: { code: "xxxx"} }
+ #
# env["action_dispatch.parameter_filter"] = -> (k, v) do
# v.reverse! if k =~ /secret/i
# end