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: