From 4e2108fd647dd4b6e38af85775dece5c9e63dae3 Mon Sep 17 00:00:00 2001 From: trafalgarzzz Date: Tue, 23 Jan 2024 19:20:12 +0800 Subject: [PATCH] Rename allowedEnvs to allowedExpressions Signed-off-by: trafalgarzzz --- pkg/utils/cmdguard/exec_pipes.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/utils/cmdguard/exec_pipes.go b/pkg/utils/cmdguard/exec_pipes.go index 10b8985646e..6c47d7f891f 100644 --- a/pkg/utils/cmdguard/exec_pipes.go +++ b/pkg/utils/cmdguard/exec_pipes.go @@ -58,7 +58,7 @@ var allowedPipedCommands = map[string]CommandValidater{ // Define illegal sequences that may lead to command injection attack var illegalSequences = []string{"&", ";", "$", "'", "`", "(", ")", "||", ">>"} -var allowedEnvs = []string{ +var allowedExpressions = []string{ "${METAURL}", // JuiceFS community's metaurl } @@ -175,7 +175,7 @@ func isValidCommand(cmd string, allowedCommands map[string]CommandValidater) boo func checkIllegalSequence(script string) error { scriptToCheck := script - for _, allowedEnv := range allowedEnvs { + for _, allowedEnv := range allowedExpressions { scriptToCheck = strings.ReplaceAll(scriptToCheck, allowedEnv, "ALLOWED_ENV") }