Skip to content

Commit

Permalink
Rename allowedEnvs to allowedExpressions
Browse files Browse the repository at this point in the history
Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
  • Loading branch information
TrafalgarZZZ committed Jan 23, 2024
1 parent 504cc4c commit 4e2108f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/utils/cmdguard/exec_pipes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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")
}

Expand Down

0 comments on commit 4e2108f

Please sign in to comment.