slackapi / slackapi/bolt-js

bug: `buildSource` does not take into account `authorizations` array when sourcing `user_id` during user-token retrieval/authorization

Open
#2,271 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triage-skip bug semver:patch
Dominant language
TypeScript
Stars
2.9k
Forks
446
Avg merge
1d 3h
Merged PRs (30d)
28

Description

Hey there,
We're developing a Slack app, allowing multiple installations per team, and we've run into a problem when using events.

@slack/bolt version

3.21.4

Node.js runtime version

v20.15.0

Steps to reproduce:
  1. Create a Slack app that can subscribe to the member_joined_channel user event.
  2. Install the app through two members of the same team - let's call them Alice and Bob.
  3. Bob opens a private channel.
  4. Bob invites Carol (a third member) to the channel.
  5. The member_joined_channel is fired, and after the buildSource() function, installationStore.fetchInstallation() is called with the user_id equivalent to Carol's id (inside authorize()).
  6. The problem lies with the fact that we cannot know which installation will be able to perform API calls on this private channel - since only Bob has access to it and Alice doesn't, yet we can't know from the source object which installation to use.

After debugging for a while it seems that we can use the authorizations property in body to know which installation is authorized, but it doesn't seem to be passed to fetchInstallation().
Is there any reason for this, or another way to solve the problem?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/App.ts at buildSource() around line 1535 and authorize() around line 922, then trace how body.authorizations is handled before installationStore.fetchInstallation() is called. Reproduce the two-installation, private-channel member_joined_channel scenario and verify that the installation lookup receives enough authorization context to select the installation able to access the channel.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
authorization, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.