mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
command actions: restrict passing env vars
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -1524,7 +1524,7 @@ func executeCommandRuleAction(c dataprovider.EventActionCommandConfig, params *E
|
||||
cmd := exec.CommandContext(ctx, c.Cmd, args...)
|
||||
cmd.Env = []string{}
|
||||
for _, keyVal := range c.EnvVars {
|
||||
if keyVal.Value == "$" {
|
||||
if keyVal.Value == "$" && !strings.HasPrefix(strings.ToUpper(keyVal.Key), "SFTPGO_") {
|
||||
val := os.Getenv(keyVal.Key)
|
||||
if val == "" {
|
||||
eventManagerLog(logger.LevelDebug, "empty value for environment variable %q", keyVal.Key)
|
||||
|
||||
Reference in New Issue
Block a user