From 012ca7a22e08487340129b7d64c36c68df6f6aeb Mon Sep 17 00:00:00 2001 From: Taylor Lodge Date: Thu, 9 Mar 2017 13:44:07 +1300 Subject: [PATCH] dup hashes before applying whitelist filter to them --- CHANGELOG.md | 5 +++++ lib/raygun/services/apply_whitelist_filter_to_payload.rb | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff4ae33..251e69f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.2.1 (09/03/2017) + +Bugfixes: + - dup input hashes before applying whitelist filtering, previously this was modifying the contents of `action_dispatch.request.parameters` + ## 1.2.0 (09/03/2017) Features: diff --git a/lib/raygun/services/apply_whitelist_filter_to_payload.rb b/lib/raygun/services/apply_whitelist_filter_to_payload.rb index aaa3d98..8194c57 100644 --- a/lib/raygun/services/apply_whitelist_filter_to_payload.rb +++ b/lib/raygun/services/apply_whitelist_filter_to_payload.rb @@ -8,13 +8,17 @@ def call(whitelist, payload) private def filter_hash(whitelist, hash) + # dup the input so each level of the hash is dup'd + # not just the top as dup isn't deep + hash = hash.dup + hash.each do |k, v| unless whitelist && (whitelist[k] || whitelist[k.to_sym]) hash[k] = '[FILTERED]' end if v.is_a?(Hash) && whitelist[k].is_a?(Hash) - filter_hash(whitelist[k], v) + hash[k] = filter_hash(whitelist[k], v) end end end