Use Slack's domain for whitelisting
This commit is contained in:
@ -84,8 +84,10 @@ router.post('auth.slack', async (ctx) => {
|
|||||||
if (!data.ok) throw httpErrors.BadRequest(data.error);
|
if (!data.ok) throw httpErrors.BadRequest(data.error);
|
||||||
|
|
||||||
// Temp to block
|
// Temp to block
|
||||||
const allowedSlackIds = process.env.ALLOWED_SLACK_IDS.split(',');
|
const allowedSlackDomains = process.env.ALLOWED_SLACK_DOMAINS.split(',');
|
||||||
if (!allowedSlackIds.includes(data.team.id)) throw httpErrors.BadRequest('Invalid Slack team');
|
if (!allowedSlackDomains.includes(data.team.domain)) {
|
||||||
|
throw httpErrors.BadRequest('Invalid Slack team');
|
||||||
|
}
|
||||||
|
|
||||||
// User
|
// User
|
||||||
let user = await User.findOne({ where: { slackId: data.user.id } });
|
let user = await User.findOne({ where: { slackId: data.user.id } });
|
||||||
|
Reference in New Issue
Block a user