litaio/lita-slack

Feature request: Channel whitelist

Opened this issue · 3 comments

By default, anyone can invite Lita into any Slack channel. In certain environments this may be undesirable. For example, one might want to extend Lita to perform dangerous operations and the people who can tell her to do those things should be restricted. While one can use Lita's authorization groups feature to implement this, it is sometimes easier to keep her open but only accessible via a restricted channel.

Make it possible to specify a Slack channel whitelist for Lita. If specified, and Lita is invited to a channel in which she doesn't belong, optionally say something, and leave immediately.

This is not possible at this time because channels.leave isn't available to bots per the API. I've filed a support request with Slack to find out why.

A related way to control Lita may be to have her ignore public (non-DM) messages sent to her via non-whitelisted channels. I'll file a separate issue for that.

Here's what Slack support said:

... opening up the *.leave methods for bots is something that is under consideration at the moment. Currently the only alternative is to /kick the bot from the channel after they are added. This could also be done via the API using the channels.kick method (which requires the channels:write permission scope). Doing it this way would potentially allow your bot to check it's 'channel whitelist' then trigger a call to the channels.kick method if the check fails.