fix: correct Slack adapter message fields for RBAC and DM policy#467
Open
zilvinasu wants to merge 2 commits intoRightNow-AI:mainfrom
Open
fix: correct Slack adapter message fields for RBAC and DM policy#467zilvinasu wants to merge 2 commits intoRightNow-AI:mainfrom
zilvinasu wants to merge 2 commits intoRightNow-AI:mainfrom
Conversation
a6bd0a6 to
ecaadb7
Compare
ecaadb7 to
f870b5e
Compare
Three issues in the Slack adapter prevented RBAC user matching and DM policy enforcement: 1. platform_id was set to user_id instead of channel — breaks the send path (chat.postMessage needs channel ID). All other adapters use channel/chat ID for platform_id. Store user ID in metadata as "sender_user_id" instead. 2. is_group was hardcoded to true — DMs (channel starting with "D") were classified as group messages, so dm_policy was never enforced. 3. Bridge RBAC and rate limiter read platform_id for user identity, but platform_id is the channel. Add sender_user_id() helper that reads from metadata first, falling back to platform_id for adapters that don't set it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f870b5e to
e1753d7
Compare
Author
|
@jaberjaber23 would appreciate a review when you get a chance. This fixes three related issues in the Slack adapter that break RBAC user matching and DM policy enforcement. |
The allowed_channels filter was blocking DMs because DM channel IDs (D-prefixed) are never in the allowed list. DM access control should be handled by dm_policy, not the channel whitelist. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
btw, tested on the deployed openfang, found another bug for allowed_channels check, as it blocks DMs by default as well, will probably fix it as part of this |
Author
|
fixed now, DM RBAC works fine, manual testing done as well, let me know if anything missing @jaberjaber23 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Slack adapter has four related issues that break RBAC user matching, DM policy enforcement, and DM delivery:
platform_idset to wrong value for RBAC -platform_idis used by the send path (chat.postMessageneeds a channel ID), and all other adapters set it to channel/chat ID. But RBAC'sidentify()matcheschannel_bindingsagainstplatform_id, expecting a user ID. Fix: store the Slack user ID inmetadata["sender_user_id"]and add asender_user_id()helper inbridge.rsthat reads it for RBAC and rate limiting.is_grouphardcoded totrue- DMs (channels starting withD) were classified as group messages, sodm_policy(ignore/allowed_only/respond) was never enforced. Fix:is_group = !channel.starts_with('D').Bridge RBAC reads
platform_idinstead of user identity -authorize_channel_user()andrate_limiter.check()usedmessage.sender.platform_id, which is the channel ID. Fix: usesender_user_id()helper that checks metadata first, falling back toplatform_idfor adapters that don't setsender_user_id.allowed_channelsfilter blocks DMs - Theallowed_channelswhitelist applies to all messages including DMs. Since DM channel IDs (D-prefixed) are never in the allowed list, all DMs are silently dropped beforedm_policycan evaluate them. Fix: exemptD-prefixed channels from theallowed_channelsfilter — DM access control is handled bydm_policy.Changes
Backward compatibility
Checklist