Introduce DISABLE_INSECURE_FEATURES to disable insecure command executions (#1)

* introduce DISABLE_INSECURE_FEATURES to disable insecure executions

Signed-off-by: Quan TRAN <account@itscaro.me>

* disable remote sources when DISABLE_INSECURE_FEATURES is set to "true"

Signed-off-by: Quan TRAN <account@itscaro.me>

* refactor envvar package

Signed-off-by: Quan TRAN <account@itscaro.me>

* (test) fix test fixtures

Signed-off-by: Quan TRAN <account@itscaro.me>

* use absolute path to avoid unit test failure

Signed-off-by: Quan TRAN <account@itscaro.me>

* Fix conflicts

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
Quan TRAN
2022-06-05 15:15:06 +09:00
committed by GitHub
co-authored by Yusuke Kuoka
parent 789af92c09
commit 577f54af7a
21 changed files with 261 additions and 33 deletions
+4 -3
View File
@@ -11,6 +11,7 @@ import (
"testing"
"github.com/google/go-cmp/cmp"
"github.com/helmfile/helmfile/pkg/envvar"
"github.com/Masterminds/semver/v3"
"go.uber.org/zap"
@@ -794,13 +795,13 @@ func Test_IsHelm3(t *testing.T) {
t.Error("helmexec.IsHelm3() - Failed to detect Helm 3")
}
os.Setenv("HELMFILE_HELM3", "1")
os.Setenv(envvar.Helm3, "1")
helm2Runner = mockRunner{output: []byte("Client: v2.16.0+ge13bc94\n")}
helm = New("helm", NewLogger(os.Stdout, "info"), "dev", &helm2Runner)
if !helm.IsHelm3() {
t.Error("helmexec.IsHelm3() - Helm3 not detected when HELMFILE_HELM3 is set")
t.Errorf("helmexec.IsHelm3() - Helm3 not detected when %s is set", envvar.Helm3)
}
os.Setenv("HELMFILE_HELM3", "")
os.Setenv(envvar.Helm3, "")
}
func Test_GetVersion(t *testing.T) {