-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration of trivy fs
to trivy repo
#4887
Comments
trivy repo
for local and remote code repository scanningtrivy fs
to trivy repo
Hi Whilst I applaude a drive for consistency in any product, I'm not sure your plan will reduce confusion particularly, which seems to be one of the drivers for this task. I'm not sure it is intuitive to use a "repo" scan to scan a local file system - maybe I don't even have a repo, I'm just playing around on my local file system - but assuming this is the right way to go then, looking at the issues you reference where confusion has arisen, it doesn't seem like simply adding a
None of these issues will be solved by removing Should the story actually be to add Equally, why not allow Or indeed maybe the story should be about removing the confusion between Any way just some thoughts to take or leave - I really appreciate the awesome work you guys do on this product. thanks |
Thanks for your input.
There are two main types of scan targets in Trivy:
In the case of container images, it's post-build, and files required before the build (like pom.xml) are likely not included. Therefore, it scans artifacts like JAR files. On the other hand, in the case of Git repositories, post-build artifacts are likely not included, so it needs to scan pom.xml instead of JAR files. Now, if we were to scan both, there are several problems:
For these reasons, we divide the scan targets depending on the target.
In other words, if it becomes clearer why artifacts are not scanned because of the name "repo", we believe confusion should decrease. Of course, as discussed in this issue, adding For "fs", we could make it a special command that scans both, but changing the behavior of existing subcommands has a significant impact and is not easy. |
Hi re: pre and post build - I'm not sure this is particularly obvious, not in the documentation anyway, of the split between same - I can see your thinking from the above. Maybe the documentation needs "a bit of a refactor" to surface this way of thinking about the scan types?
Perhaps - but only if it is already clear about the pre/post-build divide. Also, you talk about what may or may not be "likely" - Does it make sense to second-guess the use-cases people may have for containers (and for trivy)? You may be unintentionally limiting how it can be used. The point being that more flexibility in how trivy can be used (vs how you envision it being used) opens up more possibilities for the end user. Perhaps, as you allude to, it would make sense to add options to allow users to configure exactly which scans they want to run - so if you want both pre and post-build analyses in one trivy run then you have this ability.
That last option essentially means any of the targets could be used to execute all of the scans (with appropriate options) but the default behaviour is what they do today cheers |
Please note documentation needs to be updated as well, currently in 0.44.0 I see in CLI help messages:
|
still confusing but luckily I got here, and will use |
Description
Currently, Trivy has the following main subcommands:
trivy image
: Scan local or remote container imagestrivy vm
: Scan local or remote VM imagestrivy fs
: Scan local filesystemtrivy repo
: Scan remote Git repositoriesHowever,
trivy fs
command can be somewhat confusing for users. See #3293, #2518, #1543, #1884, #1477, and many examples. The file system scan was originally designed to scan code repositories, and it is intended to be used for scanning repositories locally or in a CI environment. Therefore, unlike container image scanning, it targets lock files such aspackage-lock.json
and does not target artifacts like JAR files, binary files, etc.In reality, the target for
trivy fs
is the same as the one fortrivy repo
. Whiletrivy image
andtrivy vm
support both local and remote targets,trivy fs
only supports local repositories andtrivy repo
only supports remote repositories, which is not aligned with the other commands.After this change, the subcommands would be as below and it would be more consistent:
trivy image
: Scan local or remote container imagestrivy vm
: Scan local or remote VM imagestrivy repo
: Scan local or remote Git repositoriesTherefore, I propose to deprecate
trivy fs
and enhancetrivy repo
to support both local and remote repositories. This will make it more straightforward that it is a subcommand for scanning code repositories.Implementation
When the argument passed to
trivy repo
is HTTP/HTTPS protocol, it will scan remotely. If not, it will assume it is a local file path and perform the scan. This change will improve the user experience and make the command usage more intuitive.Note
Considering the large number of users currently using
trivy fs
, we will not remove this command immediately. Instead, we will encourage users to transition to usingtrivy repo
and provide a grace period of a few years beforetrivy fs
is fully deprecated. This will give users enough time to adjust their workflows accordingly.Plan
trivy repo
, which is equivalent totrivy fs
. (v0.44.0)trivy fs
and announce it (v0.45.0)trivy fs
from the documentationtrivy fs
at some point (TBD)Tasks
trivy repo
for local and remote code repository scanning #4888trivy fs
#4889The text was updated successfully, but these errors were encountered: