Repository navigation
Replies: 1 comment
|
Hello @Shaamak, thanks for the report and the proposal! Confirmed, it reproduces on v0.76.2: currently a dependency is treated as dev only if all its configurations start with I created #11728, but narrowed the scope: only test configurations of the Android Gradle plugin ( If you'd like to work on the PR, please leave a comment in the issue. Regards, Dmitriy |
Uh oh!
There was an error while loading. Please reload this page.
Description
The Gradle lockfile parser marks a dependency as dev only if every configuration it belongs to starts with
test(pkg/dependency/parser/gradle/lockfile/parse.go). This was added in #8803 fortestCompileClasspathandtestRuntimeClasspath.The Android Gradle plugin names its test configurations per build variant, for example
debugUnitTestRuntimeClasspathanddebugAndroidTestCompileClasspath. These names don't start withtest, so dependencies used only by Android unit tests and instrumented tests are treated as production dependencies. They are reported without--include-dev-deps, along with their vulnerabilities.The same applies to other test configurations that don't start with
test, such asintegrationTestRuntimeClasspathfrom the JVM Test Suite plugin andjvmTestRuntimeClasspathfrom Kotlin Multiplatform.Proposal: treat a configuration as a test configuration when any camelCase word in its name is
test, instead of only checking thetestprefix. This keepstestRuntimeClasspathandtestFixturesRuntimeClasspathas test, marksdebugUnitTestRuntimeClasspath,debugAndroidTestCompileClasspath,integrationTestRuntimeClasspathandjvmTestRuntimeClasspathas test, and keepsdebugRuntimeClasspath(and a name likelatestRuntimeClasspath) as production. If a narrower change is preferred, the parser could match only the AndroidUnitTestandAndroidTestnames in addition to thetestprefix.I'd be happy to send a PR with tests once the approach is agreed.
Desired Behavior
junit:junitin the reproduction below is marked as dev, the same as when it is intestCompileClasspath, and it is reported only with--include-dev-deps.Actual Behavior
junit:junitis treated as a production dependency and CVE-2020-15250 is reported. The same dependency intestCompileClasspath,testRuntimeClasspathis correctly treated as dev and is not reported.Reproduction Steps
Target
Filesystem
Scanner
Vulnerability
Output Format
Table
Mode
Standalone
Debug Output
Operating System
Windows 11
Version
Checklist
trivy clean --allAll reactions