From 265d37ce47863762d02346344822d4084de2b243 Mon Sep 17 00:00:00 2001 From: Silvin Lubecki Date: Tue, 22 Sep 2020 10:17:54 +0200 Subject: [PATCH 1/2] Fix Snyk update notification: we erased the env vars using os.Environ() instead of appending to the cmd.Env. Signed-off-by: Silvin Lubecki --- internal/provider/snyk.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/provider/snyk.go b/internal/provider/snyk.go index b9d0d306..f8adcf5c 100644 --- a/internal/provider/snyk.go +++ b/internal/provider/snyk.go @@ -148,8 +148,9 @@ func (s *snykProvider) Scan(image string) error { if err != nil { return fmt.Errorf("failed to get DockerScanID: %s", err) } - cmd.Env = append(os.Environ(), fmt.Sprintf("SNYK_DOCKER_TOKEN=%s", token)) + cmd.Env = append(cmd.Env, fmt.Sprintf("SNYK_DOCKER_TOKEN=%s", token)) } + cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr return checkCommandErr(cmd.Run()) From 5cf098b52a1d4d153e37f1aa5b06e1312c25c811 Mon Sep 17 00:00:00 2001 From: Silvin Lubecki Date: Tue, 22 Sep 2020 10:20:18 +0200 Subject: [PATCH 2/2] Add the env var SNYK_INTEGRATION_NAME=DOCKER_DESKTOP for all the snyk calls. Signed-off-by: Silvin Lubecki --- internal/provider/snyk.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/provider/snyk.go b/internal/provider/snyk.go index f8adcf5c..e4a49232 100644 --- a/internal/provider/snyk.go +++ b/internal/provider/snyk.go @@ -132,8 +132,7 @@ func (s *snykProvider) Authenticate(token string) error { cmd.Env = append(cmd.Env, "SNYK_UTM_MEDIUM=Partner", "SNYK_UTM_SOURCE=Docker", - "SNYK_UTM_CAMPAIGN=Docker-Desktop-2020", - "SNYK_INTEGRATION_NAME=DOCKER_DESKTOP") + "SNYK_UTM_CAMPAIGN=Docker-Desktop-2020") cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr return checkCommandErr(cmd.Run()) @@ -188,7 +187,10 @@ func (s *snykProvider) Version() (string, error) { func (s *snykProvider) newCommand(arg ...string) *exec.Cmd { cmd := exec.CommandContext(s.context, s.path, arg...) - cmd.Env = append(os.Environ(), "NO_UPDATE_NOTIFIER=true", "SNYK_CFG_DISABLESUGGESTIONS=true") + cmd.Env = append(os.Environ(), + "NO_UPDATE_NOTIFIER=true", + "SNYK_CFG_DISABLESUGGESTIONS=true", + "SNYK_INTEGRATION_NAME=DOCKER_DESKTOP") return cmd }