From 4d9c9160e78ebd763a84c48977d2b9d4219f546f Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 16 Aug 2022 21:37:24 +0200 Subject: [PATCH] events: fix sanitize_dict not working on list items Signed-off-by: Jens Langhammer --- authentik/events/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/authentik/events/utils.py b/authentik/events/utils.py index 325714ea7..e877a5295 100644 --- a/authentik/events/utils.py +++ b/authentik/events/utils.py @@ -38,6 +38,9 @@ def cleanse_dict(source: dict[Any, Any]) -> dict[Any, Any]: final_dict[key] = value if isinstance(value, dict): final_dict[key] = cleanse_dict(value) + elif isinstance(value, list): + for idx, item in enumerate(value): + value[idx] = cleanse_dict(item) return final_dict @@ -88,6 +91,9 @@ def sanitize_dict(source: dict[Any, Any]) -> dict[Any, Any]: value = asdict(value) if isinstance(value, dict): final_dict[key] = sanitize_dict(value) + elif isinstance(value, list): + for idx, item in enumerate(value): + value[idx] = sanitize_dict(item) elif isinstance(value, (User, AnonymousUser)): final_dict[key] = sanitize_dict(get_user(value)) elif isinstance(value, models.Model):