docker / scout-cli

Docker Scout CLI
https://docker.com/products/docker-scout
Other
252 stars 60 forks source link

SARIF output from CVE scan is broken when overwriting an existing file #48

Closed bm402 closed 9 months ago

bm402 commented 9 months ago

Say I run the following command on an image with lots of vulnerable components:

docker scout cves --locations --format sarif --output report.json <image name>

A large report will be written to report.json. Then I tidy up some of the vulnerabilities and run the same command again, I'd expect a smaller report in report.json, but instead I get an invalid JSON document.

It seems like the smaller report is being written to the first n lines of report.json, but anything afterwards that already exists in report.json is also being kept, which leads to the JSON document being invalid and any tooling that parses the report.json file to break.


version: 0.24.1 (go1.21.0 - darwin/arm64)
git commit: 67cb4ef78bd69545af0e223ba5fb577b27094505