PLT-7785: Slash commands can be issued to a channel in a team without it (#7567)

* Ensured that specified channel is a part of specified team

* Simplified approach to just infer team id from specified channel id to eliminate the attack vector entirely
Этот коммит содержится в:
Jonathan
2017-10-04 11:12:13 -04:00
коммит произвёл Christopher Speller
родитель f94b807f39
Коммит fa80cb10a8
3 изменённых файлов: 42 добавлений и 7 удалений

Просмотреть файл

@@ -2808,7 +2808,10 @@ func (c *Client4) ListCommands(teamId string, customOnly bool) ([]*Command, *Res
// ExecuteCommand executes a given command.
func (c *Client4) ExecuteCommand(channelId, command string) (*CommandResponse, *Response) {
commandArgs := &CommandArgs{ChannelId: channelId, Command: command}
commandArgs := &CommandArgs{
ChannelId: channelId,
Command: command,
}
if r, err := c.DoApiPost(c.GetCommandsRoute()+"/execute", commandArgs.ToJson()); err != nil {
return nil, BuildErrorResponse(r, err)
} else {