mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
webhooks/jira: Handle anomalous payloads properly.
We recently ran into a payload in production that didn't contain an event type at all. A payload where we can't figure out the event type is quite rare. Instead of letting these payloads run amok, we should raise a more informative exception for such unusual payloads. If we encounter too many of these, then we can choose to conduct a deeper investigation on a case-by-case basis. With some changes by Tim Abbott.
This commit is contained in:
@@ -4,7 +4,7 @@ from typing import Any, Callable, Dict, Optional
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import log_exception_to_webhook_logger, webhook_view
|
||||
from zerver.decorator import log_unsupported_webhook_event, webhook_view
|
||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
@@ -45,9 +45,8 @@ class Helper:
|
||||
|
||||
def log_unsupported(self, event: str) -> None:
|
||||
summary = f"The '{event}' event isn't currently supported by the GitHub webhook"
|
||||
log_exception_to_webhook_logger(
|
||||
log_unsupported_webhook_event(
|
||||
summary=summary,
|
||||
unsupported_event=True,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user