From e5241ac574998c2b329fdf2ad2d6ce13c05e1fd7 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 15 Nov 2022 16:28:15 +0100 Subject: [PATCH] core: fix error when propertymappings return complex value Signed-off-by: Jens Langhammer --- authentik/core/api/propertymappings.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/authentik/core/api/propertymappings.py b/authentik/core/api/propertymappings.py index 1f99fff74..1344c528b 100644 --- a/authentik/core/api/propertymappings.py +++ b/authentik/core/api/propertymappings.py @@ -19,6 +19,7 @@ from authentik.core.api.used_by import UsedByMixin from authentik.core.api.utils import MetaNameSerializer, PassiveSerializer, TypeCreateSerializer from authentik.core.expression.evaluator import PropertyMappingEvaluator from authentik.core.models import PropertyMapping +from authentik.events.utils import sanitize_item from authentik.lib.utils.reflection import all_subclasses from authentik.policies.api.exec import PolicyTestSerializer @@ -140,7 +141,9 @@ class PropertyMappingViewSet( self.request, **test_params.validated_data.get("context", {}), ) - response_data["result"] = dumps(result, indent=(4 if format_result else None)) + response_data["result"] = dumps( + sanitize_item(result), indent=(4 if format_result else None) + ) except Exception as exc: # pylint: disable=broad-except response_data["result"] = str(exc) response_data["successful"] = False