From ff1510dedc2cfcb45e2fb2909d894bbe7fcf881e Mon Sep 17 00:00:00 2001 From: Jens L Date: Mon, 15 May 2023 14:39:58 +0200 Subject: [PATCH] events: sanitize enums (#5610) when importing a flow and returning logs, sometimes an enum might be included which is currently not sanitized and hence causes an exception Signed-off-by: Jens Langhammer --- authentik/events/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/authentik/events/utils.py b/authentik/events/utils.py index b5864e837..bf7099ebf 100644 --- a/authentik/events/utils.py +++ b/authentik/events/utils.py @@ -2,6 +2,7 @@ import re from copy import copy from dataclasses import asdict, is_dataclass +from enum import Enum from pathlib import Path from types import GeneratorType from typing import Any, Optional @@ -126,6 +127,8 @@ def sanitize_item(value: Any) -> Any: return str(value) if isinstance(value, YAMLTag): return str(value) + if isinstance(value, Enum): + return value.value if isinstance(value, type): return { "type": value.__name__,