diff --git a/README.md b/README.md index 9a53b4c..e5a830b 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,12 @@ In order to start the Database Server simply run docker run -p 3306:3306 stefanneuhaus/dependencycheck-central-mysql ``` +#### NVD API key + +To have a faster synchronization proces, you should apply for an NVD API key. +Get one [at the NVD website](https://nvd.nist.gov/developers/request-an-api-key). +If you have one, start your Docker container with `-e NVD_API_KEY=`. + ### Analysis clients All kinds of analysis clients are supported: Gradle, Maven, Ant, Jenkins, CLI. Apply the following changes to your build file: @@ -34,7 +40,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'org.owasp:dependency-check-gradle:8.0.0' + classpath 'org.owasp:dependency-check-gradle:9.0.6' classpath 'com.mysql:mysql-connector-j:8.2.0' } } diff --git a/overlays/dependencycheck/build.gradle b/overlays/dependencycheck/build.gradle index efd926d..d3c8415 100644 --- a/overlays/dependencycheck/build.gradle +++ b/overlays/dependencycheck/build.gradle @@ -18,7 +18,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'org.owasp:dependency-check-gradle:8.0.0' + classpath 'org.owasp:dependency-check-gradle:9.0.6' classpath 'com.mysql:mysql-connector-j:8.2.0' } } @@ -26,13 +26,16 @@ buildscript { apply plugin: 'org.owasp.dependencycheck' dependencyCheck { - cveValidForHours = 0 data { connectionString = "jdbc:mysql://localhost:3306/dependencycheck?useSSL=false&allowPublicKeyRetrieval=true" driver = "com.mysql.cj.jdbc.Driver" username = "dc-update" password = "" } + nvd { + validForHours = 0 + apiKey = System.getenv("NVD_API_KEY") ?: "" + } } diff --git a/overlays/wrapper.sh b/overlays/wrapper.sh index bd99b4e..8352f80 100755 --- a/overlays/wrapper.sh +++ b/overlays/wrapper.sh @@ -1,4 +1,12 @@ #!/bin/sh +if [ -z "${NVD_API_KEY}" ]; then + echo "--------------------------------------------------------------------------------" + echo " Detected that environment variable NVD_API_KEY was not set." + echo " Please provide an NVD API key! Updates will be very slow without it." + echo " Visit https://nvd.nist.gov/developers/request-an-api-key to get one." + echo "--------------------------------------------------------------------------------" +fi + supercronic /dependencycheck/database-update-schedule & /usr/local/bin/docker-entrypoint.sh --user=root diff --git a/test/project_uptodate/build.gradle b/test/project_uptodate/build.gradle index b3ddee9..76a03f5 100644 --- a/test/project_uptodate/build.gradle +++ b/test/project_uptodate/build.gradle @@ -3,7 +3,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'org.owasp:dependency-check-gradle:8.0.0' + classpath 'org.owasp:dependency-check-gradle:9.0.6' classpath 'com.mysql:mysql-connector-j:8.2.0' } }