Skip to content

Commit 2f75456

Browse files
committed
Merge branch 'master' into java-17-upgrade
2 parents ee524a9 + dd69acb commit 2f75456

4 files changed

Lines changed: 40 additions & 9 deletions

File tree

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,29 @@ It only scans runtime configurations by default. This can be overridden in proj
5353

5454
### Usage
5555

56-
`./gradlew dependencyCheckAggregate`
56+
You can request a [NVD API key](https://nvd.nist.gov/developers/request-an-api-key) to improve Dependency Check performance and avoid NVD rate limiting.
57+
58+
It can be provided via an environment variable:
59+
60+
```bash
61+
export NVD_API_KEY=YOUR_KEY
62+
```
63+
64+
Or via a Gradle property:
65+
66+
```bash
67+
./gradlew dependencyCheckAggregate -PPdependencyCheck.nvd.apiKey=YOUR_KEY
68+
```
5769

5870
### Suppressions
5971

60-
Due to the way the dependency checker works, false positives are an [expected occurence.](https://jeremylong.github.io/DependencyCheck/general/suppression.html)
72+
Due to the way the dependency checker works, false positives are an [expected occurrence.](https://jeremylong.github.io/DependencyCheck/general/suppression.html)
6173

6274
Provide the dependency checker with the path to your [suppression file](https://jeremylong.github.io/DependencyCheck/general/suppression.html):
6375

6476
```groovy
6577
dependencyCheck {
66-
suppressionFile = 'path/to/supression.xml'
78+
suppressionFile = 'path/to/suppressions.xml'
6779
}
6880
```
6981

build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ plugins {
22
id 'java-gradle-plugin'
33
id 'groovy'
44
id 'com.gradle.plugin-publish' version '1.3.1'
5-
id "uk.gov.hmcts.java" version "0.12.66"
5+
id "uk.gov.hmcts.java" version "0.12.67"
66
}
77

88
repositories {
99
mavenCentral()
10+
maven { url "https://plugins.gradle.org/m2/" }
1011
}
1112

1213
dependencies {
13-
implementation 'org.owasp:dependency-check-gradle:10.0.3'
14+
implementation 'org.owasp:dependency-check-gradle:12.2.0'
1415
implementation 'org.apache.maven:maven-artifact:3.9.10'
1516
compileOnly 'org.projectlombok:lombok:1.18.38'
1617
annotationProcessor 'org.projectlombok:lombok:1.18.38'
@@ -30,10 +31,8 @@ compileJava {
3031
options.compilerArgs += ["-Werror"]
3132
}
3233

33-
def version = System.getenv("RELEASE_VERSION")?.replace("refs/tags/", "") ?: "DEV-SNAPSHOT"
34-
3534
group = 'uk.gov.hmcts.reform'
36-
project.version = version
35+
project.version = System.getenv("RELEASE_VERSION")?.replace("refs/tags/", "") ?: "DEV-SNAPSHOT"
3736

3837
gradlePlugin {
3938
// Define the plugin

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/java/uk/gov/hmcts/tools/DependencyCheckSetup.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@ public static void apply(Project project) {
3636
project.getPlugins().apply(DependencyCheckPlugin.class);
3737

3838
DependencyCheckExtension extension = project.getExtensions().getByType(DependencyCheckExtension.class);
39+
40+
Project root = project.getRootProject();
41+
42+
// Gradle property: -PdependencyCheck.nvd.apiKey=...
43+
String apiKey = (String) root.findProperty("dependencyCheck.nvd.apiKey");
44+
45+
// JVM system property: -DdependencyCheck.nvd.apiKey=...
46+
if (apiKey == null || apiKey.isBlank()) {
47+
apiKey = System.getProperty("dependencyCheck.nvd.apiKey");
48+
}
49+
50+
// Environment variable
51+
if (apiKey == null || apiKey.isBlank()) {
52+
apiKey = System.getenv("NVD_API_KEY");
53+
}
54+
55+
if (apiKey != null && !apiKey.isBlank()) {
56+
extension.getNvd().setApiKey(apiKey);
57+
}
58+
3959
extension.setFailBuildOnCVSS(0f);
4060

4161
// Match the CNP pipeline which disables these checks

0 commit comments

Comments
 (0)