From 07c4950b2df3ad7938d54a51120043029dc7f75b Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Fri, 1 May 2020 12:31:27 -0400 Subject: [PATCH] admin: forbid better --- plugins/admin/admin.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/admin/admin.go b/plugins/admin/admin.go index e54e160..eeb2d5a 100644 --- a/plugins/admin/admin.go +++ b/plugins/admin/admin.go @@ -108,8 +108,14 @@ func (p *AdminPlugin) message(conn bot.Connector, k bot.Kind, message msg.Messag return true } + verbs := map[string]bool{ + "set": true, + "push": true, + "setkey": true, + } + parts := strings.Split(body, " ") - if parts[0] == "set" && len(parts) > 2 && forbiddenKeys[parts[1]] { + if verbs[parts[0]] && len(parts) > 2 && forbiddenKeys[parts[1]] { p.bot.Send(conn, bot.Message, message.Channel, "You cannot access that key") return true } else if parts[0] == "unset" && len(parts) > 1 {