feat: add an option to skip the files greater than a particular size
Description
Add --max-file-size flag to skip files greater than a particular size.
See https://github.com/aquasecurity/trivy/discussions/7151 for more context
requirements:
- Update analyzers logic:
1.1. Add
Description() stringfunction into analyzer and PostAnalyzer interfaces. (see https://github.com/aquasecurity/trivy/discussions/7151#discussioncomment-10094269) 1.2. AddAllAnalyzersTypes() map[Type]string(type->description(see 1.1)) function to show all analyzers ( see https://github.com/aquasecurity/trivy/discussions/7151#discussioncomment-10091483) - add
--max-file-sizeflag. 2.1. flag format is<analyzer_type>:<max_size>(e.g.--max-file-size jar:200mb--max-file-size secret:5mb) 2.2. flag should support size with prefix (i meanmb,kb, etc.). I saw that https://github.com/docker/go-units supports that (https://github.com/docker/go-units/blob/16e18b2861ca6fd622e7042ffeb9a3ebe8a9dff9/size.go#L78-L80) 2.3. ??? i am not sure about this - cli error is supposed to show list of all analyzers when unsupported analyzer is used. - use list of all analyzers (see 1.2) to create/update docs page using mage docs:generate (see https://github.com/aquasecurity/trivy/discussions/7151#discussioncomment-10092730)
Discussed in https://github.com/aquasecurity/trivy/discussions/7151
please assign to me, I want to contribute.
Hello @zesiar0
I assigned this task to you.
Thanks for your help!
See this discussion for more information about this issue - https://github.com/aquasecurity/trivy/discussions/7151#discussioncomment-10028280
Some info about contributing to Trivy - https://aquasecurity.github.io/trivy/v0.53/community/contribute/pr/
UPD: @zesiar0 I've updated the description of this issue with the steps required.
Hello @zesiar0
I assigned this task to you.
Thanks for your help!
See this discussion for more information about this issue - #7151 (comment)
Some info about contributing to Trivy - https://aquasecurity.github.io/trivy/v0.53/community/contribute/pr/
UPD: @zesiar0 I've updated the description of this issue with the steps required.
thx
Great work! Any updates on this PR? @DmitriyLewen @zesiar0
Hello @Percivalll Judging by the lack of questions and reactions, this functionality is not in demand among users. Therefore, we probably will not implement this (at least now the maintainers have a large number of more priority tasks).
This would be very nice for CI/CD pipelines where I don't necessarily want to add each and every large file to --skip-files and I notice the ones that cause timeout errors are typically > 10MB so it would be nice to be able to set this as a feature flag.