-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat(java): add support of test
scope for pom.xml
files
#7486
base: main
Are you sure you want to change the base?
feat(java): add support of test
scope for pom.xml
files
#7486
Conversation
@@ -303,7 +303,7 @@ func (d pomDependency) ToArtifact(opts analysisOptions) artifact { | |||
Exclusions: exclusions, | |||
Locations: locations, | |||
Relationship: ftypes.RelationshipIndirect, // default | |||
Test: d.Scope == "test", | |||
Test: d.Scope == "test" || opts.testScope, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if it works as expected. For example, if two direct dependencies have the same transitive dependency, and one scope is "test" and the other is not, I guess it would not be considered devDependency. How does Maven work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm... Nice catch.
I updated logic and added test for this case (comment before test shows how mvn
works).
Can you take a look and check that this is what you meant?
@@ -303,7 +303,7 @@ func (d pomDependency) ToArtifact(opts analysisOptions) artifact { | |||
Exclusions: exclusions, | |||
Locations: locations, | |||
Relationship: ftypes.RelationshipIndirect, // default | |||
Test: d.Scope == "test", | |||
Test: d.Scope == "test" || opts.testScope, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't it mean it'll include the test even if testScope is false? Unlike the other PR, this PR still includes test dependencies for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm... that's weird.
Do you see any vulnerabilities for test dependencies (or test packages in json
format)?
debug
logs for test dependencies are normal for this PR, because Trivy currently analyzes all dependencies and excludes Dev
dependencies later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It takes ages to scan and then fails with:
semaphore acquire: context deadline exceeded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is timeout error.
Trivy's runtime has increased because Trivy first checks all dependencies (including test ones), and only then excludes them from the report
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not fixed yet. Is the option wired through properly so that it doesn't run by default?
Dev
test
scope for pom.xml
files
Description
We added support of
test
scope.but we were forced to roll back these changes (see #7488).
This PR adds support of
test
scope.Also this PR takes into account the problem with child dependencies of a test dependency(mark test deps and children of this dependency as
Dev
).Blocker PR
pom.xml
file scan times. (see enhancement(report): include/exclude dev deps in analyzers #7476 (comment)).Checklist