feat(slack): scope private channel visibility to installing user#4779
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview On new Slack OAuth connects, Channel listing now paginates Reviewed by Cursor Bugbot for commit be61b2d. Configure here. |
Greptile SummaryThis PR scopes private Slack channel visibility to the installing user's own workspace membership, satisfying Slack Marketplace's privacy requirement that a private channel must only be shown to a user whose Slack account is a member — even when the bot has been invited.
Confidence Score: 5/5Safe to merge. Both changed files are well-contained, backward-compatible, and the new code paths all have explicit fallbacks. The auth change is purely additive — new credentials get the No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Route as channels/route.ts
participant DB as Database
participant SlackBot as Slack API (bot token)
participant SlackUser as Slack API (users.conversations)
Client->>Route: POST /api/tools/slack/channels
Route->>Route: authorizeCredentialUse()
Route->>DB: "SELECT accountId WHERE id = resolvedCredentialId"
DB-->>Route: accountId (e.g. T123-usr_U456-uuid)
Route->>Route: parseScopedSlackUserId(accountId) → scopedUserId
Route->>SlackBot: conversations.list (paginated, ≤10 pages)
SlackBot-->>Route: all bot-accessible channels
alt scopedUserId present (new credentials)
Route->>SlackUser: "users.conversations?user=scopedUserId&types=private_channel"
SlackUser-->>Route: private channels user is a member of
Route->>Route: "allowedPrivateChannelIds = Set(user private channels)"
else legacy credential or BYO bot token
Route->>Route: use is_member fallback
end
Route->>Route: filter private channels against allowedPrivateChannelIds
Route->>Route: public channels always pass
Route-->>Client: "{ channels: [...] }"
Reviews (2): Last reviewed commit: "chore(slack): trim verbose comment" | Re-trigger Greptile |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit be61b2d. Configure here.
Summary
authed_user.idat OAuth connect time (via better-authtokens.raw) and tag the credential's accountId with ausr_markerusers.conversations(botgroups:read) — private channels the owner isn't a member of are hidden, even when the bot has access (Slack Marketplace privacy requirement)is_memberbehavior (no regression for existing connections)Type of Change
Testing
Tested manually
Checklist