diff --git a/bbot/modules/output/slack.py b/bbot/modules/output/slack.py index 438ef4973c..5d47695541 100644 --- a/bbot/modules/output/slack.py +++ b/bbot/modules/output/slack.py @@ -16,7 +16,6 @@ class Slack(WebhookOutputModule): "event_types": "Types of events to send", "min_severity": "Only allow VULNERABILITY events of this severity or higher", } - good_status_code = 200 content_key = "text" def format_message_str(self, event): diff --git a/bbot/modules/output/teams.py b/bbot/modules/output/teams.py index 25cf240019..98ab3e432c 100644 --- a/bbot/modules/output/teams.py +++ b/bbot/modules/output/teams.py @@ -15,7 +15,6 @@ class Teams(WebhookOutputModule): "min_severity": "Only allow VULNERABILITY events of this severity or higher", } _module_threads = 5 - good_status_code = 202 adaptive_card = { "type": "message", "attachments": [ diff --git a/bbot/modules/templates/webhook.py b/bbot/modules/templates/webhook.py index 23d4557647..05b291acc0 100644 --- a/bbot/modules/templates/webhook.py +++ b/bbot/modules/templates/webhook.py @@ -9,7 +9,6 @@ class WebhookOutputModule(BaseOutputModule): """ accept_dupes = False - good_status_code = 204 message_size_limit = 2000 content_key = "content" vuln_severities = ["UNKNOWN", "LOW", "MEDIUM", "HIGH", "CRITICAL"] @@ -94,5 +93,4 @@ def format_message(self, event): return msg def evaluate_response(self, response): - status_code = getattr(response, "status_code", 0) - return status_code == self.good_status_code + return response.is_success diff --git a/bbot/test/test_step_2/module_tests/test_module_discord.py b/bbot/test/test_step_2/module_tests/test_module_discord.py index 96cec33a9d..d1aeb5c60f 100644 --- a/bbot/test/test_step_2/module_tests/test_module_discord.py +++ b/bbot/test/test_step_2/module_tests/test_module_discord.py @@ -29,7 +29,7 @@ def custom_response(request: httpx.Request): if module_test.request_count == 2: return httpx.Response(status_code=429, json={"retry_after": 0.01}) else: - return httpx.Response(status_code=module_test.module.good_status_code) + return httpx.Response(status_code=200) module_test.httpx_mock.add_callback(custom_response, url=self.webhook_url) diff --git a/bbot/test/test_step_2/module_tests/test_module_teams.py b/bbot/test/test_step_2/module_tests/test_module_teams.py index 56245b89df..bd00af6503 100644 --- a/bbot/test/test_step_2/module_tests/test_module_teams.py +++ b/bbot/test/test_step_2/module_tests/test_module_teams.py @@ -16,10 +16,15 @@ def custom_response(request: httpx.Request): module_test.request_count += 1 if module_test.request_count == 2: return httpx.Response( - status_code=200, - text="Webhook message delivery failed with error: Microsoft Teams endpoint returned HTTP error 429 with ContextId tcid=0,server=msgapi-production-eus-azsc2-4-170,cv=deadbeef=2..", + status_code=400, + json={ + "error": { + "code": "WorkflowTriggerIsNotEnabled", + "message": "Could not execute workflow 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' trigger 'manual' with state 'Disabled': trigger is not enabled.", + } + }, ) else: - return httpx.Response(status_code=202) + return httpx.Response(status_code=200) module_test.httpx_mock.add_callback(custom_response, url=self.webhook_url)