bug: `buildSource` does not take into account `authorizations` array when sourcing `user_id` during user-token retrieval/authorization
Nobody has claimed this yet.
- 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:
- Create a Slack app that can subscribe to the
member_joined_channeluser event. - Install the app through two members of the same team - let's call them Alice and Bob.
- Bob opens a private channel.
- Bob invites Carol (a third member) to the channel.
- The
member_joined_channelis fired, and after thebuildSource()function,installationStore.fetchInstallation()is called with the user_id equivalent to Carol's id (insideauthorize()). - 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
sourceobject 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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