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.

outgoing_webhook: Set an X-Smokescreen-Role on requests.

Alex Vandiver134db206a9dd
diff --git a/zerver/lib/outgoing_webhook.py b/zerver/lib/outgoing_webhook.py
index 5dfba934882..7fa471166e5 100644
--- a/zerver/lib/outgoing_webhook.py
+++ b/zerver/lib/outgoing_webhook.py
@@ -31,7 +31,12 @@ class OutgoingWebhookServiceInterface(metaclass=abc.ABCMeta):
self.user_profile: UserProfile = user_profile
self.service_name: str = service_name
self.session: Session = Session()
- self.session.headers.update({"User-Agent": "ZulipOutgoingWebhook/" + ZULIP_VERSION})
+ self.session.headers.update(
+ {
+ "X-Smokescreen-Role": "webhook",
+ "User-Agent": "ZulipOutgoingWebhook/" + ZULIP_VERSION,
+ }
+ )
@abc.abstractmethod
def make_request(self, base_url: str, event: Dict[str, Any]) -> Optional[Response]:
diff --git a/zerver/tests/test_outgoing_webhook_system.py b/zerver/tests/test_outgoing_webhook_system.py
index 5d0224e2245..148c0f5365e 100644
--- a/zerver/tests/test_outgoing_webhook_system.py
+++ b/zerver/tests/test_outgoing_webhook_system.py
@@ -167,6 +167,7 @@ The webhook got a response with status code *400*.""",
headers = {
"Content-Type": "application/json",
"User-Agent": user_agent,
+ "X-Smokescreen-Role": "webhook",
}
self.assertLessEqual(headers.items(), prepared_request.headers.items())