mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-21 16:07:53 +02:00
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:
co-authored by
Yusuke Kuoka
parent
789af92c09
commit
577f54af7a
@@ -7,15 +7,23 @@ import (
|
||||
neturl "net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/go-getter"
|
||||
"github.com/hashicorp/go-getter/helper/url"
|
||||
"github.com/helmfile/helmfile/pkg/envvar"
|
||||
"go.uber.org/multierr"
|
||||
"go.uber.org/zap"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
var disableInsecureFeatures bool
|
||||
|
||||
func init() {
|
||||
disableInsecureFeatures, _ = strconv.ParseBool(os.Getenv(envvar.DisableInsecureFeatures))
|
||||
}
|
||||
|
||||
func CacheDir() string {
|
||||
dir, err := os.UserCacheDir()
|
||||
if err != nil {
|
||||
@@ -279,6 +287,9 @@ func (g *GoGetter) Get(wd, src, dst string) error {
|
||||
}
|
||||
|
||||
func NewRemote(logger *zap.SugaredLogger, homeDir string, readFile func(string) ([]byte, error), dirExists func(string) bool, fileExists func(string) bool) *Remote {
|
||||
if disableInsecureFeatures {
|
||||
panic("Remote sources are disabled due to 'DISABLE_INSECURE_FEATURES'")
|
||||
}
|
||||
remote := &Remote{
|
||||
Logger: logger,
|
||||
Home: homeDir,
|
||||
|
||||
Reference in New Issue
Block a user