diff --git a/ego/premain/core/core.go b/ego/premain/core/core.go index 99e9a91..00dccd2 100644 --- a/ego/premain/core/core.go +++ b/ego/premain/core/core.go @@ -51,8 +51,8 @@ func PreMain(payload string, mounter Mounter, fs afero.Fs, hostEnviron []string) // Convert host environment string array to key-value map hostEnvironMap := make(map[string]string, len(hostEnviron)) for _, envVar := range hostEnviron { - splitString := strings.Split(envVar, "=") - hostEnvironMap[splitString[0]] = splitString[1] + envName, envValue, _ := strings.Cut(envVar, "=") + hostEnvironMap[envName] = envValue } // Check if we run as a Marble or a normal EGo application diff --git a/ego/premain/core/core_test.go b/ego/premain/core/core_test.go index 0c56018..658d7d8 100644 --- a/ego/premain/core/core_test.go +++ b/ego/premain/core/core_test.go @@ -33,7 +33,7 @@ func TestPremain(t *testing.T) { assert := assert.New(t) require := require.New(t) - hostEnviron := []string{"EDG_CWD=/host"} + hostEnviron := []string{"EDG_CWD=/host", "EDG_CONTAINS_EQUAL_SIGN=foo=bar"} fs := afero.NewMemMapFs() // sane default values @@ -51,6 +51,7 @@ func TestPremain(t *testing.T) { // Supply valid payload, no Marble mounter := assertionMounter{assert: assert, expectedMounts: conf.Mounts, usedTargets: make(map[string]bool), remountAsHostFS: false} assert.NoError(PreMain("", &mounter, fs, hostEnviron)) + assert.Equal("foo=bar", os.Getenv("EDG_CONTAINS_EQUAL_SIGN")) // Supply valid payload, no Marble payload, err := json.Marshal(conf)