Repository: honeybadger-io/honeybadger-python

Issue:
Filter nested params with params_filters
A customer mentioned that the following params are not being filtered:

> My flask app receives some sensitive information in request's form data: 
> 
> {"thing": {"password": "xxx"}} 

@demsullivan could we support this?

Discussion:

Patch:
diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml
index 0bca898..01a125d 100644
--- a/.github/workflows/python.yml
+++ b/.github/workflows/python.yml
@@ -34,7 +34,7 @@ jobs:
       run: |
         export ${{ matrix.env }}
         python -m pip install --upgrade pip
-        pip install psutil six mock itsdangerous
+        pip install psutil six mock itsdangerous nose testfixtures blinker
         ./scripts/install_frameworks.sh
         python setup.py develop
     - name: Run Tests
diff --git a/honeybadger/utils.py b/honeybadger/utils.py
index 1e3e70a..d9e0e7b 100644
--- a/honeybadger/utils.py
+++ b/honeybadger/utils.py
@@ -10,7 +10,14 @@ class StringReprJSONEncoder(json.JSONEncoder):
 
 def filter_dict(data, filter_keys):
     # filter_keys = set(data.keys())
-    for key in filter_keys:
-        if key in data:
-            data[key] = "[FILTERED]"
+    if type(data) != dict:
+      return data
+
+    for key, value in data.items():
+      if key in filter_keys:
+        data[key] = "[FILTERED]"
+
+      if type(value) == dict:
+        data[key] = filter_dict(data[key], filter_keys)
+
     return data
diff --git a/scripts/install_frameworks.sh b/scripts/install_frameworks.sh
index e1d3dd4..0a9d37a 100755
--- a/scripts/install_frameworks.sh
+++ b/scripts/install_frameworks.sh
@@ -2,5 +2,8 @@
 set -ev
 
 [ ! -z "$DJANGO_VERSION" ] && pip install Django==$DJANGO_VERSION
-[ ! -z "$FLASK_VERSION" ] && pip install Flask==$FLASK_VERSION
+
+[ -z "$FLASK_VERSION" ] && FLASK_VERSION=1.0
+pip install Flask==$FLASK_VERSION
+
 echo "OK"
\ No newline at end of file


Test patch:
diff --git a/honeybadger/tests/test_utils.py b/honeybadger/tests/test_utils.py
index 323f940..7e4bac2 100644
--- a/honeybadger/tests/test_utils.py
+++ b/honeybadger/tests/test_utils.py
@@ -5,3 +5,9 @@ def test_filter_dict():
     expected = {'foo': '[FILTERED]', 'bar': 'baz'}
     filter_keys = ['foo']
     assert filter_dict(data, filter_keys) == expected
+
+def test_filter_dict_with_nested_dict():
+  data = {'foo': 'bar', 'bar': 'baz', 'nested': { 'password': 'helloworld' } }
+  expected = {'foo': 'bar', 'bar': 'baz', 'nested': { 'password': '[FILTERED]' } }
+  filter_keys = ['password']
+  assert filter_dict(data, filter_keys) == expected