From a4b351942806bac7519c612661a3df7add21ee3a Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 13 Sep 2021 16:36:04 +0200 Subject: [PATCH] api: fix possible error in sentry proxy Signed-off-by: Jens Langhammer --- authentik/api/v3/sentry.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/authentik/api/v3/sentry.py b/authentik/api/v3/sentry.py index 89b5d530b..8f35734da 100644 --- a/authentik/api/v3/sentry.py +++ b/authentik/api/v3/sentry.py @@ -51,7 +51,10 @@ class SentryTunnelView(APIView): return HttpResponse(status=400) # Body is 2 json objects separated by \n full_body = request.body - header = loads(full_body.splitlines()[0]) + lines = full_body.splitlines() + if len(lines) < 1: + return HttpResponse(status=400) + header = loads(lines[0]) # Check that the DSN is what we expect dsn = header.get("dsn", "") if dsn != settings.SENTRY_DSN: