Trivy extension for VSCode throws a scan error, says to check logs, but logs are empty
Environment
- Windows 11 Developer Preview
- VSCode 1.65.2
- Trivy Extension version 0.3.0
Description
When I run the Trivy Scan command from the Visual Studio Code Command Palette, VSCode throws an error saying "Failed to run Trivy scan, error: 1 check logs for details."
Expected Result
Trivy scan completes successfully against the currently open VSCode workspace.
If scan fails, logs should be written to the VSCode Trivy Scan output section (see below screenshot).
Actual Result
Trivy extension throws an error message, saying scan failed, and to check logs VSCode debug logs for Trivy extension are empty.

Same Error/Issue I am also facing, Please Help.
How to configure or download Trivy for Windows.

Unfortunately Trivy doesn't support Windows at the moment - https://github.com/aquasecurity/trivy/pull/1469 is tracking reintroducing this
@owenrumney I'm getting this on Mac too Version: 1.66.2 (Universal) Commit: dfd34e8260c270da74b5c2d86d61aee4b6d56977 Date: 2022-04-11T07:49:20.994Z (2 wks ago) Electron: 17.2.0 Chromium: 98.0.4758.109 Node.js: 16.13.0 V8: 9.8.177.11-electron.0 OS: Darwin arm64 21.2.0
Hey @jERCle - if you go to the settings for Trivy, can you confirm that the Trivy binary path is correct?
If Trivy is already on your PATH it will pick it up, otherwise you will likely need to put the full path here -

The extension doesn't install Trivy, you need to already have it. https://aquasecurity.github.io/trivy/v0.18.3/installation/
@owenrumney Can confirm:

And have already been using it through terminal. I installed through homebrew, and tested with that explicit path /opt/homebrew/bin/trivy and still failed. Only error is in the exthost.log file:

I am currently going through the extension code, so will have a bit more of a play and get back to you - although have to leave the office so will continue shortly
Could you check the output of Trivy Scan in the Output Tab

@owenrumney
Running Trivy Scan from command pallette
This is also after I disabled all other extensions
However, after testing again the run button in Trivy explorer worked

I'm also seeing the same behaviour as jercle.
Running win 10, with wsl2. VSCode started from wsl terminal with code .
Project does contain a dockerfile and "trivy image [image name]" from wsl terminal produces data.
The extension also works fine, finding issue in dockerfile and pom
Anything else I can provide to help troubleshoot this?
Same for me:
ProductName: macOS
ProductVersion: 13.4
BuildVersion: 22F66
VS Code version: 1.78.2
Though I couldnt fix the error, what helped was
- quitting vsc and restarting
- ">view trivy" and running the scan from the button instead of the command
THis appears ot no longer be an issue or there are workarounds. Given how long it's been I'm closing and we can have a new ticket if required now the extension is being actively developed