From 680ef641fb142adaec0d4cb1dce75afc40aa3923 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 5 Dec 2021 10:31:16 +0100 Subject: [PATCH] providers/saml: fix error when propertymapping returns invalid data in list Signed-off-by: Jens Langhammer --- authentik/providers/saml/processors/assertion.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/authentik/providers/saml/processors/assertion.py b/authentik/providers/saml/processors/assertion.py index 5040be054..01e0b9b5f 100644 --- a/authentik/providers/saml/processors/assertion.py +++ b/authentik/providers/saml/processors/assertion.py @@ -10,6 +10,7 @@ from structlog.stdlib import get_logger from authentik.core.exceptions import PropertyMappingExpressionException from authentik.events.models import Event, EventAction +from authentik.lib.utils.errors import exception_to_string from authentik.lib.utils.time import timedelta_from_string from authentik.providers.saml.models import SAMLPropertyMapping, SAMLProvider from authentik.providers.saml.processors.request_parser import AuthNRequest @@ -101,10 +102,11 @@ class AssertionProcessor: attribute_statement.append(attribute) - except PropertyMappingExpressionException as exc: + except (PropertyMappingExpressionException, ValueError) as exc: + # Value error can be raised when assigning invalid data to an attribute Event.new( EventAction.CONFIGURATION_ERROR, - message=f"Failed to evaluate property-mapping: {str(exc)}", + message=f"Failed to evaluate property-mapping: {exception_to_string(exc)}", mapping=mapping, ).from_http(self.http_request) continue