Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

logging_util: Ensure that the logged user is authenticated.

Zixuan James Lid7746c9e6c47
diff --git a/zerver/lib/logging_util.py b/zerver/lib/logging_util.py
index 09c3593236f..dc902ea8408 100644
--- a/zerver/lib/logging_util.py
+++ b/zerver/lib/logging_util.py
@@ -275,6 +275,7 @@ class ZulipWebhookFormatter(ZulipFormatter):
client = RequestNotes.get_notes(request).client
assert client is not None
+ assert request.user.is_authenticated
setattr(record, "user", f"{request.user.delivery_email} ({request.user.realm.string_id})")
setattr(record, "client", client.name)
setattr(record, "url", request.META.get("PATH_INFO", None))