Skip to content

Commit 6f427b8

Browse files
dc-larsendacoburnlelia
authored
Fix notifiers reading repo/branch from wrong source (#30)
Webhook, Slack, MS Teams, MS Sentinel, and SumoLogic notifiers read repository and branch from self.config, which never contains these fields. The NotificationManager populates them in the facts dict (manager.py:279-280), matching the pattern the Jira notifier already uses correctly. Changed all five notifiers to read from facts instead of self.config. Co-authored-by: Douglas <douglas@socket.dev> Co-authored-by: lelia <le1ia@me.com> Co-authored-by: lelia <lelia@socket.dev>
1 parent ab6099f commit 6f427b8

5 files changed

Lines changed: 15 additions & 15 deletions

File tree

socket_basics/core/notification/ms_sentinel_notifier.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ def _send_sentinel_event(self, facts: Dict[str, Any], title: str, content: str)
7676
logger.warning('MSSentinelNotifier: missing required configuration (workspace_id, shared_key)')
7777
return
7878

79-
# Get repository and branch info from config (discovered by main logic)
80-
repo = self.config.get('repository', 'Unknown')
81-
branch = self.config.get('branch', 'Unknown')
79+
# Get repository and branch info from facts (populated by NotificationManager)
80+
repo = facts.get('repository', 'Unknown')
81+
branch = facts.get('branch', 'Unknown')
8282

8383
# Create Sentinel event payload with pre-formatted content
8484
event = {

socket_basics/core/notification/ms_teams_notifier.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def _send_teams_message(self, facts: Dict[str, Any], title: str, content: str) -
6565
logger.warning('MSTeamsNotifier: no Teams webhook URL configured')
6666
return
6767

68-
# Get repository and branch info from config (discovered by main logic)
69-
repo = self.config.get('repository', 'Unknown')
70-
branch = self.config.get('branch', 'Unknown')
68+
# Get repository and branch info from facts (populated by NotificationManager)
69+
repo = facts.get('repository', 'Unknown')
70+
branch = facts.get('branch', 'Unknown')
7171

7272
try:
7373
# Create Teams MessageCard payload with pre-formatted content

socket_basics/core/notification/slack_notifier.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ def _send_slack_message(self, facts: Dict[str, Any], title: str, content: str, f
7474
logger.warning('SlackNotifier: no Slack webhook URL configured')
7575
return
7676

77-
# Get repository and branch info from config (discovered by main logic)
78-
repo = self.repository
79-
branch = self.config.get('branch', 'Unknown')
77+
# Get repository and branch info from facts (populated by NotificationManager)
78+
repo = facts.get('repository', self.repository)
79+
branch = facts.get('branch', 'Unknown')
8080

8181
try:
8282
# Truncate content if it's too long for a single Slack block (3000 char limit)

socket_basics/core/notification/sumologic_notifier.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def _send_sumologic_log(self, facts: Dict[str, Any], title: str, content: str) -
5757
logger.warning('SumoLogicNotifier: no HTTP source URL configured')
5858
return
5959

60-
# Get repository and branch info from config (discovered by main logic)
61-
repo = self.config.get('repository', 'Unknown')
62-
branch = self.config.get('branch', 'Unknown')
60+
# Get repository and branch info from facts (populated by NotificationManager)
61+
repo = facts.get('repository', 'Unknown')
62+
branch = facts.get('branch', 'Unknown')
6363

6464
# Add full scan URL if available
6565
full_scan_url = facts.get('full_scan_url')

socket_basics/core/notification/webhook_notifier.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def _send_webhook(self, facts: Dict[str, Any], title: str, content: str) -> None
5757
logger.warning('WebhookNotifier: no webhook URL configured')
5858
return
5959

60-
# Get repository and branch info from config (discovered by main logic)
61-
repo = self.config.get('repository', 'Unknown')
62-
branch = self.config.get('branch', 'Unknown')
60+
# Get repository and branch info from facts (populated by NotificationManager)
61+
repo = facts.get('repository', 'Unknown')
62+
branch = facts.get('branch', 'Unknown')
6363

6464
# Create webhook payload with pre-formatted content
6565
payload = {

0 commit comments

Comments
 (0)