snyk 1.240.0 outputs invisible ANSI control characters in JSON output

Created on 30 Oct 2019  路  5Comments  路  Source: snyk/snyk

Expected behaviour

snyk test --file=/project/go.mod --package-manager=gomodules --json --project-name=xxx > "snyk-result.json" 2>"snyk-error.log"'

=> should just output regular JSON results of snyk.

Actual behaviour

The following ANSI control chars are add at the beginning of the JSON output:
^[[2K^[[1G^[[2K^[[1G

This was working fine with snyk v1.239.5. It seems related with the cli-spinner that was introduced in this version.

Note that this breaks any jq parsing efforts (which is actually also being done in your dockerhub images, so these will probably not be working for anyone atm).

bug

Most helpful comment

08:34:01 Installing Snyk Security tool (version 'latest') 08:34:18 Testing for known issues... 08:34:18 > /home/ubuntu/tools/io.snyk.jenkins.tools.SnykInstallation/Snyk/node_modules/.bin/snyk test --json --severity-threshold=low --file=package.json --org=### --project-name=### 08:34:21 Result: 0 known issues | No known vulnerabilities 08:34:21 Remember project for continuous monitoring... 08:34:21 > /home/ubuntu/tools/io.snyk.jenkins.tools.SnykInstallation/Snyk/node_modules/.bin/snyk monitor --json --severity-threshold=low --file=package.json --org=### --project-name=### 08:34:23 Explore the snapshot at https://app.snyk.io/org/###/project/###/history/###

Looks like its working on our end. Thanks for putting priority on this!

All 5 comments

馃憢 https://github.com/snyk/snyk/pull/843 should be fixed as soon as this is released :)

Please upgrade to 1.240.1 and try again?

We are also seeing this issue in our CI build system (Jenkins, using the Snyk plugin). Neither the hotfix nor 1.240 worked.

Rolling back to 1.239.5 appears to be a valid workaround.

馃憢 Please upgrade to 1.240.2, this should resolve your issue.

08:34:01 Installing Snyk Security tool (version 'latest') 08:34:18 Testing for known issues... 08:34:18 > /home/ubuntu/tools/io.snyk.jenkins.tools.SnykInstallation/Snyk/node_modules/.bin/snyk test --json --severity-threshold=low --file=package.json --org=### --project-name=### 08:34:21 Result: 0 known issues | No known vulnerabilities 08:34:21 Remember project for continuous monitoring... 08:34:21 > /home/ubuntu/tools/io.snyk.jenkins.tools.SnykInstallation/Snyk/node_modules/.bin/snyk monitor --json --severity-threshold=low --file=package.json --org=### --project-name=### 08:34:23 Explore the snapshot at https://app.snyk.io/org/###/project/###/history/###

Looks like its working on our end. Thanks for putting priority on this!

Was this page helpful?
0 / 5 - 0 ratings