From e8a4b1eda5be3fdc29fe3d2dca1712d5a4ac67f4 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 22 Aug 2017 17:56:29 +0100 Subject: [PATCH] error-check !github react before calling Github Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/github.com/matrix-org/go-neb/services/github/github.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/github.com/matrix-org/go-neb/services/github/github.go b/src/github.com/matrix-org/go-neb/services/github/github.go index 4902ad2..f4a968c 100644 --- a/src/github.com/matrix-org/go-neb/services/github/github.go +++ b/src/github.com/matrix-org/go-neb/services/github/github.go @@ -151,6 +151,9 @@ func (s *Service) cmdGithubReact(roomID, userID string, args []string) (interfac if len(args) < 2 { return &gomatrix.TextMessage{"m.notice", "Usage: " + cmdGithubReactUsage}, nil } + if args[1] != "+1" && args[1] != "-1" && args[1] != "laugh" && args[1] != "confused" && args[1] != "heart" && args[1] != "hooray" { + return &gomatrix.TextMessage{"m.notice", "Invalid reaction. Usage: " + cmdGithubReactUsage}, nil + } // get owner,repo,issue,resp out of args[0] owner, repo, issueNum, resp := s.getIssueDetailsFor(args[0], roomID, cmdGithubReactUsage)