mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 16:14:02 +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:
@@ -717,6 +717,7 @@ DIGEST_LOG_PATH = zulip_path("/var/log/zulip/digest.log")
|
||||
ANALYTICS_LOG_PATH = zulip_path("/var/log/zulip/analytics.log")
|
||||
ANALYTICS_LOCK_DIR = zulip_path("/home/zulip/deployments/analytics-lock-dir")
|
||||
WEBHOOK_LOG_PATH = zulip_path("/var/log/zulip/webhooks_errors.log")
|
||||
WEBHOOK_ANOMALOUS_PAYLOADS_LOG_PATH = zulip_path("/var/log/zulip/webhooks_anomalous_payloads.log")
|
||||
WEBHOOK_UNSUPPORTED_EVENTS_LOG_PATH = zulip_path("/var/log/zulip/webhooks_unsupported_events.log")
|
||||
SOFT_DEACTIVATION_LOG_PATH = zulip_path("/var/log/zulip/soft_deactivation.log")
|
||||
TRACEMALLOC_DUMP_DIR = zulip_path("/var/log/zulip/tracemalloc")
|
||||
@@ -849,6 +850,12 @@ LOGGING: Dict[str, Any] = {
|
||||
"formatter": "webhook_request_data",
|
||||
"filename": WEBHOOK_UNSUPPORTED_EVENTS_LOG_PATH,
|
||||
},
|
||||
"webhook_anomalous_file": {
|
||||
"level": "DEBUG",
|
||||
"class": "logging.handlers.WatchedFileHandler",
|
||||
"formatter": "webhook_request_data",
|
||||
"filename": WEBHOOK_ANOMALOUS_PAYLOADS_LOG_PATH,
|
||||
},
|
||||
},
|
||||
"loggers": {
|
||||
# The Python logging module uses a hierarchy of logger names for config:
|
||||
@@ -1003,6 +1010,11 @@ LOGGING: Dict[str, Any] = {
|
||||
"handlers": ["webhook_unsupported_file"],
|
||||
"propagate": False,
|
||||
},
|
||||
"zulip.zerver.webhooks.anomalous": {
|
||||
"level": "DEBUG",
|
||||
"handlers": ["webhook_anomalous_file"],
|
||||
"propagate": False,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user