Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dup hashes before applying whitelist filter to them #105

Merged
merged 1 commit into from
Mar 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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