diff --git a/.vscode/launch.json b/.vscode/launch.json index 297f4e30..4440b412 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,8 @@ "args": ["server", "--config", "${workspaceFolder}/.devcontainer/config.json"], "cwd": "${workspaceFolder}", "env": { - "PATH": "${workspaceFolder}/.venv/bin:${env:PATH}" + "PATH": "${workspaceFolder}/.venv/bin:${env:PATH}", + "SEMAPHORE_ADMIN_PASSWORD": "test123" } }, { diff --git a/db_lib/AnsiblePlaybook.go b/db_lib/AnsiblePlaybook.go index d321b6a7..3b894953 100644 --- a/db_lib/AnsiblePlaybook.go +++ b/db_lib/AnsiblePlaybook.go @@ -22,7 +22,7 @@ func (p AnsiblePlaybook) makeCmd(command string, args []string, environmentVars cmd := exec.Command(command, args...) //nolint: gas cmd.Dir = p.GetFullPath() - cmd.Env = removeSensitiveEnvs(os.Environ()) + cmd.Env = []string{} cmd.Env = append(cmd.Env, fmt.Sprintf("HOME=%s", util.Config.TmpPath)) cmd.Env = append(cmd.Env, fmt.Sprintf("PWD=%s", cmd.Dir)) diff --git a/db_lib/LocalApp.go b/db_lib/LocalApp.go index 42996985..bff53c36 100644 --- a/db_lib/LocalApp.go +++ b/db_lib/LocalApp.go @@ -2,35 +2,10 @@ package db_lib import ( "os" - "strings" "github.com/ansible-semaphore/semaphore/pkg/task_logger" ) -func removeSensitiveEnvs(envs []string) (res []string) { - sensitives := []string{ - "SEMAPHORE_ACCESS_KEY_ENCRYPTION", - "SEMAPHORE_ADMIN_PASSWORD", - "SEMAPHORE_DB_USER", - "SEMAPHORE_DB_NAME", - "SEMAPHORE_DB_HOST", - "SEMAPHORE_DB_PASS", - "SEMAPHORE_LDAP_PASSWORD", - "SEMAPHORE_RUNNER_TOKEN", - "SEMAPHORE_RUNNER_ID", - } - - for _, e := range envs { - for _, s := range sensitives { - if !strings.HasPrefix(e, s+"=") { - res = append(res, e) - } - } - } - - return res -} - type LocalApp interface { SetLogger(logger task_logger.Logger) task_logger.Logger InstallRequirements(environmentVars *[]string) error diff --git a/db_lib/ShellApp.go b/db_lib/ShellApp.go index e2fdcc12..650c7f30 100644 --- a/db_lib/ShellApp.go +++ b/db_lib/ShellApp.go @@ -2,13 +2,14 @@ package db_lib import ( "fmt" - "github.com/ansible-semaphore/semaphore/db" - "github.com/ansible-semaphore/semaphore/pkg/task_logger" - "github.com/ansible-semaphore/semaphore/util" "os" "os/exec" "strings" "time" + + "github.com/ansible-semaphore/semaphore/db" + "github.com/ansible-semaphore/semaphore/pkg/task_logger" + "github.com/ansible-semaphore/semaphore/util" ) type ShellApp struct { @@ -44,7 +45,7 @@ func (t *ShellApp) makeCmd(command string, args []string, environmentVars *[]str cmd := exec.Command(command, args...) //nolint: gas cmd.Dir = t.GetFullPath() - cmd.Env = removeSensitiveEnvs(os.Environ()) + cmd.Env = []string{} cmd.Env = append(cmd.Env, fmt.Sprintf("HOME=%s", util.Config.TmpPath)) cmd.Env = append(cmd.Env, fmt.Sprintf("PWD=%s", cmd.Dir)) diff --git a/db_lib/TerraformApp.go b/db_lib/TerraformApp.go index dd9996f5..3fbeb918 100644 --- a/db_lib/TerraformApp.go +++ b/db_lib/TerraformApp.go @@ -2,14 +2,15 @@ package db_lib import ( "fmt" - "github.com/ansible-semaphore/semaphore/db" - "github.com/ansible-semaphore/semaphore/pkg/task_logger" - "github.com/ansible-semaphore/semaphore/util" "os" "os/exec" "path" "strings" "time" + + "github.com/ansible-semaphore/semaphore/db" + "github.com/ansible-semaphore/semaphore/pkg/task_logger" + "github.com/ansible-semaphore/semaphore/util" ) type TerraformApp struct { @@ -37,7 +38,7 @@ func (t *TerraformApp) makeCmd(command string, args []string, environmentVars *[ cmd := exec.Command(command, args...) //nolint: gas cmd.Dir = t.GetFullPath() - cmd.Env = removeSensitiveEnvs(os.Environ()) + cmd.Env = []string{} cmd.Env = append(cmd.Env, fmt.Sprintf("HOME=%s", util.Config.TmpPath)) cmd.Env = append(cmd.Env, fmt.Sprintf("PWD=%s", cmd.Dir))