From e11c0e88d34ae5f5d09c5cef9ca560413f809ed1 Mon Sep 17 00:00:00 2001 From: Chadin Anuwattanaporn Date: Wed, 23 Oct 2024 21:07:50 +0800 Subject: [PATCH] chore: add logs from permissions external command execution --- server/events/external_team_allowlist_checker.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/server/events/external_team_allowlist_checker.go b/server/events/external_team_allowlist_checker.go index 9f3fe419ef..8cbdcca70d 100644 --- a/server/events/external_team_allowlist_checker.go +++ b/server/events/external_team_allowlist_checker.go @@ -26,7 +26,12 @@ func (checker *ExternalTeamAllowlistChecker) IsCommandAllowedForTeam(ctx models. return false } - return checker.checkOutputResults(out) + outputResults := checker.checkOutputResults(out) + if !outputResults { + ctx.Log.Info("command %q returns %q", cmd, out) + } + + return outputResults } func (checker *ExternalTeamAllowlistChecker) IsCommandAllowedForAnyTeam(ctx models.TeamAllowlistCheckerContext, teams []string, command string) bool { @@ -36,7 +41,12 @@ func (checker *ExternalTeamAllowlistChecker) IsCommandAllowedForAnyTeam(ctx mode return false } - return checker.checkOutputResults(out) + outputResults := checker.checkOutputResults(out) + if !outputResults { + ctx.Log.Info("command %q returns %q", cmd, out) + } + + return outputResults } func (checker *ExternalTeamAllowlistChecker) buildCommandString(ctx models.TeamAllowlistCheckerContext, teams []string, command string) string {