From 6a411d7960db632c0ca2c909d8d876957098c8d3 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 23 Jan 2022 21:23:24 +0100 Subject: [PATCH] policies/hibp: ensure password is encodable closes AUTHENTIK-1SA Signed-off-by: Jens Langhammer --- authentik/policies/hibp/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authentik/policies/hibp/models.py b/authentik/policies/hibp/models.py index 7fbf16c28..b6e2c4531 100644 --- a/authentik/policies/hibp/models.py +++ b/authentik/policies/hibp/models.py @@ -45,7 +45,7 @@ class HaveIBeenPwendPolicy(Policy): fields=request.context.keys(), ) return PolicyResult(False, _("Password not set in context")) - password = request.context[self.password_field] + password = str(request.context[self.password_field]) pw_hash = sha1(password.encode("utf-8")).hexdigest() # nosec url = f"https://api.pwnedpasswords.com/range/{pw_hash[:5]}"