Skip to content
This repository was archived by the owner on Aug 2, 2023. It is now read-only.

Conversation

@koalaty-code
Copy link
Contributor

@koalaty-code koalaty-code commented Jan 31, 2022

Trivy v0.23.0 removed the deprecated root command for trivy [image-name]. The old command has been replaced by trivy image [command options] image_name.

Fixes #122

@craftyc0der
Copy link

🙏

const trivyOptions: ExecOptions = await getTrivyExecOptions();
console.log(`Scanning for vulnerabilties in image: ${imageName}`);
const trivyToolRunner = new ToolRunner(trivyPath, [imageName], trivyOptions);
const trivyToolRunner = new ToolRunner(trivyPath, [trivyCommand, imageName], trivyOptions);
Copy link

@scottwestover scottwestover Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we need to add an additional check before adding the command here in case an older version of trivy is downloaded. There is a hard coded version of trivy that the code defaults to here:
https://github.com/Azure/container-scan/blob/master/src/trivyHelper.ts#L288, and here: https://github.com/Azure/container-scan/blob/master/src/trivyHelper.ts#L17, if the code is not able to determine a version number from the latest tag.

Maybe it would be worth removing, or updating the stable version number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Trivy stable version has been updated to v0.22.0.

@craftyc0der
Copy link

Can I help? I'd like to get builds running again.

@gopurx
Copy link

gopurx commented Feb 1, 2022

Yeah, currently builds are impacted. Do we know when this fix be available?

@larryclaman
Copy link

@koushdey - would you be able to review/approve this PR? (sorry for being pushy but this action is currently broken and needs a fix ASAP.)

@craftyc0der
Copy link

@ajinkya599 it looks like you recently contributed to this repo. Any chance you can help out?

@ThadRasmussen
Copy link

Bump! @shigupt202 @microsoftopensource Can we get approval of this or #125 to remedy this regression? Actions are failing across GitHub since trivy lastest has deprecated the call without the image command.

Scanning for vulnerabilties in image: <image name>
Error: An error occurred while scanning container image: <image name> for vulnerabilities.

Copy link
Contributor

@ajinkya599 ajinkya599 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
cc: @koushdey

Copy link
Contributor

@koushdey koushdey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for raising the PR.

@koushdey koushdey merged commit 10e7882 into Azure:master Feb 3, 2022
koushdey pushed a commit that referenced this pull request Feb 3, 2022
* Fix trivy entrypoint command to scan image

* Bump stable Trivy version to v0.22.0
koushdey added a commit that referenced this pull request Feb 3, 2022
* Fix trivy entrypoint command to scan image

* Bump stable Trivy version to v0.22.0

Co-authored-by: Adam Letizia <43392371+koalaty-code@users.noreply.github.com>
@koalaty-code koalaty-code deleted the invoke-trivy-image branch February 3, 2022 14:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when scanning image - Trivy - No help topic for image name

8 participants