Helio
05/01/2023, 2:14 AMorg.json
and I noticed that the vulnerability for my gradle project is using the dataFile
scope.
For one of my projects, I addressed it by doing:
dependencies {
dataFiles("org.json","json","20230227")
}
However, for another project, I get the error:
Configuration with name 'dataFiles' not found.
Would any of you have any suggestion what could I could be possible be doing wrong?
Any help is greatly appreciated.
BTW: Using gradle 8.1.1 in both.Chris Lee
05/01/2023, 9:27 AMChris Lee
05/01/2023, 9:29 AMHelio
05/01/2023, 5:48 PMChris Lee
05/01/2023, 5:56 PM./gradlew build --scan
) to identify dependencies?Chris Lee
05/01/2023, 6:11 PMHelio
05/01/2023, 10:33 PM./gradlew build --scan
I tried ./gradlew dependencies
though.Helio
05/01/2023, 10:33 PMruntimeClasspath
, etc, it was because I tried to add the implementation (library)
for the project that I couldn’t use dataFiles.Chris Lee
05/01/2023, 10:35 PM:project:dependencies
- by itself it only shows dependencies for the root project.
Try a scan, it’s more interactive / searchable.Helio
05/01/2023, 10:44 PM./gradlew build --scan
suffice the request? I mean, it looks like I need to accept Term and Conditions in order to get it published. Not sure how safe it would be to do that though. 👀Chris Lee
05/01/2023, 10:44 PMHelio
05/01/2023, 10:46 PMChris Lee
05/01/2023, 10:46 PMHelio
05/01/2023, 11:05 PMChris Lee
05/01/2023, 11:06 PMHelio
05/01/2023, 11:06 PMChris Lee
05/01/2023, 11:07 PMHelio
05/01/2023, 11:10 PMconstraints {
dataFiles("org.json","json","20230227") {
because("<https://security.snyk.io/vuln/SNYK-JAVA-ORGJSON-5488379>")
}
}
And it fails with:
Configuration with name 'dataFiles' not found.
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.artifacts.UnknownConfigurationException: Configuration with name 'dataFiles' not found.
Chris Lee
05/01/2023, 11:11 PMHelio
05/01/2023, 11:11 PMconfigurations {
dataFiles
}
Helio
05/01/2023, 11:11 PMYes. It is in dataFiles in one project but not others.What do you mean?
Chris Lee
05/01/2023, 11:12 PMHelio
05/01/2023, 11:16 PMbuild.gradle.kts_1
)
a. This repository uses Snyk plugin;
b. It also uses gradle 8.1.1
c. When I updated build.gradle.kts
and added the constraint
, overriding dataFiles
, it worked as it should.
2. Repository B (build.gradle.kts_2
)
a. This repository uses Snyk plugin;
b. It also uses gradle 8.1.1
c. When I updated build.gradle.kts
and added the constraint
, overriding dataFiles
, it failed with the error above.
Is there anything I might be missing here? For example, is there any possible configuration that could affect how gradle resolve the configuration from within dependencies
?Chris Lee
05/01/2023, 11:22 PMHelio
05/01/2023, 11:24 PMplugins {
id("io.snyk.gradle.plugin.snykplugin") version "0.4"
}
Which I suppose that where the vulnerable dependency is coming from.Helio
05/01/2023, 11:25 PMChris Lee
05/01/2023, 11:26 PMHelio
05/01/2023, 11:28 PMdataFiles("org.json","json","20230227")
gradle will fail to build due to the dataFiles
keyword.Chris Lee
05/01/2023, 11:29 PMHelio
05/01/2023, 11:34 PMNot sure what same json package means.The same dependency
org.json:json
.
What is the snyk output from just Project B?I don’t think the problem here is with the snyk execution (since I’m not invoking it). The build gradle does not compile, because when I make usage of the
dataFiles
keyword under dependencies
(from build.gradle.kts
), the exception is thrown by simply trying to re-sync the project.Chris Lee
05/01/2023, 11:35 PMHelio
05/01/2023, 11:35 PMHelio
05/01/2023, 11:36 PMdataFiles
, but in project A I didn’t get the exception.Helio
05/01/2023, 11:38 PMdataFiles
in my gradle config. Which I’m not entirely sure what it could beChris Lee
05/01/2023, 11:38 PMHelio
05/01/2023, 11:43 PMdataFiles
within the dependency
.
But for some odd reason, using dataFiles
in project B, doesn’t compile.
I will see if I can investigate further, but it is very odd.Chris Lee
05/01/2023, 11:45 PMHelio
05/01/2023, 11:48 PMgradle -q dependencies --configuration dataFiles
------------------------------------------------------------
Root project 'plugins'
------------------------------------------------------------
dataFiles - The data artifacts to be processed for this plugin.
\--- org.json:json:20200518
A web-based, searchable dependency report is available by adding the --scan option.
Chris Lee
05/01/2023, 11:56 PMHelio
05/01/2023, 11:58 PMHelio
05/02/2023, 1:00 AMsettings.graadle.kts
I have the following:
rootProject.name = "plugins"
include(":src:directDownload")
include(":src:collectMetrics")
I noticed that once I remove the includes
from settings.gradle.kts
, I don’t get the exception.
So I probably need somehow to apply the dataFiles
only for plugins
context.Chris Lee
05/02/2023, 1:02 AMHelio
05/02/2023, 1:04 AMproject("plugins") {
dependencies {
constraints {
dataFiles("org.json","json","20230227") {
because("<https://security.snyk.io/vuln/SNYK-JAVA-ORGJSON-5488379>")
}
}
}
}
Helio
05/02/2023, 1:04 AMdataFiles
from allProjects
?Chris Lee
05/02/2023, 1:04 AMHelio
05/02/2023, 1:04 AMProject with path 'plugins' could not be found in root project 'plugins'.
I will see if I can find the issue.Chris Lee
05/02/2023, 1:05 AMproject("plugins") {
Helio
05/02/2023, 1:06 AMChris Lee
05/02/2023, 1:06 AMdependencies {
constraints {
dataFiles("org.json","json","20230227") {
because("<https://security.snyk.io/vuln/SNYK-JAVA-ORGJSON-5488379>")
}
}
}
Helio
05/02/2023, 1:06 AMHelio
05/02/2023, 1:07 AMHelio
05/02/2023, 1:07 AM