events: deepcopy event kwargs to prevent objects being removed, remove workaround

closes #4041

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2022-11-21 12:31:17 +01:00
parent 2e2a4aaa78
commit 426f0bc9dd
4 changed files with 62 additions and 11 deletions

View File

@ -1,6 +1,7 @@
"""authentik events models"""
import time
from collections import Counter
from copy import deepcopy
from datetime import timedelta
from inspect import currentframe
from smtplib import SMTPException
@ -210,7 +211,7 @@ class Event(SerializerModel, ExpiringModel):
current = currentframe()
parent = current.f_back
app = parent.f_globals["__name__"]
cleaned_kwargs = cleanse_dict(sanitize_dict(kwargs))
cleaned_kwargs = cleanse_dict(sanitize_dict(deepcopy(kwargs)))
event = Event(action=action, app=app, context=cleaned_kwargs)
return event