Skip to content

Commit

Permalink
dup hashes before applying whitelist filter to them
Browse files Browse the repository at this point in the history
  • Loading branch information
UberMouse committed Mar 9, 2017
1 parent c3fb0a0 commit 6ed5f9a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
6 changes: 5 additions & 1 deletion lib/raygun/services/apply_whitelist_filter_to_payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6ed5f9a

Please sign in to comment.