Fix/slack pre auth media download - #55272
Conversation
Add early auth check in _handle_slack_message() that runs BEFORE any API calls (thread context fetch, user name resolution, file downloads) or file processing. Unauthorized users could previously trigger Slack API calls and file downloads before the runner's _is_user_authorized gate rejected them. Same pattern as Telegram fix NousResearch#54164: build a SessionSource and check the runner's _is_user_authorized at the adapter level before event construction consumes resources. Fixes the gap where Slack has no adapter-level auth gate while Discord and Telegram have adapter-level allowlists.
Related: #54213 (Teams) and #52353 (Telegram) apply the same pre-auth side-effect hardening pattern — reject the unauthorized sender before attachment metadata fetch / media download — to their respective platform adapters. This is the Slack counterpart ( |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM
Same pattern as Discord early-auth fix (PR #55273). Rejects unauthorized Slack message events before file metadata fetches or media processing.
- Consistent with Discord adapter pattern
- Clean early-auth gate
- Well-scoped: 2 files, 65 additions
Reviewed 2 files, 65 additions. Approved.
|
Thanks for targeting a real pre-auth side-effect boundary. The normal Slack message path still fetches file metadata/media before the runner receives the constructed event ( Problems
Suggested changes
Automated hermes-sweeper review. |
|
Merged via #69482 — your commit was cherry-picked/reapplied onto current main with your authorship preserved in git history: your pre-auth media gating was cherry-picked directly. Thanks for the contribution! |
Summary
This rejects unauthorized Slack message events before the adapter performs file metadata fetches or media processing.
The gateway runner performs the final
_is_user_authorizedcheck after the adapter has already constructed aMessageEvent. For Slack messages with files, that meant an unauthorized sender could still trigger Slackfiles_infocalls and file-processing work before the runner rejected the event.Changes
_handle_slack_message().files_info, or file download work when the sender is unauthorized.files_info.Tests