diff --git a/analyzers/archive-analyzer.html b/analyzers/archive-analyzer.html index 0bb1dc779..574e18864 100644 --- a/analyzers/archive-analyzer.html +++ b/analyzers/archive-analyzer.html @@ -1,13 +1,13 @@ - + dependency-check – Archive Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,88 +160,88 @@
  • - Archive Analyzer + Archive
  • - + - Assembly Analyzer + Assembly
  • - + - Autoconf Analyzer + Autoconf
  • - + - Central Analyzer + Central
  • - + - CMake Analyzer + CMake
  • - + - Jar Analyzer + Jar
  • - + - Nexus Analyzer + Nexus
  • - + - Node.js Analyzer + Node.js
  • - + - Nuspec Analyzer + Nuspec
  • - + - OpenSSL Analyzer + OpenSSL
  • - + - Python Analyzer + Python
  • - + - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • diff --git a/analyzers/assembly-analyzer.html b/analyzers/assembly-analyzer.html index 6aa21c314..ff35ccb55 100644 --- a/analyzers/assembly-analyzer.html +++ b/analyzers/assembly-analyzer.html @@ -1,13 +1,13 @@ - + dependency-check – Assembly Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,88 +160,88 @@
  • - + - Archive Analyzer + Archive
  • - Assembly Analyzer + Assembly
  • - + - Autoconf Analyzer + Autoconf
  • - + - Central Analyzer + Central
  • - + - CMake Analyzer + CMake
  • - + - Jar Analyzer + Jar
  • - + - Nexus Analyzer + Nexus
  • - + - Node.js Analyzer + Node.js
  • - + - Nuspec Analyzer + Nuspec
  • - + - OpenSSL Analyzer + OpenSSL
  • - + - Python Analyzer + Python
  • - + - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • diff --git a/analyzers/autoconf.html b/analyzers/autoconf.html index 3f9713d12..83544618c 100644 --- a/analyzers/autoconf.html +++ b/analyzers/autoconf.html @@ -1,13 +1,13 @@ - + dependency-check – Autoconf Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,88 +160,88 @@
  • - + - Archive Analyzer + Archive
  • - + - Assembly Analyzer + Assembly
  • - Autoconf Analyzer + Autoconf
  • - + - Central Analyzer + Central
  • - + - CMake Analyzer + CMake
  • - + - Jar Analyzer + Jar
  • - + - Nexus Analyzer + Nexus
  • - + - Node.js Analyzer + Node.js
  • - + - Nuspec Analyzer + Nuspec
  • - + - OpenSSL Analyzer + OpenSSL
  • - + - Python Analyzer + Python
  • - + - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • diff --git a/analyzers/central-analyzer.html b/analyzers/central-analyzer.html index 63e4f5fd0..b75a594f1 100644 --- a/analyzers/central-analyzer.html +++ b/analyzers/central-analyzer.html @@ -1,13 +1,13 @@ - + dependency-check – Central Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,88 +160,88 @@
  • - + - Archive Analyzer + Archive
  • - + - Assembly Analyzer + Assembly
  • - + - Autoconf Analyzer + Autoconf
  • - Central Analyzer + Central
  • - + - CMake Analyzer + CMake
  • - + - Jar Analyzer + Jar
  • - + - Nexus Analyzer + Nexus
  • - + - Node.js Analyzer + Node.js
  • - + - Nuspec Analyzer + Nuspec
  • - + - OpenSSL Analyzer + OpenSSL
  • - + - Python Analyzer + Python
  • - + - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • diff --git a/analyzers/cmake.html b/analyzers/cmake.html index f01a1145b..0d709c0c9 100644 --- a/analyzers/cmake.html +++ b/analyzers/cmake.html @@ -1,13 +1,13 @@ - + dependency-check – CMake Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,88 +160,88 @@
  • - + - Archive Analyzer + Archive
  • - + - Assembly Analyzer + Assembly
  • - + - Autoconf Analyzer + Autoconf
  • - + - Central Analyzer + Central
  • - CMake Analyzer + CMake
  • - + - Jar Analyzer + Jar
  • - + - Nexus Analyzer + Nexus
  • - + - Node.js Analyzer + Node.js
  • - + - Nuspec Analyzer + Nuspec
  • - + - OpenSSL Analyzer + OpenSSL
  • - + - Python Analyzer + Python
  • - + - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • diff --git a/analyzers/composer-lock.html b/analyzers/composer-lock.html index e3e636297..75eb7ad76 100644 --- a/analyzers/composer-lock.html +++ b/analyzers/composer-lock.html @@ -1,13 +1,13 @@ - + dependency-check – Composer Lock Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -157,7 +157,7 @@ File Type Analyzers
    - +
  • diff --git a/analyzers/index.html b/analyzers/index.html index 37be39e68..27dac138f 100644 --- a/analyzers/index.html +++ b/analyzers/index.html @@ -1,13 +1,13 @@ - + dependency-check – File Type Analyzers @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -158,90 +158,90 @@
  • - + - Archive Analyzer + Archive
  • - + - Assembly Analyzer + Assembly
  • - + - Autoconf Analyzer + Autoconf
  • - + - Central Analyzer + Central
  • - + - CMake Analyzer + CMake
  • - + - Jar Analyzer + Jar
  • - + - Nexus Analyzer + Nexus
  • - + - Node.js Analyzer + Node.js
  • - + - Nuspec Analyzer + Nuspec
  • - + - OpenSSL Analyzer + OpenSSL
  • - + - Python Analyzer + Python
  • - + - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • diff --git a/analyzers/jar-analyzer.html b/analyzers/jar-analyzer.html index 904a84f39..e00ea0ba3 100644 --- a/analyzers/jar-analyzer.html +++ b/analyzers/jar-analyzer.html @@ -1,13 +1,13 @@ - + dependency-check – Jar Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,88 +160,88 @@
  • - + - Archive Analyzer + Archive
  • - + - Assembly Analyzer + Assembly
  • - + - Autoconf Analyzer + Autoconf
  • - + - Central Analyzer + Central
  • - + - CMake Analyzer + CMake
  • - Jar Analyzer + Jar
  • - + - Nexus Analyzer + Nexus
  • - + - Node.js Analyzer + Node.js
  • - + - Nuspec Analyzer + Nuspec
  • - + - OpenSSL Analyzer + OpenSSL
  • - + - Python Analyzer + Python
  • - + - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • diff --git a/analyzers/nexus-analyzer.html b/analyzers/nexus-analyzer.html index 0beda133b..d8df82c71 100644 --- a/analyzers/nexus-analyzer.html +++ b/analyzers/nexus-analyzer.html @@ -1,13 +1,13 @@ - + dependency-check – Nexus Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,88 +160,88 @@
  • - + - Archive Analyzer + Archive
  • - + - Assembly Analyzer + Assembly
  • - + - Autoconf Analyzer + Autoconf
  • - + - Central Analyzer + Central
  • - + - CMake Analyzer + CMake
  • - + - Jar Analyzer + Jar
  • - Nexus Analyzer + Nexus
  • - + - Node.js Analyzer + Node.js
  • - + - Nuspec Analyzer + Nuspec
  • - + - OpenSSL Analyzer + OpenSSL
  • - + - Python Analyzer + Python
  • - + - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • diff --git a/analyzers/nodejs.html b/analyzers/nodejs.html index 280724872..c31d1c295 100644 --- a/analyzers/nodejs.html +++ b/analyzers/nodejs.html @@ -1,13 +1,13 @@ - + dependency-check – Node.js Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,88 +160,88 @@
  • - + - Archive Analyzer + Archive
  • - + - Assembly Analyzer + Assembly
  • - + - Autoconf Analyzer + Autoconf
  • - + - Central Analyzer + Central
  • - + - CMake Analyzer + CMake
  • - + - Jar Analyzer + Jar
  • - + - Nexus Analyzer + Nexus
  • - Node.js Analyzer + Node.js
  • - + - Nuspec Analyzer + Nuspec
  • - + - OpenSSL Analyzer + OpenSSL
  • - + - Python Analyzer + Python
  • - + - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • @@ -307,7 +307,7 @@

    Node.js Analyzer

    OWASP dependency-check includes an analyzer that will scan Node Package Manager package specification files. The analyzer will collect as much information as it can about the package. The information collected is internally referred to as evidence and is grouped into vendor, product, and version buckets. Other analyzers later use this evidence to identify any Common Platform Enumeration (CPE) identifiers that apply.

    -

    Note: Also consider using the Node Security Project auditing tool, nsp.

    +

    Note:_Consider using Retire.js or the Node Security Project auditing tool, nsp instead of, or in addition to OWASP dependency-check to analyze Node.js packages.

    Files Types Scanned: package.json

    diff --git a/analyzers/nuspec-analyzer.html b/analyzers/nuspec-analyzer.html index 77c9d83ec..15d2e48fa 100644 --- a/analyzers/nuspec-analyzer.html +++ b/analyzers/nuspec-analyzer.html @@ -1,13 +1,13 @@ - + dependency-check – Nuspec Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,88 +160,88 @@
  • - + - Archive Analyzer + Archive
  • - + - Assembly Analyzer + Assembly
  • - + - Autoconf Analyzer + Autoconf
  • - + - Central Analyzer + Central
  • - + - CMake Analyzer + CMake
  • - + - Jar Analyzer + Jar
  • - + - Nexus Analyzer + Nexus
  • - + - Node.js Analyzer + Node.js
  • - Nuspec Analyzer + Nuspec
  • - + - OpenSSL Analyzer + OpenSSL
  • - + - Python Analyzer + Python
  • - + - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • diff --git a/analyzers/openssl.html b/analyzers/openssl.html index 2650c0e4f..2e09ad151 100644 --- a/analyzers/openssl.html +++ b/analyzers/openssl.html @@ -1,13 +1,13 @@ - + dependency-check – OpenSSL Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,88 +160,88 @@
  • - + - Archive Analyzer + Archive
  • - + - Assembly Analyzer + Assembly
  • - + - Autoconf Analyzer + Autoconf
  • - + - Central Analyzer + Central
  • - + - CMake Analyzer + CMake
  • - + - Jar Analyzer + Jar
  • - + - Nexus Analyzer + Nexus
  • - + - Node.js Analyzer + Node.js
  • - + - Nuspec Analyzer + Nuspec
  • - OpenSSL Analyzer + OpenSSL
  • - + - Python Analyzer + Python
  • - + - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • diff --git a/analyzers/python.html b/analyzers/python.html index 7af6730c7..1173920ae 100644 --- a/analyzers/python.html +++ b/analyzers/python.html @@ -1,13 +1,13 @@ - + dependency-check – Python Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,88 +160,88 @@
  • - + - Archive Analyzer + Archive
  • - + - Assembly Analyzer + Assembly
  • - + - Autoconf Analyzer + Autoconf
  • - + - Central Analyzer + Central
  • - + - CMake Analyzer + CMake
  • - + - Jar Analyzer + Jar
  • - + - Nexus Analyzer + Nexus
  • - + - Node.js Analyzer + Node.js
  • - + - Nuspec Analyzer + Nuspec
  • - + - OpenSSL Analyzer + OpenSSL
  • - Python Analyzer + Python
  • - + - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • diff --git a/analyzers/ruby-gemspec.html b/analyzers/ruby-gemspec.html index dfb820e20..187c60801 100644 --- a/analyzers/ruby-gemspec.html +++ b/analyzers/ruby-gemspec.html @@ -1,13 +1,13 @@ - + dependency-check – Ruby Gemspec Analyzer @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,88 +160,88 @@
  • - + - Archive Analyzer + Archive
  • - + - Assembly Analyzer + Assembly
  • - + - Autoconf Analyzer + Autoconf
  • - + - Central Analyzer + Central
  • - + - CMake Analyzer + CMake
  • - + - Jar Analyzer + Jar
  • - + - Nexus Analyzer + Nexus
  • - + - Node.js Analyzer + Node.js
  • - + - Nuspec Analyzer + Nuspec
  • - + - OpenSSL Analyzer + OpenSSL
  • - + - Python Analyzer + Python
  • - Ruby Gemspec Analyzer + Ruby Gemspec
  • - +
  • @@ -307,7 +307,7 @@

    Ruby Gemspec Analyzer

    OWASP dependency-check includes an analyzer that will scan Ruby Gem specifications. The analyzer will collect as much information as it can about the Gem. The information collected is internally referred to as evidence and is grouped into vendor, product, and version buckets. Other analyzers later use this evidence to identify any Common Platform Enumeration (CPE) identifiers that apply.

    -

    Note: Also consider using the Ruby bundler-audit tool.

    +

    Note: It is highly recommended that Ruby projects use bundler-audit.

    Files Types Scanned: Rakefile, *.gemspec

    diff --git a/current.txt b/current.txt index 6261a05bb..d5e98f723 100644 --- a/current.txt +++ b/current.txt @@ -1 +1 @@ -1.3.1 \ No newline at end of file +1.3.2 \ No newline at end of file diff --git a/data/cachenvd.html b/data/cachenvd.html index f1e24b51e..7e85a101a 100644 --- a/data/cachenvd.html +++ b/data/cachenvd.html @@ -1,13 +1,13 @@ - + dependency-check – Snapshotting the NVD @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -185,7 +185,7 @@ File Type Analyzers - +
  • diff --git a/data/database.html b/data/database.html index 257323e2f..0c9b07cb0 100644 --- a/data/database.html +++ b/data/database.html @@ -1,13 +1,13 @@ - + dependency-check – Using a Database Server @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -185,7 +185,7 @@ File Type Analyzers
    - +
  • @@ -277,7 +277,8 @@
  • The connection string, database user name, and the database user's password will also need to be configured.
  • -

    Depending on the database being used, you may need to customize the dbStatements.properties.

    +

    Depending on the database being used, you may need to customize the dbStatements.properties. Alternatively to modifying the dbStatements.properties it is now possible to use a dialect file to support other databases. See dbStatements_h2.properties as an example.

    +

    Also, if using an external database you will need to manually upgrade the schema. See database upgrades for more information.

    As always, feel free to open an issue or post a question to the dependency-check google group.

    diff --git a/data/index.html b/data/index.html index 3299aabb9..23d7a237f 100644 --- a/data/index.html +++ b/data/index.html @@ -1,13 +1,13 @@ - + dependency-check – Internet Access Required @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -185,7 +185,7 @@ File Type Analyzers - +
  • diff --git a/data/mirrornvd.html b/data/mirrornvd.html index 192959cda..da4b6c307 100644 --- a/data/mirrornvd.html +++ b/data/mirrornvd.html @@ -1,13 +1,13 @@ - + dependency-check – Mirroring the NVD from NIST @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -185,7 +185,7 @@ File Type Analyzers
    - +
  • diff --git a/data/proxy.html b/data/proxy.html index 3647157cf..93992b683 100644 --- a/data/proxy.html +++ b/data/proxy.html @@ -1,13 +1,13 @@ - + dependency-check – Proxy Configuration @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -185,7 +185,7 @@ File Type Analyzers
    - +
  • diff --git a/data/upgrade.html b/data/upgrade.html new file mode 100644 index 000000000..7ad4fb647 --- /dev/null +++ b/data/upgrade.html @@ -0,0 +1,247 @@ + + + + + + + + + dependency-check – Database Upgrades + + + + + + + + + + + + + + + + + + + + + Fork me on GitHub + + + + + +
    + + + + + +
    +
    + +
    + + +
    + +

    Database Upgrades

    +

    If using an external database server, such as MySQL, a DBA must manually perform the database upgrades. Currently, a copy of the initialization and upgrade scripts for MySQL can be found in the github repository.

    +

    If you want to use an external database other then MySQL please open an issue in our issue tracker as a dialect properties file will need to be created.

    +
    +
    +
    + +
    + + + + diff --git a/dependency-analysis.html b/dependency-analysis.html index 4b1f407a9..74652ffe9 100644 --- a/dependency-analysis.html +++ b/dependency-analysis.html @@ -1,13 +1,13 @@ - + dependency-check – @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -157,7 +157,7 @@ File Type Analyzers - +
  • diff --git a/dependency-check-ant/apidocs/allclasses-frame.html b/dependency-check-ant/apidocs/allclasses-frame.html index ef02f2b4c..adc98b4cf 100644 --- a/dependency-check-ant/apidocs/allclasses-frame.html +++ b/dependency-check-ant/apidocs/allclasses-frame.html @@ -2,10 +2,10 @@ - + -All Classes (Dependency-Check Ant Task 1.3.1 API) - +All Classes (Dependency-Check Ant Task 1.3.2 API) + diff --git a/dependency-check-ant/apidocs/allclasses-noframe.html b/dependency-check-ant/apidocs/allclasses-noframe.html index 101275220..60ce9fa78 100644 --- a/dependency-check-ant/apidocs/allclasses-noframe.html +++ b/dependency-check-ant/apidocs/allclasses-noframe.html @@ -2,10 +2,10 @@ - + -All Classes (Dependency-Check Ant Task 1.3.1 API) - +All Classes (Dependency-Check Ant Task 1.3.2 API) + diff --git a/dependency-check-ant/apidocs/constant-values.html b/dependency-check-ant/apidocs/constant-values.html index 6cfebe87d..17c893ccf 100644 --- a/dependency-check-ant/apidocs/constant-values.html +++ b/dependency-check-ant/apidocs/constant-values.html @@ -2,16 +2,16 @@ - + -Constant Field Values (Dependency-Check Ant Task 1.3.1 API) - +Constant Field Values (Dependency-Check Ant Task 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/deprecated-list.html b/dependency-check-ant/apidocs/deprecated-list.html index a63316aa2..09e125ff3 100644 --- a/dependency-check-ant/apidocs/deprecated-list.html +++ b/dependency-check-ant/apidocs/deprecated-list.html @@ -2,16 +2,16 @@ - + -Deprecated List (Dependency-Check Ant Task 1.3.1 API) - +Deprecated List (Dependency-Check Ant Task 1.3.2 API) + @@ -87,10 +87,20 @@ +org.owasp.dependencycheck.taskdefs.Check.isUpdateOnly() +
    Use the update task instead
    + + + org.owasp.dependencycheck.taskdefs.Check.setApplicationName(String)
    use projectName instead.
    + +org.owasp.dependencycheck.taskdefs.Check.setUpdateOnly(boolean) +
    Use the update task instead
    + +
  • @@ -141,6 +151,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/help-doc.html b/dependency-check-ant/apidocs/help-doc.html index 0daf2774b..93a850b8f 100644 --- a/dependency-check-ant/apidocs/help-doc.html +++ b/dependency-check-ant/apidocs/help-doc.html @@ -2,16 +2,16 @@ - + -API Help (Dependency-Check Ant Task 1.3.1 API) - +API Help (Dependency-Check Ant Task 1.3.2 API) + @@ -217,6 +217,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/index-all.html b/dependency-check-ant/apidocs/index-all.html index 610d7a3dd..c5f94e1d4 100644 --- a/dependency-check-ant/apidocs/index-all.html +++ b/dependency-check-ant/apidocs/index-all.html @@ -2,16 +2,16 @@ - + -Index (Dependency-Check Ant Task 1.3.1 API) - +Index (Dependency-Check Ant Task 1.3.2 API) + @@ -185,6 +185,10 @@
    Get the value of cveUrl20Modified.
    +
    getCveValidForHours() - Method in class org.owasp.dependencycheck.taskdefs.Update
    +
    +
    Get the value of cveValidForHours.
    +
    getDatabaseDriverName() - Method in class org.owasp.dependencycheck.taskdefs.Update
    Get the value of databaseDriverName.
    @@ -371,7 +375,9 @@
     
    isUpdateOnly() - Method in class org.owasp.dependencycheck.taskdefs.Check
    -
    Get the value of updateOnly.
    +
    Deprecated. +
    Use the update task instead
    +
    isWarnEnabled() - Method in class org.owasp.dependencycheck.ant.logging.AntLoggerAdapter
     
    @@ -441,31 +447,31 @@
    use projectName instead.
    -
    setArchiveAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setArchiveAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Sets whether or not the analyzer is enabled.
    -
    setAssemblyAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setAssemblyAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Sets whether or not the analyzer is enabled.
    -
    setAutoconfAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setAutoconfAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Set the value of autoconfAnalyzerEnabled.
    -
    setAutoUpdate(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setAutoUpdate(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Set the value of autoUpdate.
    -
    setCentralAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setCentralAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Set the value of centralAnalyzerEnabled.
    -
    setCMakeAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setCMakeAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Set the value of cmakeAnalyzerEnabled.
    -
    setComposerAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setComposerAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Set the value of composerAnalyzerEnabled.
    @@ -493,6 +499,10 @@
    Set the value of cveUrl20Modified.
    +
    setCveValidForHours(Integer) - Method in class org.owasp.dependencycheck.taskdefs.Update
    +
    +
    Set the value of cveValidForHours.
    +
    setDatabaseDriverName(String) - Method in class org.owasp.dependencycheck.taskdefs.Update
    Set the value of databaseDriverName.
    @@ -517,11 +527,11 @@
    Set the value of failBuildOnCVSS.
    -
    setJarAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setJarAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Sets whether or not the analyzer is enabled.
    -
    setNexusAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setNexusAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Set the value of nexusAnalyzerEnabled.
    @@ -529,19 +539,19 @@
    Set the value of nexusUrl.
    -
    setNexusUsesProxy(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setNexusUsesProxy(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Set the value of nexusUsesProxy.
    -
    setNodeAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setNodeAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Set the value of nodeAnalyzerEnabled.
    -
    setNuspecAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setNuspecAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Sets whether or not the analyzer is enabled.
    -
    setOpensslAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setOpensslAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Set the value of opensslAnalyzerEnabled.
    @@ -569,11 +579,11 @@
    Set the value of proxyUsername.
    -
    setPyDistributionAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setPyDistributionAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Set the value of pyDistributionAnalyzerEnabled.
    -
    setPyPackageAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setPyPackageAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Set the value of pyPackageAnalyzerEnabled.
    @@ -589,7 +599,7 @@
    Set the value of reportOutputDirectory.
    -
    setRubygemsAnalyzerEnabled(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    +
    setRubygemsAnalyzerEnabled(Boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    Set the value of rubygemsAnalyzerEnabled.
    @@ -611,7 +621,9 @@
    setUpdateOnly(boolean) - Method in class org.owasp.dependencycheck.taskdefs.Check
    -
    Set the value of updateOnly.
    +
    Deprecated. +
    Use the update task instead
    +
    setZipExtensions(String) - Method in class org.owasp.dependencycheck.taskdefs.Check
    @@ -715,6 +727,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/index.html b/dependency-check-ant/apidocs/index.html index 35255606f..ed4073c51 100644 --- a/dependency-check-ant/apidocs/index.html +++ b/dependency-check-ant/apidocs/index.html @@ -2,9 +2,9 @@ - + -Dependency-Check Ant Task 1.3.1 API +Dependency-Check Ant Task 1.3.2 API @@ -780,6 +780,6 @@ extends org.slf4j.helpers.MarkerIgnoringBase -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/AntLoggerFactory.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/AntLoggerFactory.html index d226b533b..e1fcb842b 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/AntLoggerFactory.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/AntLoggerFactory.html @@ -2,16 +2,16 @@ - + -AntLoggerFactory (Dependency-Check Ant Task 1.3.1 API) - +AntLoggerFactory (Dependency-Check Ant Task 1.3.2 API) + @@ -273,6 +273,6 @@ implements org.slf4j.ILoggerFactory -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/class-use/AntLoggerAdapter.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/class-use/AntLoggerAdapter.html index a3ba18033..db458ce64 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/class-use/AntLoggerAdapter.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/class-use/AntLoggerAdapter.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.ant.logging.AntLoggerAdapter (Dependency-Check Ant Task 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.ant.logging.AntLoggerAdapter (Dependency-Check Ant Task 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/class-use/AntLoggerFactory.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/class-use/AntLoggerFactory.html index 5fbae5032..ace6fd9ca 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/class-use/AntLoggerFactory.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/class-use/AntLoggerFactory.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.ant.logging.AntLoggerFactory (Dependency-Check Ant Task 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.ant.logging.AntLoggerFactory (Dependency-Check Ant Task 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-frame.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-frame.html index faf267759..d39920b85 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-frame.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.ant.logging (Dependency-Check Ant Task 1.3.1 API) - +org.owasp.dependencycheck.ant.logging (Dependency-Check Ant Task 1.3.2 API) + diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-summary.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-summary.html index 6d84e70a3..52ee63f21 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-summary.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.ant.logging (Dependency-Check Ant Task 1.3.1 API) - +org.owasp.dependencycheck.ant.logging (Dependency-Check Ant Task 1.3.2 API) + @@ -147,6 +147,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-tree.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-tree.html index 075d8c6cf..de046e132 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-tree.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.ant.logging Class Hierarchy (Dependency-Check Ant Task 1.3.1 API) - +org.owasp.dependencycheck.ant.logging Class Hierarchy (Dependency-Check Ant Task 1.3.2 API) + @@ -130,6 +130,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-use.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-use.html index 778360fcf..e84664bc8 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-use.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/ant/logging/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.ant.logging (Dependency-Check Ant Task 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.ant.logging (Dependency-Check Ant Task 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Check.ReportFormats.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Check.ReportFormats.html index e6e7043bf..7f4b1776d 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Check.ReportFormats.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Check.ReportFormats.html @@ -2,16 +2,16 @@ - + -Check.ReportFormats (Dependency-Check Ant Task 1.3.1 API) - +Check.ReportFormats (Dependency-Check Ant Task 1.3.2 API) + @@ -292,6 +292,6 @@ extends org.apache.tools.ant.types.EnumeratedAttribute -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Check.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Check.html index ab8d70ec0..9645173ac 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Check.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Check.html @@ -2,16 +2,16 @@ - + -Check (Dependency-Check Ant Task 1.3.1 API) - +Check (Dependency-Check Ant Task 1.3.2 API) + @@ -276,91 +276,91 @@ extends -boolean +Boolean isArchiveAnalyzerEnabled()
    Returns whether or not the analyzer is enabled.
    -boolean +Boolean isAssemblyAnalyzerEnabled()
    Returns whether or not the analyzer is enabled.
    -boolean +Boolean isAutoconfAnalyzerEnabled()
    Get the value of autoconfAnalyzerEnabled.
    -boolean +Boolean isAutoUpdate()
    Get the value of autoUpdate.
    -boolean +Boolean isCentralAnalyzerEnabled()
    Get the value of centralAnalyzerEnabled.
    -boolean +Boolean isCMakeAnalyzerEnabled()
    Get the value of cmakeAnalyzerEnabled.
    -boolean +Boolean isComposerAnalyzerEnabled()
    Get the value of composerAnalyzerEnabled.
    -boolean +Boolean isJarAnalyzerEnabled()
    Returns whether or not the analyzer is enabled.
    -boolean +Boolean isNexusAnalyzerEnabled()
    Get the value of nexusAnalyzerEnabled.
    -boolean +Boolean isNexusUsesProxy()
    Get the value of nexusUsesProxy.
    -boolean +Boolean isNodeAnalyzerEnabled()
    Get the value of nodeAnalyzerEnabled.
    -boolean +Boolean isNuspecAnalyzerEnabled()
    Returns whether or not the analyzer is enabled.
    -boolean +Boolean isOpensslAnalyzerEnabled()
    Get the value of opensslAnalyzerEnabled.
    -boolean +Boolean isPyDistributionAnalyzerEnabled()
    Get the value of pyDistributionAnalyzerEnabled.
    -boolean +Boolean isPyPackageAnalyzerEnabled()
    Get the value of pyPackageAnalyzerEnabled.
    @@ -372,7 +372,7 @@ extends -boolean +Boolean isRubygemsAnalyzerEnabled()
    Get the value of rubygemsAnalyzerEnabled.
    @@ -386,7 +386,9 @@ extends boolean isUpdateOnly() -
    Get the value of updateOnly.
    +
    Deprecated.  +
    Use the update task instead
    +
    @@ -405,43 +407,43 @@ extends void -setArchiveAnalyzerEnabled(boolean archiveAnalyzerEnabled) +setArchiveAnalyzerEnabled(Boolean archiveAnalyzerEnabled)
    Sets whether or not the analyzer is enabled.
    void -setAssemblyAnalyzerEnabled(boolean assemblyAnalyzerEnabled) +setAssemblyAnalyzerEnabled(Boolean assemblyAnalyzerEnabled)
    Sets whether or not the analyzer is enabled.
    void -setAutoconfAnalyzerEnabled(boolean autoconfAnalyzerEnabled) +setAutoconfAnalyzerEnabled(Boolean autoconfAnalyzerEnabled)
    Set the value of autoconfAnalyzerEnabled.
    void -setAutoUpdate(boolean autoUpdate) +setAutoUpdate(Boolean autoUpdate)
    Set the value of autoUpdate.
    void -setCentralAnalyzerEnabled(boolean centralAnalyzerEnabled) +setCentralAnalyzerEnabled(Boolean centralAnalyzerEnabled)
    Set the value of centralAnalyzerEnabled.
    void -setCMakeAnalyzerEnabled(boolean cmakeAnalyzerEnabled) +setCMakeAnalyzerEnabled(Boolean cmakeAnalyzerEnabled)
    Set the value of cmakeAnalyzerEnabled.
    void -setComposerAnalyzerEnabled(boolean composerAnalyzerEnabled) +setComposerAnalyzerEnabled(Boolean composerAnalyzerEnabled)
    Set the value of composerAnalyzerEnabled.
    @@ -453,13 +455,13 @@ extends void -setJarAnalyzerEnabled(boolean jarAnalyzerEnabled) +setJarAnalyzerEnabled(Boolean jarAnalyzerEnabled)
    Sets whether or not the analyzer is enabled.
    void -setNexusAnalyzerEnabled(boolean nexusAnalyzerEnabled) +setNexusAnalyzerEnabled(Boolean nexusAnalyzerEnabled)
    Set the value of nexusAnalyzerEnabled.
    @@ -471,25 +473,25 @@ extends void -setNexusUsesProxy(boolean nexusUsesProxy) +setNexusUsesProxy(Boolean nexusUsesProxy)
    Set the value of nexusUsesProxy.
    void -setNodeAnalyzerEnabled(boolean nodeAnalyzerEnabled) +setNodeAnalyzerEnabled(Boolean nodeAnalyzerEnabled)
    Set the value of nodeAnalyzerEnabled.
    void -setNuspecAnalyzerEnabled(boolean nuspecAnalyzerEnabled) +setNuspecAnalyzerEnabled(Boolean nuspecAnalyzerEnabled)
    Sets whether or not the analyzer is enabled.
    void -setOpensslAnalyzerEnabled(boolean opensslAnalyzerEnabled) +setOpensslAnalyzerEnabled(Boolean opensslAnalyzerEnabled)
    Set the value of opensslAnalyzerEnabled.
    @@ -507,13 +509,13 @@ extends void -setPyDistributionAnalyzerEnabled(boolean pyDistributionAnalyzerEnabled) +setPyDistributionAnalyzerEnabled(Boolean pyDistributionAnalyzerEnabled)
    Set the value of pyDistributionAnalyzerEnabled.
    void -setPyPackageAnalyzerEnabled(boolean pyPackageAnalyzerEnabled) +setPyPackageAnalyzerEnabled(Boolean pyPackageAnalyzerEnabled)
    Set the value of pyPackageAnalyzerEnabled.
    @@ -537,7 +539,7 @@ extends void -setRubygemsAnalyzerEnabled(boolean rubygemsAnalyzerEnabled) +setRubygemsAnalyzerEnabled(Boolean rubygemsAnalyzerEnabled)
    Set the value of rubygemsAnalyzerEnabled.
    @@ -556,7 +558,9 @@ extends void setUpdateOnly(boolean updateOnly) -
    Set the value of updateOnly.
    +
    Deprecated.  +
    Use the update task instead
    +
    @@ -571,7 +575,7 @@ extends

    Methods inherited from class org.owasp.dependencycheck.taskdefs.Update

    -getConnectionString, getConnectionTimeout, getCveUrl12Base, getCveUrl12Modified, getCveUrl20Base, getCveUrl20Modified, getDatabaseDriverName, getDatabaseDriverPath, getDatabasePassword, getDatabaseUser, getProxyPassword, getProxyPort, getProxyServer, getProxyUsername, setConnectionString, setConnectionTimeout, setCveUrl12Base, setCveUrl12Modified, setCveUrl20Base, setCveUrl20Modified, setDatabaseDriverName, setDatabaseDriverPath, setDatabasePassword, setDatabaseUser, setProxyPassword, setProxyPort, setProxyServer, setProxyUsername +getConnectionString, getConnectionTimeout, getCveUrl12Base, getCveUrl12Modified, getCveUrl20Base, getCveUrl20Modified, getCveValidForHours, getDatabaseDriverName, getDatabaseDriverPath, getDatabasePassword, getDatabaseUser, getProxyPassword, getProxyPort, getProxyServer, getProxyUsername, setConnectionString, setConnectionTimeout, setCveUrl12Base, setCveUrl12Modified, setCveUrl20Base, setCveUrl20Modified, setCveValidForHours, setDatabaseDriverName, setDatabaseDriverPath, setDatabasePassword, setDatabaseUser, setProxyPassword, setProxyPort, setProxyServer, setProxyUsername - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1365,6 +1375,6 @@ public void setApplicationName(Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Purge.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Purge.html index 0317ce210..ee0e35402 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Purge.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Purge.html @@ -2,16 +2,16 @@ - + -Purge (Dependency-Check Ant Task 1.3.1 API) - +Purge (Dependency-Check Ant Task 1.3.2 API) + @@ -370,6 +370,6 @@ extends org.apache.tools.ant.Task
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Update.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Update.html index acf3d5adb..0f1c8de99 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Update.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/Update.html @@ -2,16 +2,16 @@ - + -Update (Dependency-Check Ant Task 1.3.1 API) - +Update (Dependency-Check Ant Task 1.3.2 API) + @@ -229,95 +229,107 @@ extends +Integer +getCveValidForHours() +
    Get the value of cveValidForHours.
    + + + String getDatabaseDriverName()
    Get the value of databaseDriverName.
    - + String getDatabaseDriverPath()
    Get the value of databaseDriverPath.
    - + String getDatabasePassword()
    Get the value of databasePassword.
    - + String getDatabaseUser()
    Get the value of databaseUser.
    - + String getProxyPassword()
    Get the value of proxyPassword.
    - + String getProxyPort()
    Get the value of proxyPort.
    - + String getProxyServer()
    Get the value of proxyServer.
    - + String getProxyUsername()
    Get the value of proxyUsername.
    - + protected void populateSettings()
    Takes the properties supplied and updates the dependency-check settings.
    - + void setConnectionString(String connectionString)
    Set the value of connectionString.
    - + void setConnectionTimeout(String connectionTimeout)
    Set the value of connectionTimeout.
    - + void setCveUrl12Base(String cveUrl12Base)
    Set the value of cveUrl12Base.
    - + void setCveUrl12Modified(String cveUrl12Modified)
    Set the value of cveUrl12Modified.
    - + void setCveUrl20Base(String cveUrl20Base)
    Set the value of cveUrl20Base.
    - + void setCveUrl20Modified(String cveUrl20Modified)
    Set the value of cveUrl20Modified.
    + +void +setCveValidForHours(Integer cveValidForHours) +
    Set the value of cveValidForHours.
    + + void setDatabaseDriverName(String databaseDriverName) @@ -735,6 +747,28 @@ extends
    Parameters:
    cveUrl20Base - new value of cveUrl20Base
    + + + + + + + + @@ -758,13 +792,15 @@ extends
  • populateSettings

    -
    protected void populateSettings()
    +
    protected void populateSettings()
    +                         throws org.apache.tools.ant.BuildException
    Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties required to change the proxy server, port, and connection timeout.
    Overrides:
    populateSettings in class Purge
    -
    +
    Throws:
    +
    org.apache.tools.ant.BuildException - thrown when an invalid setting is configured.
  • @@ -834,6 +870,6 @@ extends -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Check.ReportFormats.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Check.ReportFormats.html index 465f2ed0b..c16c753da 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Check.ReportFormats.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Check.ReportFormats.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.taskdefs.Check.ReportFormats (Dependency-Check Ant Task 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.taskdefs.Check.ReportFormats (Dependency-Check Ant Task 1.3.2 API) + @@ -156,6 +156,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Check.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Check.html index 068fe5881..aa3393cc5 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Check.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Check.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.taskdefs.Check (Dependency-Check Ant Task 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.taskdefs.Check (Dependency-Check Ant Task 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Purge.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Purge.html index 70653d38e..019fc4ba8 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Purge.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Purge.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.taskdefs.Purge (Dependency-Check Ant Task 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.taskdefs.Purge (Dependency-Check Ant Task 1.3.2 API) + @@ -162,6 +162,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Update.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Update.html index 09ae1860e..4f57240b3 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Update.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/class-use/Update.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.taskdefs.Update (Dependency-Check Ant Task 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.taskdefs.Update (Dependency-Check Ant Task 1.3.2 API) + @@ -156,6 +156,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-frame.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-frame.html index 7730dabb2..80f12cc74 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-frame.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.taskdefs (Dependency-Check Ant Task 1.3.1 API) - +org.owasp.dependencycheck.taskdefs (Dependency-Check Ant Task 1.3.2 API) + diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-summary.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-summary.html index 4d5115d7a..563541a62 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-summary.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.taskdefs (Dependency-Check Ant Task 1.3.1 API) - +org.owasp.dependencycheck.taskdefs (Dependency-Check Ant Task 1.3.2 API) + @@ -159,6 +159,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-tree.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-tree.html index 0357bd7b1..23b57bf46 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-tree.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.taskdefs Class Hierarchy (Dependency-Check Ant Task 1.3.1 API) - +org.owasp.dependencycheck.taskdefs Class Hierarchy (Dependency-Check Ant Task 1.3.2 API) + @@ -146,6 +146,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-use.html b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-use.html index 676e47236..4767c60e4 100644 --- a/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-use.html +++ b/dependency-check-ant/apidocs/org/owasp/dependencycheck/taskdefs/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.taskdefs (Dependency-Check Ant Task 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.taskdefs (Dependency-Check Ant Task 1.3.2 API) + @@ -159,6 +159,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/slf4j/impl/StaticLoggerBinder.html b/dependency-check-ant/apidocs/org/slf4j/impl/StaticLoggerBinder.html index eff8afdf4..5e875a5f2 100644 --- a/dependency-check-ant/apidocs/org/slf4j/impl/StaticLoggerBinder.html +++ b/dependency-check-ant/apidocs/org/slf4j/impl/StaticLoggerBinder.html @@ -2,16 +2,16 @@ - + -StaticLoggerBinder (Dependency-Check Ant Task 1.3.1 API) - +StaticLoggerBinder (Dependency-Check Ant Task 1.3.2 API) + @@ -329,6 +329,6 @@ implements org.slf4j.spi.LoggerFactoryBinder -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/slf4j/impl/class-use/StaticLoggerBinder.html b/dependency-check-ant/apidocs/org/slf4j/impl/class-use/StaticLoggerBinder.html index 542d1b45a..7b80ac706 100644 --- a/dependency-check-ant/apidocs/org/slf4j/impl/class-use/StaticLoggerBinder.html +++ b/dependency-check-ant/apidocs/org/slf4j/impl/class-use/StaticLoggerBinder.html @@ -2,16 +2,16 @@ - + -Uses of Class org.slf4j.impl.StaticLoggerBinder (Dependency-Check Ant Task 1.3.1 API) - +Uses of Class org.slf4j.impl.StaticLoggerBinder (Dependency-Check Ant Task 1.3.2 API) + @@ -156,6 +156,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/slf4j/impl/package-frame.html b/dependency-check-ant/apidocs/org/slf4j/impl/package-frame.html index fccf56d25..7e4725fa0 100644 --- a/dependency-check-ant/apidocs/org/slf4j/impl/package-frame.html +++ b/dependency-check-ant/apidocs/org/slf4j/impl/package-frame.html @@ -2,10 +2,10 @@ - + -org.slf4j.impl (Dependency-Check Ant Task 1.3.1 API) - +org.slf4j.impl (Dependency-Check Ant Task 1.3.2 API) + diff --git a/dependency-check-ant/apidocs/org/slf4j/impl/package-summary.html b/dependency-check-ant/apidocs/org/slf4j/impl/package-summary.html index 2a3ce05f0..cdf29185f 100644 --- a/dependency-check-ant/apidocs/org/slf4j/impl/package-summary.html +++ b/dependency-check-ant/apidocs/org/slf4j/impl/package-summary.html @@ -2,16 +2,16 @@ - + -org.slf4j.impl (Dependency-Check Ant Task 1.3.1 API) - +org.slf4j.impl (Dependency-Check Ant Task 1.3.2 API) + @@ -142,6 +142,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/slf4j/impl/package-tree.html b/dependency-check-ant/apidocs/org/slf4j/impl/package-tree.html index 33a5fd4d9..99af1fc7b 100644 --- a/dependency-check-ant/apidocs/org/slf4j/impl/package-tree.html +++ b/dependency-check-ant/apidocs/org/slf4j/impl/package-tree.html @@ -2,16 +2,16 @@ - + -org.slf4j.impl Class Hierarchy (Dependency-Check Ant Task 1.3.1 API) - +org.slf4j.impl Class Hierarchy (Dependency-Check Ant Task 1.3.2 API) + @@ -125,6 +125,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/org/slf4j/impl/package-use.html b/dependency-check-ant/apidocs/org/slf4j/impl/package-use.html index 555470c56..7a34ee77b 100644 --- a/dependency-check-ant/apidocs/org/slf4j/impl/package-use.html +++ b/dependency-check-ant/apidocs/org/slf4j/impl/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.slf4j.impl (Dependency-Check Ant Task 1.3.1 API) - +Uses of Package org.slf4j.impl (Dependency-Check Ant Task 1.3.2 API) + @@ -150,6 +150,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/overview-frame.html b/dependency-check-ant/apidocs/overview-frame.html index 5a8c9315b..4b956524c 100644 --- a/dependency-check-ant/apidocs/overview-frame.html +++ b/dependency-check-ant/apidocs/overview-frame.html @@ -2,10 +2,10 @@ - + -Overview List (Dependency-Check Ant Task 1.3.1 API) - +Overview List (Dependency-Check Ant Task 1.3.2 API) + diff --git a/dependency-check-ant/apidocs/overview-summary.html b/dependency-check-ant/apidocs/overview-summary.html index 972a1d539..eb782bcde 100644 --- a/dependency-check-ant/apidocs/overview-summary.html +++ b/dependency-check-ant/apidocs/overview-summary.html @@ -2,16 +2,16 @@ - + -Overview (Dependency-Check Ant Task 1.3.1 API) - +Overview (Dependency-Check Ant Task 1.3.2 API) + @@ -64,7 +64,7 @@
    -

    Dependency-Check Ant Task 1.3.1 API

    +

    Dependency-Check Ant Task 1.3.2 API

    @@ -140,6 +140,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/overview-tree.html b/dependency-check-ant/apidocs/overview-tree.html index 08746b46f..b1abb930f 100644 --- a/dependency-check-ant/apidocs/overview-tree.html +++ b/dependency-check-ant/apidocs/overview-tree.html @@ -2,16 +2,16 @@ - + -Class Hierarchy (Dependency-Check Ant Task 1.3.1 API) - +Class Hierarchy (Dependency-Check Ant Task 1.3.2 API) + @@ -155,6 +155,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/apidocs/serialized-form.html b/dependency-check-ant/apidocs/serialized-form.html index c5d9fb2f3..608fd565c 100644 --- a/dependency-check-ant/apidocs/serialized-form.html +++ b/dependency-check-ant/apidocs/serialized-form.html @@ -2,16 +2,16 @@ - + -Serialized Form (Dependency-Check Ant Task 1.3.1 API) - +Serialized Form (Dependency-Check Ant Task 1.3.2 API) + @@ -139,6 +139,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-ant/checkstyle.html b/dependency-check-ant/checkstyle.html index 0bb979218..b2c4bd293 100644 --- a/dependency-check-ant/checkstyle.html +++ b/dependency-check-ant/checkstyle.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Checkstyle Results @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -233,7 +233,7 @@

    Checkstyle Results

    -

    The following document contains the results of Checkstyle 6.2 with C:\Users\jeremy\Projects\DependencyCheck\dependency-check-ant/../src/main/config/checkstyle-checks.xml ruleset. rss feed

    +

    The following document contains the results of Checkstyle 6.11.2 with C:\Users\jeremy\Projects\DependencyCheck\dependency-check-ant/../src/main/config/checkstyle-checks.xml ruleset. rss feed

    Summary

    diff --git a/dependency-check-ant/cobertura/frame-sourcefiles-org.owasp.dependencycheck.ant.logging.html b/dependency-check-ant/cobertura/frame-sourcefiles-org.owasp.dependencycheck.ant.logging.html index cd7103d86..7d39c584d 100644 --- a/dependency-check-ant/cobertura/frame-sourcefiles-org.owasp.dependencycheck.ant.logging.html +++ b/dependency-check-ant/cobertura/frame-sourcefiles-org.owasp.dependencycheck.ant.logging.html @@ -15,10 +15,10 @@ org.owasp.dependencycheck.ant.logging
    - + - +
    AntLoggerAdapter (0%)AntLoggerAdapter (35%)
    AntLoggerFactory (0%)AntLoggerFactory (100%)
    diff --git a/dependency-check-ant/cobertura/frame-sourcefiles-org.owasp.dependencycheck.taskdefs.html b/dependency-check-ant/cobertura/frame-sourcefiles-org.owasp.dependencycheck.taskdefs.html index 9378f1ffb..be458b287 100644 --- a/dependency-check-ant/cobertura/frame-sourcefiles-org.owasp.dependencycheck.taskdefs.html +++ b/dependency-check-ant/cobertura/frame-sourcefiles-org.owasp.dependencycheck.taskdefs.html @@ -15,13 +15,13 @@ org.owasp.dependencycheck.taskdefs - + - + - +
    Check (0%)Check (54%)
    Purge (0%)Purge (47%)
    Update (0%)Update (25%)
    diff --git a/dependency-check-ant/cobertura/frame-sourcefiles-org.slf4j.impl.html b/dependency-check-ant/cobertura/frame-sourcefiles-org.slf4j.impl.html index 2b7e2c2cb..e4039382e 100644 --- a/dependency-check-ant/cobertura/frame-sourcefiles-org.slf4j.impl.html +++ b/dependency-check-ant/cobertura/frame-sourcefiles-org.slf4j.impl.html @@ -15,7 +15,7 @@ org.slf4j.impl - +
    StaticLoggerBinder (0%)StaticLoggerBinder (100%)
    diff --git a/dependency-check-ant/cobertura/frame-sourcefiles.html b/dependency-check-ant/cobertura/frame-sourcefiles.html index 92094afd8..87193caff 100644 --- a/dependency-check-ant/cobertura/frame-sourcefiles.html +++ b/dependency-check-ant/cobertura/frame-sourcefiles.html @@ -15,22 +15,22 @@ All Packages - + - + - + - + - + - +
    AntLoggerAdapter (0%)AntLoggerAdapter (35%)
    AntLoggerFactory (0%)AntLoggerFactory (100%)
    Check (0%)Check (54%)
    Purge (0%)Purge (47%)
    StaticLoggerBinder (0%)StaticLoggerBinder (100%)
    Update (0%)Update (25%)
    diff --git a/dependency-check-ant/cobertura/frame-summary-org.owasp.dependencycheck.ant.logging.html b/dependency-check-ant/cobertura/frame-summary-org.owasp.dependencycheck.ant.logging.html index 4e61d33ec..8ac71c635 100644 --- a/dependency-check-ant/cobertura/frame-summary-org.owasp.dependencycheck.ant.logging.html +++ b/dependency-check-ant/cobertura/frame-summary-org.owasp.dependencycheck.ant.logging.html @@ -16,7 +16,7 @@ - +
    Package # Classes Line Coverage Branch Coverage Complexity
    org.owasp.dependencycheck.ant.logging2
    0%
    0/103
    0%
    0/48
    1.706
    org.owasp.dependencycheck.ant.logging2
    37%
    39/104
    28%
    14/50
    1.735
    - + diff --git a/dependency-check-ant/cobertura/frame-summary-org.owasp.dependencycheck.taskdefs.html b/dependency-check-ant/cobertura/frame-summary-org.owasp.dependencycheck.taskdefs.html index 35e33c84f..2040af93f 100644 --- a/dependency-check-ant/cobertura/frame-summary-org.owasp.dependencycheck.taskdefs.html +++ b/dependency-check-ant/cobertura/frame-summary-org.owasp.dependencycheck.taskdefs.html @@ -16,7 +16,7 @@ - +
    Package # Classes Line Coverage Branch Coverage Complexity
    org.owasp.dependencycheck.taskdefs4
    0%
    0/376
    0%
    0/148
    1.882
    org.owasp.dependencycheck.taskdefs4
    47%
    166/349
    50%
    40/80
    1.548
    - + diff --git a/dependency-check-ant/cobertura/frame-summary-org.slf4j.impl.html b/dependency-check-ant/cobertura/frame-summary-org.slf4j.impl.html index 5f0390c38..9f947daa1 100644 --- a/dependency-check-ant/cobertura/frame-summary-org.slf4j.impl.html +++ b/dependency-check-ant/cobertura/frame-summary-org.slf4j.impl.html @@ -16,7 +16,7 @@ - +
    Package # Classes Line Coverage Branch Coverage Complexity
    org.slf4j.impl1
    0%
    0/13
    N/A
    1
    org.slf4j.impl1
    100%
    13/13
    N/A
    1
    - + diff --git a/dependency-check-ant/cobertura/frame-summary.html b/dependency-check-ant/cobertura/frame-summary.html index 0a01dd1c1..3305238db 100644 --- a/dependency-check-ant/cobertura/frame-summary.html +++ b/dependency-check-ant/cobertura/frame-summary.html @@ -16,10 +16,10 @@ - - - - + + + +
    Package # Classes Line Coverage Branch Coverage Complexity
    All Packages7
    0%
    0/492
    0%
    0/196
    1.809
    org.owasp.dependencycheck.ant.logging2
    0%
    0/103
    0%
    0/48
    1.706
    org.owasp.dependencycheck.taskdefs4
    0%
    0/376
    0%
    0/148
    1.882
    org.slf4j.impl1
    0%
    0/13
    N/A
    1
    All Packages7
    46%
    218/466
    41%
    54/130
    1.573
    org.owasp.dependencycheck.ant.logging2
    37%
    39/104
    28%
    14/50
    1.735
    org.owasp.dependencycheck.taskdefs4
    47%
    166/349
    50%
    40/80
    1.548
    org.slf4j.impl1
    100%
    13/13
    N/A
    1
    - + diff --git a/dependency-check-ant/cobertura/org.owasp.dependencycheck.ant.logging.AntLoggerAdapter.html b/dependency-check-ant/cobertura/org.owasp.dependencycheck.ant.logging.AntLoggerAdapter.html index e32eb0ae6..d7ee15241 100644 --- a/dependency-check-ant/cobertura/org.owasp.dependencycheck.ant.logging.AntLoggerAdapter.html +++ b/dependency-check-ant/cobertura/org.owasp.dependencycheck.ant.logging.AntLoggerAdapter.html @@ -12,7 +12,7 @@
     
    - +
    Classes in this File Line Coverage Branch Coverage Complexity
    AntLoggerAdapter
    0%
    0/99
    0%
    0/48
    1.75
    AntLoggerAdapter
    35%
    35/100
    28%
    14/50
    1.781
     
    @@ -103,9 +103,9 @@
          */
     43  
         public AntLoggerAdapter(Task task) {
    -  44  0
             super();
    -  45  0
             this.task = task;
    -  46  0
         }
    +  44  13
             super();
    +  45  13
             this.task = task;
    +  46  13
         }
     47  
     
     48   @@ -141,327 +141,330 @@
         @Override
     65  
         public void trace(String msg) {
    -  66  0
             task.log(msg, Project.MSG_VERBOSE);
    -  67  0
         }
    +  66  31
             if (task != null) {
    +  67  27
                 task.log(msg, Project.MSG_VERBOSE);
     68   -
     
    -  69   -
         @Override
    +
             }
    +  69  31
         }
     70   +
     
    +  71   +
         @Override
    +  72  
         public void trace(String format, Object arg) {
    -  71  0
             if (task != null) {
    -  72  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg);
    -  73  0
                 task.log(tp.getMessage(), Project.MSG_VERBOSE);
    -  74   -
             }
    -  75  0
         }
    +  73  29
             if (task != null) {
    +  74  21
                 final FormattingTuple tp = MessageFormatter.format(format, arg);
    +  75  21
                 task.log(tp.getMessage(), Project.MSG_VERBOSE);
     76   -
     
    -  77   -
         @Override
    +
             }
    +  77  29
         }
     78   +
     
    +  79   +
         @Override
    +  80  
         public void trace(String format, Object arg1, Object arg2) {
    -  79  0
             if (task != null) {
    -  80  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
    -  81  0
                 task.log(tp.getMessage(), Project.MSG_VERBOSE);
    -  82   -
             }
    -  83  0
         }
    +  81  13
             if (task != null) {
    +  82  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
    +  83  0
                 task.log(tp.getMessage(), Project.MSG_VERBOSE);
     84   -
     
    -  85   -
         @Override
    +
             }
    +  85  13
         }
     86   +
     
    +  87   +
         @Override
    +  88  
         public void trace(String format, Object... arguments) {
    -  87  0
             if (task != null) {
    -  88  0
                 final FormattingTuple tp = MessageFormatter.format(format, arguments);
    -  89  0
                 task.log(tp.getMessage(), Project.MSG_VERBOSE);
    -  90   -
             }
    -  91  0
         }
    +  89  0
             if (task != null) {
    +  90  0
                 final FormattingTuple tp = MessageFormatter.format(format, arguments);
    +  91  0
                 task.log(tp.getMessage(), Project.MSG_VERBOSE);
     92   -
     
    -  93   -
         @Override
    +
             }
    +  93  0
         }
     94   +
     
    +  95   +
         @Override
    +  96  
         public void trace(String msg, Throwable t) {
    -  95  0
             if (task != null) {
    -  96  0
                 task.log(msg, t, Project.MSG_VERBOSE);
    -  97   -
             }
    -  98  0
         }
    +  97  0
             if (task != null) {
    +  98  0
                 task.log(msg, t, Project.MSG_VERBOSE);
     99   -
     
    -  100   -
         @Override
    +
             }
    +  100  0
         }
     101   -
         public boolean isDebugEnabled() {
    -  102  0
             return true;
    +
     
    +  102   +
         @Override
     103   -
         }
    -  104   -
     
    +
         public boolean isDebugEnabled() {
    +  104  10
             return true;
     105   -
         @Override
    +
         }
     106   +
     
    +  107   +
         @Override
    +  108  
         public void debug(String msg) {
    -  107  0
             if (task != null) {
    -  108  0
                 task.log(msg, Project.MSG_DEBUG);
    -  109   -
             }
    -  110  0
         }
    +  109  134
             if (task != null) {
    +  110  116
                 task.log(msg, Project.MSG_DEBUG);
     111   -
     
    -  112   -
         @Override
    +
             }
    +  112  134
         }
     113   +
     
    +  114   +
         @Override
    +  115  
         public void debug(String format, Object arg) {
    -  114  0
             if (task != null) {
    -  115  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg);
    -  116  0
                 task.log(tp.getMessage(), Project.MSG_DEBUG);
    -  117   -
             }
    -  118  0
         }
    +  116  382
             if (task != null) {
    +  117  369
                 final FormattingTuple tp = MessageFormatter.format(format, arg);
    +  118  369
                 task.log(tp.getMessage(), Project.MSG_DEBUG);
     119   -
     
    -  120   -
         @Override
    +
             }
    +  120  382
         }
     121   +
     
    +  122   +
         @Override
    +  123  
         public void debug(String format, Object arg1, Object arg2) {
    -  122  0
             if (task != null) {
    -  123  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
    -  124  0
                 task.log(tp.getMessage(), Project.MSG_DEBUG);
    -  125   -
             }
    -  126  0
         }
    +  124  25
             if (task != null) {
    +  125  19
                 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
    +  126  19
                 task.log(tp.getMessage(), Project.MSG_DEBUG);
     127   -
     
    -  128   -
         @Override
    +
             }
    +  128  25
         }
     129   +
     
    +  130   +
         @Override
    +  131  
         public void debug(String format, Object... arguments) {
    -  130  0
             if (task != null) {
    -  131  0
                 final FormattingTuple tp = MessageFormatter.format(format, arguments);
    -  132  0
                 task.log(tp.getMessage(), Project.MSG_DEBUG);
    -  133   -
             }
    -  134  0
         }
    +  132  2
             if (task != null) {
    +  133  2
                 final FormattingTuple tp = MessageFormatter.format(format, arguments);
    +  134  2
                 task.log(tp.getMessage(), Project.MSG_DEBUG);
     135   -
     
    -  136   -
         @Override
    +
             }
    +  136  2
         }
     137   +
     
    +  138   +
         @Override
    +  139  
         public void debug(String msg, Throwable t) {
    -  138  0
             if (task != null) {
    -  139  0
                 task.log(msg, t, Project.MSG_DEBUG);
    -  140   -
             }
    -  141  0
         }
    +  140  0
             if (task != null) {
    +  141  0
                 task.log(msg, t, Project.MSG_DEBUG);
     142   -
     
    -  143   -
         @Override
    +
             }
    +  143  0
         }
     144   -
         public boolean isInfoEnabled() {
    -  145  0
             return true;
    +
     
    +  145   +
         @Override
     146   -
         }
    -  147   -
     
    +
         public boolean isInfoEnabled() {
    +  147  0
             return true;
     148   -
         @Override
    +
         }
     149   +
     
    +  150   +
         @Override
    +  151  
         public void info(String msg) {
    -  150  0
             if (task != null) {
    -  151  0
                 task.log(msg, Project.MSG_INFO);
    -  152   -
             }
    -  153  0
         }
    +  152  6
             if (task != null) {
    +  153  6
                 task.log(msg, Project.MSG_INFO);
     154   -
     
    -  155   -
         @Override
    +
             }
    +  155  6
         }
     156   +
     
    +  157   +
         @Override
    +  158  
         public void info(String format, Object arg) {
    -  157  0
             if (task != null) {
    -  158  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg);
    -  159  0
                 task.log(tp.getMessage(), Project.MSG_INFO);
    -  160   -
             }
    -  161  0
         }
    +  159  6
             if (task != null) {
    +  160  6
                 final FormattingTuple tp = MessageFormatter.format(format, arg);
    +  161  6
                 task.log(tp.getMessage(), Project.MSG_INFO);
     162   -
     
    -  163   -
         @Override
    +
             }
    +  163  6
         }
     164   +
     
    +  165   +
         @Override
    +  166  
         public void info(String format, Object arg1, Object arg2) {
    -  165  0
             if (task != null) {
    -  166  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
    -  167  0
                 task.log(tp.getMessage(), Project.MSG_INFO);
    -  168   -
             }
    -  169  0
         }
    +  167  0
             if (task != null) {
    +  168  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
    +  169  0
                 task.log(tp.getMessage(), Project.MSG_INFO);
     170   -
     
    -  171   -
         @Override
    +
             }
    +  171  0
         }
     172   +
     
    +  173   +
         @Override
    +  174  
         public void info(String format, Object... arguments) {
    -  173  0
             if (task != null) {
    -  174  0
                 final FormattingTuple tp = MessageFormatter.format(format, arguments);
    -  175  0
                 task.log(tp.getMessage(), Project.MSG_INFO);
    -  176   -
             }
    -  177  0
         }
    +  175  0
             if (task != null) {
    +  176  0
                 final FormattingTuple tp = MessageFormatter.format(format, arguments);
    +  177  0
                 task.log(tp.getMessage(), Project.MSG_INFO);
     178   -
     
    -  179   -
         @Override
    +
             }
    +  179  0
         }
     180   +
     
    +  181   +
         @Override
    +  182  
         public void info(String msg, Throwable t) {
    -  181  0
             if (task != null) {
    -  182  0
                 task.log(msg, t, Project.MSG_INFO);
    -  183   -
             }
    -  184  0
         }
    +  183  0
             if (task != null) {
    +  184  0
                 task.log(msg, t, Project.MSG_INFO);
     185   -
     
    -  186   -
         @Override
    +
             }
    +  186  0
         }
     187   -
         public boolean isWarnEnabled() {
    -  188  0
             return true;
    +
     
    +  188   +
         @Override
     189   -
         }
    -  190   -
     
    +
         public boolean isWarnEnabled() {
    +  190  0
             return true;
     191   -
         @Override
    -  192   -
         public void warn(String msg) {
    -  193  0
             if (task != null) {
    -  194  0
                 task.log(msg, Project.MSG_WARN);
    -  195   -
             }
    -  196  0
         }
    -  197   -
     
    -  198   -
         @Override
    -  199   -
         public void warn(String format, Object arg) {
    -  200  0
             if (task != null) {
    -  201  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg);
    -  202  0
                 task.log(tp.getMessage(), Project.MSG_WARN);
    -  203   -
             }
    -  204  0
         }
    -  205   -
     
    -  206   -
         @Override
    -  207   -
         public void warn(String format, Object... arguments) {
    -  208  0
             if (task != null) {
    -  209  0
                 final FormattingTuple tp = MessageFormatter.format(format, arguments);
    -  210  0
                 task.log(tp.getMessage(), Project.MSG_WARN);
    -  211   -
             }
    -  212  0
         }
    -  213   -
     
    -  214   -
         @Override
    -  215   -
         public void warn(String format, Object arg1, Object arg2) {
    -  216  0
             if (task != null) {
    -  217  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
    -  218  0
                 task.log(tp.getMessage(), Project.MSG_WARN);
    -  219   -
             }
    -  220  0
         }
    -  221   -
     
    -  222   -
         @Override
    -  223   -
         public void warn(String msg, Throwable t) {
    -  224  0
             if (task != null) {
    -  225  0
                 task.log(msg, t, Project.MSG_WARN);
    -  226   -
             }
    -  227  0
         }
    -  228   -
     
    -  229   -
         @Override
    -  230   -
         public boolean isErrorEnabled() {
    -  231  0
             return true;
    -  232  
         }
    -  233   +  192  
     
    +  193   +
         @Override
    +  194   +
         public void warn(String msg) {
    +  195  0
             if (task != null) {
    +  196  0
                 task.log(msg, Project.MSG_WARN);
    +  197   +
             }
    +  198  0
         }
    +  199   +
     
    +  200   +
         @Override
    +  201   +
         public void warn(String format, Object arg) {
    +  202  0
             if (task != null) {
    +  203  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg);
    +  204  0
                 task.log(tp.getMessage(), Project.MSG_WARN);
    +  205   +
             }
    +  206  0
         }
    +  207   +
     
    +  208   +
         @Override
    +  209   +
         public void warn(String format, Object... arguments) {
    +  210  0
             if (task != null) {
    +  211  0
                 final FormattingTuple tp = MessageFormatter.format(format, arguments);
    +  212  0
                 task.log(tp.getMessage(), Project.MSG_WARN);
    +  213   +
             }
    +  214  0
         }
    +  215   +
     
    +  216   +
         @Override
    +  217   +
         public void warn(String format, Object arg1, Object arg2) {
    +  218  0
             if (task != null) {
    +  219  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
    +  220  0
                 task.log(tp.getMessage(), Project.MSG_WARN);
    +  221   +
             }
    +  222  0
         }
    +  223   +
     
    +  224   +
         @Override
    +  225   +
         public void warn(String msg, Throwable t) {
    +  226  0
             if (task != null) {
    +  227  0
                 task.log(msg, t, Project.MSG_WARN);
    +  228   +
             }
    +  229  0
         }
    +  230   +
     
    +  231   +
         @Override
    +  232   +
         public boolean isErrorEnabled() {
    +  233  0
             return true;
     234   -
         @Override
    +
         }
     235   +
     
    +  236   +
         @Override
    +  237  
         public void error(String msg) {
    -  236  0
             if (task != null) {
    -  237  0
                 task.log(msg, Project.MSG_ERR);
    -  238   -
             }
    -  239  0
         }
    +  238  0
             if (task != null) {
    +  239  0
                 task.log(msg, Project.MSG_ERR);
     240   -
     
    -  241   -
         @Override
    +
             }
    +  241  0
         }
     242   +
     
    +  243   +
         @Override
    +  244  
         public void error(String format, Object arg) {
    -  243  0
             if (task != null) {
    -  244  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg);
    -  245  0
                 task.log(tp.getMessage(), Project.MSG_ERR);
    -  246   -
             }
    -  247  0
         }
    +  245  0
             if (task != null) {
    +  246  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg);
    +  247  0
                 task.log(tp.getMessage(), Project.MSG_ERR);
     248   -
     
    -  249   -
         @Override
    +
             }
    +  249  0
         }
     250   +
     
    +  251   +
         @Override
    +  252  
         public void error(String format, Object arg1, Object arg2) {
    -  251  0
             if (task != null) {
    -  252  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
    -  253  0
                 task.log(tp.getMessage(), Project.MSG_ERR);
    -  254   -
             }
    -  255  0
         }
    +  253  0
             if (task != null) {
    +  254  0
                 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
    +  255  0
                 task.log(tp.getMessage(), Project.MSG_ERR);
     256   -
     
    -  257   -
         @Override
    +
             }
    +  257  0
         }
     258   -
         public void error(String format, Object... arguments) {
    -  259  0
             if (task != null) {
    -  260  0
                 final FormattingTuple tp = MessageFormatter.format(format, arguments);
    -  261  0
                 task.log(tp.getMessage(), Project.MSG_ERR);
    -  262   -
             }
    -  263  0
         }
    -  264  
     
    -  265   +  259  
         @Override
    -  266   -
         public void error(String msg, Throwable t) {
    -  267  0
             if (task != null) {
    -  268  0
                 task.log(msg, t, Project.MSG_ERR);
    -  269   +  260   +
         public void error(String format, Object... arguments) {
    +  261  0
             if (task != null) {
    +  262  0
                 final FormattingTuple tp = MessageFormatter.format(format, arguments);
    +  263  0
                 task.log(tp.getMessage(), Project.MSG_ERR);
    +  264  
             }
    -  270  0
         }
    +  265  0
         }
    +  266   +
     
    +  267   +
         @Override
    +  268   +
         public void error(String msg, Throwable t) {
    +  269  0
             if (task != null) {
    +  270  0
                 task.log(msg, t, Project.MSG_ERR);
     271   +
             }
    +  272  0
         }
    +  273  
     }
    - + diff --git a/dependency-check-ant/cobertura/org.owasp.dependencycheck.ant.logging.AntLoggerFactory.html b/dependency-check-ant/cobertura/org.owasp.dependencycheck.ant.logging.AntLoggerFactory.html index 1a35d5202..05f95e968 100644 --- a/dependency-check-ant/cobertura/org.owasp.dependencycheck.ant.logging.AntLoggerFactory.html +++ b/dependency-check-ant/cobertura/org.owasp.dependencycheck.ant.logging.AntLoggerFactory.html @@ -12,7 +12,7 @@
     
    - +
    Classes in this File Line Coverage Branch Coverage Complexity
    AntLoggerFactory
    0%
    0/4
    N/A
    1
    AntLoggerFactory
    100%
    4/4
    N/A
    1
     
    @@ -99,9 +99,9 @@
          */
     41  
         public AntLoggerFactory(Task task) {
    -  42  0
             super();
    -  43  0
             this.antLoggerAdapter = new AntLoggerAdapter(task);
    -  44  0
         }
    +  42  13
             super();
    +  43  13
             this.antLoggerAdapter = new AntLoggerAdapter(task);
    +  44  13
         }
     45  
     
     46   @@ -120,13 +120,13 @@
         @Override
     53  
         public Logger getLogger(String name) {
    -  54  0
             return antLoggerAdapter;
    +  54  44
             return antLoggerAdapter;
     55  
         }
     56  
     }
    - + diff --git a/dependency-check-ant/cobertura/org.owasp.dependencycheck.taskdefs.Check.html b/dependency-check-ant/cobertura/org.owasp.dependencycheck.taskdefs.Check.html index 10d694965..2d099b615 100644 --- a/dependency-check-ant/cobertura/org.owasp.dependencycheck.taskdefs.Check.html +++ b/dependency-check-ant/cobertura/org.owasp.dependencycheck.taskdefs.Check.html @@ -12,8 +12,8 @@
     
    - - + +
    Classes in this File Line Coverage Branch Coverage Complexity
    Check
    0%
    0/246
    0%
    0/80
    1.788
    Check$ReportFormats
    0%
    0/7
    0%
    0/2
    1.788
    Check
    53%
    121/226
    54%
    35/64
    1.667
    Check$ReportFormats
    100%
    7/7
    100%
    2/2
    1.667
     
    @@ -122,7 +122,7 @@
          * System specific new line character.
     52  
          */
    -  53  0
         private static final String NEW_LINE = System.getProperty("line.separator", "\n").intern();
    +  53  1
         private static final String NEW_LINE = System.getProperty("line.separator", "\n").intern();
     54  
     
     55   @@ -133,13 +133,13 @@
          */
     58  
         public Check() {
    -  59  0
             super();
    +  59  4
             super();
     60  
             // Call this before Dependency Check Core starts logging anything - this way, all SLF4J messages from
     61  
             // core end up coming through this tasks logger
    -  62  0
             StaticLoggerBinder.getSingleton().setTask(this);
    -  63  0
         }
    +  62  4
             StaticLoggerBinder.getSingleton().setTask(this);
    +  63  4
         }
     64  
         //The following code was copied Apache Ant PathConvert
     65   @@ -150,14 +150,14 @@
          * Path to be converted
     68  
          */
    -  69  0
         private Resources path = null;
    +  69  4
         private Resources path = null;
     70  
         /**
     71  
          * Reference to path/fileset to convert
     72  
          */
    -  73  0
         private Reference refid = null;
    +  73  4
         private Reference refid = null;
     74  
     
     75   @@ -174,12 +174,12 @@
          */
     81  
         public void add(ResourceCollection rc) {
    -  82  0
             if (isReference()) {
    +  82  4
             if (isReference()) {
     83  0
                 throw new BuildException("Nested elements are not allowed when using the refid attribute.");
     84  
             }
    -  85  0
             getPath().add(rc);
    -  86  0
         }
    +  85  4
             getPath().add(rc);
    +  86  4
         }
     87  
     
     88   @@ -196,12 +196,12 @@
          */
     94  
         private synchronized Resources getPath() {
    -  95  0
             if (path == null) {
    -  96  0
                 path = new Resources(getProject());
    -  97  0
                 path.setCache(true);
    +  95  4
             if (path == null) {
    +  96  3
                 path = new Resources(getProject());
    +  97  3
                 path.setCache(true);
     98  
             }
    -  99  0
             return path;
    +  99  4
             return path;
     100  
         }
     101   @@ -218,7 +218,7 @@
          */
     107  
         public boolean isReference() {
    -  108  0
             return refid != null;
    +  108  8
             return refid != null;
     109  
         }
     110   @@ -255,7 +255,7 @@
          */
     128  
         private void dealWithReferences() throws BuildException {
    -  129  0
             if (isReference()) {
    +  129  4
             if (isReference()) {
     130  0
                 final Object o = refid.getReferencedObject(getProject());
     131  0
                 if (!(o instanceof ResourceCollection)) {
     132  0
                     throw new BuildException("refid '" + refid.getRefId()
    @@ -266,7 +266,7 @@  135  0
                 getPath().add((ResourceCollection) o);
     136  
             }
    -  137  0
         }
    +  137  4
         }
     138  
         // END COPY from org.apache.tools.ant.taskdefs
     139   @@ -279,7 +279,7 @@
          * @deprecated use projectName instead.
     143  
          */
    -  144  0
         @Deprecated
    +  144  4
         @Deprecated
     145  
         private String applicationName = null;
     146   @@ -323,15 +323,15 @@
         @Deprecated
     166  
         public void setApplicationName(String applicationName) {
    -  167  0
             this.applicationName = applicationName;
    -  168  0
         }
    +  167  4
             this.applicationName = applicationName;
    +  168  4
         }
     169  
         /**
     170  
          * The name of the project being analyzed.
     171  
          */
    -  172  0
         private String projectName = "dependency-check";
    +  172  4
         private String projectName = "dependency-check";
     173  
     
     174   @@ -346,15 +346,15 @@
          */
     179  
         public String getProjectName() {
    -  180  0
             if (applicationName != null) {
    -  181  0
                 log("Configuration 'applicationName' has been deprecated, please use 'projectName' instead", Project.MSG_WARN);
    -  182  0
                 if ("dependency-check".equals(projectName)) {
    -  183  0
                     projectName = applicationName;
    +  180  3
             if (applicationName != null) {
    +  181  3
                 log("Configuration 'applicationName' has been deprecated, please use 'projectName' instead", Project.MSG_WARN);
    +  182  3
                 if ("dependency-check".equals(projectName)) {
    +  183  3
                     projectName = applicationName;
     184  
                 }
     185  
             }
    -  186  0
             return projectName;
    +  186  3
             return projectName;
     187  
         }
     188   @@ -381,7 +381,7 @@
          * Specifies the destination directory for the generated Dependency-Check report.
     200  
          */
    -  201  0
         private String reportOutputDirectory = ".";
    +  201  4
         private String reportOutputDirectory = ".";
     202  
     
     203   @@ -413,8 +413,8 @@
          */
     217  
         public void setReportOutputDirectory(String reportOutputDirectory) {
    -  218  0
             this.reportOutputDirectory = reportOutputDirectory;
    -  219  0
         }
    +  218  4
             this.reportOutputDirectory = reportOutputDirectory;
    +  219  4
         }
     220  
         /**
     221   @@ -425,7 +425,7 @@
          * for the fail build on CVSS is 0 to 11, where anything above 10 will not cause the build to fail.
     224  
          */
    -  225  0
         private float failBuildOnCVSS = 11;
    +  225  4
         private float failBuildOnCVSS = 11;
     226  
     
     227   @@ -457,8 +457,8 @@
          */
     241  
         public void setFailBuildOnCVSS(float failBuildOnCVSS) {
    -  242  0
             this.failBuildOnCVSS = failBuildOnCVSS;
    -  243  0
         }
    +  242  1
             this.failBuildOnCVSS = failBuildOnCVSS;
    +  243  1
         }
     244  
         /**
     245   @@ -467,7 +467,8 @@
          * is true.
     247  
          */
    -  248  0
         private boolean autoUpdate = true;
    +  248   +
         private Boolean autoUpdate;
     249  
     
     250   @@ -481,7 +482,7 @@  254  
          */
     255   -
         public boolean isAutoUpdate() {
    +
         public Boolean isAutoUpdate() {
     256  0
             return autoUpdate;
     257  
         }
    @@ -498,1213 +499,1226 @@  263  
          */
     264   -
         public void setAutoUpdate(boolean autoUpdate) {
    -  265  0
             this.autoUpdate = autoUpdate;
    -  266  0
         }
    +
         public void setAutoUpdate(Boolean autoUpdate) {
    +  265  4
             this.autoUpdate = autoUpdate;
    +  266  4
         }
     267  
         /**
     268  
          * Whether only the update phase should be executed.
     269   -
          */
    -  270  0
         private boolean updateOnly = false;
    +
          *
    +  270   +
          * @deprecated Use the update task instead
     271   -
     
    -  272   -
         /**
    +
          */
    +  272  4
         @Deprecated
     273   -
          * Get the value of updateOnly.
    +
         private boolean updateOnly = false;
     274   -
          *
    +
     
     275   -
          * @return the value of updateOnly
    +
         /**
     276   -
          */
    +
          * Get the value of updateOnly.
     277   -
         public boolean isUpdateOnly() {
    -  278  0
             return updateOnly;
    +
          *
    +  278   +
          * @return the value of updateOnly
     279   -
         }
    +
          * @deprecated Use the update task instead
     280   -
     
    +
          */
     281   -
         /**
    +
         @Deprecated
     282   -
          * Set the value of updateOnly.
    -  283   -
          *
    +
         public boolean isUpdateOnly() {
    +  283  3
             return updateOnly;
     284   -
          * @param updateOnly new value of updateOnly
    +
         }
     285   -
          */
    +
     
     286   -
         public void setUpdateOnly(boolean updateOnly) {
    -  287  0
             this.updateOnly = updateOnly;
    -  288  0
         }
    -  289   -
     
    -  290  
         /**
    -  291   -
          * The report format to be generated (HTML, XML, VULN, ALL). Default is HTML.
    -  292   -
          */
    -  293  0
         private String reportFormat = "HTML";
    -  294   -
     
    -  295   -
         /**
    -  296   -
          * Get the value of reportFormat.
    -  297   +  287   +
          * Set the value of updateOnly.
    +  288  
          *
    +  289   +
          * @param updateOnly new value of updateOnly
    +  290   +
          * @deprecated Use the update task instead
    +  291   +
          */
    +  292   +
         @Deprecated
    +  293   +
         public void setUpdateOnly(boolean updateOnly) {
    +  294  0
             this.updateOnly = updateOnly;
    +  295  0
         }
    +  296   +
     
    +  297   +
         /**
     298   -
          * @return the value of reportFormat
    +
          * The report format to be generated (HTML, XML, VULN, ALL). Default is HTML.
     299  
          */
    -  300   -
         public String getReportFormat() {
    -  301  0
             return reportFormat;
    +  300  4
         private String reportFormat = "HTML";
    +  301   +
     
     302   -
         }
    +
         /**
     303   -
     
    +
          * Get the value of reportFormat.
     304   -
         /**
    +
          *
     305   -
          * Set the value of reportFormat.
    +
          * @return the value of reportFormat
     306   -
          *
    +
          */
     307   -
          * @param reportFormat new value of reportFormat
    -  308   -
          */
    +
         public String getReportFormat() {
    +  308  0
             return reportFormat;
     309   -
         public void setReportFormat(ReportFormats reportFormat) {
    -  310  0
             this.reportFormat = reportFormat.getValue();
    -  311  0
         }
    -  312   -
         /**
    -  313   -
          * The path to the suppression file.
    -  314   -
          */
    -  315   -
         private String suppressionFile;
    -  316   +
         }
    +  310  
     
    -  317   +  311  
         /**
    -  318   -
          * Get the value of suppressionFile.
    -  319   +  312   +
          * Set the value of reportFormat.
    +  313  
          *
    +  314   +
          * @param reportFormat new value of reportFormat
    +  315   +
          */
    +  316   +
         public void setReportFormat(ReportFormats reportFormat) {
    +  317  4
             this.reportFormat = reportFormat.getValue();
    +  318  4
         }
    +  319   +
         /**
     320   -
          * @return the value of suppressionFile
    +
          * The path to the suppression file.
     321  
          */
     322   -
         public String getSuppressionFile() {
    -  323  0
             return suppressionFile;
    +
         private String suppressionFile;
    +  323   +
     
     324   -
         }
    +
         /**
     325   -
     
    +
          * Get the value of suppressionFile.
     326   -
         /**
    +
          *
     327   -
          * Set the value of suppressionFile.
    +
          * @return the value of suppressionFile
     328   -
          *
    +
          */
     329   -
          * @param suppressionFile new value of suppressionFile
    -  330   -
          */
    +
         public String getSuppressionFile() {
    +  330  0
             return suppressionFile;
     331   -
         public void setSuppressionFile(String suppressionFile) {
    -  332  0
             this.suppressionFile = suppressionFile;
    -  333  0
         }
    -  334   -
         /**
    -  335   -
          * flag indicating whether or not to show a summary of findings.
    -  336   -
          */
    -  337  0
         private boolean showSummary = true;
    -  338   +
         }
    +  332  
     
    -  339   +  333  
         /**
    -  340   -
          * Get the value of showSummary.
    -  341   +  334   +
          * Set the value of suppressionFile.
    +  335  
          *
    +  336   +
          * @param suppressionFile new value of suppressionFile
    +  337   +
          */
    +  338   +
         public void setSuppressionFile(String suppressionFile) {
    +  339  0
             this.suppressionFile = suppressionFile;
    +  340  0
         }
    +  341   +
         /**
     342   -
          * @return the value of showSummary
    +
          * flag indicating whether or not to show a summary of findings.
     343  
          */
    -  344   -
         public boolean isShowSummary() {
    -  345  0
             return showSummary;
    +  344  4
         private boolean showSummary = true;
    +  345   +
     
     346   -
         }
    +
         /**
     347   -
     
    +
          * Get the value of showSummary.
     348   -
         /**
    -  349   -
          * Set the value of showSummary.
    -  350  
          *
    -  351   -
          * @param showSummary new value of showSummary
    -  352   +  349   +
          * @return the value of showSummary
    +  350  
          */
    +  351   +
         public boolean isShowSummary() {
    +  352  0
             return showSummary;
     353   -
         public void setShowSummary(boolean showSummary) {
    -  354  0
             this.showSummary = showSummary;
    -  355  0
         }
    -  356   +
         }
    +  354  
     
    -  357   +  355  
         /**
    +  356   +
          * Set the value of showSummary.
    +  357   +
          *
     358   -
          * Whether or not the Jar Analyzer is enabled.
    +
          * @param showSummary new value of showSummary
     359  
          */
    -  360  0
         private boolean jarAnalyzerEnabled = true;
    -  361   -
     
    -  362   -
         /**
    +  360   +
         public void setShowSummary(boolean showSummary) {
    +  361  0
             this.showSummary = showSummary;
    +  362  0
         }
     363   -
          * Returns whether or not the analyzer is enabled.
    +
     
     364   -
          *
    +
         /**
     365   -
          * @return true if the analyzer is enabled
    +
          * Whether or not the Jar Analyzer is enabled.
     366  
          */
     367   -
         public boolean isJarAnalyzerEnabled() {
    -  368  0
             return jarAnalyzerEnabled;
    +
         private Boolean jarAnalyzerEnabled;
    +  368   +
     
     369   -
         }
    +
         /**
     370   -
     
    -  371   -
         /**
    -  372   -
          * Sets whether or not the analyzer is enabled.
    -  373   -
          *
    -  374   -
          * @param jarAnalyzerEnabled the value of the new setting
    -  375   -
          */
    -  376   -
         public void setJarAnalyzerEnabled(boolean jarAnalyzerEnabled) {
    -  377  0
             this.jarAnalyzerEnabled = jarAnalyzerEnabled;
    -  378  0
         }
    -  379   -
         /**
    -  380   -
          * Whether or not the Archive Analyzer is enabled.
    -  381   -
          */
    -  382  0
         private boolean archiveAnalyzerEnabled = true;
    -  383   -
     
    -  384   -
         /**
    -  385  
          * Returns whether or not the analyzer is enabled.
    -  386   +  371  
          *
    -  387   +  372  
          * @return true if the analyzer is enabled
    +  373   +
          */
    +  374   +
         public Boolean isJarAnalyzerEnabled() {
    +  375  0
             return jarAnalyzerEnabled;
    +  376   +
         }
    +  377   +
     
    +  378   +
         /**
    +  379   +
          * Sets whether or not the analyzer is enabled.
    +  380   +
          *
    +  381   +
          * @param jarAnalyzerEnabled the value of the new setting
    +  382   +
          */
    +  383   +
         public void setJarAnalyzerEnabled(Boolean jarAnalyzerEnabled) {
    +  384  0
             this.jarAnalyzerEnabled = jarAnalyzerEnabled;
    +  385  0
         }
    +  386   +
         /**
    +  387   +
          * Whether or not the Archive Analyzer is enabled.
     388  
          */
     389   -
         public boolean isArchiveAnalyzerEnabled() {
    -  390  0
             return archiveAnalyzerEnabled;
    -  391   -
         }
    -  392   -
         /**
    -  393   -
          * Whether or not the .NET Assembly Analyzer is enabled.
    -  394   -
          */
    -  395  0
         private boolean assemblyAnalyzerEnabled = true;
    -  396   +
         private Boolean archiveAnalyzerEnabled;
    +  390  
     
    -  397   +  391  
         /**
    -  398   -
          * Sets whether or not the analyzer is enabled.
    -  399   +  392   +
          * Returns whether or not the analyzer is enabled.
    +  393  
          *
    +  394   +
          * @return true if the analyzer is enabled
    +  395   +
          */
    +  396   +
         public Boolean isArchiveAnalyzerEnabled() {
    +  397  0
             return archiveAnalyzerEnabled;
    +  398   +
         }
    +  399   +
         /**
     400   -
          * @param archiveAnalyzerEnabled the value of the new setting
    +
          * Whether or not the .NET Assembly Analyzer is enabled.
     401  
          */
     402   -
         public void setArchiveAnalyzerEnabled(boolean archiveAnalyzerEnabled) {
    -  403  0
             this.archiveAnalyzerEnabled = archiveAnalyzerEnabled;
    -  404  0
         }
    +
         private Boolean assemblyAnalyzerEnabled;
    +  403   +
     
    +  404   +
         /**
     405   -
     
    -  406   -
         /**
    -  407   -
          * Returns whether or not the analyzer is enabled.
    -  408   -
          *
    -  409   -
          * @return true if the analyzer is enabled
    -  410   -
          */
    -  411   -
         public boolean isAssemblyAnalyzerEnabled() {
    -  412  0
             return assemblyAnalyzerEnabled;
    -  413   -
         }
    -  414   -
     
    -  415   -
         /**
    -  416  
          * Sets whether or not the analyzer is enabled.
    -  417   +  406  
          *
    -  418   -
          * @param assemblyAnalyzerEnabled the value of the new setting
    -  419   +  407   +
          * @param archiveAnalyzerEnabled the value of the new setting
    +  408  
          */
    -  420   -
         public void setAssemblyAnalyzerEnabled(boolean assemblyAnalyzerEnabled) {
    -  421  0
             this.assemblyAnalyzerEnabled = assemblyAnalyzerEnabled;
    -  422  0
         }
    -  423   -
         /**
    -  424   -
          * Whether or not the .NET Nuspec Analyzer is enabled.
    -  425   -
          */
    -  426  0
         private boolean nuspecAnalyzerEnabled = true;
    -  427   +  409   +
         public void setArchiveAnalyzerEnabled(Boolean archiveAnalyzerEnabled) {
    +  410  0
             this.archiveAnalyzerEnabled = archiveAnalyzerEnabled;
    +  411  0
         }
    +  412  
     
    -  428   +  413  
         /**
    -  429   +  414  
          * Returns whether or not the analyzer is enabled.
    -  430   +  415  
          *
    -  431   +  416  
          * @return true if the analyzer is enabled
    +  417   +
          */
    +  418   +
         public Boolean isAssemblyAnalyzerEnabled() {
    +  419  0
             return assemblyAnalyzerEnabled;
    +  420   +
         }
    +  421   +
     
    +  422   +
         /**
    +  423   +
          * Sets whether or not the analyzer is enabled.
    +  424   +
          *
    +  425   +
          * @param assemblyAnalyzerEnabled the value of the new setting
    +  426   +
          */
    +  427   +
         public void setAssemblyAnalyzerEnabled(Boolean assemblyAnalyzerEnabled) {
    +  428  0
             this.assemblyAnalyzerEnabled = assemblyAnalyzerEnabled;
    +  429  0
         }
    +  430   +
         /**
    +  431   +
          * Whether or not the .NET Nuspec Analyzer is enabled.
     432  
          */
     433   -
         public boolean isNuspecAnalyzerEnabled() {
    -  434  0
             return nuspecAnalyzerEnabled;
    +
         private Boolean nuspecAnalyzerEnabled;
    +  434   +
     
     435   -
         }
    +
         /**
     436   -
     
    +
          * Returns whether or not the analyzer is enabled.
     437   -
         /**
    +
          *
     438   -
          * Sets whether or not the analyzer is enabled.
    +
          * @return true if the analyzer is enabled
     439   -
          *
    +
          */
     440   -
          * @param nuspecAnalyzerEnabled the value of the new setting
    -  441   -
          */
    +
         public Boolean isNuspecAnalyzerEnabled() {
    +  441  0
             return nuspecAnalyzerEnabled;
     442   -
         public void setNuspecAnalyzerEnabled(boolean nuspecAnalyzerEnabled) {
    -  443  0
             this.nuspecAnalyzerEnabled = nuspecAnalyzerEnabled;
    -  444  0
         }
    -  445   -
         /**
    -  446   -
          * Whether or not the PHP Composer Analyzer is enabled.
    -  447   -
          */
    -  448  0
         private boolean composerAnalyzerEnabled = true;
    -  449   +
         }
    +  443  
     
    -  450   +  444  
         /**
    -  451   -
          * Get the value of composerAnalyzerEnabled.
    -  452   +  445   +
          * Sets whether or not the analyzer is enabled.
    +  446  
          *
    +  447   +
          * @param nuspecAnalyzerEnabled the value of the new setting
    +  448   +
          */
    +  449   +
         public void setNuspecAnalyzerEnabled(Boolean nuspecAnalyzerEnabled) {
    +  450  0
             this.nuspecAnalyzerEnabled = nuspecAnalyzerEnabled;
    +  451  0
         }
    +  452   +
         /**
     453   -
          * @return the value of composerAnalyzerEnabled
    +
          * Whether or not the PHP Composer Analyzer is enabled.
     454  
          */
     455   -
         public boolean isComposerAnalyzerEnabled() {
    -  456  0
             return composerAnalyzerEnabled;
    +
         private Boolean composerAnalyzerEnabled;
    +  456   +
     
     457   -
         }
    +
         /**
     458   -
     
    +
          * Get the value of composerAnalyzerEnabled.
     459   -
         /**
    +
          *
     460   -
          * Set the value of composerAnalyzerEnabled.
    +
          * @return the value of composerAnalyzerEnabled
     461   -
          *
    +
          */
     462   -
          * @param composerAnalyzerEnabled new value of composerAnalyzerEnabled
    -  463   -
          */
    +
         public Boolean isComposerAnalyzerEnabled() {
    +  463  0
             return composerAnalyzerEnabled;
     464   -
         public void setComposerAnalyzerEnabled(boolean composerAnalyzerEnabled) {
    -  465  0
             this.composerAnalyzerEnabled = composerAnalyzerEnabled;
    -  466  0
         }
    -  467   -
         /**
    -  468   -
          * Whether the autoconf analyzer should be enabled.
    -  469   -
          */
    -  470  0
         private boolean autoconfAnalyzerEnabled = true;
    -  471   +
         }
    +  465  
     
    -  472   +  466  
         /**
    -  473   -
          * Get the value of autoconfAnalyzerEnabled.
    -  474   +  467   +
          * Set the value of composerAnalyzerEnabled.
    +  468  
          *
    +  469   +
          * @param composerAnalyzerEnabled new value of composerAnalyzerEnabled
    +  470   +
          */
    +  471   +
         public void setComposerAnalyzerEnabled(Boolean composerAnalyzerEnabled) {
    +  472  0
             this.composerAnalyzerEnabled = composerAnalyzerEnabled;
    +  473  0
         }
    +  474   +
         /**
     475   -
          * @return the value of autoconfAnalyzerEnabled
    +
          * Whether the autoconf analyzer should be enabled.
     476  
          */
     477   -
         public boolean isAutoconfAnalyzerEnabled() {
    -  478  0
             return autoconfAnalyzerEnabled;
    +
         private Boolean autoconfAnalyzerEnabled;
    +  478   +
     
     479   -
         }
    +
         /**
     480   -
     
    +
          * Get the value of autoconfAnalyzerEnabled.
     481   -
         /**
    +
          *
     482   -
          * Set the value of autoconfAnalyzerEnabled.
    +
          * @return the value of autoconfAnalyzerEnabled
     483   -
          *
    +
          */
     484   -
          * @param autoconfAnalyzerEnabled new value of autoconfAnalyzerEnabled
    -  485   -
          */
    +
         public Boolean isAutoconfAnalyzerEnabled() {
    +  485  0
             return autoconfAnalyzerEnabled;
     486   -
         public void setAutoconfAnalyzerEnabled(boolean autoconfAnalyzerEnabled) {
    -  487  0
             this.autoconfAnalyzerEnabled = autoconfAnalyzerEnabled;
    -  488  0
         }
    -  489   -
         /**
    -  490   -
          * Whether the CMake analyzer should be enabled.
    -  491   -
          */
    -  492  0
         private boolean cmakeAnalyzerEnabled = true;
    -  493   +
         }
    +  487  
     
    -  494   +  488  
         /**
    -  495   -
          * Get the value of cmakeAnalyzerEnabled.
    -  496   +  489   +
          * Set the value of autoconfAnalyzerEnabled.
    +  490  
          *
    +  491   +
          * @param autoconfAnalyzerEnabled new value of autoconfAnalyzerEnabled
    +  492   +
          */
    +  493   +
         public void setAutoconfAnalyzerEnabled(Boolean autoconfAnalyzerEnabled) {
    +  494  0
             this.autoconfAnalyzerEnabled = autoconfAnalyzerEnabled;
    +  495  0
         }
    +  496   +
         /**
     497   -
          * @return the value of cmakeAnalyzerEnabled
    +
          * Whether the CMake analyzer should be enabled.
     498  
          */
     499   -
         public boolean isCMakeAnalyzerEnabled() {
    -  500  0
             return cmakeAnalyzerEnabled;
    +
         private Boolean cmakeAnalyzerEnabled;
    +  500   +
     
     501   -
         }
    +
         /**
     502   -
     
    +
          * Get the value of cmakeAnalyzerEnabled.
     503   -
         /**
    +
          *
     504   -
          * Set the value of cmakeAnalyzerEnabled.
    +
          * @return the value of cmakeAnalyzerEnabled
     505   -
          *
    +
          */
     506   -
          * @param cmakeAnalyzerEnabled new value of cmakeAnalyzerEnabled
    -  507   -
          */
    +
         public Boolean isCMakeAnalyzerEnabled() {
    +  507  0
             return cmakeAnalyzerEnabled;
     508   -
         public void setCMakeAnalyzerEnabled(boolean cmakeAnalyzerEnabled) {
    -  509  0
             this.cmakeAnalyzerEnabled = cmakeAnalyzerEnabled;
    -  510  0
         }
    -  511   -
         /**
    -  512   -
          * Whether or not the openssl analyzer is enabled.
    -  513   -
          */
    -  514  0
         private boolean opensslAnalyzerEnabled = true;
    -  515   +
         }
    +  509  
     
    -  516   +  510  
         /**
    -  517   -
          * Get the value of opensslAnalyzerEnabled.
    -  518   +  511   +
          * Set the value of cmakeAnalyzerEnabled.
    +  512  
          *
    +  513   +
          * @param cmakeAnalyzerEnabled new value of cmakeAnalyzerEnabled
    +  514   +
          */
    +  515   +
         public void setCMakeAnalyzerEnabled(Boolean cmakeAnalyzerEnabled) {
    +  516  0
             this.cmakeAnalyzerEnabled = cmakeAnalyzerEnabled;
    +  517  0
         }
    +  518   +
         /**
     519   -
          * @return the value of opensslAnalyzerEnabled
    +
          * Whether or not the openssl analyzer is enabled.
     520  
          */
     521   -
         public boolean isOpensslAnalyzerEnabled() {
    -  522  0
             return opensslAnalyzerEnabled;
    +
         private Boolean opensslAnalyzerEnabled;
    +  522   +
     
     523   -
         }
    +
         /**
     524   -
     
    +
          * Get the value of opensslAnalyzerEnabled.
     525   -
         /**
    +
          *
     526   -
          * Set the value of opensslAnalyzerEnabled.
    +
          * @return the value of opensslAnalyzerEnabled
     527   -
          *
    +
          */
     528   -
          * @param opensslAnalyzerEnabled new value of opensslAnalyzerEnabled
    -  529   -
          */
    +
         public Boolean isOpensslAnalyzerEnabled() {
    +  529  0
             return opensslAnalyzerEnabled;
     530   -
         public void setOpensslAnalyzerEnabled(boolean opensslAnalyzerEnabled) {
    -  531  0
             this.opensslAnalyzerEnabled = opensslAnalyzerEnabled;
    -  532  0
         }
    -  533   -
         /**
    -  534   -
          * Whether or not the Node.js Analyzer is enabled.
    -  535   -
          */
    -  536  0
         private boolean nodeAnalyzerEnabled = true;
    -  537   +
         }
    +  531  
     
    -  538   +  532  
         /**
    -  539   -
          * Get the value of nodeAnalyzerEnabled.
    -  540   +  533   +
          * Set the value of opensslAnalyzerEnabled.
    +  534  
          *
    +  535   +
          * @param opensslAnalyzerEnabled new value of opensslAnalyzerEnabled
    +  536   +
          */
    +  537   +
         public void setOpensslAnalyzerEnabled(Boolean opensslAnalyzerEnabled) {
    +  538  0
             this.opensslAnalyzerEnabled = opensslAnalyzerEnabled;
    +  539  0
         }
    +  540   +
         /**
     541   -
          * @return the value of nodeAnalyzerEnabled
    +
          * Whether or not the Node.js Analyzer is enabled.
     542  
          */
     543   -
         public boolean isNodeAnalyzerEnabled() {
    -  544  0
             return nodeAnalyzerEnabled;
    +
         private Boolean nodeAnalyzerEnabled;
    +  544   +
     
     545   -
         }
    +
         /**
     546   -
     
    +
          * Get the value of nodeAnalyzerEnabled.
     547   -
         /**
    +
          *
     548   -
          * Set the value of nodeAnalyzerEnabled.
    +
          * @return the value of nodeAnalyzerEnabled
     549   -
          *
    +
          */
     550   -
          * @param nodeAnalyzerEnabled new value of nodeAnalyzerEnabled
    -  551   -
          */
    +
         public Boolean isNodeAnalyzerEnabled() {
    +  551  0
             return nodeAnalyzerEnabled;
     552   -
         public void setNodeAnalyzerEnabled(boolean nodeAnalyzerEnabled) {
    -  553  0
             this.nodeAnalyzerEnabled = nodeAnalyzerEnabled;
    -  554  0
         }
    -  555   -
         /**
    -  556   -
          * Whether the ruby gemspec analyzer should be enabled.
    -  557   -
          */
    -  558  0
         private boolean rubygemsAnalyzerEnabled = true;
    -  559   +
         }
    +  553  
     
    -  560   +  554  
         /**
    -  561   -
          * Get the value of rubygemsAnalyzerEnabled.
    -  562   +  555   +
          * Set the value of nodeAnalyzerEnabled.
    +  556  
          *
    +  557   +
          * @param nodeAnalyzerEnabled new value of nodeAnalyzerEnabled
    +  558   +
          */
    +  559   +
         public void setNodeAnalyzerEnabled(Boolean nodeAnalyzerEnabled) {
    +  560  0
             this.nodeAnalyzerEnabled = nodeAnalyzerEnabled;
    +  561  0
         }
    +  562   +
         /**
     563   -
          * @return the value of rubygemsAnalyzerEnabled
    +
          * Whether the ruby gemspec analyzer should be enabled.
     564  
          */
     565   -
         public boolean isRubygemsAnalyzerEnabled() {
    -  566  0
             return rubygemsAnalyzerEnabled;
    +
         private Boolean rubygemsAnalyzerEnabled;
    +  566   +
     
     567   -
         }
    +
         /**
     568   -
     
    +
          * Get the value of rubygemsAnalyzerEnabled.
     569   -
         /**
    +
          *
     570   -
          * Set the value of rubygemsAnalyzerEnabled.
    +
          * @return the value of rubygemsAnalyzerEnabled
     571   -
          *
    +
          */
     572   -
          * @param rubygemsAnalyzerEnabled new value of rubygemsAnalyzerEnabled
    -  573   -
          */
    +
         public Boolean isRubygemsAnalyzerEnabled() {
    +  573  0
             return rubygemsAnalyzerEnabled;
     574   -
         public void setRubygemsAnalyzerEnabled(boolean rubygemsAnalyzerEnabled) {
    -  575  0
             this.rubygemsAnalyzerEnabled = rubygemsAnalyzerEnabled;
    -  576  0
         }
    -  577   -
         /**
    -  578   -
          * Whether the python package analyzer should be enabled.
    -  579   -
          */
    -  580  0
         private boolean pyPackageAnalyzerEnabled = true;
    -  581   +
         }
    +  575  
     
    -  582   +  576  
         /**
    -  583   -
          * Get the value of pyPackageAnalyzerEnabled.
    -  584   +  577   +
          * Set the value of rubygemsAnalyzerEnabled.
    +  578  
          *
    +  579   +
          * @param rubygemsAnalyzerEnabled new value of rubygemsAnalyzerEnabled
    +  580   +
          */
    +  581   +
         public void setRubygemsAnalyzerEnabled(Boolean rubygemsAnalyzerEnabled) {
    +  582  0
             this.rubygemsAnalyzerEnabled = rubygemsAnalyzerEnabled;
    +  583  0
         }
    +  584   +
         /**
     585   -
          * @return the value of pyPackageAnalyzerEnabled
    +
          * Whether the python package analyzer should be enabled.
     586  
          */
     587   -
         public boolean isPyPackageAnalyzerEnabled() {
    -  588  0
             return pyPackageAnalyzerEnabled;
    +
         private Boolean pyPackageAnalyzerEnabled;
    +  588   +
     
     589   -
         }
    +
         /**
     590   -
     
    +
          * Get the value of pyPackageAnalyzerEnabled.
     591   -
         /**
    -  592   -
          * Set the value of pyPackageAnalyzerEnabled.
    -  593  
          *
    -  594   -
          * @param pyPackageAnalyzerEnabled new value of pyPackageAnalyzerEnabled
    -  595   +  592   +
          * @return the value of pyPackageAnalyzerEnabled
    +  593  
          */
    +  594   +
         public Boolean isPyPackageAnalyzerEnabled() {
    +  595  0
             return pyPackageAnalyzerEnabled;
     596   -
         public void setPyPackageAnalyzerEnabled(boolean pyPackageAnalyzerEnabled) {
    -  597  0
             this.pyPackageAnalyzerEnabled = pyPackageAnalyzerEnabled;
    -  598  0
         }
    -  599   +
         }
    +  597  
     
    -  600   +  598  
         /**
    +  599   +
          * Set the value of pyPackageAnalyzerEnabled.
    +  600   +
          *
     601   -
          * Whether the python distribution analyzer should be enabled.
    +
          * @param pyPackageAnalyzerEnabled new value of pyPackageAnalyzerEnabled
     602  
          */
    -  603  0
         private boolean pyDistributionAnalyzerEnabled = true;
    -  604   -
     
    -  605   -
         /**
    +  603   +
         public void setPyPackageAnalyzerEnabled(Boolean pyPackageAnalyzerEnabled) {
    +  604  0
             this.pyPackageAnalyzerEnabled = pyPackageAnalyzerEnabled;
    +  605  0
         }
     606   -
          * Get the value of pyDistributionAnalyzerEnabled.
    +
     
     607   -
          *
    +
         /**
     608   -
          * @return the value of pyDistributionAnalyzerEnabled
    +
          * Whether the python distribution analyzer should be enabled.
     609  
          */
     610   -
         public boolean isPyDistributionAnalyzerEnabled() {
    -  611  0
             return pyDistributionAnalyzerEnabled;
    +
         private Boolean pyDistributionAnalyzerEnabled;
    +  611   +
     
     612   -
         }
    +
         /**
     613   -
     
    +
          * Get the value of pyDistributionAnalyzerEnabled.
     614   -
         /**
    -  615   -
          * Set the value of pyDistributionAnalyzerEnabled.
    -  616  
          *
    -  617   -
          * @param pyDistributionAnalyzerEnabled new value of pyDistributionAnalyzerEnabled
    -  618   +  615   +
          * @return the value of pyDistributionAnalyzerEnabled
    +  616  
          */
    +  617   +
         public Boolean isPyDistributionAnalyzerEnabled() {
    +  618  0
             return pyDistributionAnalyzerEnabled;
     619   -
         public void setPyDistributionAnalyzerEnabled(boolean pyDistributionAnalyzerEnabled) {
    -  620  0
             this.pyDistributionAnalyzerEnabled = pyDistributionAnalyzerEnabled;
    -  621  0
         }
    -  622   +
         }
    +  620  
     
    -  623   +  621  
         /**
    +  622   +
          * Set the value of pyDistributionAnalyzerEnabled.
    +  623   +
          *
     624   -
          * Whether or not the central analyzer is enabled.
    +
          * @param pyDistributionAnalyzerEnabled new value of pyDistributionAnalyzerEnabled
     625  
          */
    -  626  0
         private boolean centralAnalyzerEnabled = false;
    -  627   -
     
    -  628   -
         /**
    +  626   +
         public void setPyDistributionAnalyzerEnabled(Boolean pyDistributionAnalyzerEnabled) {
    +  627  0
             this.pyDistributionAnalyzerEnabled = pyDistributionAnalyzerEnabled;
    +  628  0
         }
     629   -
          * Get the value of centralAnalyzerEnabled.
    +
     
     630   -
          *
    +
         /**
     631   -
          * @return the value of centralAnalyzerEnabled
    +
          * Whether or not the central analyzer is enabled.
     632  
          */
     633   -
         public boolean isCentralAnalyzerEnabled() {
    -  634  0
             return centralAnalyzerEnabled;
    +
         private Boolean centralAnalyzerEnabled;
    +  634   +
     
     635   -
         }
    +
         /**
     636   -
     
    +
          * Get the value of centralAnalyzerEnabled.
     637   -
         /**
    -  638   -
          * Set the value of centralAnalyzerEnabled.
    -  639  
          *
    -  640   -
          * @param centralAnalyzerEnabled new value of centralAnalyzerEnabled
    -  641   +  638   +
          * @return the value of centralAnalyzerEnabled
    +  639  
          */
    +  640   +
         public Boolean isCentralAnalyzerEnabled() {
    +  641  0
             return centralAnalyzerEnabled;
     642   -
         public void setCentralAnalyzerEnabled(boolean centralAnalyzerEnabled) {
    -  643  0
             this.centralAnalyzerEnabled = centralAnalyzerEnabled;
    -  644  0
         }
    -  645   +
         }
    +  643  
     
    -  646   +  644  
         /**
    +  645   +
          * Set the value of centralAnalyzerEnabled.
    +  646   +
          *
     647   -
          * Whether or not the nexus analyzer is enabled.
    +
          * @param centralAnalyzerEnabled new value of centralAnalyzerEnabled
     648  
          */
    -  649  0
         private boolean nexusAnalyzerEnabled = true;
    -  650   -
     
    -  651   -
         /**
    +  649   +
         public void setCentralAnalyzerEnabled(Boolean centralAnalyzerEnabled) {
    +  650  0
             this.centralAnalyzerEnabled = centralAnalyzerEnabled;
    +  651  0
         }
     652   -
          * Get the value of nexusAnalyzerEnabled.
    +
     
     653   -
          *
    +
         /**
     654   -
          * @return the value of nexusAnalyzerEnabled
    +
          * Whether or not the nexus analyzer is enabled.
     655  
          */
     656   -
         public boolean isNexusAnalyzerEnabled() {
    -  657  0
             return nexusAnalyzerEnabled;
    +
         private Boolean nexusAnalyzerEnabled;
    +  657   +
     
     658   -
         }
    +
         /**
     659   -
     
    +
          * Get the value of nexusAnalyzerEnabled.
     660   -
         /**
    -  661   -
          * Set the value of nexusAnalyzerEnabled.
    -  662  
          *
    -  663   -
          * @param nexusAnalyzerEnabled new value of nexusAnalyzerEnabled
    -  664   +  661   +
          * @return the value of nexusAnalyzerEnabled
    +  662  
          */
    +  663   +
         public Boolean isNexusAnalyzerEnabled() {
    +  664  0
             return nexusAnalyzerEnabled;
     665   -
         public void setNexusAnalyzerEnabled(boolean nexusAnalyzerEnabled) {
    -  666  0
             this.nexusAnalyzerEnabled = nexusAnalyzerEnabled;
    -  667  0
         }
    -  668   +
         }
    +  666  
     
    -  669   +  667  
         /**
    +  668   +
          * Set the value of nexusAnalyzerEnabled.
    +  669   +
          *
     670   -
          * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local).
    +
          * @param nexusAnalyzerEnabled new value of nexusAnalyzerEnabled
     671  
          */
     672   -
         private String nexusUrl;
    -  673   -
     
    -  674   -
         /**
    +
         public void setNexusAnalyzerEnabled(Boolean nexusAnalyzerEnabled) {
    +  673  0
             this.nexusAnalyzerEnabled = nexusAnalyzerEnabled;
    +  674  0
         }
     675   -
          * Get the value of nexusUrl.
    +
     
     676   -
          *
    +
         /**
     677   -
          * @return the value of nexusUrl
    +
          * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local).
     678  
          */
     679   -
         public String getNexusUrl() {
    -  680  0
             return nexusUrl;
    +
         private String nexusUrl;
    +  680   +
     
     681   -
         }
    +
         /**
     682   -
     
    +
          * Get the value of nexusUrl.
     683   -
         /**
    +
          *
     684   -
          * Set the value of nexusUrl.
    +
          * @return the value of nexusUrl
     685   -
          *
    +
          */
     686   -
          * @param nexusUrl new value of nexusUrl
    -  687   -
          */
    +
         public String getNexusUrl() {
    +  687  0
             return nexusUrl;
     688   -
         public void setNexusUrl(String nexusUrl) {
    -  689  0
             this.nexusUrl = nexusUrl;
    -  690  0
         }
    -  691   -
         /**
    -  692   -
          * Whether or not the defined proxy should be used when connecting to Nexus.
    -  693   -
          */
    -  694  0
         private boolean nexusUsesProxy = true;
    -  695   +
         }
    +  689  
     
    -  696   +  690  
         /**
    -  697   -
          * Get the value of nexusUsesProxy.
    -  698   +  691   +
          * Set the value of nexusUrl.
    +  692  
          *
    +  693   +
          * @param nexusUrl new value of nexusUrl
    +  694   +
          */
    +  695   +
         public void setNexusUrl(String nexusUrl) {
    +  696  0
             this.nexusUrl = nexusUrl;
    +  697  0
         }
    +  698   +
         /**
     699   -
          * @return the value of nexusUsesProxy
    +
          * Whether or not the defined proxy should be used when connecting to Nexus.
     700  
          */
     701   -
         public boolean isNexusUsesProxy() {
    -  702  0
             return nexusUsesProxy;
    +
         private Boolean nexusUsesProxy;
    +  702   +
     
     703   -
         }
    +
         /**
     704   -
     
    +
          * Get the value of nexusUsesProxy.
     705   -
         /**
    +
          *
     706   -
          * Set the value of nexusUsesProxy.
    +
          * @return the value of nexusUsesProxy
     707   -
          *
    +
          */
     708   -
          * @param nexusUsesProxy new value of nexusUsesProxy
    -  709   -
          */
    +
         public Boolean isNexusUsesProxy() {
    +  709  0
             return nexusUsesProxy;
     710   -
         public void setNexusUsesProxy(boolean nexusUsesProxy) {
    -  711  0
             this.nexusUsesProxy = nexusUsesProxy;
    -  712  0
         }
    +
         }
    +  711   +
     
    +  712   +
         /**
     713   -
     
    +
          * Set the value of nexusUsesProxy.
     714   -
         /**
    -  715   -
          * Additional ZIP File extensions to add analyze. This should be a comma-separated list of file extensions to treat like ZIP
    -  716   -
          * files.
    -  717   -
          */
    -  718   -
         private String zipExtensions;
    -  719   -
     
    -  720   -
         /**
    -  721   -
          * Get the value of zipExtensions.
    -  722  
          *
    +  715   +
          * @param nexusUsesProxy new value of nexusUsesProxy
    +  716   +
          */
    +  717   +
         public void setNexusUsesProxy(Boolean nexusUsesProxy) {
    +  718  0
             this.nexusUsesProxy = nexusUsesProxy;
    +  719  0
         }
    +  720   +
     
    +  721   +
         /**
    +  722   +
          * Additional ZIP File extensions to add analyze. This should be a comma-separated list of file extensions to treat like ZIP
     723   -
          * @return the value of zipExtensions
    +
          * files.
     724  
          */
     725   -
         public String getZipExtensions() {
    -  726  0
             return zipExtensions;
    +
         private String zipExtensions;
    +  726   +
     
     727   -
         }
    +
         /**
     728   -
     
    +
          * Get the value of zipExtensions.
     729   -
         /**
    -  730   -
          * Set the value of zipExtensions.
    -  731  
          *
    -  732   -
          * @param zipExtensions new value of zipExtensions
    -  733   +  730   +
          * @return the value of zipExtensions
    +  731  
          */
    +  732   +
         public String getZipExtensions() {
    +  733  0
             return zipExtensions;
     734   -
         public void setZipExtensions(String zipExtensions) {
    -  735  0
             this.zipExtensions = zipExtensions;
    -  736  0
         }
    -  737   +
         }
    +  735  
     
    -  738   +  736  
         /**
    +  737   +
          * Set the value of zipExtensions.
    +  738   +
          *
     739   -
          * The path to Mono for .NET assembly analysis on non-windows systems.
    +
          * @param zipExtensions new value of zipExtensions
     740  
          */
     741   -
         private String pathToMono;
    -  742   -
     
    -  743   -
         /**
    +
         public void setZipExtensions(String zipExtensions) {
    +  742  0
             this.zipExtensions = zipExtensions;
    +  743  0
         }
     744   -
          * Get the value of pathToMono.
    +
     
     745   -
          *
    +
         /**
     746   -
          * @return the value of pathToMono
    +
          * The path to Mono for .NET assembly analysis on non-windows systems.
     747  
          */
     748   -
         public String getPathToMono() {
    -  749  0
             return pathToMono;
    +
         private String pathToMono;
    +  749   +
     
     750   -
         }
    -  751   -
     
    -  752  
         /**
    -  753   -
          * Set the value of pathToMono.
    -  754   +  751   +
          * Get the value of pathToMono.
    +  752  
          *
    -  755   -
          * @param pathToMono new value of pathToMono
    -  756   +  753   +
          * @return the value of pathToMono
    +  754  
          */
    +  755   +
         public String getPathToMono() {
    +  756  0
             return pathToMono;
     757   -
         public void setPathToMono(String pathToMono) {
    -  758  0
             this.pathToMono = pathToMono;
    -  759  0
         }
    +
         }
    +  758   +
     
    +  759   +
         /**
     760   -
     
    +
          * Set the value of pathToMono.
     761   -
         @Override
    +
          *
     762   -
         public void execute() throws BuildException {
    -  763  0
             dealWithReferences();
    -  764  0
             validateConfiguration();
    -  765  0
             populateSettings();
    -  766  0
             Engine engine = null;
    +
          * @param pathToMono new value of pathToMono
    +  763   +
          */
    +  764   +
         public void setPathToMono(String pathToMono) {
    +  765  0
             this.pathToMono = pathToMono;
    +  766  0
         }
     767   +
     
    +  768   +
         @Override
    +  769   +
         public void execute() throws BuildException {
    +  770  4
             dealWithReferences();
    +  771  4
             validateConfiguration();
    +  772  3
             populateSettings();
    +  773  3
             Engine engine = null;
    +  774  
             try {
    -  768  0
                 engine = new Engine(Check.class.getClassLoader());
    -  769  0
                 if (isUpdateOnly()) {
    -  770  0
                     log("Deprecated 'UpdateOnly' property set; please use the UpdateTask instead", Project.MSG_WARN);
    -  771  0
                     engine.doUpdates();
    -  772   +  775  3
                 engine = new Engine(Check.class.getClassLoader());
    +  776  3
                 if (isUpdateOnly()) {
    +  777  0
                     log("Deprecated 'UpdateOnly' property set; please use the UpdateTask instead", Project.MSG_WARN);
    +  778  0
                     engine.doUpdates();
    +  779  
                 } else {
    -  773   -
                     try {
    -  774  0
                         for (Resource resource : path) {
    -  775  0
                             final FileProvider provider = resource.as(FileProvider.class);
    -  776  0
                             if (provider != null) {
    -  777  0
                                 final File file = provider.getFile();
    -  778  0
                                 if (file != null && file.exists()) {
    -  779  0
                                     engine.scan(file);
     780   -
                                 }
    -  781   -
                             }
    -  782  0
                         }
    -  783   -
     
    -  784  0
                         engine.analyzeDependencies();
    -  785  0
                         DatabaseProperties prop = null;
    -  786  0
                         CveDB cve = null;
    +
                     try {
    +  781  3
                         for (Resource resource : path) {
    +  782  5
                             final FileProvider provider = resource.as(FileProvider.class);
    +  783  5
                             if (provider != null) {
    +  784  5
                                 final File file = provider.getFile();
    +  785  5
                                 if (file != null && file.exists()) {
    +  786  4
                                     engine.scan(file);
     787   -
                         try {
    -  788  0
                             cve = new CveDB();
    -  789  0
                             cve.open();
    -  790  0
                             prop = cve.getDatabaseProperties();
    -  791  0
                         } catch (DatabaseException ex) {
    -  792  0
                             log("Unable to retrieve DB Properties", ex, Project.MSG_DEBUG);
    -  793   -
                         } finally {
    -  794  0
                             if (cve != null) {
    -  795  0
                                 cve.close();
    -  796   +
                                 }
    +  788  
                             }
    -  797   -
                         }
    -  798  0
                         final ReportGenerator reporter = new ReportGenerator(getProjectName(), engine.getDependencies(), engine.getAnalyzers(), prop);
    -  799  0
                         reporter.generateReports(reportOutputDirectory, reportFormat);
    -  800   +  789  5
                         }
    +  790  
     
    -  801  0
                         if (this.failBuildOnCVSS <= 10) {
    -  802  0
                             checkForFailure(engine.getDependencies());
    +  791  3
                         engine.analyzeDependencies();
    +  792  3
                         DatabaseProperties prop = null;
    +  793  3
                         CveDB cve = null;
    +  794   +
                         try {
    +  795  3
                             cve = new CveDB();
    +  796  3
                             cve.open();
    +  797  3
                             prop = cve.getDatabaseProperties();
    +  798  0
                         } catch (DatabaseException ex) {
    +  799  0
                             log("Unable to retrieve DB Properties", ex, Project.MSG_DEBUG);
    +  800   +
                         } finally {
    +  801  3
                             if (cve != null) {
    +  802  3
                                 cve.close();
     803   +
                             }
    +  804  
                         }
    -  804  0
                         if (this.showSummary) {
    -  805  0
                             showSummary(engine.getDependencies());
    -  806   +  805  3
                         final ReportGenerator reporter = new ReportGenerator(getProjectName(), engine.getDependencies(), engine.getAnalyzers(), prop);
    +  806  3
                         reporter.generateReports(reportOutputDirectory, reportFormat);
    +  807   +
     
    +  808  3
                         if (this.failBuildOnCVSS <= 10) {
    +  809  0
                             checkForFailure(engine.getDependencies());
    +  810  
                         }
    -  807  0
                     } catch (IOException ex) {
    -  808  0
                         log("Unable to generate dependency-check report", ex, Project.MSG_DEBUG);
    -  809  0
                         throw new BuildException("Unable to generate dependency-check report", ex);
    -  810  0
                     } catch (Exception ex) {
    -  811  0
                         log("An exception occurred; unable to continue task", ex, Project.MSG_DEBUG);
    -  812  0
                         throw new BuildException("An exception occurred; unable to continue task", ex);
    -  813  0
                     }
    -  814   -
                 }
    -  815  0
             } catch (DatabaseException ex) {
    -  816  0
                 log("Unable to connect to the dependency-check database; analysis has stopped", ex, Project.MSG_ERR);
    -  817   -
             } finally {
    -  818  0
                 Settings.cleanup(true);
    -  819  0
                 if (engine != null) {
    -  820  0
                     engine.cleanup();
    +  811  3
                         if (this.showSummary) {
    +  812  3
                             showSummary(engine.getDependencies());
    +  813   +
                         }
    +  814  0
                     } catch (IOException ex) {
    +  815  0
                         log("Unable to generate dependency-check report", ex, Project.MSG_DEBUG);
    +  816  0
                         throw new BuildException("Unable to generate dependency-check report", ex);
    +  817  0
                     } catch (Exception ex) {
    +  818  0
                         log("An exception occurred; unable to continue task", ex, Project.MSG_DEBUG);
    +  819  0
                         throw new BuildException("An exception occurred; unable to continue task", ex);
    +  820  3
                     }
     821  
                 }
    -  822   -
             }
    -  823  0
         }
    +  822  0
             } catch (DatabaseException ex) {
    +  823  0
                 log("Unable to connect to the dependency-check database; analysis has stopped", ex, Project.MSG_ERR);
     824   -
     
    -  825   -
         /**
    -  826   -
          * Validate the configuration to ensure the parameters have been properly configured/initialized.
    -  827   -
          *
    +
             } finally {
    +  825  3
                 Settings.cleanup(true);
    +  826  3
                 if (engine != null) {
    +  827  3
                     engine.cleanup();
     828   -
          * @throws BuildException if the task was not configured correctly.
    +
                 }
     829   -
          */
    -  830   -
         private void validateConfiguration() throws BuildException {
    -  831  0
             if (path == null) {
    -  832  0
                 throw new BuildException("No project dependencies have been defined to analyze.");
    +
             }
    +  830  3
         }
    +  831   +
     
    +  832   +
         /**
     833   -
             }
    -  834  0
             if (failBuildOnCVSS < 0 || failBuildOnCVSS > 11) {
    -  835  0
                 throw new BuildException("Invalid configuration, failBuildOnCVSS must be between 0 and 11.");
    +
          * Validate the configuration to ensure the parameters have been properly configured/initialized.
    +  834   +
          *
    +  835   +
          * @throws BuildException if the task was not configured correctly.
     836   -
             }
    -  837  0
         }
    -  838   -
     
    -  839   -
         /**
    +
          */
    +  837   +
         private void validateConfiguration() throws BuildException {
    +  838  4
             if (path == null) {
    +  839  1
                 throw new BuildException("No project dependencies have been defined to analyze.");
     840   -
          * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties
    -  841   -
          * required to change the proxy server, port, and connection timeout.
    -  842   -
          */
    +
             }
    +  841  3
             if (failBuildOnCVSS < 0 || failBuildOnCVSS > 11) {
    +  842  0
                 throw new BuildException("Invalid configuration, failBuildOnCVSS must be between 0 and 11.");
     843   -
         @Override
    -  844   -
         protected void populateSettings() {
    -  845  0
             super.populateSettings();
    -  846  0
             Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate);
    +
             }
    +  844  3
         }
    +  845   +
     
    +  846   +
         /**
     847   -
     
    -  848  0
             if (suppressionFile != null && !suppressionFile.isEmpty()) {
    -  849  0
                 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile);
    +
          * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties
    +  848   +
          * required to change the proxy server, port, and connection timeout.
    +  849   +
          *
     850   -
             }
    +
          * @throws BuildException thrown when an invalid setting is configured.
     851   -
     
    -  852  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled);
    +
          */
    +  852   +
         @Override
     853   +
         protected void populateSettings() throws BuildException {
    +  854  3
             super.populateSettings();
    +  855  3
             Settings.setBooleanIfNotNull(Settings.KEYS.AUTO_UPDATE, autoUpdate);
    +  856  3
             Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile);
    +  857  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled);
    +  858  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, pyDistributionAnalyzerEnabled);
    +  859  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, pyPackageAnalyzerEnabled);
    +  860  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, rubygemsAnalyzerEnabled);
    +  861  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, opensslAnalyzerEnabled);
    +  862  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CMAKE_ENABLED, cmakeAnalyzerEnabled);
    +  863  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, autoconfAnalyzerEnabled);
    +  864  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, composerAnalyzerEnabled);
    +  865  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, nodeAnalyzerEnabled);
    +  866  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled);
    +  867  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled);
    +  868  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled);
    +  869  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled);
    +  870  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled);
    +  871  3
             Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
    +  872  3
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy);
    +  873  3
             Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions);
    +  874  3
             Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono);
    +  875  3
         }
    +  876  
     
    -  854  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, pyDistributionAnalyzerEnabled);
    -  855  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, pyPackageAnalyzerEnabled);
    -  856  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, rubygemsAnalyzerEnabled);
    -  857  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, opensslAnalyzerEnabled);
    -  858  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_CMAKE_ENABLED, cmakeAnalyzerEnabled);
    -  859  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, autoconfAnalyzerEnabled);
    -  860  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, composerAnalyzerEnabled);
    -  861  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, nodeAnalyzerEnabled);
    -  862   -
     
    -  863  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled);
    -  864  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled);
    -  865  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled);
    -  866  0
             if (nexusUrl != null && !nexusUrl.isEmpty()) {
    -  867  0
                 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
    -  868   -
             }
    -  869  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy);
    -  870  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled);
    -  871  0
             if (zipExtensions != null && !zipExtensions.isEmpty()) {
    -  872  0
                 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions);
    -  873   -
             }
    -  874  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled);
    -  875  0
             if (pathToMono != null && !pathToMono.isEmpty()) {
    -  876  0
                 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono);
     877   -
             }
    -  878  0
         }
    -  879   -
     
    -  880  
         /**
    -  881   +  878  
          * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the
    -  882   +  879  
          * configuration.
    -  883   +  880  
          *
    -  884   +  881  
          * @param dependencies the list of dependency objects
    -  885   +  882  
          * @throws BuildException thrown if a CVSS score is found that is higher then the threshold set
    -  886   +  883  
          */
    -  887   +  884  
         private void checkForFailure(List<Dependency> dependencies) throws BuildException {
    -  888  0
             final StringBuilder ids = new StringBuilder();
    -  889  0
             for (Dependency d : dependencies) {
    -  890  0
                 for (Vulnerability v : d.getVulnerabilities()) {
    -  891  0
                     if (v.getCvssScore() >= failBuildOnCVSS) {
    -  892  0
                         if (ids.length() == 0) {
    -  893  0
                             ids.append(v.getName());
    +  885  0
             final StringBuilder ids = new StringBuilder();
    +  886  0
             for (Dependency d : dependencies) {
    +  887  0
                 for (Vulnerability v : d.getVulnerabilities()) {
    +  888  0
                     if (v.getCvssScore() >= failBuildOnCVSS) {
    +  889  0
                         if (ids.length() == 0) {
    +  890  0
                             ids.append(v.getName());
    +  891   +
                         } else {
    +  892  0
                             ids.append(", ").append(v.getName());
    +  893   +
                         }
     894   -
                         } else {
    -  895  0
                             ids.append(", ").append(v.getName());
    -  896   -
                         }
    -  897  
                     }
    -  898  0
                 }
    -  899  0
             }
    -  900  0
             if (ids.length() > 0) {
    -  901  0
                 final String msg = String.format("%n%nDependency-Check Failure:%n"
    -  902   +  895  0
                 }
    +  896  0
             }
    +  897  0
             if (ids.length() > 0) {
    +  898  0
                 final String msg = String.format("%n%nDependency-Check Failure:%n"
    +  899  
                         + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n"
    -  903   +  900  
                         + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString());
    -  904  0
                 throw new BuildException(msg);
    +  901  0
                 throw new BuildException(msg);
    +  902   +
             }
    +  903  0
         }
    +  904   +
     
     905   -
             }
    -  906  0
         }
    -  907   -
     
    -  908  
         /**
    -  909   +  906  
          * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries.
    -  910   +  907  
          *
    -  911   +  908  
          * @param dependencies a list of dependency objects
    -  912   +  909  
          */
    -  913   +  910  
         private void showSummary(List<Dependency> dependencies) {
    -  914  0
             final StringBuilder summary = new StringBuilder();
    -  915  0
             for (Dependency d : dependencies) {
    -  916  0
                 boolean firstEntry = true;
    -  917  0
                 final StringBuilder ids = new StringBuilder();
    -  918  0
                 for (Vulnerability v : d.getVulnerabilities()) {
    -  919  0
                     if (firstEntry) {
    -  920  0
                         firstEntry = false;
    -  921   +  911  3
             final StringBuilder summary = new StringBuilder();
    +  912  3
             for (Dependency d : dependencies) {
    +  913  5
                 boolean firstEntry = true;
    +  914  5
                 final StringBuilder ids = new StringBuilder();
    +  915  5
                 for (Vulnerability v : d.getVulnerabilities()) {
    +  916  18
                     if (firstEntry) {
    +  917  4
                         firstEntry = false;
    +  918  
                     } else {
    -  922  0
                         ids.append(", ");
    -  923   +  919  14
                         ids.append(", ");
    +  920  
                     }
    -  924  0
                     ids.append(v.getName());
    -  925  0
                 }
    -  926  0
                 if (ids.length() > 0) {
    -  927  0
                     summary.append(d.getFileName()).append(" (");
    -  928  0
                     firstEntry = true;
    -  929  0
                     for (Identifier id : d.getIdentifiers()) {
    -  930  0
                         if (firstEntry) {
    -  931  0
                             firstEntry = false;
    -  932   +  921  18
                     ids.append(v.getName());
    +  922  18
                 }
    +  923  5
                 if (ids.length() > 0) {
    +  924  4
                     summary.append(d.getFileName()).append(" (");
    +  925  4
                     firstEntry = true;
    +  926  4
                     for (Identifier id : d.getIdentifiers()) {
    +  927  15
                         if (firstEntry) {
    +  928  4
                             firstEntry = false;
    +  929  
                         } else {
    -  933  0
                             summary.append(", ");
    -  934   +  930  11
                             summary.append(", ");
    +  931  
                         }
    -  935  0
                         summary.append(id.getValue());
    -  936  0
                     }
    -  937  0
                     summary.append(") : ").append(ids).append(NEW_LINE);
    -  938   +  932  15
                         summary.append(id.getValue());
    +  933  15
                     }
    +  934  4
                     summary.append(") : ").append(ids).append(NEW_LINE);
    +  935  
                 }
    -  939  0
             }
    -  940  0
             if (summary.length() > 0) {
    -  941  0
                 final String msg = String.format("%n%n"
    -  942   +  936  5
             }
    +  937  3
             if (summary.length() > 0) {
    +  938  3
                 final String msg = String.format("%n%n"
    +  939  
                         + "One or more dependencies were identified with known vulnerabilities:%n%n%s"
    -  943   +  940  
                         + "%n%nSee the dependency-check report for more details.%n%n", summary.toString());
    -  944  0
                 log(msg, Project.MSG_WARN);
    +  941  3
                 log(msg, Project.MSG_WARN);
    +  942   +
             }
    +  943  3
         }
    +  944   +
     
     945   -
             }
    -  946  0
         }
    -  947   -
     
    -  948  
         /**
    -  949   +  946  
          * An enumeration of supported report formats: "ALL", "HTML", "XML", "VULN", etc..
    -  950   +  947  
          */
    -  951  0
         public static class ReportFormats extends EnumeratedAttribute {
    -  952   +  948  4
         public static class ReportFormats extends EnumeratedAttribute {
    +  949  
     
    -  953   +  950  
             /**
    -  954   +  951  
              * Returns the list of values for the report format.
    -  955   +  952  
              *
    -  956   +  953  
              * @return the list of values for the report format
    -  957   +  954  
              */
    -  958   +  955  
             @Override
    -  959   +  956  
             public String[] getValues() {
    -  960  0
                 int i = 0;
    -  961  0
                 final Format[] formats = Format.values();
    -  962  0
                 final String[] values = new String[formats.length];
    -  963  0
                 for (Format format : formats) {
    -  964  0
                     values[i++] = format.name();
    -  965   +  957  4
                 int i = 0;
    +  958  4
                 final Format[] formats = Format.values();
    +  959  4
                 final String[] values = new String[formats.length];
    +  960  20
                 for (Format format : formats) {
    +  961  16
                     values[i++] = format.name();
    +  962  
                 }
    -  966  0
                 return values;
    -  967   +  963  4
                 return values;
    +  964  
             }
    -  968   +  965  
         }
    -  969   +  966  
     }
    - + diff --git a/dependency-check-ant/cobertura/org.owasp.dependencycheck.taskdefs.Purge.html b/dependency-check-ant/cobertura/org.owasp.dependencycheck.taskdefs.Purge.html index 5a3588f8e..6dcbf96ed 100644 --- a/dependency-check-ant/cobertura/org.owasp.dependencycheck.taskdefs.Purge.html +++ b/dependency-check-ant/cobertura/org.owasp.dependencycheck.taskdefs.Purge.html @@ -12,7 +12,7 @@
     
    - +
    Classes in this File Line Coverage Branch Coverage Complexity
    Purge
    0%
    0/38
    0%
    0/8
    2.4
    Purge
    47%
    18/38
    25%
    2/8
    2.4
     
    @@ -105,13 +105,13 @@
          */
     44  
         public Purge() {
    -  45  0
             super();
    +  45  4
             super();
     46  
             // Call this before Dependency Check Core starts logging anything - this way, all SLF4J messages from
     47  
             // core end up coming through this tasks logger
    -  48  0
             StaticLoggerBinder.getSingleton().setTask(this);
    -  49  0
         }
    +  48  4
             StaticLoggerBinder.getSingleton().setTask(this);
    +  49  4
         }
     50  
     
     51   @@ -120,7 +120,7 @@
          * The location of the data directory that contains
     53  
          */
    -  54  0
         private String dataDirectory = null;
    +  54  4
         private String dataDirectory = null;
     55  
     
     56   @@ -198,43 +198,43 @@
          */
     100  
         protected void populateSettings() {
    -  101  0
             Settings.initialize();
    -  102  0
             InputStream taskProperties = null;
    +  101  3
             Settings.initialize();
    +  102  3
             InputStream taskProperties = null;
     103  
             try {
    -  104  0
                 taskProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE);
    -  105  0
                 Settings.mergeProperties(taskProperties);
    +  104  3
                 taskProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE);
    +  105  3
                 Settings.mergeProperties(taskProperties);
     106  0
             } catch (IOException ex) {
     107  0
                 log("Unable to load the dependency-check ant task.properties file.", ex, Project.MSG_WARN);
     108  
             } finally {
    -  109  0
                 if (taskProperties != null) {
    +  109  3
                 if (taskProperties != null) {
     110  
                     try {
    -  111  0
                         taskProperties.close();
    +  111  3
                         taskProperties.close();
     112  0
                     } catch (IOException ex) {
     113  0
                         log("", ex, Project.MSG_DEBUG);
    -  114  0
                     }
    +  114  3
                     }
     115  
                 }
     116  
             }
    -  117  0
             if (dataDirectory != null) {
    +  117  3
             if (dataDirectory != null) {
     118  0
                 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory);
     119  
             } else {
    -  120  0
                 final File jarPath = new File(Purge.class.getProtectionDomain().getCodeSource().getLocation().getPath());
    -  121  0
                 final File base = jarPath.getParentFile();
    -  122  0
                 final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY);
    -  123  0
                 final File dataDir = new File(base, sub);
    -  124  0
                 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath());
    +  120  3
                 final File jarPath = new File(Purge.class.getProtectionDomain().getCodeSource().getLocation().getPath());
    +  121  3
                 final File base = jarPath.getParentFile();
    +  122  3
                 final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY);
    +  123  3
                 final File dataDir = new File(base, sub);
    +  124  3
                 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath());
     125  
             }
    -  126  0
         }
    +  126  3
         }
     127  
     }
    - + diff --git a/dependency-check-ant/cobertura/org.owasp.dependencycheck.taskdefs.Update.html b/dependency-check-ant/cobertura/org.owasp.dependencycheck.taskdefs.Update.html index ce4e23fcd..6ba3b1f96 100644 --- a/dependency-check-ant/cobertura/org.owasp.dependencycheck.taskdefs.Update.html +++ b/dependency-check-ant/cobertura/org.owasp.dependencycheck.taskdefs.Update.html @@ -12,7 +12,7 @@
     
    - +
    Classes in this File Line Coverage Branch Coverage Complexity
    Update
    0%
    0/85
    0%
    0/58
    2
    Update
    25%
    20/78
    16%
    1/6
    1.182
     
    @@ -91,13 +91,13 @@
          */
     37  
         public Update() {
    -  38  0
             super();
    +  38  4
             super();
     39  
             // Call this before Dependency Check Core starts logging anything - this way, all SLF4J messages from
     40  
             // core end up coming through this tasks logger
    -  41  0
             StaticLoggerBinder.getSingleton().setTask(this);
    -  42  0
         }
    +  41  4
             StaticLoggerBinder.getSingleton().setTask(this);
    +  42  4
         }
     43  
     
     44   @@ -693,113 +693,128 @@  360  
         /**
     361   -
          * Executes the update by initializing the settings, downloads the NVD XML data, and then processes the data storing it in the
    +
          * The number of hours to wait before re-checking for updates.
     362   -
          * local database.
    -  363   -
          *
    -  364   -
          * @throws BuildException thrown if a connection to the local database cannot be made.
    -  365  
          */
    +  363   +
         private Integer cveValidForHours;
    +  364   +
     
    +  365   +
         /**
     366   -
         @Override
    +
          * Get the value of cveValidForHours.
     367   -
         public void execute() throws BuildException {
    -  368  0
             populateSettings();
    -  369  0
             Engine engine = null;
    +
          *
    +  368   +
          * @return the value of cveValidForHours
    +  369   +
          */
     370   -
             try {
    -  371  0
                 engine = new Engine(Update.class.getClassLoader());
    -  372  0
                 engine.doUpdates();
    -  373  0
             } catch (DatabaseException ex) {
    -  374  0
                 throw new BuildException("Unable to connect to the dependency-check database; unable to update the NVD data", ex);
    +
         public Integer getCveValidForHours() {
    +  371  0
             return cveValidForHours;
    +  372   +
         }
    +  373   +
     
    +  374   +
         /**
     375   -
             } finally {
    -  376  0
                 Settings.cleanup(true);
    -  377  0
                 if (engine != null) {
    -  378  0
                     engine.cleanup();
    +
          * Set the value of cveValidForHours.
    +  376   +
          *
    +  377   +
          * @param cveValidForHours new value of cveValidForHours
    +  378   +
          */
     379   -
                 }
    -  380   -
             }
    +
         public void setCveValidForHours(Integer cveValidForHours) {
    +  380  0
             this.cveValidForHours = cveValidForHours;
     381  0
         }
     382  
     
     383  
         /**
     384   -
          * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties
    +
          * Executes the update by initializing the settings, downloads the NVD XML data, and then processes the data storing it in the
     385   -
          * required to change the proxy server, port, and connection timeout.
    +
          * local database.
     386   -
          */
    +
          *
     387   -
         @Override
    +
          * @throws BuildException thrown if a connection to the local database cannot be made.
     388   -
         protected void populateSettings() {
    -  389  0
             super.populateSettings();
    -  390  0
             if (proxyServer != null && !proxyServer.isEmpty()) {
    -  391  0
                 Settings.setString(Settings.KEYS.PROXY_SERVER, proxyServer);
    -  392   -
             }
    -  393  0
             if (proxyPort != null && !proxyPort.isEmpty()) {
    -  394  0
                 Settings.setString(Settings.KEYS.PROXY_PORT, proxyPort);
    -  395   -
             }
    -  396  0
             if (proxyUsername != null && !proxyUsername.isEmpty()) {
    -  397  0
                 Settings.setString(Settings.KEYS.PROXY_USERNAME, proxyUsername);
    +
          */
    +  389   +
         @Override
    +  390   +
         public void execute() throws BuildException {
    +  391  0
             populateSettings();
    +  392  0
             Engine engine = null;
    +  393   +
             try {
    +  394  0
                 engine = new Engine(Update.class.getClassLoader());
    +  395  0
                 engine.doUpdates();
    +  396  0
             } catch (DatabaseException ex) {
    +  397  0
                 throw new BuildException("Unable to connect to the dependency-check database; unable to update the NVD data", ex);
     398   +
             } finally {
    +  399  0
                 Settings.cleanup(true);
    +  400  0
                 if (engine != null) {
    +  401  0
                     engine.cleanup();
    +  402   +
                 }
    +  403  
             }
    -  399  0
             if (proxyPassword != null && !proxyPassword.isEmpty()) {
    -  400  0
                 Settings.setString(Settings.KEYS.PROXY_PASSWORD, proxyPassword);
    -  401   -
             }
    -  402  0
             if (connectionTimeout != null && !connectionTimeout.isEmpty()) {
    -  403  0
                 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout);
    -  404   -
             }
    -  405  0
             if (databaseDriverName != null && !databaseDriverName.isEmpty()) {
    -  406  0
                 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName);
    +  404  0
         }
    +  405   +
     
    +  406   +
         /**
     407   -
             }
    -  408  0
             if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) {
    -  409  0
                 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath);
    +
          * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties
    +  408   +
          * required to change the proxy server, port, and connection timeout.
    +  409   +
          *
     410   -
             }
    -  411  0
             if (connectionString != null && !connectionString.isEmpty()) {
    -  412  0
                 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString);
    +
          * @throws BuildException thrown when an invalid setting is configured.
    +  411   +
          */
    +  412   +
         @Override
     413   +
         protected void populateSettings() throws BuildException {
    +  414  3
             super.populateSettings();
    +  415  3
             Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_SERVER, proxyServer);
    +  416  3
             Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PORT, proxyPort);
    +  417  3
             Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_USERNAME, proxyUsername);
    +  418  3
             Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PASSWORD, proxyPassword);
    +  419  3
             Settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout);
    +  420  3
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName);
    +  421  3
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath);
    +  422  3
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString);
    +  423  3
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser);
    +  424  3
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword);
    +  425  3
             Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified);
    +  426  3
             Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified);
    +  427  3
             Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base);
    +  428  3
             Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base);
    +  429  3
             if (cveValidForHours != null) {
    +  430  0
                 if (cveValidForHours >= 0) {
    +  431  0
                     Settings.setInt(Settings.KEYS.CVE_CHECK_VALID_FOR_HOURS, cveValidForHours);
    +  432   +
                 } else {
    +  433  0
                     throw new BuildException("Invalid setting: `cpeValidForHours` must be 0 or greater");
    +  434   +
                 }
    +  435  
             }
    -  414  0
             if (databaseUser != null && !databaseUser.isEmpty()) {
    -  415  0
                 Settings.setString(Settings.KEYS.DB_USER, databaseUser);
    -  416   -
             }
    -  417  0
             if (databasePassword != null && !databasePassword.isEmpty()) {
    -  418  0
                 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword);
    -  419   -
             }
    -  420  0
             if (cveUrl12Modified != null && !cveUrl12Modified.isEmpty()) {
    -  421  0
                 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified);
    -  422   -
             }
    -  423  0
             if (cveUrl20Modified != null && !cveUrl20Modified.isEmpty()) {
    -  424  0
                 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified);
    -  425   -
             }
    -  426  0
             if (cveUrl12Base != null && !cveUrl12Base.isEmpty()) {
    -  427  0
                 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base);
    -  428   -
             }
    -  429  0
             if (cveUrl20Base != null && !cveUrl20Base.isEmpty()) {
    -  430  0
                 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base);
    -  431   -
             }
    -  432  0
         }
    -  433   +  436  3
         }
    +  437  
     }
    - + diff --git a/dependency-check-ant/cobertura/org.slf4j.impl.StaticLoggerBinder.html b/dependency-check-ant/cobertura/org.slf4j.impl.StaticLoggerBinder.html index 8045caaa8..c05bd2fc4 100644 --- a/dependency-check-ant/cobertura/org.slf4j.impl.StaticLoggerBinder.html +++ b/dependency-check-ant/cobertura/org.slf4j.impl.StaticLoggerBinder.html @@ -12,7 +12,7 @@
     
    - +
    Classes in this File Line Coverage Branch Coverage Complexity
    StaticLoggerBinder
    0%
    0/13
    N/A
    1
    StaticLoggerBinder
    100%
    13/13
    N/A
    1
     
    @@ -89,7 +89,7 @@
          *
     36  
          */
    -  37  0
         private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
    +  37  1
         private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
     38  
     
     39   @@ -104,7 +104,7 @@
          */
     44  
         public static final StaticLoggerBinder getSingleton() {
    -  45  0
             return SINGLETON;
    +  45  58
             return SINGLETON;
     46  
         }
     47   @@ -115,7 +115,7 @@
          * Ant tasks have the log method we actually want to call. So we hang onto the task as a delegate
     50  
          */
    -  51  0
         private Task task = null;
    +  51  1
         private Task task = null;
     52  
     
     53   @@ -130,9 +130,9 @@
          */
     58  
         public void setTask(Task task) {
    -  59  0
             this.task = task;
    -  60  0
             loggerFactory = new AntLoggerFactory(task);
    -  61  0
         }
    +  59  12
             this.task = task;
    +  60  12
             loggerFactory = new AntLoggerFactory(task);
    +  61  12
         }
     62  
     
     63   @@ -145,10 +145,10 @@
          */
     67  
         // to avoid constant folding by the compiler, this field must *not* be final
    -  68  0
         public static String REQUESTED_API_VERSION = "1.7.12"; // final
    +  68  1
         public static String REQUESTED_API_VERSION = "1.7.12"; // final
     69  
     
    -  70  0
         private static final String LOGGER_FACTORY_CLASS = AntLoggerFactory.class.getName();
    +  70  1
         private static final String LOGGER_FACTORY_CLASS = AntLoggerFactory.class.getName();
     71  
     
     72   @@ -167,9 +167,9 @@
          * Constructs a new static logger binder.
     79  
          */
    -  80  0
         private StaticLoggerBinder() {
    -  81  0
             loggerFactory = new AntLoggerFactory(task);
    -  82  0
         }
    +  80  1
         private StaticLoggerBinder() {
    +  81  1
             loggerFactory = new AntLoggerFactory(task);
    +  82  1
         }
     83  
     
     84   @@ -186,7 +186,7 @@
         @Override
     90  
         public ILoggerFactory getLoggerFactory() {
    -  91  0
             return loggerFactory;
    +  91  44
             return loggerFactory;
     92  
         }
     93   @@ -205,13 +205,13 @@
         @Override
     100  
         public String getLoggerFactoryClassStr() {
    -  101  0
             return LOGGER_FACTORY_CLASS;
    +  101  1
             return LOGGER_FACTORY_CLASS;
     102  
         }
     103  
     }
    - + diff --git a/dependency-check-ant/config-purge.html b/dependency-check-ant/config-purge.html index 51c63adac..bb9a9acd9 100644 --- a/dependency-check-ant/config-purge.html +++ b/dependency-check-ant/config-purge.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Configuration @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-ant/config-update.html b/dependency-check-ant/config-update.html index dd13f2ba4..e24b746ae 100644 --- a/dependency-check-ant/config-update.html +++ b/dependency-check-ant/config-update.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Configuration @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -249,7 +249,7 @@ URL for the modified CVE 1.2. -http://nvd.nist.gov/download/nvdcve-modified.xml +https://nvd.nist.gov/download/nvdcve-Modified.xml.gz @@ -258,7 +258,7 @@ URL for the modified CVE 2.0. -http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-modified.xml +https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-Modified.xml.gz @@ -267,7 +267,7 @@ Base URL for each year’s CVE 1.2, the %d will be replaced with the year. -http://nvd.nist.gov/download/nvdcve-%d.xml +https://nvd.nist.gov/download/nvdcve-%d.xml.gz @@ -276,7 +276,7 @@ Base URL for each year’s CVE 2.0, the %d will be replaced with the year. -http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml +https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml.gz diff --git a/dependency-check-ant/configuration.html b/dependency-check-ant/configuration.html index f28ff5a1f..97d4c3933 100644 --- a/dependency-check-ant/configuration.html +++ b/dependency-check-ant/configuration.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Configuration @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -206,24 +206,15 @@ -projectName +cveValidForHours -The name of the project being scanned. +Sets the number of hours to wait before checking for new updates from the NVD -Dependency-Check +4 -reportOutputDirectory - -The location to write the report(s). Note, this is not used if generating the report as part of a mvn site build - -‘target’ - - - - failBuildOnCVSS Specifies if the build should be failed if a CVSS score above a specified level is identified. The default is 11 which means since the CVSS scores are 0-10, by default the build will never fail. @@ -231,6 +222,15 @@ 11 + + +projectName + +The name of the project being scanned. + +Dependency-Check + + reportFormat @@ -242,6 +242,15 @@ +reportOutputDirectory + +The location to write the report(s). Note, this is not used if generating the report as part of a mvn site build + +‘target’ + + + + suppressionFile The file path to the XML suppression file - used to suppress false positives @@ -249,7 +258,7 @@   - + proxyServer @@ -258,7 +267,7 @@   - + proxyPort @@ -267,7 +276,7 @@   - + proxyUsername @@ -276,7 +285,7 @@   - + proxyPassword @@ -285,7 +294,7 @@   - + connectionTimeout diff --git a/dependency-check-ant/dependency-analysis.html b/dependency-check-ant/dependency-analysis.html index 8bc85eab8..29bb5128e 100644 --- a/dependency-check-ant/dependency-analysis.html +++ b/dependency-check-ant/dependency-analysis.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Dependencies Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -247,7 +247,7 @@ org.owasp dependency-check-core -1.3.1 +1.3.2 compile jar @@ -255,7 +255,7 @@ org.owasp dependency-check-utils -1.3.1 +1.3.2 compile jar @@ -263,7 +263,7 @@ org.owasp dependency-check-core -1.3.1 +1.3.2 test tests test-jar @@ -306,7 +306,7 @@ org.slf4j slf4j-api -1.7.12 +1.7.13 compile jar @@ -333,7 +333,7 @@ com.google.code.findbugs annotations -3.0.0 +3.0.1u2 provided jar diff --git a/dependency-check-ant/dependency-updates-report.html b/dependency-check-ant/dependency-updates-report.html index f5bacd786..f42ffdffd 100644 --- a/dependency-check-ant/dependency-updates-report.html +++ b/dependency-check-ant/dependency-updates-report.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Dependency Updates Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -238,7 +238,7 @@ # of dependencies using the latest version available -27 +24 # of dependencies where the next version available is smaller than an incremental version update @@ -246,7 +246,7 @@ # of dependencies where the next version available is an incremental version update -0 +3 # of dependencies where the next version available is a minor version update @@ -298,7 +298,7 @@ com.google.code.findbugs annotations -3.0.0 +3.0.1u2 jar @@ -463,7 +463,7 @@ 4.8.0 5.0.0 - + org.apache.maven maven-core 3.3.3 @@ -471,11 +471,11 @@ jar - +3.3.9 - + org.apache.maven maven-plugin-api 3.3.3 @@ -483,11 +483,11 @@ jar - +3.3.9 - + org.apache.maven maven-settings 3.3.3 @@ -495,7 +495,7 @@ jar - +3.3.9 @@ -586,7 +586,7 @@ org.jmockit jmockit -1.19 +1.20 test jar @@ -610,7 +610,7 @@ org.slf4j slf4j-api -1.7.12 +1.7.13 jar @@ -622,7 +622,7 @@ org.slf4j slf4j-simple -1.7.12 +1.7.13 jar @@ -661,7 +661,7 @@ org.owasp dependency-check-core -1.3.1 +1.3.2 compile jar @@ -673,7 +673,7 @@ org.owasp dependency-check-utils -1.3.1 +1.3.2 compile jar @@ -758,7 +758,7 @@ annotations Current Version -3.0.0 +3.0.1u2 Scope @@ -794,7 +794,7 @@ jar Newer versions -1.4.177 Next Minor
    1.4.178
    1.4.179
    1.4.180
    1.4.181
    1.4.182
    1.4.183
    1.4.184
    1.4.185
    1.4.186
    1.4.187
    1.4.188
    1.4.189 Latest Minor
    +1.4.177 Next Minor
    1.4.178
    1.4.179
    1.4.180
    1.4.181
    1.4.182
    1.4.183
    1.4.184
    1.4.185
    1.4.186
    1.4.187
    1.4.188
    1.4.189
    1.4.190 Latest Minor

    com.sun.mail:mailapi

    @@ -1013,7 +1013,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-core

    @@ -1040,7 +1040,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-queryparser

    @@ -1067,7 +1067,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-test-framework

    @@ -1094,13 +1094,13 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.maven:maven-core

    - + @@ -1118,13 +1118,16 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven:maven-plugin-api

    - + @@ -1142,13 +1145,16 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven:maven-settings

    - + @@ -1166,7 +1172,10 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven.plugin-testing:maven-plugin-testing-harness

    @@ -1349,7 +1358,7 @@ - + @@ -1397,7 +1406,7 @@ - + @@ -1421,7 +1430,7 @@ - + @@ -1445,7 +1454,7 @@ - + @@ -1469,7 +1478,7 @@ - + diff --git a/dependency-check-ant/findbugs.html b/dependency-check-ant/findbugs.html index 2bdd84495..21ff8eb2b 100644 --- a/dependency-check-ant/findbugs.html +++ b/dependency-check-ant/findbugs.html @@ -1,13 +1,13 @@ - + dependency-check-ant – FindBugs Bug Detector Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-ant/index.html b/dependency-check-ant/index.html index 71a9be43f..e2593c350 100644 --- a/dependency-check-ant/index.html +++ b/dependency-check-ant/index.html @@ -1,13 +1,13 @@ - + dependency-check-ant – About @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -160,7 +160,7 @@
      -
    1. Download dependency-check-ant from bintray here.
    2. +
    3. Download dependency-check-ant from bintray here.
    4. Unzip the archive
    5. diff --git a/dependency-check-ant/integration.html b/dependency-check-ant/integration.html index 7850be197..4ae66b636 100644 --- a/dependency-check-ant/integration.html +++ b/dependency-check-ant/integration.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Continuous Integration @@ -54,7 +54,7 @@
    6. - + /
    7. @@ -67,9 +67,9 @@ -
    8. | Last Published: 2015-09-20
    9. +
    10. | Last Published: 2015-11-29
    11. - Version: 1.3.1 + Version: 1.3.2
    12. diff --git a/dependency-check-ant/issue-tracking.html b/dependency-check-ant/issue-tracking.html index 7bbd36ce9..cc3c4363b 100644 --- a/dependency-check-ant/issue-tracking.html +++ b/dependency-check-ant/issue-tracking.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Issue Tracking @@ -54,7 +54,7 @@
    13. - + /
    14. @@ -67,9 +67,9 @@ -
    15. | Last Published: 2015-09-20
    16. +
    17. | Last Published: 2015-11-29
    18. - Version: 1.3.1 + Version: 1.3.2
    19. diff --git a/dependency-check-ant/license.html b/dependency-check-ant/license.html index 5b20f02d3..214fe9cf3 100644 --- a/dependency-check-ant/license.html +++ b/dependency-check-ant/license.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Project License @@ -54,7 +54,7 @@
    20. - + /
    21. @@ -67,9 +67,9 @@ -
    22. | Last Published: 2015-09-20
    23. +
    24. | Last Published: 2015-11-29
    25. - Version: 1.3.1 + Version: 1.3.2
    26. diff --git a/dependency-check-ant/mail-lists.html b/dependency-check-ant/mail-lists.html index 60d9ebce4..ac3964beb 100644 --- a/dependency-check-ant/mail-lists.html +++ b/dependency-check-ant/mail-lists.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Project Mailing Lists @@ -54,7 +54,7 @@
    27. - + /
    28. @@ -67,9 +67,9 @@ -
    29. | Last Published: 2015-09-20
    30. +
    31. | Last Published: 2015-11-29
    32. - Version: 1.3.1 + Version: 1.3.2
    33. diff --git a/dependency-check-ant/plugin-updates-report.html b/dependency-check-ant/plugin-updates-report.html index 17b16de68..1a11fac21 100644 --- a/dependency-check-ant/plugin-updates-report.html +++ b/dependency-check-ant/plugin-updates-report.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Plugin Updates Report @@ -54,7 +54,7 @@
    34. - + /
    35. @@ -67,9 +67,9 @@ -
    36. | Last Published: 2015-09-20
    37. +
    38. | Last Published: 2015-11-29
    39. - Version: 1.3.1 + Version: 1.3.2
    40. @@ -250,7 +250,7 @@
    - + @@ -286,7 +286,7 @@ - + @@ -346,7 +346,7 @@ - + @@ -383,16 +383,26 @@ + + + + + + + + + + - + - + @@ -402,7 +412,7 @@ - + @@ -412,6 +422,16 @@ + + + + + + + + + + @@ -487,7 +507,7 @@ -
    jmockit
    Current Version1.19
    1.20
    Scope test
    dependency-check-core
    Current Version1.3.1
    1.3.2
    Scope compile
    dependency-check-utils
    Current Version1.3.1
    1.3.2
    Scope compile
    slf4j-api
    Current Version1.7.12
    1.7.13
    Scope
    slf4j-simple
    Current Version1.7.12
    1.7.13
    Scope
    # of plugins where the next version available is a minor version update0
    2
    # of plugins where the next version available is a major version update org.apache.maven.plugins maven-assembly-plugin2.5.52.6 org.apache.maven.plugins maven-failsafe-plugin2.18.12.19
    org.apache.maven.pluginsmaven-javadoc-plugin2.9.12.10
    org.apache.maven.plugins maven-release-plugin2.5.22.5.3
    org.apache.maven.plugins maven-resources-plugin
    org.apache.maven.plugins maven-site-plugin
    org.apache.maven.pluginsmaven-source-plugin2.2.12.3
    org.apache.maven.pluginsmaven-assembly-plugin
    Current Version2.5.5
    +2.6

    Plugin org.apache.maven.plugins:maven-clean-plugin

    @@ -577,7 +597,7 @@ -
    maven-failsafe-plugin
    Current Version2.18.1
    +2.19

    Plugin org.apache.maven.plugins:maven-gpg-plugin

    @@ -624,6 +644,24 @@
    Current Version 2.6
    +

    Plugin org.apache.maven.plugins:maven-javadoc-plugin

    + + + + + + + + + + + + + + + +
    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-javadoc-plugin
    Current Version2.9.1
    Newer versions2.10 Next Minor
    2.10.1
    2.10.2
    2.10.3 Latest Minor
    +

    Plugin org.apache.maven.plugins:maven-release-plugin

    @@ -637,7 +675,7 @@ -
    maven-release-plugin
    Current Version2.5.2
    +2.5.3

    Plugin org.apache.maven.plugins:maven-resources-plugin

    @@ -669,6 +707,24 @@
    Current Version 3.4
    +

    Plugin org.apache.maven.plugins:maven-source-plugin

    + + + + + + + + + + + + + + + +
    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-source-plugin
    Current Version2.2.1
    Newer versions2.3 Next Minor
    2.4 Latest Minor
    +

    Plugin org.apache.maven.plugins:maven-surefire-plugin

    diff --git a/dependency-check-ant/project-info.html b/dependency-check-ant/project-info.html index 01c615c9c..bbcb40746 100644 --- a/dependency-check-ant/project-info.html +++ b/dependency-check-ant/project-info.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Project Information @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-ant/project-reports.html b/dependency-check-ant/project-reports.html index 1648b396b..615a2acd9 100644 --- a/dependency-check-ant/project-reports.html +++ b/dependency-check-ant/project-reports.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Generated Reports @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-ant/project-summary.html b/dependency-check-ant/project-summary.html index 4fb08883e..49cd63664 100644 --- a/dependency-check-ant/project-summary.html +++ b/dependency-check-ant/project-summary.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Project Summary @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -246,7 +246,7 @@ - + diff --git a/dependency-check-ant/source-repository.html b/dependency-check-ant/source-repository.html index ccb272cf9..3fc0ffeee 100644 --- a/dependency-check-ant/source-repository.html +++ b/dependency-check-ant/source-repository.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Source Repository @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-ant/surefire-report.html b/dependency-check-ant/surefire-report.html index bd2ed9566..3beb34612 100644 --- a/dependency-check-ant/surefire-report.html +++ b/dependency-check-ant/surefire-report.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Surefire Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -267,7 +267,7 @@ function toggleDisplay(elementId) { -
    dependency-check-ant
    Version1.3.1
    1.3.2
    Type jar
    0 0 100%16.626

    +10.406

    Note: failures are anticipated and checked for with assertions while errors are unanticipated.


    Package List

    @@ -288,7 +288,7 @@ function toggleDisplay(elementId) { 0 0 100% -16.626
    +10.406

    Note: package statistics are not computed recursively, they only sum up all of its testsuites numbers.

    org.owasp.dependencycheck.taskdefs

    @@ -310,7 +310,7 @@ function toggleDisplay(elementId) { 0 0 100% -16.626

    +10.406

    Test Cases

    [Summary] [Package List] [Test Cases]

    @@ -319,20 +319,20 @@ function toggleDisplay(elementId) { - - + + - - + + - - + + - -
    testGetFailBuildOnCVSS0.391
    testGetFailBuildOnCVSS0.406
    testAddDirSet7.948
    testAddDirSet5.96
    testAddFileSet4.582
    testAddFileSet2.516
    testAddFileList3.705

    +testAddFileList +1.524
    diff --git a/dependency-check-ant/taglist.html b/dependency-check-ant/taglist.html index 18b63a0aa..378af37c7 100644 --- a/dependency-check-ant/taglist.html +++ b/dependency-check-ant/taglist.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Tag List report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-ant/team-list.html b/dependency-check-ant/team-list.html index 491961551..a91820718 100644 --- a/dependency-check-ant/team-list.html +++ b/dependency-check-ant/team-list.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Project Team @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-ant/xref-test/index.html b/dependency-check-ant/xref-test/index.html index 3dafe2f34..57b048b3d 100644 --- a/dependency-check-ant/xref-test/index.html +++ b/dependency-check-ant/xref-test/index.html @@ -4,7 +4,7 @@ - Dependency-Check Ant Task 1.3.1 Reference + Dependency-Check Ant Task 1.3.2 Reference diff --git a/dependency-check-ant/xref-test/org/owasp/dependencycheck/taskdefs/DependencyCheckTaskTest.html b/dependency-check-ant/xref-test/org/owasp/dependencycheck/taskdefs/DependencyCheckTaskTest.html index 2af1a2044..270c981a6 100644 --- a/dependency-check-ant/xref-test/org/owasp/dependencycheck/taskdefs/DependencyCheckTaskTest.html +++ b/dependency-check-ant/xref-test/org/owasp/dependencycheck/taskdefs/DependencyCheckTaskTest.html @@ -34,7 +34,7 @@ 26 import org.junit.Rule; 27 import org.junit.Test; 28 import org.junit.rules.ExpectedException; -29 import org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase; +29 import org.owasp.dependencycheck.BaseDBTestCase; 30 import org.owasp.dependencycheck.utils.Settings; 31 32 import static org.junit.Assert.assertTrue; diff --git a/dependency-check-ant/xref-test/org/owasp/dependencycheck/taskdefs/package-frame.html b/dependency-check-ant/xref-test/org/owasp/dependencycheck/taskdefs/package-frame.html index 72595d9d0..f487ab6e3 100644 --- a/dependency-check-ant/xref-test/org/owasp/dependencycheck/taskdefs/package-frame.html +++ b/dependency-check-ant/xref-test/org/owasp/dependencycheck/taskdefs/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Ant Task 1.3.1 Reference Package org.owasp.dependencycheck.taskdefs + Dependency-Check Ant Task 1.3.2 Reference Package org.owasp.dependencycheck.taskdefs diff --git a/dependency-check-ant/xref-test/org/owasp/dependencycheck/taskdefs/package-summary.html b/dependency-check-ant/xref-test/org/owasp/dependencycheck/taskdefs/package-summary.html index 2742a1de3..8b93cafb2 100644 --- a/dependency-check-ant/xref-test/org/owasp/dependencycheck/taskdefs/package-summary.html +++ b/dependency-check-ant/xref-test/org/owasp/dependencycheck/taskdefs/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Ant Task 1.3.1 Reference Package org.owasp.dependencycheck.taskdefs + Dependency-Check Ant Task 1.3.2 Reference Package org.owasp.dependencycheck.taskdefs diff --git a/dependency-check-ant/xref-test/overview-frame.html b/dependency-check-ant/xref-test/overview-frame.html index dc55d58c6..122c17560 100644 --- a/dependency-check-ant/xref-test/overview-frame.html +++ b/dependency-check-ant/xref-test/overview-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Ant Task 1.3.1 Reference + Dependency-Check Ant Task 1.3.2 Reference diff --git a/dependency-check-ant/xref-test/overview-summary.html b/dependency-check-ant/xref-test/overview-summary.html index f2234de14..da7a72970 100644 --- a/dependency-check-ant/xref-test/overview-summary.html +++ b/dependency-check-ant/xref-test/overview-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Ant Task 1.3.1 Reference + Dependency-Check Ant Task 1.3.2 Reference @@ -24,7 +24,7 @@ -

    Dependency-Check Ant Task 1.3.1 Reference

    +

    Dependency-Check Ant Task 1.3.2 Reference

    diff --git a/dependency-check-ant/xref/index.html b/dependency-check-ant/xref/index.html index 3dafe2f34..57b048b3d 100644 --- a/dependency-check-ant/xref/index.html +++ b/dependency-check-ant/xref/index.html @@ -4,7 +4,7 @@ - Dependency-Check Ant Task 1.3.1 Reference + Dependency-Check Ant Task 1.3.2 Reference diff --git a/dependency-check-ant/xref/org/owasp/dependencycheck/ant/logging/AntLoggerAdapter.html b/dependency-check-ant/xref/org/owasp/dependencycheck/ant/logging/AntLoggerAdapter.html index b5a8a218b..244219cfa 100644 --- a/dependency-check-ant/xref/org/owasp/dependencycheck/ant/logging/AntLoggerAdapter.html +++ b/dependency-check-ant/xref/org/owasp/dependencycheck/ant/logging/AntLoggerAdapter.html @@ -71,212 +71,214 @@ 6364 @Override 65publicvoid trace(String msg) { -66 task.log(msg, Project.MSG_VERBOSE); -67 } -68 -69 @Override -70publicvoid trace(String format, Object arg) { -71if (task != null) { -72final FormattingTuple tp = MessageFormatter.format(format, arg); -73 task.log(tp.getMessage(), Project.MSG_VERBOSE); -74 } -75 } -76 -77 @Override -78publicvoid trace(String format, Object arg1, Object arg2) { -79if (task != null) { -80final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); -81 task.log(tp.getMessage(), Project.MSG_VERBOSE); -82 } -83 } -84 -85 @Override -86publicvoid trace(String format, Object... arguments) { -87if (task != null) { -88final FormattingTuple tp = MessageFormatter.format(format, arguments); -89 task.log(tp.getMessage(), Project.MSG_VERBOSE); -90 } -91 } -92 -93 @Override -94publicvoid trace(String msg, Throwable t) { -95if (task != null) { -96 task.log(msg, t, Project.MSG_VERBOSE); -97 } -98 } -99 -100 @Override -101publicboolean isDebugEnabled() { -102returntrue; -103 } -104 -105 @Override -106publicvoid debug(String msg) { -107if (task != null) { -108 task.log(msg, Project.MSG_DEBUG); -109 } -110 } -111 -112 @Override -113publicvoid debug(String format, Object arg) { -114if (task != null) { -115final FormattingTuple tp = MessageFormatter.format(format, arg); -116 task.log(tp.getMessage(), Project.MSG_DEBUG); -117 } -118 } -119 -120 @Override -121publicvoid debug(String format, Object arg1, Object arg2) { -122if (task != null) { -123final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); -124 task.log(tp.getMessage(), Project.MSG_DEBUG); -125 } -126 } -127 -128 @Override -129publicvoid debug(String format, Object... arguments) { -130if (task != null) { -131final FormattingTuple tp = MessageFormatter.format(format, arguments); -132 task.log(tp.getMessage(), Project.MSG_DEBUG); -133 } -134 } -135 -136 @Override -137publicvoid debug(String msg, Throwable t) { -138if (task != null) { -139 task.log(msg, t, Project.MSG_DEBUG); -140 } -141 } -142 -143 @Override -144publicboolean isInfoEnabled() { -145returntrue; -146 } -147 -148 @Override -149publicvoid info(String msg) { -150if (task != null) { -151 task.log(msg, Project.MSG_INFO); -152 } -153 } -154 -155 @Override -156publicvoid info(String format, Object arg) { -157if (task != null) { -158final FormattingTuple tp = MessageFormatter.format(format, arg); -159 task.log(tp.getMessage(), Project.MSG_INFO); -160 } -161 } -162 -163 @Override -164publicvoid info(String format, Object arg1, Object arg2) { -165if (task != null) { -166final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); -167 task.log(tp.getMessage(), Project.MSG_INFO); -168 } -169 } -170 -171 @Override -172publicvoid info(String format, Object... arguments) { -173if (task != null) { -174final FormattingTuple tp = MessageFormatter.format(format, arguments); -175 task.log(tp.getMessage(), Project.MSG_INFO); -176 } -177 } -178 -179 @Override -180publicvoid info(String msg, Throwable t) { -181if (task != null) { -182 task.log(msg, t, Project.MSG_INFO); -183 } -184 } -185 -186 @Override -187publicboolean isWarnEnabled() { -188returntrue; -189 } -190 -191 @Override -192publicvoid warn(String msg) { -193if (task != null) { -194 task.log(msg, Project.MSG_WARN); -195 } -196 } -197 -198 @Override -199publicvoid warn(String format, Object arg) { -200if (task != null) { -201final FormattingTuple tp = MessageFormatter.format(format, arg); -202 task.log(tp.getMessage(), Project.MSG_WARN); -203 } -204 } -205 -206 @Override -207publicvoid warn(String format, Object... arguments) { -208if (task != null) { -209final FormattingTuple tp = MessageFormatter.format(format, arguments); -210 task.log(tp.getMessage(), Project.MSG_WARN); -211 } -212 } -213 -214 @Override -215publicvoid warn(String format, Object arg1, Object arg2) { -216if (task != null) { -217final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); -218 task.log(tp.getMessage(), Project.MSG_WARN); -219 } -220 } -221 -222 @Override -223publicvoid warn(String msg, Throwable t) { -224if (task != null) { -225 task.log(msg, t, Project.MSG_WARN); -226 } -227 } -228 -229 @Override -230publicboolean isErrorEnabled() { -231returntrue; -232 } -233 -234 @Override -235publicvoid error(String msg) { -236if (task != null) { -237 task.log(msg, Project.MSG_ERR); -238 } -239 } -240 -241 @Override -242publicvoid error(String format, Object arg) { -243if (task != null) { -244final FormattingTuple tp = MessageFormatter.format(format, arg); -245 task.log(tp.getMessage(), Project.MSG_ERR); -246 } -247 } -248 -249 @Override -250publicvoid error(String format, Object arg1, Object arg2) { -251if (task != null) { -252final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); -253 task.log(tp.getMessage(), Project.MSG_ERR); -254 } -255 } -256 -257 @Override -258publicvoid error(String format, Object... arguments) { -259if (task != null) { -260final FormattingTuple tp = MessageFormatter.format(format, arguments); -261 task.log(tp.getMessage(), Project.MSG_ERR); -262 } -263 } -264 -265 @Override -266publicvoid error(String msg, Throwable t) { -267if (task != null) { -268 task.log(msg, t, Project.MSG_ERR); -269 } -270 } -271 } +66if (task != null) { +67 task.log(msg, Project.MSG_VERBOSE); +68 } +69 } +70 +71 @Override +72publicvoid trace(String format, Object arg) { +73if (task != null) { +74final FormattingTuple tp = MessageFormatter.format(format, arg); +75 task.log(tp.getMessage(), Project.MSG_VERBOSE); +76 } +77 } +78 +79 @Override +80publicvoid trace(String format, Object arg1, Object arg2) { +81if (task != null) { +82final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); +83 task.log(tp.getMessage(), Project.MSG_VERBOSE); +84 } +85 } +86 +87 @Override +88publicvoid trace(String format, Object... arguments) { +89if (task != null) { +90final FormattingTuple tp = MessageFormatter.format(format, arguments); +91 task.log(tp.getMessage(), Project.MSG_VERBOSE); +92 } +93 } +94 +95 @Override +96publicvoid trace(String msg, Throwable t) { +97if (task != null) { +98 task.log(msg, t, Project.MSG_VERBOSE); +99 } +100 } +101 +102 @Override +103publicboolean isDebugEnabled() { +104returntrue; +105 } +106 +107 @Override +108publicvoid debug(String msg) { +109if (task != null) { +110 task.log(msg, Project.MSG_DEBUG); +111 } +112 } +113 +114 @Override +115publicvoid debug(String format, Object arg) { +116if (task != null) { +117final FormattingTuple tp = MessageFormatter.format(format, arg); +118 task.log(tp.getMessage(), Project.MSG_DEBUG); +119 } +120 } +121 +122 @Override +123publicvoid debug(String format, Object arg1, Object arg2) { +124if (task != null) { +125final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); +126 task.log(tp.getMessage(), Project.MSG_DEBUG); +127 } +128 } +129 +130 @Override +131publicvoid debug(String format, Object... arguments) { +132if (task != null) { +133final FormattingTuple tp = MessageFormatter.format(format, arguments); +134 task.log(tp.getMessage(), Project.MSG_DEBUG); +135 } +136 } +137 +138 @Override +139publicvoid debug(String msg, Throwable t) { +140if (task != null) { +141 task.log(msg, t, Project.MSG_DEBUG); +142 } +143 } +144 +145 @Override +146publicboolean isInfoEnabled() { +147returntrue; +148 } +149 +150 @Override +151publicvoid info(String msg) { +152if (task != null) { +153 task.log(msg, Project.MSG_INFO); +154 } +155 } +156 +157 @Override +158publicvoid info(String format, Object arg) { +159if (task != null) { +160final FormattingTuple tp = MessageFormatter.format(format, arg); +161 task.log(tp.getMessage(), Project.MSG_INFO); +162 } +163 } +164 +165 @Override +166publicvoid info(String format, Object arg1, Object arg2) { +167if (task != null) { +168final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); +169 task.log(tp.getMessage(), Project.MSG_INFO); +170 } +171 } +172 +173 @Override +174publicvoid info(String format, Object... arguments) { +175if (task != null) { +176final FormattingTuple tp = MessageFormatter.format(format, arguments); +177 task.log(tp.getMessage(), Project.MSG_INFO); +178 } +179 } +180 +181 @Override +182publicvoid info(String msg, Throwable t) { +183if (task != null) { +184 task.log(msg, t, Project.MSG_INFO); +185 } +186 } +187 +188 @Override +189publicboolean isWarnEnabled() { +190returntrue; +191 } +192 +193 @Override +194publicvoid warn(String msg) { +195if (task != null) { +196 task.log(msg, Project.MSG_WARN); +197 } +198 } +199 +200 @Override +201publicvoid warn(String format, Object arg) { +202if (task != null) { +203final FormattingTuple tp = MessageFormatter.format(format, arg); +204 task.log(tp.getMessage(), Project.MSG_WARN); +205 } +206 } +207 +208 @Override +209publicvoid warn(String format, Object... arguments) { +210if (task != null) { +211final FormattingTuple tp = MessageFormatter.format(format, arguments); +212 task.log(tp.getMessage(), Project.MSG_WARN); +213 } +214 } +215 +216 @Override +217publicvoid warn(String format, Object arg1, Object arg2) { +218if (task != null) { +219final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); +220 task.log(tp.getMessage(), Project.MSG_WARN); +221 } +222 } +223 +224 @Override +225publicvoid warn(String msg, Throwable t) { +226if (task != null) { +227 task.log(msg, t, Project.MSG_WARN); +228 } +229 } +230 +231 @Override +232publicboolean isErrorEnabled() { +233returntrue; +234 } +235 +236 @Override +237publicvoid error(String msg) { +238if (task != null) { +239 task.log(msg, Project.MSG_ERR); +240 } +241 } +242 +243 @Override +244publicvoid error(String format, Object arg) { +245if (task != null) { +246final FormattingTuple tp = MessageFormatter.format(format, arg); +247 task.log(tp.getMessage(), Project.MSG_ERR); +248 } +249 } +250 +251 @Override +252publicvoid error(String format, Object arg1, Object arg2) { +253if (task != null) { +254final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); +255 task.log(tp.getMessage(), Project.MSG_ERR); +256 } +257 } +258 +259 @Override +260publicvoid error(String format, Object... arguments) { +261if (task != null) { +262final FormattingTuple tp = MessageFormatter.format(format, arguments); +263 task.log(tp.getMessage(), Project.MSG_ERR); +264 } +265 } +266 +267 @Override +268publicvoid error(String msg, Throwable t) { +269if (task != null) { +270 task.log(msg, t, Project.MSG_ERR); +271 } +272 } +273 }
    diff --git a/dependency-check-ant/xref/org/owasp/dependencycheck/ant/logging/package-frame.html b/dependency-check-ant/xref/org/owasp/dependencycheck/ant/logging/package-frame.html index 788ff8807..3acf5c0c4 100644 --- a/dependency-check-ant/xref/org/owasp/dependencycheck/ant/logging/package-frame.html +++ b/dependency-check-ant/xref/org/owasp/dependencycheck/ant/logging/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Ant Task 1.3.1 Reference Package org.owasp.dependencycheck.ant.logging + Dependency-Check Ant Task 1.3.2 Reference Package org.owasp.dependencycheck.ant.logging diff --git a/dependency-check-ant/xref/org/owasp/dependencycheck/ant/logging/package-summary.html b/dependency-check-ant/xref/org/owasp/dependencycheck/ant/logging/package-summary.html index 7fabf27be..096df1a6d 100644 --- a/dependency-check-ant/xref/org/owasp/dependencycheck/ant/logging/package-summary.html +++ b/dependency-check-ant/xref/org/owasp/dependencycheck/ant/logging/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Ant Task 1.3.1 Reference Package org.owasp.dependencycheck.ant.logging + Dependency-Check Ant Task 1.3.2 Reference Package org.owasp.dependencycheck.ant.logging diff --git a/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/Check.html b/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/Check.html index cdef482bd..48fc8e828 100644 --- a/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/Check.html +++ b/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/Check.html @@ -253,14 +253,14 @@ 245 * Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not recommended that this be turned to false. Default246 * is true.247 */ -248privateboolean autoUpdate = true; +248private Boolean autoUpdate; 249250/**251 * Get the value of autoUpdate.252 *253 * @return the value of autoUpdate254 */ -255publicboolean isAutoUpdate() { +255public Boolean isAutoUpdate() { 256return autoUpdate; 257 } 258 @@ -269,712 +269,709 @@ 261 *262 * @param autoUpdate new value of autoUpdate263 */ -264publicvoid setAutoUpdate(boolean autoUpdate) { +264publicvoid setAutoUpdate(Boolean autoUpdate) { 265this.autoUpdate = autoUpdate; 266 } 267/**268 * Whether only the update phase should be executed. -269 */ -270privateboolean updateOnly = false; -271 -272/** -273 * Get the value of updateOnly. -274 * -275 * @return the value of updateOnly -276 */ -277publicboolean isUpdateOnly() { -278return updateOnly; -279 } -280 -281/** -282 * Set the value of updateOnly. -283 * -284 * @param updateOnly new value of updateOnly -285 */ -286publicvoid setUpdateOnly(boolean updateOnly) { -287this.updateOnly = updateOnly; -288 } -289 -290/** -291 * The report format to be generated (HTML, XML, VULN, ALL). Default is HTML. -292 */ -293private String reportFormat = "HTML"; -294 -295/** -296 * Get the value of reportFormat. -297 * -298 * @return the value of reportFormat +269 * +270 * @deprecated Use the update task instead +271 */ +272 @Deprecated +273privateboolean updateOnly = false; +274 +275/** +276 * Get the value of updateOnly. +277 * +278 * @return the value of updateOnly +279 * @deprecated Use the update task instead +280 */ +281 @Deprecated +282publicboolean isUpdateOnly() { +283return updateOnly; +284 } +285 +286/** +287 * Set the value of updateOnly. +288 * +289 * @param updateOnly new value of updateOnly +290 * @deprecated Use the update task instead +291 */ +292 @Deprecated +293publicvoid setUpdateOnly(boolean updateOnly) { +294this.updateOnly = updateOnly; +295 } +296 +297/** +298 * The report format to be generated (HTML, XML, VULN, ALL). Default is HTML.299 */ -300public String getReportFormat() { -301return reportFormat; -302 } -303 -304/** -305 * Set the value of reportFormat. -306 * -307 * @param reportFormat new value of reportFormat -308 */ -309publicvoid setReportFormat(ReportFormats reportFormat) { -310this.reportFormat = reportFormat.getValue(); -311 } -312/** -313 * The path to the suppression file. -314 */ -315private String suppressionFile; -316 -317/** -318 * Get the value of suppressionFile. -319 * -320 * @return the value of suppressionFile +300private String reportFormat = "HTML"; +301 +302/** +303 * Get the value of reportFormat. +304 * +305 * @return the value of reportFormat +306 */ +307public String getReportFormat() { +308return reportFormat; +309 } +310 +311/** +312 * Set the value of reportFormat. +313 * +314 * @param reportFormat new value of reportFormat +315 */ +316publicvoid setReportFormat(ReportFormats reportFormat) { +317this.reportFormat = reportFormat.getValue(); +318 } +319/** +320 * The path to the suppression file.321 */ -322public String getSuppressionFile() { -323return suppressionFile; -324 } -325 -326/** -327 * Set the value of suppressionFile. -328 * -329 * @param suppressionFile new value of suppressionFile -330 */ -331publicvoid setSuppressionFile(String suppressionFile) { -332this.suppressionFile = suppressionFile; -333 } -334/** -335 * flag indicating whether or not to show a summary of findings. -336 */ -337privateboolean showSummary = true; -338 -339/** -340 * Get the value of showSummary. -341 * -342 * @return the value of showSummary +322private String suppressionFile; +323 +324/** +325 * Get the value of suppressionFile. +326 * +327 * @return the value of suppressionFile +328 */ +329public String getSuppressionFile() { +330return suppressionFile; +331 } +332 +333/** +334 * Set the value of suppressionFile. +335 * +336 * @param suppressionFile new value of suppressionFile +337 */ +338publicvoid setSuppressionFile(String suppressionFile) { +339this.suppressionFile = suppressionFile; +340 } +341/** +342 * flag indicating whether or not to show a summary of findings.343 */ -344publicboolean isShowSummary() { -345return showSummary; -346 } -347 -348/** -349 * Set the value of showSummary. -350 * -351 * @param showSummary new value of showSummary -352 */ -353publicvoid setShowSummary(boolean showSummary) { -354this.showSummary = showSummary; -355 } -356 -357/** -358 * Whether or not the Jar Analyzer is enabled. +344privateboolean showSummary = true; +345 +346/** +347 * Get the value of showSummary. +348 * +349 * @return the value of showSummary +350 */ +351publicboolean isShowSummary() { +352return showSummary; +353 } +354 +355/** +356 * Set the value of showSummary. +357 * +358 * @param showSummary new value of showSummary359 */ -360privateboolean jarAnalyzerEnabled = true; -361 -362/** -363 * Returns whether or not the analyzer is enabled. -364 * -365 * @return true if the analyzer is enabled +360publicvoid setShowSummary(boolean showSummary) { +361this.showSummary = showSummary; +362 } +363 +364/** +365 * Whether or not the Jar Analyzer is enabled.366 */ -367publicboolean isJarAnalyzerEnabled() { -368return jarAnalyzerEnabled; -369 } -370 -371/** -372 * Sets whether or not the analyzer is enabled. -373 * -374 * @param jarAnalyzerEnabled the value of the new setting -375 */ -376publicvoid setJarAnalyzerEnabled(boolean jarAnalyzerEnabled) { -377this.jarAnalyzerEnabled = jarAnalyzerEnabled; -378 } -379/** -380 * Whether or not the Archive Analyzer is enabled. -381 */ -382privateboolean archiveAnalyzerEnabled = true; -383 -384/** -385 * Returns whether or not the analyzer is enabled. -386 * -387 * @return true if the analyzer is enabled +367private Boolean jarAnalyzerEnabled; +368 +369/** +370 * Returns whether or not the analyzer is enabled. +371 * +372 * @return true if the analyzer is enabled +373 */ +374public Boolean isJarAnalyzerEnabled() { +375return jarAnalyzerEnabled; +376 } +377 +378/** +379 * Sets whether or not the analyzer is enabled. +380 * +381 * @param jarAnalyzerEnabled the value of the new setting +382 */ +383publicvoid setJarAnalyzerEnabled(Boolean jarAnalyzerEnabled) { +384this.jarAnalyzerEnabled = jarAnalyzerEnabled; +385 } +386/** +387 * Whether or not the Archive Analyzer is enabled.388 */ -389publicboolean isArchiveAnalyzerEnabled() { -390return archiveAnalyzerEnabled; -391 } -392/** -393 * Whether or not the .NET Assembly Analyzer is enabled. -394 */ -395privateboolean assemblyAnalyzerEnabled = true; -396 -397/** -398 * Sets whether or not the analyzer is enabled. -399 * -400 * @param archiveAnalyzerEnabled the value of the new setting +389private Boolean archiveAnalyzerEnabled; +390 +391/** +392 * Returns whether or not the analyzer is enabled. +393 * +394 * @return true if the analyzer is enabled +395 */ +396public Boolean isArchiveAnalyzerEnabled() { +397return archiveAnalyzerEnabled; +398 } +399/** +400 * Whether or not the .NET Assembly Analyzer is enabled.401 */ -402publicvoid setArchiveAnalyzerEnabled(boolean archiveAnalyzerEnabled) { -403this.archiveAnalyzerEnabled = archiveAnalyzerEnabled; -404 } -405 -406/** -407 * Returns whether or not the analyzer is enabled. -408 * -409 * @return true if the analyzer is enabled -410 */ -411publicboolean isAssemblyAnalyzerEnabled() { -412return assemblyAnalyzerEnabled; -413 } -414 -415/** -416 * Sets whether or not the analyzer is enabled. -417 * -418 * @param assemblyAnalyzerEnabled the value of the new setting -419 */ -420publicvoid setAssemblyAnalyzerEnabled(boolean assemblyAnalyzerEnabled) { -421this.assemblyAnalyzerEnabled = assemblyAnalyzerEnabled; -422 } -423/** -424 * Whether or not the .NET Nuspec Analyzer is enabled. -425 */ -426privateboolean nuspecAnalyzerEnabled = true; -427 -428/** -429 * Returns whether or not the analyzer is enabled. -430 * -431 * @return true if the analyzer is enabled +402private Boolean assemblyAnalyzerEnabled; +403 +404/** +405 * Sets whether or not the analyzer is enabled. +406 * +407 * @param archiveAnalyzerEnabled the value of the new setting +408 */ +409publicvoid setArchiveAnalyzerEnabled(Boolean archiveAnalyzerEnabled) { +410this.archiveAnalyzerEnabled = archiveAnalyzerEnabled; +411 } +412 +413/** +414 * Returns whether or not the analyzer is enabled. +415 * +416 * @return true if the analyzer is enabled +417 */ +418public Boolean isAssemblyAnalyzerEnabled() { +419return assemblyAnalyzerEnabled; +420 } +421 +422/** +423 * Sets whether or not the analyzer is enabled. +424 * +425 * @param assemblyAnalyzerEnabled the value of the new setting +426 */ +427publicvoid setAssemblyAnalyzerEnabled(Boolean assemblyAnalyzerEnabled) { +428this.assemblyAnalyzerEnabled = assemblyAnalyzerEnabled; +429 } +430/** +431 * Whether or not the .NET Nuspec Analyzer is enabled.432 */ -433publicboolean isNuspecAnalyzerEnabled() { -434return nuspecAnalyzerEnabled; -435 } -436 -437/** -438 * Sets whether or not the analyzer is enabled. -439 * -440 * @param nuspecAnalyzerEnabled the value of the new setting -441 */ -442publicvoid setNuspecAnalyzerEnabled(boolean nuspecAnalyzerEnabled) { -443this.nuspecAnalyzerEnabled = nuspecAnalyzerEnabled; -444 } -445/** -446 * Whether or not the PHP Composer Analyzer is enabled. -447 */ -448privateboolean composerAnalyzerEnabled = true; -449 -450/** -451 * Get the value of composerAnalyzerEnabled. -452 * -453 * @return the value of composerAnalyzerEnabled +433private Boolean nuspecAnalyzerEnabled; +434 +435/** +436 * Returns whether or not the analyzer is enabled. +437 * +438 * @return true if the analyzer is enabled +439 */ +440public Boolean isNuspecAnalyzerEnabled() { +441return nuspecAnalyzerEnabled; +442 } +443 +444/** +445 * Sets whether or not the analyzer is enabled. +446 * +447 * @param nuspecAnalyzerEnabled the value of the new setting +448 */ +449publicvoid setNuspecAnalyzerEnabled(Boolean nuspecAnalyzerEnabled) { +450this.nuspecAnalyzerEnabled = nuspecAnalyzerEnabled; +451 } +452/** +453 * Whether or not the PHP Composer Analyzer is enabled.454 */ -455publicboolean isComposerAnalyzerEnabled() { -456return composerAnalyzerEnabled; -457 } -458 -459/** -460 * Set the value of composerAnalyzerEnabled. -461 * -462 * @param composerAnalyzerEnabled new value of composerAnalyzerEnabled -463 */ -464publicvoid setComposerAnalyzerEnabled(boolean composerAnalyzerEnabled) { -465this.composerAnalyzerEnabled = composerAnalyzerEnabled; -466 } -467/** -468 * Whether the autoconf analyzer should be enabled. -469 */ -470privateboolean autoconfAnalyzerEnabled = true; -471 -472/** -473 * Get the value of autoconfAnalyzerEnabled. -474 * -475 * @return the value of autoconfAnalyzerEnabled +455private Boolean composerAnalyzerEnabled; +456 +457/** +458 * Get the value of composerAnalyzerEnabled. +459 * +460 * @return the value of composerAnalyzerEnabled +461 */ +462public Boolean isComposerAnalyzerEnabled() { +463return composerAnalyzerEnabled; +464 } +465 +466/** +467 * Set the value of composerAnalyzerEnabled. +468 * +469 * @param composerAnalyzerEnabled new value of composerAnalyzerEnabled +470 */ +471publicvoid setComposerAnalyzerEnabled(Boolean composerAnalyzerEnabled) { +472this.composerAnalyzerEnabled = composerAnalyzerEnabled; +473 } +474/** +475 * Whether the autoconf analyzer should be enabled.476 */ -477publicboolean isAutoconfAnalyzerEnabled() { -478return autoconfAnalyzerEnabled; -479 } -480 -481/** -482 * Set the value of autoconfAnalyzerEnabled. -483 * -484 * @param autoconfAnalyzerEnabled new value of autoconfAnalyzerEnabled -485 */ -486publicvoid setAutoconfAnalyzerEnabled(boolean autoconfAnalyzerEnabled) { -487this.autoconfAnalyzerEnabled = autoconfAnalyzerEnabled; -488 } -489/** -490 * Whether the CMake analyzer should be enabled. -491 */ -492privateboolean cmakeAnalyzerEnabled = true; -493 -494/** -495 * Get the value of cmakeAnalyzerEnabled. -496 * -497 * @return the value of cmakeAnalyzerEnabled +477private Boolean autoconfAnalyzerEnabled; +478 +479/** +480 * Get the value of autoconfAnalyzerEnabled. +481 * +482 * @return the value of autoconfAnalyzerEnabled +483 */ +484public Boolean isAutoconfAnalyzerEnabled() { +485return autoconfAnalyzerEnabled; +486 } +487 +488/** +489 * Set the value of autoconfAnalyzerEnabled. +490 * +491 * @param autoconfAnalyzerEnabled new value of autoconfAnalyzerEnabled +492 */ +493publicvoid setAutoconfAnalyzerEnabled(Boolean autoconfAnalyzerEnabled) { +494this.autoconfAnalyzerEnabled = autoconfAnalyzerEnabled; +495 } +496/** +497 * Whether the CMake analyzer should be enabled.498 */ -499publicboolean isCMakeAnalyzerEnabled() { -500return cmakeAnalyzerEnabled; -501 } -502 -503/** -504 * Set the value of cmakeAnalyzerEnabled. -505 * -506 * @param cmakeAnalyzerEnabled new value of cmakeAnalyzerEnabled -507 */ -508publicvoid setCMakeAnalyzerEnabled(boolean cmakeAnalyzerEnabled) { -509this.cmakeAnalyzerEnabled = cmakeAnalyzerEnabled; -510 } -511/** -512 * Whether or not the openssl analyzer is enabled. -513 */ -514privateboolean opensslAnalyzerEnabled = true; -515 -516/** -517 * Get the value of opensslAnalyzerEnabled. -518 * -519 * @return the value of opensslAnalyzerEnabled +499private Boolean cmakeAnalyzerEnabled; +500 +501/** +502 * Get the value of cmakeAnalyzerEnabled. +503 * +504 * @return the value of cmakeAnalyzerEnabled +505 */ +506public Boolean isCMakeAnalyzerEnabled() { +507return cmakeAnalyzerEnabled; +508 } +509 +510/** +511 * Set the value of cmakeAnalyzerEnabled. +512 * +513 * @param cmakeAnalyzerEnabled new value of cmakeAnalyzerEnabled +514 */ +515publicvoid setCMakeAnalyzerEnabled(Boolean cmakeAnalyzerEnabled) { +516this.cmakeAnalyzerEnabled = cmakeAnalyzerEnabled; +517 } +518/** +519 * Whether or not the openssl analyzer is enabled.520 */ -521publicboolean isOpensslAnalyzerEnabled() { -522return opensslAnalyzerEnabled; -523 } -524 -525/** -526 * Set the value of opensslAnalyzerEnabled. -527 * -528 * @param opensslAnalyzerEnabled new value of opensslAnalyzerEnabled -529 */ -530publicvoid setOpensslAnalyzerEnabled(boolean opensslAnalyzerEnabled) { -531this.opensslAnalyzerEnabled = opensslAnalyzerEnabled; -532 } -533/** -534 * Whether or not the Node.js Analyzer is enabled. -535 */ -536privateboolean nodeAnalyzerEnabled = true; -537 -538/** -539 * Get the value of nodeAnalyzerEnabled. -540 * -541 * @return the value of nodeAnalyzerEnabled +521private Boolean opensslAnalyzerEnabled; +522 +523/** +524 * Get the value of opensslAnalyzerEnabled. +525 * +526 * @return the value of opensslAnalyzerEnabled +527 */ +528public Boolean isOpensslAnalyzerEnabled() { +529return opensslAnalyzerEnabled; +530 } +531 +532/** +533 * Set the value of opensslAnalyzerEnabled. +534 * +535 * @param opensslAnalyzerEnabled new value of opensslAnalyzerEnabled +536 */ +537publicvoid setOpensslAnalyzerEnabled(Boolean opensslAnalyzerEnabled) { +538this.opensslAnalyzerEnabled = opensslAnalyzerEnabled; +539 } +540/** +541 * Whether or not the Node.js Analyzer is enabled.542 */ -543publicboolean isNodeAnalyzerEnabled() { -544return nodeAnalyzerEnabled; -545 } -546 -547/** -548 * Set the value of nodeAnalyzerEnabled. -549 * -550 * @param nodeAnalyzerEnabled new value of nodeAnalyzerEnabled -551 */ -552publicvoid setNodeAnalyzerEnabled(boolean nodeAnalyzerEnabled) { -553this.nodeAnalyzerEnabled = nodeAnalyzerEnabled; -554 } -555/** -556 * Whether the ruby gemspec analyzer should be enabled. -557 */ -558privateboolean rubygemsAnalyzerEnabled = true; -559 -560/** -561 * Get the value of rubygemsAnalyzerEnabled. -562 * -563 * @return the value of rubygemsAnalyzerEnabled +543private Boolean nodeAnalyzerEnabled; +544 +545/** +546 * Get the value of nodeAnalyzerEnabled. +547 * +548 * @return the value of nodeAnalyzerEnabled +549 */ +550public Boolean isNodeAnalyzerEnabled() { +551return nodeAnalyzerEnabled; +552 } +553 +554/** +555 * Set the value of nodeAnalyzerEnabled. +556 * +557 * @param nodeAnalyzerEnabled new value of nodeAnalyzerEnabled +558 */ +559publicvoid setNodeAnalyzerEnabled(Boolean nodeAnalyzerEnabled) { +560this.nodeAnalyzerEnabled = nodeAnalyzerEnabled; +561 } +562/** +563 * Whether the ruby gemspec analyzer should be enabled.564 */ -565publicboolean isRubygemsAnalyzerEnabled() { -566return rubygemsAnalyzerEnabled; -567 } -568 -569/** -570 * Set the value of rubygemsAnalyzerEnabled. -571 * -572 * @param rubygemsAnalyzerEnabled new value of rubygemsAnalyzerEnabled -573 */ -574publicvoid setRubygemsAnalyzerEnabled(boolean rubygemsAnalyzerEnabled) { -575this.rubygemsAnalyzerEnabled = rubygemsAnalyzerEnabled; -576 } -577/** -578 * Whether the python package analyzer should be enabled. -579 */ -580privateboolean pyPackageAnalyzerEnabled = true; -581 -582/** -583 * Get the value of pyPackageAnalyzerEnabled. -584 * -585 * @return the value of pyPackageAnalyzerEnabled +565private Boolean rubygemsAnalyzerEnabled; +566 +567/** +568 * Get the value of rubygemsAnalyzerEnabled. +569 * +570 * @return the value of rubygemsAnalyzerEnabled +571 */ +572public Boolean isRubygemsAnalyzerEnabled() { +573return rubygemsAnalyzerEnabled; +574 } +575 +576/** +577 * Set the value of rubygemsAnalyzerEnabled. +578 * +579 * @param rubygemsAnalyzerEnabled new value of rubygemsAnalyzerEnabled +580 */ +581publicvoid setRubygemsAnalyzerEnabled(Boolean rubygemsAnalyzerEnabled) { +582this.rubygemsAnalyzerEnabled = rubygemsAnalyzerEnabled; +583 } +584/** +585 * Whether the python package analyzer should be enabled.586 */ -587publicboolean isPyPackageAnalyzerEnabled() { -588return pyPackageAnalyzerEnabled; -589 } -590 -591/** -592 * Set the value of pyPackageAnalyzerEnabled. -593 * -594 * @param pyPackageAnalyzerEnabled new value of pyPackageAnalyzerEnabled -595 */ -596publicvoid setPyPackageAnalyzerEnabled(boolean pyPackageAnalyzerEnabled) { -597this.pyPackageAnalyzerEnabled = pyPackageAnalyzerEnabled; -598 } -599 -600/** -601 * Whether the python distribution analyzer should be enabled. +587private Boolean pyPackageAnalyzerEnabled; +588 +589/** +590 * Get the value of pyPackageAnalyzerEnabled. +591 * +592 * @return the value of pyPackageAnalyzerEnabled +593 */ +594public Boolean isPyPackageAnalyzerEnabled() { +595return pyPackageAnalyzerEnabled; +596 } +597 +598/** +599 * Set the value of pyPackageAnalyzerEnabled. +600 * +601 * @param pyPackageAnalyzerEnabled new value of pyPackageAnalyzerEnabled602 */ -603privateboolean pyDistributionAnalyzerEnabled = true; -604 -605/** -606 * Get the value of pyDistributionAnalyzerEnabled. -607 * -608 * @return the value of pyDistributionAnalyzerEnabled +603publicvoid setPyPackageAnalyzerEnabled(Boolean pyPackageAnalyzerEnabled) { +604this.pyPackageAnalyzerEnabled = pyPackageAnalyzerEnabled; +605 } +606 +607/** +608 * Whether the python distribution analyzer should be enabled.609 */ -610publicboolean isPyDistributionAnalyzerEnabled() { -611return pyDistributionAnalyzerEnabled; -612 } -613 -614/** -615 * Set the value of pyDistributionAnalyzerEnabled. -616 * -617 * @param pyDistributionAnalyzerEnabled new value of pyDistributionAnalyzerEnabled -618 */ -619publicvoid setPyDistributionAnalyzerEnabled(boolean pyDistributionAnalyzerEnabled) { -620this.pyDistributionAnalyzerEnabled = pyDistributionAnalyzerEnabled; -621 } -622 -623/** -624 * Whether or not the central analyzer is enabled. +610private Boolean pyDistributionAnalyzerEnabled; +611 +612/** +613 * Get the value of pyDistributionAnalyzerEnabled. +614 * +615 * @return the value of pyDistributionAnalyzerEnabled +616 */ +617public Boolean isPyDistributionAnalyzerEnabled() { +618return pyDistributionAnalyzerEnabled; +619 } +620 +621/** +622 * Set the value of pyDistributionAnalyzerEnabled. +623 * +624 * @param pyDistributionAnalyzerEnabled new value of pyDistributionAnalyzerEnabled625 */ -626privateboolean centralAnalyzerEnabled = false; -627 -628/** -629 * Get the value of centralAnalyzerEnabled. -630 * -631 * @return the value of centralAnalyzerEnabled +626publicvoid setPyDistributionAnalyzerEnabled(Boolean pyDistributionAnalyzerEnabled) { +627this.pyDistributionAnalyzerEnabled = pyDistributionAnalyzerEnabled; +628 } +629 +630/** +631 * Whether or not the central analyzer is enabled.632 */ -633publicboolean isCentralAnalyzerEnabled() { -634return centralAnalyzerEnabled; -635 } -636 -637/** -638 * Set the value of centralAnalyzerEnabled. -639 * -640 * @param centralAnalyzerEnabled new value of centralAnalyzerEnabled -641 */ -642publicvoid setCentralAnalyzerEnabled(boolean centralAnalyzerEnabled) { -643this.centralAnalyzerEnabled = centralAnalyzerEnabled; -644 } -645 -646/** -647 * Whether or not the nexus analyzer is enabled. +633private Boolean centralAnalyzerEnabled; +634 +635/** +636 * Get the value of centralAnalyzerEnabled. +637 * +638 * @return the value of centralAnalyzerEnabled +639 */ +640public Boolean isCentralAnalyzerEnabled() { +641return centralAnalyzerEnabled; +642 } +643 +644/** +645 * Set the value of centralAnalyzerEnabled. +646 * +647 * @param centralAnalyzerEnabled new value of centralAnalyzerEnabled648 */ -649privateboolean nexusAnalyzerEnabled = true; -650 -651/** -652 * Get the value of nexusAnalyzerEnabled. -653 * -654 * @return the value of nexusAnalyzerEnabled +649publicvoid setCentralAnalyzerEnabled(Boolean centralAnalyzerEnabled) { +650this.centralAnalyzerEnabled = centralAnalyzerEnabled; +651 } +652 +653/** +654 * Whether or not the nexus analyzer is enabled.655 */ -656publicboolean isNexusAnalyzerEnabled() { -657return nexusAnalyzerEnabled; -658 } -659 -660/** -661 * Set the value of nexusAnalyzerEnabled. -662 * -663 * @param nexusAnalyzerEnabled new value of nexusAnalyzerEnabled -664 */ -665publicvoid setNexusAnalyzerEnabled(boolean nexusAnalyzerEnabled) { -666this.nexusAnalyzerEnabled = nexusAnalyzerEnabled; -667 } -668 -669/** -670 * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local). +656private Boolean nexusAnalyzerEnabled; +657 +658/** +659 * Get the value of nexusAnalyzerEnabled. +660 * +661 * @return the value of nexusAnalyzerEnabled +662 */ +663public Boolean isNexusAnalyzerEnabled() { +664return nexusAnalyzerEnabled; +665 } +666 +667/** +668 * Set the value of nexusAnalyzerEnabled. +669 * +670 * @param nexusAnalyzerEnabled new value of nexusAnalyzerEnabled671 */ -672private String nexusUrl; -673 -674/** -675 * Get the value of nexusUrl. -676 * -677 * @return the value of nexusUrl +672publicvoid setNexusAnalyzerEnabled(Boolean nexusAnalyzerEnabled) { +673this.nexusAnalyzerEnabled = nexusAnalyzerEnabled; +674 } +675 +676/** +677 * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local).678 */ -679public String getNexusUrl() { -680return nexusUrl; -681 } -682 -683/** -684 * Set the value of nexusUrl. -685 * -686 * @param nexusUrl new value of nexusUrl -687 */ -688publicvoid setNexusUrl(String nexusUrl) { -689this.nexusUrl = nexusUrl; -690 } -691/** -692 * Whether or not the defined proxy should be used when connecting to Nexus. -693 */ -694privateboolean nexusUsesProxy = true; -695 -696/** -697 * Get the value of nexusUsesProxy. -698 * -699 * @return the value of nexusUsesProxy +679private String nexusUrl; +680 +681/** +682 * Get the value of nexusUrl. +683 * +684 * @return the value of nexusUrl +685 */ +686public String getNexusUrl() { +687return nexusUrl; +688 } +689 +690/** +691 * Set the value of nexusUrl. +692 * +693 * @param nexusUrl new value of nexusUrl +694 */ +695publicvoid setNexusUrl(String nexusUrl) { +696this.nexusUrl = nexusUrl; +697 } +698/** +699 * Whether or not the defined proxy should be used when connecting to Nexus.700 */ -701publicboolean isNexusUsesProxy() { -702return nexusUsesProxy; -703 } -704 -705/** -706 * Set the value of nexusUsesProxy. -707 * -708 * @param nexusUsesProxy new value of nexusUsesProxy -709 */ -710publicvoid setNexusUsesProxy(boolean nexusUsesProxy) { -711this.nexusUsesProxy = nexusUsesProxy; -712 } -713 -714/** -715 * Additional ZIP File extensions to add analyze. This should be a comma-separated list of file extensions to treat like ZIP -716 * files. -717 */ -718private String zipExtensions; -719 -720/** -721 * Get the value of zipExtensions. -722 * -723 * @return the value of zipExtensions +701private Boolean nexusUsesProxy; +702 +703/** +704 * Get the value of nexusUsesProxy. +705 * +706 * @return the value of nexusUsesProxy +707 */ +708public Boolean isNexusUsesProxy() { +709return nexusUsesProxy; +710 } +711 +712/** +713 * Set the value of nexusUsesProxy. +714 * +715 * @param nexusUsesProxy new value of nexusUsesProxy +716 */ +717publicvoid setNexusUsesProxy(Boolean nexusUsesProxy) { +718this.nexusUsesProxy = nexusUsesProxy; +719 } +720 +721/** +722 * Additional ZIP File extensions to add analyze. This should be a comma-separated list of file extensions to treat like ZIP +723 * files.724 */ -725public String getZipExtensions() { -726return zipExtensions; -727 } -728 -729/** -730 * Set the value of zipExtensions. -731 * -732 * @param zipExtensions new value of zipExtensions -733 */ -734publicvoid setZipExtensions(String zipExtensions) { -735this.zipExtensions = zipExtensions; -736 } -737 -738/** -739 * The path to Mono for .NET assembly analysis on non-windows systems. +725private String zipExtensions; +726 +727/** +728 * Get the value of zipExtensions. +729 * +730 * @return the value of zipExtensions +731 */ +732public String getZipExtensions() { +733return zipExtensions; +734 } +735 +736/** +737 * Set the value of zipExtensions. +738 * +739 * @param zipExtensions new value of zipExtensions740 */ -741private String pathToMono; -742 -743/** -744 * Get the value of pathToMono. -745 * -746 * @return the value of pathToMono +741publicvoid setZipExtensions(String zipExtensions) { +742this.zipExtensions = zipExtensions; +743 } +744 +745/** +746 * The path to Mono for .NET assembly analysis on non-windows systems.747 */ -748public String getPathToMono() { -749return pathToMono; -750 } -751 -752/** -753 * Set the value of pathToMono. -754 * -755 * @param pathToMono new value of pathToMono -756 */ -757publicvoid setPathToMono(String pathToMono) { -758this.pathToMono = pathToMono; -759 } -760 -761 @Override -762publicvoid execute() throws BuildException { -763 dealWithReferences(); -764 validateConfiguration(); -765 populateSettings(); -766 Engine engine = null; -767try { -768 engine = new Engine(Check.class.getClassLoader()); -769if (isUpdateOnly()) { -770 log("Deprecated 'UpdateOnly' property set; please use the UpdateTask instead", Project.MSG_WARN); -771 engine.doUpdates(); -772 } else { -773try { -774for (Resource resource : path) { -775final FileProvider provider = resource.as(FileProvider.class); -776if (provider != null) { -777final File file = provider.getFile(); -778if (file != null && file.exists()) { -779 engine.scan(file); -780 } -781 } -782 } -783 -784 engine.analyzeDependencies(); -785 DatabaseProperties prop = null; -786 CveDB cve = null; -787try { -788 cve = new CveDB(); -789 cve.open(); -790 prop = cve.getDatabaseProperties(); -791 } catch (DatabaseException ex) { -792 log("Unable to retrieve DB Properties", ex, Project.MSG_DEBUG); -793 } finally { -794if (cve != null) { -795 cve.close(); -796 } -797 } -798final ReportGenerator reporter = new ReportGenerator(getProjectName(), engine.getDependencies(), engine.getAnalyzers(), prop); -799 reporter.generateReports(reportOutputDirectory, reportFormat); -800 -801if (this.failBuildOnCVSS <= 10) { -802 checkForFailure(engine.getDependencies()); -803 } -804if (this.showSummary) { -805 showSummary(engine.getDependencies()); -806 } -807 } catch (IOException ex) { -808 log("Unable to generate dependency-check report", ex, Project.MSG_DEBUG); -809thrownew BuildException("Unable to generate dependency-check report", ex); -810 } catch (Exception ex) { -811 log("An exception occurred; unable to continue task", ex, Project.MSG_DEBUG); -812thrownew BuildException("An exception occurred; unable to continue task", ex); -813 } -814 } -815 } catch (DatabaseException ex) { -816 log("Unable to connect to the dependency-check database; analysis has stopped", ex, Project.MSG_ERR); -817 } finally { -818 Settings.cleanup(true); -819if (engine != null) { -820 engine.cleanup(); +748private String pathToMono; +749 +750/** +751 * Get the value of pathToMono. +752 * +753 * @return the value of pathToMono +754 */ +755public String getPathToMono() { +756return pathToMono; +757 } +758 +759/** +760 * Set the value of pathToMono. +761 * +762 * @param pathToMono new value of pathToMono +763 */ +764publicvoid setPathToMono(String pathToMono) { +765this.pathToMono = pathToMono; +766 } +767 +768 @Override +769publicvoid execute() throws BuildException { +770 dealWithReferences(); +771 validateConfiguration(); +772 populateSettings(); +773 Engine engine = null; +774try { +775 engine = new Engine(Check.class.getClassLoader()); +776if (isUpdateOnly()) { +777 log("Deprecated 'UpdateOnly' property set; please use the UpdateTask instead", Project.MSG_WARN); +778 engine.doUpdates(); +779 } else { +780try { +781for (Resource resource : path) { +782final FileProvider provider = resource.as(FileProvider.class); +783if (provider != null) { +784final File file = provider.getFile(); +785if (file != null && file.exists()) { +786 engine.scan(file); +787 } +788 } +789 } +790 +791 engine.analyzeDependencies(); +792 DatabaseProperties prop = null; +793 CveDB cve = null; +794try { +795 cve = new CveDB(); +796 cve.open(); +797 prop = cve.getDatabaseProperties(); +798 } catch (DatabaseException ex) { +799 log("Unable to retrieve DB Properties", ex, Project.MSG_DEBUG); +800 } finally { +801if (cve != null) { +802 cve.close(); +803 } +804 } +805final ReportGenerator reporter = new ReportGenerator(getProjectName(), engine.getDependencies(), engine.getAnalyzers(), prop); +806 reporter.generateReports(reportOutputDirectory, reportFormat); +807 +808if (this.failBuildOnCVSS <= 10) { +809 checkForFailure(engine.getDependencies()); +810 } +811if (this.showSummary) { +812 showSummary(engine.getDependencies()); +813 } +814 } catch (IOException ex) { +815 log("Unable to generate dependency-check report", ex, Project.MSG_DEBUG); +816thrownew BuildException("Unable to generate dependency-check report", ex); +817 } catch (Exception ex) { +818 log("An exception occurred; unable to continue task", ex, Project.MSG_DEBUG); +819thrownew BuildException("An exception occurred; unable to continue task", ex); +820 } 821 } -822 } -823 } -824 -825/** -826 * Validate the configuration to ensure the parameters have been properly configured/initialized. -827 * -828 * @throws BuildException if the task was not configured correctly. -829 */ -830privatevoid validateConfiguration() throws BuildException { -831if (path == null) { -832thrownew BuildException("No project dependencies have been defined to analyze."); -833 } -834if (failBuildOnCVSS < 0 || failBuildOnCVSS > 11) { -835thrownew BuildException("Invalid configuration, failBuildOnCVSS must be between 0 and 11."); -836 } -837 } -838 -839/** -840 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties -841 * required to change the proxy server, port, and connection timeout. -842 */ -843 @Override -844protectedvoid populateSettings() { -845super.populateSettings(); -846 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); -847 -848if (suppressionFile != null && !suppressionFile.isEmpty()) { -849 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); -850 } -851 -852 Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled); -853 -854 Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, pyDistributionAnalyzerEnabled); -855 Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, pyPackageAnalyzerEnabled); -856 Settings.setBoolean(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, rubygemsAnalyzerEnabled); -857 Settings.setBoolean(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, opensslAnalyzerEnabled); -858 Settings.setBoolean(Settings.KEYS.ANALYZER_CMAKE_ENABLED, cmakeAnalyzerEnabled); -859 Settings.setBoolean(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, autoconfAnalyzerEnabled); -860 Settings.setBoolean(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, composerAnalyzerEnabled); -861 Settings.setBoolean(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, nodeAnalyzerEnabled); -862 -863 Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled); -864 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); -865 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); -866if (nexusUrl != null && !nexusUrl.isEmpty()) { -867 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); -868 } -869 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy); -870 Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled); -871if (zipExtensions != null && !zipExtensions.isEmpty()) { -872 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); -873 } -874 Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled); -875if (pathToMono != null && !pathToMono.isEmpty()) { -876 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); -877 } -878 } -879 -880/** -881 * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the -882 * configuration. -883 * -884 * @param dependencies the list of dependency objects -885 * @throws BuildException thrown if a CVSS score is found that is higher then the threshold set -886 */ -887privatevoid checkForFailure(List<Dependency> dependencies) throws BuildException { -888final StringBuilder ids = new StringBuilder(); -889for (Dependency d : dependencies) { -890for (Vulnerability v : d.getVulnerabilities()) { -891if (v.getCvssScore() >= failBuildOnCVSS) { -892if (ids.length() == 0) { -893 ids.append(v.getName()); -894 } else { -895 ids.append(", ").append(v.getName()); -896 } -897 } -898 } -899 } -900if (ids.length() > 0) { -901final String msg = String.format("%n%nDependency-Check Failure:%n" -902 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" -903 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); -904thrownew BuildException(msg); -905 } -906 } -907 -908/** -909 * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. -910 * -911 * @param dependencies a list of dependency objects -912 */ -913privatevoid showSummary(List<Dependency> dependencies) { -914final StringBuilder summary = new StringBuilder(); -915for (Dependency d : dependencies) { -916boolean firstEntry = true; -917final StringBuilder ids = new StringBuilder(); -918for (Vulnerability v : d.getVulnerabilities()) { -919if (firstEntry) { -920 firstEntry = false; -921 } else { -922 ids.append(", "); -923 } -924 ids.append(v.getName()); -925 } -926if (ids.length() > 0) { -927 summary.append(d.getFileName()).append(" ("); -928 firstEntry = true; -929for (Identifier id : d.getIdentifiers()) { -930if (firstEntry) { -931 firstEntry = false; -932 } else { -933 summary.append(", "); -934 } -935 summary.append(id.getValue()); -936 } -937 summary.append(") : ").append(ids).append(NEW_LINE); -938 } -939 } -940if (summary.length() > 0) { -941final String msg = String.format("%n%n" -942 + "One or more dependencies were identified with known vulnerabilities:%n%n%s" -943 + "%n%nSee the dependency-check report for more details.%n%n", summary.toString()); -944 log(msg, Project.MSG_WARN); -945 } -946 } -947 -948/** -949 * An enumeration of supported report formats: "ALL", "HTML", "XML", "VULN", etc.. -950 */ -951publicstaticclassReportFormatsextends EnumeratedAttribute { -952 -953/** -954 * Returns the list of values for the report format. -955 * -956 * @return the list of values for the report format -957 */ -958 @Override -959public String[] getValues() { -960int i = 0; -961final Format[] formats = Format.values(); -962final String[] values = new String[formats.length]; -963for (Format format : formats) { -964 values[i++] = format.name(); -965 } -966return values; -967 } -968 } -969 } +822 } catch (DatabaseException ex) { +823 log("Unable to connect to the dependency-check database; analysis has stopped", ex, Project.MSG_ERR); +824 } finally { +825 Settings.cleanup(true); +826if (engine != null) { +827 engine.cleanup(); +828 } +829 } +830 } +831 +832/** +833 * Validate the configuration to ensure the parameters have been properly configured/initialized. +834 * +835 * @throws BuildException if the task was not configured correctly. +836 */ +837privatevoid validateConfiguration() throws BuildException { +838if (path == null) { +839thrownew BuildException("No project dependencies have been defined to analyze."); +840 } +841if (failBuildOnCVSS < 0 || failBuildOnCVSS > 11) { +842thrownew BuildException("Invalid configuration, failBuildOnCVSS must be between 0 and 11."); +843 } +844 } +845 +846/** +847 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties +848 * required to change the proxy server, port, and connection timeout. +849 * +850 * @throws BuildException thrown when an invalid setting is configured. +851 */ +852 @Override +853protectedvoid populateSettings() throws BuildException { +854super.populateSettings(); +855 Settings.setBooleanIfNotNull(Settings.KEYS.AUTO_UPDATE, autoUpdate); +856 Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); +857 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled); +858 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, pyDistributionAnalyzerEnabled); +859 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, pyPackageAnalyzerEnabled); +860 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, rubygemsAnalyzerEnabled); +861 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, opensslAnalyzerEnabled); +862 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CMAKE_ENABLED, cmakeAnalyzerEnabled); +863 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, autoconfAnalyzerEnabled); +864 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, composerAnalyzerEnabled); +865 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, nodeAnalyzerEnabled); +866 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled); +867 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); +868 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); +869 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled); +870 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled); +871 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); +872 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy); +873 Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); +874 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); +875 } +876 +877/** +878 * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the +879 * configuration. +880 * +881 * @param dependencies the list of dependency objects +882 * @throws BuildException thrown if a CVSS score is found that is higher then the threshold set +883 */ +884privatevoid checkForFailure(List<Dependency> dependencies) throws BuildException { +885final StringBuilder ids = new StringBuilder(); +886for (Dependency d : dependencies) { +887for (Vulnerability v : d.getVulnerabilities()) { +888if (v.getCvssScore() >= failBuildOnCVSS) { +889if (ids.length() == 0) { +890 ids.append(v.getName()); +891 } else { +892 ids.append(", ").append(v.getName()); +893 } +894 } +895 } +896 } +897if (ids.length() > 0) { +898final String msg = String.format("%n%nDependency-Check Failure:%n" +899 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" +900 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); +901thrownew BuildException(msg); +902 } +903 } +904 +905/** +906 * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. +907 * +908 * @param dependencies a list of dependency objects +909 */ +910privatevoid showSummary(List<Dependency> dependencies) { +911final StringBuilder summary = new StringBuilder(); +912for (Dependency d : dependencies) { +913boolean firstEntry = true; +914final StringBuilder ids = new StringBuilder(); +915for (Vulnerability v : d.getVulnerabilities()) { +916if (firstEntry) { +917 firstEntry = false; +918 } else { +919 ids.append(", "); +920 } +921 ids.append(v.getName()); +922 } +923if (ids.length() > 0) { +924 summary.append(d.getFileName()).append(" ("); +925 firstEntry = true; +926for (Identifier id : d.getIdentifiers()) { +927if (firstEntry) { +928 firstEntry = false; +929 } else { +930 summary.append(", "); +931 } +932 summary.append(id.getValue()); +933 } +934 summary.append(") : ").append(ids).append(NEW_LINE); +935 } +936 } +937if (summary.length() > 0) { +938final String msg = String.format("%n%n" +939 + "One or more dependencies were identified with known vulnerabilities:%n%n%s" +940 + "%n%nSee the dependency-check report for more details.%n%n", summary.toString()); +941 log(msg, Project.MSG_WARN); +942 } +943 } +944 +945/** +946 * An enumeration of supported report formats: "ALL", "HTML", "XML", "VULN", etc.. +947 */ +948publicstaticclassReportFormatsextends EnumeratedAttribute { +949 +950/** +951 * Returns the list of values for the report format. +952 * +953 * @return the list of values for the report format +954 */ +955 @Override +956public String[] getValues() { +957int i = 0; +958final Format[] formats = Format.values(); +959final String[] values = new String[formats.length]; +960for (Format format : formats) { +961 values[i++] = format.name(); +962 } +963return values; +964 } +965 } +966 }
    diff --git a/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/Update.html b/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/Update.html index 015f73e1c..534c484e9 100644 --- a/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/Update.html +++ b/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/Update.html @@ -366,79 +366,83 @@ 358 } 359360/** -361 * Executes the update by initializing the settings, downloads the NVD XML data, and then processes the data storing it in the -362 * local database. -363 * -364 * @throws BuildException thrown if a connection to the local database cannot be made. -365 */ -366 @Override -367publicvoid execute() throws BuildException { -368 populateSettings(); -369 Engine engine = null; -370try { -371 engine = new Engine(Update.class.getClassLoader()); -372 engine.doUpdates(); -373 } catch (DatabaseException ex) { -374thrownew BuildException("Unable to connect to the dependency-check database; unable to update the NVD data", ex); -375 } finally { -376 Settings.cleanup(true); -377if (engine != null) { -378 engine.cleanup(); -379 } -380 } +361 * The number of hours to wait before re-checking for updates. +362 */ +363private Integer cveValidForHours; +364 +365/** +366 * Get the value of cveValidForHours. +367 * +368 * @return the value of cveValidForHours +369 */ +370public Integer getCveValidForHours() { +371return cveValidForHours; +372 } +373 +374/** +375 * Set the value of cveValidForHours. +376 * +377 * @param cveValidForHours new value of cveValidForHours +378 */ +379publicvoid setCveValidForHours(Integer cveValidForHours) { +380this.cveValidForHours = cveValidForHours; 381 } 382383/** -384 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties -385 * required to change the proxy server, port, and connection timeout. -386 */ -387 @Override -388protectedvoid populateSettings() { -389super.populateSettings(); -390if (proxyServer != null && !proxyServer.isEmpty()) { -391 Settings.setString(Settings.KEYS.PROXY_SERVER, proxyServer); -392 } -393if (proxyPort != null && !proxyPort.isEmpty()) { -394 Settings.setString(Settings.KEYS.PROXY_PORT, proxyPort); -395 } -396if (proxyUsername != null && !proxyUsername.isEmpty()) { -397 Settings.setString(Settings.KEYS.PROXY_USERNAME, proxyUsername); -398 } -399if (proxyPassword != null && !proxyPassword.isEmpty()) { -400 Settings.setString(Settings.KEYS.PROXY_PASSWORD, proxyPassword); -401 } -402if (connectionTimeout != null && !connectionTimeout.isEmpty()) { -403 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); -404 } -405if (databaseDriverName != null && !databaseDriverName.isEmpty()) { -406 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); -407 } -408if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) { -409 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); -410 } -411if (connectionString != null && !connectionString.isEmpty()) { -412 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString); -413 } -414if (databaseUser != null && !databaseUser.isEmpty()) { -415 Settings.setString(Settings.KEYS.DB_USER, databaseUser); -416 } -417if (databasePassword != null && !databasePassword.isEmpty()) { -418 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword); -419 } -420if (cveUrl12Modified != null && !cveUrl12Modified.isEmpty()) { -421 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); -422 } -423if (cveUrl20Modified != null && !cveUrl20Modified.isEmpty()) { -424 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); -425 } -426if (cveUrl12Base != null && !cveUrl12Base.isEmpty()) { -427 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); -428 } -429if (cveUrl20Base != null && !cveUrl20Base.isEmpty()) { -430 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); -431 } -432 } -433 } +384 * Executes the update by initializing the settings, downloads the NVD XML data, and then processes the data storing it in the +385 * local database. +386 * +387 * @throws BuildException thrown if a connection to the local database cannot be made. +388 */ +389 @Override +390publicvoid execute() throws BuildException { +391 populateSettings(); +392 Engine engine = null; +393try { +394 engine = new Engine(Update.class.getClassLoader()); +395 engine.doUpdates(); +396 } catch (DatabaseException ex) { +397thrownew BuildException("Unable to connect to the dependency-check database; unable to update the NVD data", ex); +398 } finally { +399 Settings.cleanup(true); +400if (engine != null) { +401 engine.cleanup(); +402 } +403 } +404 } +405 +406/** +407 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties +408 * required to change the proxy server, port, and connection timeout. +409 * +410 * @throws BuildException thrown when an invalid setting is configured. +411 */ +412 @Override +413protectedvoid populateSettings() throws BuildException { +414super.populateSettings(); +415 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_SERVER, proxyServer); +416 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PORT, proxyPort); +417 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_USERNAME, proxyUsername); +418 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PASSWORD, proxyPassword); +419 Settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); +420 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); +421 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); +422 Settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString); +423 Settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser); +424 Settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword); +425 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); +426 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); +427 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); +428 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); +429if (cveValidForHours != null) { +430if (cveValidForHours >= 0) { +431 Settings.setInt(Settings.KEYS.CVE_CHECK_VALID_FOR_HOURS, cveValidForHours); +432 } else { +433thrownew BuildException("Invalid setting: `cpeValidForHours` must be 0 or greater"); +434 } +435 } +436 } +437 }
    diff --git a/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/package-frame.html b/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/package-frame.html index f36830a4b..5f0f48d23 100644 --- a/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/package-frame.html +++ b/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Ant Task 1.3.1 Reference Package org.owasp.dependencycheck.taskdefs + Dependency-Check Ant Task 1.3.2 Reference Package org.owasp.dependencycheck.taskdefs diff --git a/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/package-summary.html b/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/package-summary.html index ca92fefe3..e179223bd 100644 --- a/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/package-summary.html +++ b/dependency-check-ant/xref/org/owasp/dependencycheck/taskdefs/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Ant Task 1.3.1 Reference Package org.owasp.dependencycheck.taskdefs + Dependency-Check Ant Task 1.3.2 Reference Package org.owasp.dependencycheck.taskdefs diff --git a/dependency-check-ant/xref/org/slf4j/impl/package-frame.html b/dependency-check-ant/xref/org/slf4j/impl/package-frame.html index 51a09d78d..9477818e1 100644 --- a/dependency-check-ant/xref/org/slf4j/impl/package-frame.html +++ b/dependency-check-ant/xref/org/slf4j/impl/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Ant Task 1.3.1 Reference Package org.slf4j.impl + Dependency-Check Ant Task 1.3.2 Reference Package org.slf4j.impl diff --git a/dependency-check-ant/xref/org/slf4j/impl/package-summary.html b/dependency-check-ant/xref/org/slf4j/impl/package-summary.html index 4a4ba09ea..c023ef7ec 100644 --- a/dependency-check-ant/xref/org/slf4j/impl/package-summary.html +++ b/dependency-check-ant/xref/org/slf4j/impl/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Ant Task 1.3.1 Reference Package org.slf4j.impl + Dependency-Check Ant Task 1.3.2 Reference Package org.slf4j.impl diff --git a/dependency-check-ant/xref/overview-frame.html b/dependency-check-ant/xref/overview-frame.html index c50148da8..86637ddab 100644 --- a/dependency-check-ant/xref/overview-frame.html +++ b/dependency-check-ant/xref/overview-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Ant Task 1.3.1 Reference + Dependency-Check Ant Task 1.3.2 Reference diff --git a/dependency-check-ant/xref/overview-summary.html b/dependency-check-ant/xref/overview-summary.html index 6405d6a2d..f60649829 100644 --- a/dependency-check-ant/xref/overview-summary.html +++ b/dependency-check-ant/xref/overview-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Ant Task 1.3.1 Reference + Dependency-Check Ant Task 1.3.2 Reference @@ -24,7 +24,7 @@ -

    Dependency-Check Ant Task 1.3.1 Reference

    +

    Dependency-Check Ant Task 1.3.2 Reference

    diff --git a/dependency-check-cli/apidocs/allclasses-frame.html b/dependency-check-cli/apidocs/allclasses-frame.html index 783aa1b47..95ea8a7ce 100644 --- a/dependency-check-cli/apidocs/allclasses-frame.html +++ b/dependency-check-cli/apidocs/allclasses-frame.html @@ -2,10 +2,10 @@ - + -All Classes (Dependency-Check Command Line 1.3.1 API) - +All Classes (Dependency-Check Command Line 1.3.2 API) + @@ -15,6 +15,7 @@
  • App
  • CliParser
  • CliParser.ARGUMENT
  • +
  • InvalidScanPathException
  • diff --git a/dependency-check-cli/apidocs/allclasses-noframe.html b/dependency-check-cli/apidocs/allclasses-noframe.html index d93d85284..092bdd8d0 100644 --- a/dependency-check-cli/apidocs/allclasses-noframe.html +++ b/dependency-check-cli/apidocs/allclasses-noframe.html @@ -2,10 +2,10 @@ - + -All Classes (Dependency-Check Command Line 1.3.1 API) - +All Classes (Dependency-Check Command Line 1.3.2 API) + @@ -15,6 +15,7 @@
  • App
  • CliParser
  • CliParser.ARGUMENT
  • +
  • InvalidScanPathException
  • diff --git a/dependency-check-cli/apidocs/constant-values.html b/dependency-check-cli/apidocs/constant-values.html index 6c2c34731..b9f48a2ad 100644 --- a/dependency-check-cli/apidocs/constant-values.html +++ b/dependency-check-cli/apidocs/constant-values.html @@ -2,16 +2,16 @@ - + -Constant Field Values (Dependency-Check Command Line 1.3.1 API) - +Constant Field Values (Dependency-Check Command Line 1.3.2 API) + @@ -161,82 +161,96 @@ + + + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -559,6 +580,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/deprecated-list.html b/dependency-check-cli/apidocs/deprecated-list.html index b1e575611..3c8ecf1ab 100644 --- a/dependency-check-cli/apidocs/deprecated-list.html +++ b/dependency-check-cli/apidocs/deprecated-list.html @@ -2,16 +2,16 @@ - + -Deprecated List (Dependency-Check Command Line 1.3.1 API) - +Deprecated List (Dependency-Check Command Line 1.3.2 API) + @@ -144,6 +144,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/help-doc.html b/dependency-check-cli/apidocs/help-doc.html index ada5702b7..26720b24d 100644 --- a/dependency-check-cli/apidocs/help-doc.html +++ b/dependency-check-cli/apidocs/help-doc.html @@ -2,16 +2,16 @@ - + -API Help (Dependency-Check Command Line 1.3.1 API) - +API Help (Dependency-Check Command Line 1.3.2 API) + @@ -211,6 +211,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/index-all.html b/dependency-check-cli/apidocs/index-all.html index 967632d64..757bbe4ce 100644 --- a/dependency-check-cli/apidocs/index-all.html +++ b/dependency-check-cli/apidocs/index-all.html @@ -2,16 +2,16 @@ - + -Index (Dependency-Check Command Line 1.3.1 API) - +Index (Dependency-Check Command Line 1.3.2 API) + @@ -139,6 +139,10 @@
    The CLI argument name for setting the URL for the CVE Data Files.
    +
    CVE_VALID_FOR_HOURS - Static variable in class org.owasp.dependencycheck.CliParser.ARGUMENT
    +
    +
    The CLI argument name for setting the location of the suppression file.
    +
    @@ -189,6 +193,10 @@
    Disables the Autoconf Analyzer.
    +
    DISABLE_BUNDLE_AUDIT - Static variable in class org.owasp.dependencycheck.CliParser.ARGUMENT
    +
    +
    Disables the Ruby Bundler Audit Analyzer.
    +
    DISABLE_CENTRAL - Static variable in class org.owasp.dependencycheck.CliParser.ARGUMENT
    Disables the Central Analyzer.
    @@ -273,6 +281,10 @@
    Returns the connection timeout.
    +
    getCveValidForHours() - Method in class org.owasp.dependencycheck.CliParser
    +
    +
    Get the value of cveValidForHours.
    +
    getDatabaseDriverName() - Method in class org.owasp.dependencycheck.CliParser
    Returns the database driver name if specified; otherwise null is returned.
    @@ -309,6 +321,10 @@
    Returns the url to the nexus server if one was specified.
    +
    getPathToBundleAudit() - Method in class org.owasp.dependencycheck.CliParser
    +
    +
    Returns the path to bundle-audit for Ruby bundle analysis.
    +
    getPathToMono() - Method in class org.owasp.dependencycheck.CliParser
    Returns the path to Mono for .NET Assembly analysis on non-windows systems.
    @@ -381,6 +397,26 @@

    I

    +
    InvalidScanPathException - Exception in org.owasp.dependencycheck
    +
    +
    Thrown if an invalid path is encountered.
    +
    +
    InvalidScanPathException() - Constructor for exception org.owasp.dependencycheck.InvalidScanPathException
    +
    +
    Creates a new InvalidScanPathException.
    +
    +
    InvalidScanPathException(String) - Constructor for exception org.owasp.dependencycheck.InvalidScanPathException
    +
    +
    Creates a new InvalidScanPathException.
    +
    +
    InvalidScanPathException(Throwable) - Constructor for exception org.owasp.dependencycheck.InvalidScanPathException
    +
    +
    Creates a new InvalidScanPathException.
    +
    +
    InvalidScanPathException(String, Throwable) - Constructor for exception org.owasp.dependencycheck.InvalidScanPathException
    +
    +
    Creates a new InvalidScanPathException.
    +
    isArchiveDisabled() - Method in class org.owasp.dependencycheck.CliParser
    Returns true if the disableArchive command line argument was specified.
    @@ -397,6 +433,10 @@
    Checks if the auto update feature has been disabled.
    +
    isBundleAuditDisabled() - Method in class org.owasp.dependencycheck.CliParser
    +
    +
    Returns true if the disableBundleAudit command line argument was specified.
    +
    isCentralDisabled() - Method in class org.owasp.dependencycheck.CliParser
    Returns true if the disableCentral command line argument was specified.
    @@ -525,6 +565,10 @@
    Parses the arguments passed in and captures the results for later use.
    +
    PATH_TO_BUNDLE_AUDIT - Static variable in class org.owasp.dependencycheck.CliParser.ARGUMENT
    +
    +
    The CLI argument name for setting the path to bundle-audit for Ruby bundle analysis.
    +
    PATH_TO_MONO - Static variable in class org.owasp.dependencycheck.CliParser.ARGUMENT
    The CLI argument name for setting the path to mono for .NET Assembly analysis on non-windows systems.
    @@ -686,6 +730,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/index.html b/dependency-check-cli/apidocs/index.html index def3885c1..fac952dac 100644 --- a/dependency-check-cli/apidocs/index.html +++ b/dependency-check-cli/apidocs/index.html @@ -2,9 +2,9 @@ - + -Dependency-Check Command Line 1.3.1 API +Dependency-Check Command Line 1.3.2 API @@ -295,6 +295,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/org/owasp/dependencycheck/CliParser.ARGUMENT.html b/dependency-check-cli/apidocs/org/owasp/dependencycheck/CliParser.ARGUMENT.html index 14cb8a97a..aa8a984d4 100644 --- a/dependency-check-cli/apidocs/org/owasp/dependencycheck/CliParser.ARGUMENT.html +++ b/dependency-check-cli/apidocs/org/owasp/dependencycheck/CliParser.ARGUMENT.html @@ -2,16 +2,16 @@ - + -CliParser.ARGUMENT (Dependency-Check Command Line 1.3.1 API) - +CliParser.ARGUMENT (Dependency-Check Command Line 1.3.2 API) + @@ -37,7 +37,7 @@
    + + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + - + - + - + - + - + - + - + - + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
    "cveUrl20Modified"
    + +public static final StringCVE_VALID_FOR_HOURS"cveValidForHours"
    public static final String DATA_DIRECTORY "data"
    public static final String DATA_DIRECTORY_SHORT "d"
    public static final String DB_DRIVER "dbDriverName"
    public static final String DB_DRIVER_PATH "dbDriverPath"
    public static final String DB_NAME "dbUser"
    public static final String DB_PASSWORD "dbPassword"
    public static final String DISABLE_ARCHIVE "disableArchive"
    public static final String DISABLE_ASSEMBLY "disableAssembly"
    public static final String DISABLE_AUTO_UPDATE "noupdate"
    public static final String DISABLE_AUTO_UPDATE_SHORT "n"
    public static final String DISABLE_AUTOCONF "disableAutoconf"
    + +public static final StringDISABLE_BUNDLE_AUDIT"disableBundleAudit"
    @@ -378,132 +392,139 @@ "f"
    + +public static final StringPATH_TO_BUNDLE_AUDIT"bundleAudit"
    public static final String PATH_TO_MONO "mono"
    public static final String PROJECT "project"
    public static final String PROP "propertyfile"
    public static final String PROP_SHORT "P"
    public static final String PROXY_PASSWORD "proxypass"
    public static final String PROXY_PORT "proxyport"
    public static final String PROXY_SERVER "proxyserver"
    public static final String PROXY_URL "proxyurl"
    public static final String PROXY_USERNAME "proxyuser"
    public static final String PURGE_NVD "purge"
    public static final String SCAN "scan"
    public static final String SCAN_SHORT "s"
    public static final String SUPPRESSION_FILE "suppression"
    public static final String SYM_LINK_DEPTH "symLink"
    public static final String UPDATE_ONLY "updateonly"
    public static final String VERBOSE_LOG "log"
    public static final String VERBOSE_LOG_SHORT "l"
    public static final String VERSION "version"
    public static final String static StringCVE_VALID_FOR_HOURS +
    The CLI argument name for setting the location of the suppression file.
    +
    static String DATA_DIRECTORY
    The CLI argument name for setting the location of the data directory.
    static String DATA_DIRECTORY_SHORT
    The short CLI argument name for setting the location of the data directory.
    static String DB_DRIVER
    The CLI argument name for setting the database driver name.
    static String DB_DRIVER_PATH
    The CLI argument name for setting the path to the database driver; in case it is not on the class path.
    static String DB_NAME
    The CLI argument name for setting the database user name.
    static String DB_PASSWORD
    The CLI argument name for setting the database password.
    static String DISABLE_ARCHIVE
    Disables the Archive Analyzer.
    static String DISABLE_ASSEMBLY
    Disables the Assembly Analyzer.
    static String DISABLE_AUTO_UPDATE
    The long CLI argument name specifying that the CPE/CVE/etc.
    static String DISABLE_AUTO_UPDATE_SHORT
    The short CLI argument name specifying that the CPE/CVE/etc.
    static String DISABLE_AUTOCONF
    Disables the Autoconf Analyzer.
    static StringDISABLE_BUNDLE_AUDIT +
    Disables the Ruby Bundler Audit Analyzer.
    +
    static String DISABLE_CENTRAL @@ -379,47 +391,53 @@ extends static StringPATH_TO_BUNDLE_AUDIT +
    The CLI argument name for setting the path to bundle-audit for Ruby bundle analysis.
    +
    static String PATH_TO_MONO
    The CLI argument name for setting the path to mono for .NET Assembly analysis on non-windows systems.
    static String PROJECT
    The long CLI argument name specifying the name of the project to be scanned.
    static String PROP
    The CLI argument name for setting the location of an additional properties file.
    static String PROP_SHORT
    The short CLI argument name for setting the location of an additional properties file.
    static String PROXY_PASSWORD
    The CLI argument name indicating the proxy password.
    static String PROXY_PORT
    The CLI argument name indicating the proxy port.
    static String PROXY_SERVER
    The CLI argument name indicating the proxy server.
    static String PROXY_URL
    Deprecated.  @@ -427,67 +445,67 @@ extends +
    static String PROXY_USERNAME
    The CLI argument name indicating the proxy username.
    static String PURGE_NVD
    The long CLI argument name specifying that only the update phase should be executed; no scan should be run.
    static String SCAN
    The long CLI argument name specifying the directory/file to scan.
    static String SCAN_SHORT
    The short CLI argument name specifying the directory/file to scan.
    static String SUPPRESSION_FILE
    The CLI argument name for setting the location of the suppression file.
    static String SYM_LINK_DEPTH
    The CLI argument name for setting the depth of symbolic links that will be followed.
    static String UPDATE_ONLY
    The long CLI argument name specifying that only the update phase should be executed; no scan should be run.
    static String VERBOSE_LOG
    The CLI argument name for setting the location of the data directory.
    static String VERBOSE_LOG_SHORT
    The short CLI argument name for setting the location of the data directory.
    static String VERSION
    The short CLI argument name asking for the version.
    static String VERSION_SHORT
    The long CLI argument name asking for the version.
    @@ -953,6 +971,17 @@ public static final See Also:
    Constant Field Values
    + + + +
      +
    • +

      CVE_VALID_FOR_HOURS

      +
      public static final String CVE_VALID_FOR_HOURS
      +
      The CLI argument name for setting the location of the suppression file.
      +
      See Also:
      Constant Field Values
      +
    • +
    @@ -1052,6 +1081,17 @@ public static final See Also:
    Constant Field Values
    + + + +
      +
    • +

      DISABLE_BUNDLE_AUDIT

      +
      public static final String DISABLE_BUNDLE_AUDIT
      +
      Disables the Ruby Bundler Audit Analyzer.
      +
      See Also:
      Constant Field Values
      +
    • +
    @@ -1209,7 +1249,7 @@ public static final  - @@ -1260,7 +1311,7 @@ public static final 
    IntegergetCveValidForHours() +
    Get the value of cveValidForHours.
    +
    String getDatabaseDriverName()
    Returns the database driver name if specified; otherwise null is returned.
    String getDatabaseDriverPath()
    Returns the database driver path if specified; otherwise null is returned.
    String getDatabasePassword()
    Returns the database database password if specified; otherwise null is returned.
    String getDatabaseUser()
    Returns the database database user name if specified; otherwise null is returned.
    String getDataDirectory()
    Get the value of dataDirectory.
    String[] getExcludeList()
    Retrieves the list of excluded file patterns specified by the 'exclude' argument.
    String getModifiedCve12Url()
    Returns the URL for the modified CVE 1.2 XMl file.
    String getModifiedCve20Url()
    Returns the URL for the modified CVE 2.0 XMl file.
    String getNexusUrl()
    Returns the url to the nexus server if one was specified.
    StringgetPathToBundleAudit() +
    Returns the path to bundle-audit for Ruby bundle analysis.
    +
    String getPathToMono() @@ -345,119 +357,125 @@ extends booleanisBundleAuditDisabled() +
    Returns true if the disableBundleAudit command line argument was specified.
    +
    boolean isCentralDisabled()
    Returns true if the disableCentral command line argument was specified.
    boolean isCmakeDisabled()
    Returns true if the disableCmake command line argument was specified.
    boolean isComposerDisabled()
    Returns true if the disableComposer command line argument was specified.
    boolean isGetHelp()
    Determines if the 'help' command line argument was passed in.
    boolean isGetVersion()
    Determines if the 'version' command line argument was passed in.
    boolean isJarDisabled()
    Returns true if the disableJar command line argument was specified.
    boolean isNexusDisabled()
    Returns true if the disableNexus command line argument was specified.
    boolean isNexusUsesProxy()
    Returns true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false is returned.
    boolean isNodeJsDisabled()
    Returns true if the disableNodeJS command line argument was specified.
    boolean isNuspecDisabled()
    Returns true if the disableNuspec command line argument was specified.
    boolean isOpenSSLDisabled()
    Returns true if the disableOpenSSL command line argument was specified.
    boolean isPurge()
    Checks if the purge NVD flag has been set.
    boolean isPythonDistributionDisabled()
    Returns true if the disablePyDist command line argument was specified.
    boolean isPythonPackageDisabled()
    Returns true if the disablePyPkg command line argument was specified.
    boolean isRubyGemspecDisabled()
    Returns whether the Ruby gemspec analyzer is disabled.
    boolean isRunScan()
    Determines if the 'scan' command line argument was passed in.
    boolean isUpdateOnly()
    Checks if the update only flag has been set.
    void parse(String[] args)
    Parses the arguments passed in and captures the results for later use.
    void printHelp()
    Displays the command line help message to the standard output.
    void printVersionInfo()
    @@ -607,6 +625,17 @@ extends Returns:
    true if the disableAssembly command line argument was specified; otherwise false
    +
    + + +
      +
    • +

      isBundleAuditDisabled

      +
      public boolean isBundleAuditDisabled()
      +
      Returns true if the disableBundleAudit command line argument was specified.
      +
      Returns:
      true if the disableBundleAudit command line argument was specified; otherwise false
      +
    • +
    @@ -793,6 +822,17 @@ extends Returns:
    the path to Mono
    +
    + + +
      +
    • +

      getPathToBundleAudit

      +
      public String getPathToBundleAudit()
      +
      Returns the path to bundle-audit for Ruby bundle analysis.
      +
      Returns:
      the path to Mono
      +
    • +
    @@ -1062,7 +1102,7 @@ extends - @@ -1136,6 +1187,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/org/owasp/dependencycheck/InvalidScanPathException.html b/dependency-check-cli/apidocs/org/owasp/dependencycheck/InvalidScanPathException.html new file mode 100644 index 000000000..18d2c7d80 --- /dev/null +++ b/dependency-check-cli/apidocs/org/owasp/dependencycheck/InvalidScanPathException.html @@ -0,0 +1,306 @@ + + + + + + +InvalidScanPathException (Dependency-Check Command Line 1.3.2 API) + + + + + + + +
    + + + +
    +
    org.owasp.dependencycheck
    +

    Class InvalidScanPathException

    +
    +
    + +
    +
      +
    • +
      +
      All Implemented Interfaces:
      +
      Serializable
      +
      +
      +
      +
      public class InvalidScanPathException
      +extends Exception
      +
      Thrown if an invalid path is encountered.
      +
      Author:
      +
      Jeremy Long
      +
      See Also:
      Serialized Form
      +
    • +
    +
    +
    + +
    +
    +
      +
    • + +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          InvalidScanPathException

          +
          public InvalidScanPathException()
          +
          Creates a new InvalidScanPathException.
          +
        • +
        + + + +
          +
        • +

          InvalidScanPathException

          +
          public InvalidScanPathException(String msg)
          +
          Creates a new InvalidScanPathException.
          +
          Parameters:
          msg - a message for the exception
          +
        • +
        + + + +
          +
        • +

          InvalidScanPathException

          +
          public InvalidScanPathException(Throwable ex)
          +
          Creates a new InvalidScanPathException.
          +
          Parameters:
          ex - the cause of the exception
          +
        • +
        + + + +
          +
        • +

          InvalidScanPathException

          +
          public InvalidScanPathException(String msg,
          +                        Throwable ex)
          +
          Creates a new InvalidScanPathException.
          +
          Parameters:
          msg - a message for the exception
          ex - the cause of the exception
          +
        • +
        +
      • +
      +
    • +
    +
    +
    + + + + + +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    + + diff --git a/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/App.html b/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/App.html index 7f9875f42..c7c864f74 100644 --- a/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/App.html +++ b/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/App.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.App (Dependency-Check Command Line 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.App (Dependency-Check Command Line 1.3.2 API) + @@ -110,6 +110,6 @@
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/CliParser.ARGUMENT.html b/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/CliParser.ARGUMENT.html index 6449a06db..68bd8b5b0 100644 --- a/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/CliParser.ARGUMENT.html +++ b/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/CliParser.ARGUMENT.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.CliParser.ARGUMENT (Dependency-Check Command Line 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.CliParser.ARGUMENT (Dependency-Check Command Line 1.3.2 API) + @@ -110,6 +110,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/CliParser.html b/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/CliParser.html index 60bc422b6..3881e1048 100644 --- a/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/CliParser.html +++ b/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/CliParser.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.CliParser (Dependency-Check Command Line 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.CliParser (Dependency-Check Command Line 1.3.2 API) + @@ -110,6 +110,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/InvalidScanPathException.html b/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/InvalidScanPathException.html new file mode 100644 index 000000000..23ce84029 --- /dev/null +++ b/dependency-check-cli/apidocs/org/owasp/dependencycheck/class-use/InvalidScanPathException.html @@ -0,0 +1,115 @@ + + + + + + +Uses of Class org.owasp.dependencycheck.InvalidScanPathException (Dependency-Check Command Line 1.3.2 API) + + + + + + + + + + +
    +

    Uses of Class
    org.owasp.dependencycheck.InvalidScanPathException

    +
    +
    No usage of org.owasp.dependencycheck.InvalidScanPathException
    + + + + +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    + + diff --git a/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-frame.html b/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-frame.html index c213883bf..b4f702317 100644 --- a/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-frame.html +++ b/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck (Dependency-Check Command Line 1.3.1 API) - +org.owasp.dependencycheck (Dependency-Check Command Line 1.3.2 API) + @@ -17,6 +17,10 @@
  • CliParser
  • CliParser.ARGUMENT
  • +

    Exceptions

    + diff --git a/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-summary.html b/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-summary.html index 251a79838..c32ada197 100644 --- a/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-summary.html +++ b/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck (Dependency-Check Command Line 1.3.1 API) - +org.owasp.dependencycheck (Dependency-Check Command Line 1.3.2 API) + @@ -100,6 +100,23 @@
    +
  • + + + + + + + + + + + + +
    Exception Summary 
    ExceptionDescription
    InvalidScanPathException +
    Thrown if an invalid path is encountered.
    +
    +
  • @@ -151,6 +168,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-tree.html b/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-tree.html index cabf20061..7eac383b8 100644 --- a/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-tree.html +++ b/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck Class Hierarchy (Dependency-Check Command Line 1.3.1 API) - +org.owasp.dependencycheck Class Hierarchy (Dependency-Check Command Line 1.3.2 API) + @@ -73,6 +73,15 @@
  • org.owasp.dependencycheck.App
  • org.owasp.dependencycheck.CliParser
  • org.owasp.dependencycheck.CliParser.ARGUMENT
  • +
  • java.lang.Throwable (implements java.io.Serializable) + +
  • @@ -121,6 +130,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-use.html b/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-use.html index 9b5505317..7dd53364d 100644 --- a/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-use.html +++ b/dependency-check-cli/apidocs/org/owasp/dependencycheck/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck (Dependency-Check Command Line 1.3.1 API) - +Uses of Package org.owasp.dependencycheck (Dependency-Check Command Line 1.3.2 API) + @@ -110,6 +110,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/overview-tree.html b/dependency-check-cli/apidocs/overview-tree.html index f8276f3d0..7e131ff7e 100644 --- a/dependency-check-cli/apidocs/overview-tree.html +++ b/dependency-check-cli/apidocs/overview-tree.html @@ -2,16 +2,16 @@ - + -Class Hierarchy (Dependency-Check Command Line 1.3.1 API) - +Class Hierarchy (Dependency-Check Command Line 1.3.2 API) + @@ -77,6 +77,15 @@
  • org.owasp.dependencycheck.App
  • org.owasp.dependencycheck.CliParser
  • org.owasp.dependencycheck.CliParser.ARGUMENT
  • +
  • java.lang.Throwable (implements java.io.Serializable) + +
  • @@ -125,6 +134,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-cli/apidocs/serialized-form.html b/dependency-check-cli/apidocs/serialized-form.html new file mode 100644 index 000000000..96b9ab2d6 --- /dev/null +++ b/dependency-check-cli/apidocs/serialized-form.html @@ -0,0 +1,132 @@ + + + + + + +Serialized Form (Dependency-Check Command Line 1.3.2 API) + + + + + + + +
    + + + + + +
    + + +
    +

    Serialized Form

    +
    +
    + +
    + +
    + + + + + +
    + + +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    + + diff --git a/dependency-check-cli/arguments.html b/dependency-check-cli/arguments.html index bb8de8213..0f18bda9f 100644 --- a/dependency-check-cli/arguments.html +++ b/dependency-check-cli/arguments.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Command Line Arguments @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -326,6 +326,19 @@ Print the version information. +Optional + + + + + + +--cveValidForHours + +<hours> + +The number of hours to wait before checking for new updates from the NVD. The default is 4 hours. + Optional @@ -360,7 +373,7 @@ URL for the modified CVE 1.2 -http://nvd.nist.gov/download/nvdcve-modified.xml +https://nvd.nist.gov/download/nvdcve-Modified.xml.gz @@ -373,7 +386,7 @@ URL for the modified CVE 2.0 -http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-modified.xml +https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-Modified.xml.gz @@ -386,7 +399,7 @@ Base URL for each year’s CVE 1.2, the %d will be replaced with the year -http://nvd.nist.gov/download/nvdcve-%d.xml +https://nvd.nist.gov/download/nvdcve-%d.xml.gz @@ -399,7 +412,7 @@ Base URL for each year’s CVE 2.0, the %d will be replaced with the year -http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml +https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml.gz @@ -484,6 +497,19 @@ +--disableBundleAudit + + + +Sets whether the Ruby Bundler Audit Analyzer will be used. + +false + + + + + + --disableAutoconf @@ -493,7 +519,7 @@ false - + @@ -506,7 +532,7 @@ false - + @@ -519,7 +545,7 @@ false - + @@ -532,7 +558,7 @@ false - + @@ -545,7 +571,7 @@   - + @@ -558,7 +584,7 @@ false - + @@ -571,7 +597,7 @@ false - + @@ -584,7 +610,7 @@ false - + @@ -597,7 +623,7 @@ false - + @@ -610,7 +636,7 @@   - + @@ -623,7 +649,7 @@ true - + @@ -636,7 +662,7 @@ false - + @@ -649,7 +675,7 @@ false - + @@ -659,6 +685,19 @@ The path to Mono for .NET Assembly analysis on non-windows systems. +  + + + + + + +--bundleAudit + + + +The path to the bundle-audit executable. +   diff --git a/dependency-check-cli/checkstyle.html b/dependency-check-cli/checkstyle.html index b66b2c661..a681146a3 100644 --- a/dependency-check-cli/checkstyle.html +++ b/dependency-check-cli/checkstyle.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Checkstyle Results @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -240,7 +240,7 @@

    Checkstyle Results

    -

    The following document contains the results of Checkstyle 6.2 with C:\Users\jeremy\Projects\DependencyCheck\dependency-check-cli/../src/main/config/checkstyle-checks.xml ruleset. rss feed

    +

    The following document contains the results of Checkstyle 6.11.2 with C:\Users\jeremy\Projects\DependencyCheck\dependency-check-cli/../src/main/config/checkstyle-checks.xml ruleset. rss feed

    Summary

    @@ -253,10 +253,25 @@ -
    8 0 01
    +3

    Details

    +

    org/owasp/dependencycheck/App.java

    + + + + + + + + + + + + +
    SeverityCategoryRuleMessageLine
     ErrorimportsUnusedImportsUnused import - org.apache.commons.lang.StringUtils.30
    +

    org/owasp/dependencycheck/CliParser.java

    @@ -269,8 +284,14 @@ - -
     Error sizes MethodCountTotal number of methods is 59 (max allowed is 40).42
    +Total number of methods is 62 (max allowed is 40). +42 + + Error +regexp +RegexpSingleline +Line matches the illegal pattern '\s+$'. +347 diff --git a/dependency-check-cli/checkstyle.rss b/dependency-check-cli/checkstyle.rss index 4b1c9e99e..56bb0a6f9 100644 --- a/dependency-check-cli/checkstyle.rss +++ b/dependency-check-cli/checkstyle.rss @@ -26,7 +26,7 @@ under the License. ©2012 - 2015 OWASP File: 8, - Errors: 1, + Errors: 3, Warnings: 0, Infos: 0 @@ -55,7 +55,7 @@ under the License. 0 - 0 + 1 @@ -111,7 +111,7 @@ under the License. 0 - 1 + 2 diff --git a/dependency-check-cli/cobertura/frame-sourcefiles-org.owasp.dependencycheck.html b/dependency-check-cli/cobertura/frame-sourcefiles-org.owasp.dependencycheck.html index a1268042d..bdff2550a 100644 --- a/dependency-check-cli/cobertura/frame-sourcefiles-org.owasp.dependencycheck.html +++ b/dependency-check-cli/cobertura/frame-sourcefiles-org.owasp.dependencycheck.html @@ -18,7 +18,7 @@ org.owasp.dependencycheck App (10%) -CliParser (56%) +CliParser (54%) InvalidScanPathException (0%) diff --git a/dependency-check-cli/cobertura/frame-sourcefiles.html b/dependency-check-cli/cobertura/frame-sourcefiles.html index e4b8dec7c..a74894257 100644 --- a/dependency-check-cli/cobertura/frame-sourcefiles.html +++ b/dependency-check-cli/cobertura/frame-sourcefiles.html @@ -18,7 +18,7 @@ All Packages App (10%) -CliParser (56%) +CliParser (54%) InvalidScanPathException (0%) diff --git a/dependency-check-cli/cobertura/frame-summary-org.owasp.dependencycheck.html b/dependency-check-cli/cobertura/frame-summary-org.owasp.dependencycheck.html index 3f681e1dc..4d8a1096a 100644 --- a/dependency-check-cli/cobertura/frame-summary-org.owasp.dependencycheck.html +++ b/dependency-check-cli/cobertura/frame-summary-org.owasp.dependencycheck.html @@ -16,7 +16,7 @@ - +
    Package # Classes Line Coverage Branch Coverage Complexity
    org.owasp.dependencycheck4
    30%
    148/485
    15%
    50/324
    3.282
    org.owasp.dependencycheck4
    31%
    154/492
    19%
    56/284
    2.946
    - + diff --git a/dependency-check-cli/cobertura/frame-summary.html b/dependency-check-cli/cobertura/frame-summary.html index ec535537e..ee4e9ffae 100644 --- a/dependency-check-cli/cobertura/frame-summary.html +++ b/dependency-check-cli/cobertura/frame-summary.html @@ -16,8 +16,8 @@ - - + +
    Package # Classes Line Coverage Branch Coverage Complexity
    All Packages4
    30%
    148/485
    15%
    50/324
    3.282
    org.owasp.dependencycheck4
    30%
    148/485
    15%
    50/324
    3.282
    All Packages4
    31%
    154/492
    19%
    56/284
    2.946
    org.owasp.dependencycheck4
    31%
    154/492
    19%
    56/284
    2.946
    - + diff --git a/dependency-check-cli/cobertura/org.owasp.dependencycheck.App.html b/dependency-check-cli/cobertura/org.owasp.dependencycheck.App.html index df8df144e..00da5a41d 100644 --- a/dependency-check-cli/cobertura/org.owasp.dependencycheck.App.html +++ b/dependency-check-cli/cobertura/org.owasp.dependencycheck.App.html @@ -12,7 +12,7 @@
     
    - +
    Classes in this File Line Coverage Branch Coverage Complexity
    App
    10%
    27/263
    6%
    10/158
    11.25
    App
    10%
    27/253
    9%
    10/104
    7.75
     
    @@ -76,618 +76,582 @@  29  
     import org.apache.commons.cli.ParseException;
     30   -
     import org.owasp.dependencycheck.data.nvdcve.CveDB;
    +
     import org.apache.commons.lang.StringUtils;
     31   -
     import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
    +
     import org.owasp.dependencycheck.data.nvdcve.CveDB;
     32   -
     import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties;
    +
     import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
     33   -
     import org.owasp.dependencycheck.dependency.Dependency;
    +
     import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties;
     34   -
     import org.apache.tools.ant.DirectoryScanner;
    +
     import org.owasp.dependencycheck.dependency.Dependency;
     35   -
     import org.owasp.dependencycheck.reporting.ReportGenerator;
    +
     import org.apache.tools.ant.DirectoryScanner;
     36   -
     import org.owasp.dependencycheck.utils.Settings;
    +
     import org.owasp.dependencycheck.reporting.ReportGenerator;
     37   -
     import org.slf4j.Logger;
    +
     import org.owasp.dependencycheck.utils.Settings;
     38   -
     import org.slf4j.LoggerFactory;
    +
     import org.slf4j.Logger;
     39   -
     import ch.qos.logback.core.FileAppender;
    +
     import org.slf4j.LoggerFactory;
     40   -
     import org.slf4j.impl.StaticLoggerBinder;
    +
     import ch.qos.logback.core.FileAppender;
     41   -
     
    +
     import org.slf4j.impl.StaticLoggerBinder;
     42   -
     /**
    +
     
     43   -
      * The command line interface for the DependencyCheck application.
    +
     /**
     44   -
      *
    +
      * The command line interface for the DependencyCheck application.
     45   -
      * @author Jeremy Long
    +
      *
     46   +
      * @author Jeremy Long
    +  47  
      */
    -  47  2
     public class App {
    -  48   -
     
    +  48  2
     public class App {
     49   -
         /**
    +
     
     50   -
          * The logger.
    +
         /**
     51   +
          * The logger.
    +  52  
          */
    -  52  1
         private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
    -  53   -
     
    +  53  1
         private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
     54   -
         /**
    +
     
     55   -
          * The main method for the application.
    +
         /**
     56   -
          *
    +
          * The main method for the application.
     57   -
          * @param args the command line arguments
    +
          *
     58   -
          */
    -  59   -
         public static void main(String[] args) {
    -  60   -
             try {
    -  61  0
                 Settings.initialize();
    -  62  0
                 final App app = new App();
    -  63  0
                 app.run(args);
    -  64   -
             } finally {
    -  65  0
                 Settings.cleanup(true);
    -  66  0
             }
    -  67  0
         }
    -  68   -
     
    -  69   -
         /**
    -  70   -
          * Main CLI entry-point into the application.
    -  71   -
          *
    -  72  
          * @param args the command line arguments
    +  59   +
          */
    +  60   +
         public static void main(String[] args) {
    +  61   +
             try {
    +  62  0
                 Settings.initialize();
    +  63  0
                 final App app = new App();
    +  64  0
                 app.run(args);
    +  65   +
             } finally {
    +  66  0
                 Settings.cleanup(true);
    +  67  0
             }
    +  68  0
         }
    +  69   +
     
    +  70   +
         /**
    +  71   +
          * Main CLI entry-point into the application.
    +  72   +
          *
     73   -
          */
    +
          * @param args the command line arguments
     74   +
          */
    +  75  
         public void run(String[] args) {
    -  75  0
             final CliParser cli = new CliParser();
    -  76   -
     
    +  76  0
             final CliParser cli = new CliParser();
     77   -
             try {
    -  78  0
                 cli.parse(args);
    -  79  0
             } catch (FileNotFoundException ex) {
    -  80  0
                 System.err.println(ex.getMessage());
    -  81  0
                 cli.printHelp();
    -  82  0
                 return;
    -  83  0
             } catch (ParseException ex) {
    -  84  0
                 System.err.println(ex.getMessage());
    -  85  0
                 cli.printHelp();
    -  86  0
                 return;
    -  87  0
             }
    -  88  
     
    -  89  0
             if (cli.getVerboseLog() != null) {
    -  90  0
                 prepareLogger(cli.getVerboseLog());
    -  91   -
             }
    +  78   +
             try {
    +  79  0
                 cli.parse(args);
    +  80  0
             } catch (FileNotFoundException ex) {
    +  81  0
                 System.err.println(ex.getMessage());
    +  82  0
                 cli.printHelp();
    +  83  0
                 return;
    +  84  0
             } catch (ParseException ex) {
    +  85  0
                 System.err.println(ex.getMessage());
    +  86  0
                 cli.printHelp();
    +  87  0
                 return;
    +  88  0
             }
    +  89   +
     
    +  90  0
             if (cli.getVerboseLog() != null) {
    +  91  0
                 prepareLogger(cli.getVerboseLog());
     92   +
             }
    +  93  
     
    -  93  0
             if (cli.isPurge()) {
    -  94  0
                 if (cli.getConnectionString() != null) {
    -  95  0
                     LOGGER.error("Unable to purge the database when using a non-default connection string");
    -  96   +  94  0
             if (cli.isPurge()) {
    +  95  0
                 if (cli.getConnectionString() != null) {
    +  96  0
                     LOGGER.error("Unable to purge the database when using a non-default connection string");
    +  97  
                 } else {
    -  97  0
                     populateSettings(cli);
    -  98   -
                     File db;
    +  98  0
                     populateSettings(cli);
     99   +
                     File db;
    +  100  
                     try {
    -  100  0
                         db = new File(Settings.getDataDirectory(), "dc.h2.db");
    -  101  0
                         if (db.exists()) {
    -  102  0
                             if (db.delete()) {
    -  103  0
                                 LOGGER.info("Database file purged; local copy of the NVD has been removed");
    -  104   +  101  0
                         db = new File(Settings.getDataDirectory(), "dc.h2.db");
    +  102  0
                         if (db.exists()) {
    +  103  0
                             if (db.delete()) {
    +  104  0
                                 LOGGER.info("Database file purged; local copy of the NVD has been removed");
    +  105  
                             } else {
    -  105  0
                                 LOGGER.error("Unable to delete '{}'; please delete the file manually", db.getAbsolutePath());
    -  106   -
                             }
    +  106  0
                                 LOGGER.error("Unable to delete '{}'; please delete the file manually", db.getAbsolutePath());
     107   +
                             }
    +  108  
                         } else {
    -  108  0
                             LOGGER.error("Unable to purge database; the database file does not exists: {}", db.getAbsolutePath());
    -  109   +  109  0
                             LOGGER.error("Unable to purge database; the database file does not exists: {}", db.getAbsolutePath());
    +  110  
                         }
    -  110  0
                     } catch (IOException ex) {
    -  111  0
                         LOGGER.error("Unable to delete the database");
    -  112  0
                     }
    -  113  0
                 }
    -  114  0
             } else if (cli.isGetVersion()) {
    -  115  0
                 cli.printVersionInfo();
    -  116  0
             } else if (cli.isUpdateOnly()) {
    -  117  0
                 populateSettings(cli);
    -  118  0
                 runUpdateOnly();
    -  119  0
             } else if (cli.isRunScan()) {
    -  120  0
                 populateSettings(cli);
    -  121   +  111  0
                     } catch (IOException ex) {
    +  112  0
                         LOGGER.error("Unable to delete the database");
    +  113  0
                     }
    +  114  0
                 }
    +  115  0
             } else if (cli.isGetVersion()) {
    +  116  0
                 cli.printVersionInfo();
    +  117  0
             } else if (cli.isUpdateOnly()) {
    +  118  0
                 populateSettings(cli);
    +  119  0
                 runUpdateOnly();
    +  120  0
             } else if (cli.isRunScan()) {
    +  121  0
                 populateSettings(cli);
    +  122  
                 try {
    -  122  0
                     runScan(cli.getReportDirectory(), cli.getReportFormat(), cli.getProjectName(), cli.getScanFiles(),
    -  123   +  123  0
                     runScan(cli.getReportDirectory(), cli.getReportFormat(), cli.getProjectName(), cli.getScanFiles(),
    +  124  
                             cli.getExcludeList(), cli.getSymLinkDepth());
    -  124  0
                 } catch (InvalidScanPathException ex) {
    -  125  0
                     LOGGER.error("An invalid scan path was detected; unable to scan '//*' paths");
    -  126  0
                 }
    -  127   +  125  0
                 } catch (InvalidScanPathException ex) {
    +  126  0
                     LOGGER.error("An invalid scan path was detected; unable to scan '//*' paths");
    +  127  0
                 }
    +  128  
             } else {
    -  128  0
                 cli.printHelp();
    -  129   +  129  0
                 cli.printHelp();
    +  130  
             }
    -  130  0
         }
    -  131   -
     
    +  131  0
         }
     132   -
         /**
    +
     
     133   -
          * Scans the specified directories and writes the dependency reports to the reportDirectory.
    +
         /**
     134   -
          *
    +
          * Scans the specified directories and writes the dependency reports to the reportDirectory.
     135   -
          * @param reportDirectory the path to the directory where the reports will be written
    +
          *
     136   -
          * @param outputFormat the output format of the report
    +
          * @param reportDirectory the path to the directory where the reports will be written
     137   -
          * @param applicationName the application name for the report
    +
          * @param outputFormat the output format of the report
     138   -
          * @param files the files/directories to scan
    +
          * @param applicationName the application name for the report
     139   -
          * @param excludes the patterns for files/directories to exclude
    +
          * @param files the files/directories to scan
     140   -
          * @param symLinkDepth the depth that symbolic links will be followed
    +
          * @param excludes the patterns for files/directories to exclude
     141   -
          *
    +
          * @param symLinkDepth the depth that symbolic links will be followed
     142   -
          * @throws InvalidScanPathException thrown if the path to scan starts with "//"
    +
          *
     143   -
          */
    +
          * @throws InvalidScanPathException thrown if the path to scan starts with "//"
     144   -
         private void runScan(String reportDirectory, String outputFormat, String applicationName, String[] files,
    +
          */
     145   +
         private void runScan(String reportDirectory, String outputFormat, String applicationName, String[] files,
    +  146  
                 String[] excludes, int symLinkDepth) throws InvalidScanPathException {
    -  146  0
             Engine engine = null;
    -  147   +  147  0
             Engine engine = null;
    +  148  
             try {
    -  148  0
                 engine = new Engine();
    -  149  0
                 final List<String> antStylePaths = new ArrayList<String>();
    -  150  0
                 for (String file : files) {
    -  151  0
                     final String antPath = ensureCanonicalPath(file);
    -  152  0
                     antStylePaths.add(antPath);
    -  153   -
                 }
    +  149  0
                 engine = new Engine();
    +  150  0
                 final List<String> antStylePaths = new ArrayList<String>();
    +  151  0
                 for (String file : files) {
    +  152  0
                     final String antPath = ensureCanonicalPath(file);
    +  153  0
                     antStylePaths.add(antPath);
     154   +
                 }
    +  155  
     
    -  155  0
                 final Set<File> paths = new HashSet<File>();
    -  156  0
                 for (String file : antStylePaths) {
    -  157  0
                     LOGGER.debug("Scanning {}", file);
    -  158  0
                     final DirectoryScanner scanner = new DirectoryScanner();
    -  159  0
                     String include = file.replace('\\', '/');
    -  160   -
                     File baseDir;
    +  156  0
                 final Set<File> paths = new HashSet<File>();
    +  157  0
                 for (String file : antStylePaths) {
    +  158  0
                     LOGGER.debug("Scanning {}", file);
    +  159  0
                     final DirectoryScanner scanner = new DirectoryScanner();
    +  160  0
                     String include = file.replace('\\', '/');
     161   +
                     File baseDir;
    +  162  
     
    -  162  0
                     if (include.startsWith("//")) {
    -  163  0
                         throw new InvalidScanPathException("Unable to scan paths specified by //");
    -  164   +  163  0
                     if (include.startsWith("//")) {
    +  164  0
                         throw new InvalidScanPathException("Unable to scan paths specified by //");
    +  165  
                     } else {
    -  165  0
                         final int pos = getLastFileSeparator(include);
    -  166  0
                         final String tmpBase = include.substring(0, pos);
    -  167  0
                         final String tmpInclude = include.substring(pos + 1);
    -  168  0
                         if (tmpInclude.indexOf('*') >= 0 || tmpInclude.indexOf('?') >= 0
    -  169   +  166  0
                         final int pos = getLastFileSeparator(include);
    +  167  0
                         final String tmpBase = include.substring(0, pos);
    +  168  0
                         final String tmpInclude = include.substring(pos + 1);
    +  169  0
                         if (tmpInclude.indexOf('*') >= 0 || tmpInclude.indexOf('?') >= 0
    +  170  
                                 || (new File(include)).isFile()) {
    -  170  0
                             baseDir = new File(tmpBase);
    -  171  0
                             include = tmpInclude;
    -  172   +  171  0
                             baseDir = new File(tmpBase);
    +  172  0
                             include = tmpInclude;
    +  173  
                         } else {
    -  173  0
                             baseDir = new File(tmpBase, tmpInclude);
    -  174  0
                             include = "**/*";
    -  175   -
                         }
    +  174  0
                             baseDir = new File(tmpBase, tmpInclude);
    +  175  0
                             include = "**/*";
     176   -
                     }
    -  177   -
                     //LOGGER.debug("baseDir: {}", baseDir);
    -  178   -
                     //LOGGER.debug("include: {}", include);
    -  179  0
                     scanner.setBasedir(baseDir);
    -  180  0
                     final String[] includes = {include};
    -  181  0
                     scanner.setIncludes(includes);
    -  182  0
                     scanner.setMaxLevelsOfSymlinks(symLinkDepth);
    -  183  0
                     if (symLinkDepth <= 0) {
    -  184  0
                         scanner.setFollowSymlinks(false);
    -  185   -
                     }
    -  186  0
                     if (excludes != null && excludes.length > 0) {
    -  187  0
                         scanner.addExcludes(excludes);
    -  188   -
                     }
    -  189  0
                     scanner.scan();
    -  190  0
                     if (scanner.getIncludedFilesCount() > 0) {
    -  191  0
                         for (String s : scanner.getIncludedFiles()) {
    -  192  0
                             final File f = new File(baseDir, s);
    -  193  0
                             LOGGER.debug("Found file {}", f.toString());
    -  194  0
                             paths.add(f);
    -  195  
                         }
    +  177   +
                     }
    +  178   +
                     //LOGGER.debug("baseDir: {}", baseDir);
    +  179   +
                     //LOGGER.debug("include: {}", include);
    +  180  0
                     scanner.setBasedir(baseDir);
    +  181  0
                     final String[] includes = {include};
    +  182  0
                     scanner.setIncludes(includes);
    +  183  0
                     scanner.setMaxLevelsOfSymlinks(symLinkDepth);
    +  184  0
                     if (symLinkDepth <= 0) {
    +  185  0
                         scanner.setFollowSymlinks(false);
    +  186   +
                     }
    +  187  0
                     if (excludes != null && excludes.length > 0) {
    +  188  0
                         scanner.addExcludes(excludes);
    +  189   +
                     }
    +  190  0
                     scanner.scan();
    +  191  0
                     if (scanner.getIncludedFilesCount() > 0) {
    +  192  0
                         for (String s : scanner.getIncludedFiles()) {
    +  193  0
                             final File f = new File(baseDir, s);
    +  194  0
                             LOGGER.debug("Found file {}", f.toString());
    +  195  0
                             paths.add(f);
     196   +
                         }
    +  197  
                     }
    -  197  0
                 }
    -  198  0
                 engine.scan(paths);
    -  199   +  198  0
                 }
    +  199  0
                 engine.scan(paths);
    +  200  
     
    -  200  0
                 engine.analyzeDependencies();
    -  201  0
                 final List<Dependency> dependencies = engine.getDependencies();
    -  202  0
                 DatabaseProperties prop = null;
    -  203  0
                 CveDB cve = null;
    -  204   +  201  0
                 engine.analyzeDependencies();
    +  202  0
                 final List<Dependency> dependencies = engine.getDependencies();
    +  203  0
                 DatabaseProperties prop = null;
    +  204  0
                 CveDB cve = null;
    +  205  
                 try {
    -  205  0
                     cve = new CveDB();
    -  206  0
                     cve.open();
    -  207  0
                     prop = cve.getDatabaseProperties();
    -  208  0
                 } catch (DatabaseException ex) {
    -  209  0
                     LOGGER.debug("Unable to retrieve DB Properties", ex);
    -  210   +  206  0
                     cve = new CveDB();
    +  207  0
                     cve.open();
    +  208  0
                     prop = cve.getDatabaseProperties();
    +  209  0
                 } catch (DatabaseException ex) {
    +  210  0
                     LOGGER.debug("Unable to retrieve DB Properties", ex);
    +  211  
                 } finally {
    -  211  0
                     if (cve != null) {
    -  212  0
                         cve.close();
    -  213   -
                     }
    +  212  0
                     if (cve != null) {
    +  213  0
                         cve.close();
     214   +
                     }
    +  215  
                 }
    -  215  0
                 final ReportGenerator report = new ReportGenerator(applicationName, dependencies, engine.getAnalyzers(), prop);
    -  216   +  216  0
                 final ReportGenerator report = new ReportGenerator(applicationName, dependencies, engine.getAnalyzers(), prop);
    +  217  
                 try {
    -  217  0
                     report.generateReports(reportDirectory, outputFormat);
    -  218  0
                 } catch (IOException ex) {
    -  219  0
                     LOGGER.error("There was an IO error while attempting to generate the report.");
    -  220  0
                     LOGGER.debug("", ex);
    -  221  0
                 } catch (Throwable ex) {
    -  222  0
                     LOGGER.error("There was an error while attempting to generate the report.");
    -  223  0
                     LOGGER.debug("", ex);
    -  224  0
                 }
    -  225  0
             } catch (DatabaseException ex) {
    -  226  0
                 LOGGER.error("Unable to connect to the dependency-check database; analysis has stopped");
    -  227  0
                 LOGGER.debug("", ex);
    -  228   +  218  0
                     report.generateReports(reportDirectory, outputFormat);
    +  219  0
                 } catch (IOException ex) {
    +  220  0
                     LOGGER.error("There was an IO error while attempting to generate the report.");
    +  221  0
                     LOGGER.debug("", ex);
    +  222  0
                 } catch (Throwable ex) {
    +  223  0
                     LOGGER.error("There was an error while attempting to generate the report.");
    +  224  0
                     LOGGER.debug("", ex);
    +  225  0
                 }
    +  226  0
             } catch (DatabaseException ex) {
    +  227  0
                 LOGGER.error("Unable to connect to the dependency-check database; analysis has stopped");
    +  228  0
                 LOGGER.debug("", ex);
    +  229  
             } finally {
    -  229  0
                 if (engine != null) {
    -  230  0
                     engine.cleanup();
    -  231   -
                 }
    +  230  0
                 if (engine != null) {
    +  231  0
                     engine.cleanup();
     232   +
                 }
    +  233  
             }
    -  233  0
         }
    -  234   -
     
    +  234  0
         }
     235   -
         /**
    +
     
     236   -
          * Only executes the update phase of dependency-check.
    +
         /**
     237   -
          */
    +
          * Only executes the update phase of dependency-check.
     238   +
          */
    +  239  
         private void runUpdateOnly() {
    -  239  0
             Engine engine = null;
    -  240   +  240  0
             Engine engine = null;
    +  241  
             try {
    -  241  0
                 engine = new Engine();
    -  242  0
                 engine.doUpdates();
    -  243  0
             } catch (DatabaseException ex) {
    -  244  0
                 LOGGER.error("Unable to connect to the dependency-check database; analysis has stopped");
    -  245  0
                 LOGGER.debug("", ex);
    -  246   +  242  0
                 engine = new Engine();
    +  243  0
                 engine.doUpdates();
    +  244  0
             } catch (DatabaseException ex) {
    +  245  0
                 LOGGER.error("Unable to connect to the dependency-check database; analysis has stopped");
    +  246  0
                 LOGGER.debug("", ex);
    +  247  
             } finally {
    -  247  0
                 if (engine != null) {
    -  248  0
                     engine.cleanup();
    -  249   -
                 }
    +  248  0
                 if (engine != null) {
    +  249  0
                     engine.cleanup();
     250   +
                 }
    +  251  
             }
    -  251  0
         }
    -  252   -
     
    +  252  0
         }
     253   -
         /**
    +
     
     254   -
          * Updates the global Settings.
    +
         /**
     255   -
          *
    +
          * Updates the global Settings.
     256   -
          * @param cli a reference to the CLI Parser that contains the command line arguments used to set the corresponding settings in
    +
          *
     257   -
          * the core engine.
    +
          * @param cli a reference to the CLI Parser that contains the command line arguments used to set the corresponding settings in
     258   -
          */
    +
          * the core engine.
     259   -
         private void populateSettings(CliParser cli) {
    +
          */
     260   +
         private void populateSettings(CliParser cli) {
    +  261  
     
    -  261  0
             final boolean autoUpdate = cli.isAutoUpdate();
    -  262  0
             final String connectionTimeout = cli.getConnectionTimeout();
    -  263  0
             final String proxyServer = cli.getProxyServer();
    -  264  0
             final String proxyPort = cli.getProxyPort();
    -  265  0
             final String proxyUser = cli.getProxyUsername();
    -  266  0
             final String proxyPass = cli.getProxyPassword();
    -  267  0
             final String dataDirectory = cli.getDataDirectory();
    -  268  0
             final File propertiesFile = cli.getPropertiesFile();
    -  269  0
             final String suppressionFile = cli.getSuppressionFile();
    -  270  0
             final String nexusUrl = cli.getNexusUrl();
    -  271  0
             final String databaseDriverName = cli.getDatabaseDriverName();
    -  272  0
             final String databaseDriverPath = cli.getDatabaseDriverPath();
    -  273  0
             final String connectionString = cli.getConnectionString();
    -  274  0
             final String databaseUser = cli.getDatabaseUser();
    -  275  0
             final String databasePassword = cli.getDatabasePassword();
    -  276  0
             final String additionalZipExtensions = cli.getAdditionalZipExtensions();
    -  277  0
             final String pathToMono = cli.getPathToMono();
    -  278  0
             final String cveMod12 = cli.getModifiedCve12Url();
    -  279  0
             final String cveMod20 = cli.getModifiedCve20Url();
    -  280  0
             final String cveBase12 = cli.getBaseCve12Url();
    -  281  0
             final String cveBase20 = cli.getBaseCve20Url();
    -  282   -
     
    -  283  0
             if (propertiesFile != null) {
    +  262  0
             final boolean autoUpdate = cli.isAutoUpdate();
    +  263  0
             final String connectionTimeout = cli.getConnectionTimeout();
    +  264  0
             final String proxyServer = cli.getProxyServer();
    +  265  0
             final String proxyPort = cli.getProxyPort();
    +  266  0
             final String proxyUser = cli.getProxyUsername();
    +  267  0
             final String proxyPass = cli.getProxyPassword();
    +  268  0
             final String dataDirectory = cli.getDataDirectory();
    +  269  0
             final File propertiesFile = cli.getPropertiesFile();
    +  270  0
             final String suppressionFile = cli.getSuppressionFile();
    +  271  0
             final String nexusUrl = cli.getNexusUrl();
    +  272  0
             final String databaseDriverName = cli.getDatabaseDriverName();
    +  273  0
             final String databaseDriverPath = cli.getDatabaseDriverPath();
    +  274  0
             final String connectionString = cli.getConnectionString();
    +  275  0
             final String databaseUser = cli.getDatabaseUser();
    +  276  0
             final String databasePassword = cli.getDatabasePassword();
    +  277  0
             final String additionalZipExtensions = cli.getAdditionalZipExtensions();
    +  278  0
             final String pathToMono = cli.getPathToMono();
    +  279  0
             final String cveMod12 = cli.getModifiedCve12Url();
    +  280  0
             final String cveMod20 = cli.getModifiedCve20Url();
    +  281  0
             final String cveBase12 = cli.getBaseCve12Url();
    +  282  0
             final String cveBase20 = cli.getBaseCve20Url();
    +  283  0
             final Integer cveValidForHours = cli.getCveValidForHours();
     284   +
     
    +  285  0
             if (propertiesFile != null) {
    +  286  
                 try {
    -  285  0
                     Settings.mergeProperties(propertiesFile);
    -  286  0
                 } catch (FileNotFoundException ex) {
    -  287  0
                     LOGGER.error("Unable to load properties file '{}'", propertiesFile.getPath());
    -  288  0
                     LOGGER.debug("", ex);
    -  289  0
                 } catch (IOException ex) {
    -  290  0
                     LOGGER.error("Unable to find properties file '{}'", propertiesFile.getPath());
    -  291  0
                     LOGGER.debug("", ex);
    -  292  0
                 }
    -  293   -
             }
    -  294   -
             // We have to wait until we've merged the properties before attempting to set whether we use
    +  287  0
                     Settings.mergeProperties(propertiesFile);
    +  288  0
                 } catch (FileNotFoundException ex) {
    +  289  0
                     LOGGER.error("Unable to load properties file '{}'", propertiesFile.getPath());
    +  290  0
                     LOGGER.debug("", ex);
    +  291  0
                 } catch (IOException ex) {
    +  292  0
                     LOGGER.error("Unable to find properties file '{}'", propertiesFile.getPath());
    +  293  0
                     LOGGER.debug("", ex);
    +  294  0
                 }
     295   -
             // the proxy for Nexus since it could be disabled in the properties, but not explicitly stated
    +
             }
     296   +
             // We have to wait until we've merged the properties before attempting to set whether we use
    +  297   +
             // the proxy for Nexus since it could be disabled in the properties, but not explicitly stated
    +  298  
             // on the command line
    -  297  0
             final boolean nexusUsesProxy = cli.isNexusUsesProxy();
    -  298  0
             if (dataDirectory != null) {
    -  299  0
                 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory);
    -  300  0
             } else if (System.getProperty("basedir") != null) {
    -  301  0
                 final File dataDir = new File(System.getProperty("basedir"), "data");
    -  302  0
                 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath());
    -  303  0
             } else {
    -  304  0
                 final File jarPath = new File(App.class.getProtectionDomain().getCodeSource().getLocation().getPath());
    -  305  0
                 final File base = jarPath.getParentFile();
    -  306  0
                 final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY);
    -  307  0
                 final File dataDir = new File(base, sub);
    -  308  0
                 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath());
    -  309   +  299  0
             final boolean nexusUsesProxy = cli.isNexusUsesProxy();
    +  300  0
             if (dataDirectory != null) {
    +  301  0
                 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory);
    +  302  0
             } else if (System.getProperty("basedir") != null) {
    +  303  0
                 final File dataDir = new File(System.getProperty("basedir"), "data");
    +  304  0
                 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath());
    +  305  0
             } else {
    +  306  0
                 final File jarPath = new File(App.class.getProtectionDomain().getCodeSource().getLocation().getPath());
    +  307  0
                 final File base = jarPath.getParentFile();
    +  308  0
                 final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY);
    +  309  0
                 final File dataDir = new File(base, sub);
    +  310  0
                 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath());
    +  311  
             }
    -  310  0
             Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate);
    -  311  0
             if (proxyServer != null && !proxyServer.isEmpty()) {
    -  312  0
                 Settings.setString(Settings.KEYS.PROXY_SERVER, proxyServer);
    -  313   -
             }
    -  314  0
             if (proxyPort != null && !proxyPort.isEmpty()) {
    -  315  0
                 Settings.setString(Settings.KEYS.PROXY_PORT, proxyPort);
    -  316   -
             }
    -  317  0
             if (proxyUser != null && !proxyUser.isEmpty()) {
    -  318  0
                 Settings.setString(Settings.KEYS.PROXY_USERNAME, proxyUser);
    -  319   -
             }
    -  320  0
             if (proxyPass != null && !proxyPass.isEmpty()) {
    -  321  0
                 Settings.setString(Settings.KEYS.PROXY_PASSWORD, proxyPass);
    -  322   -
             }
    -  323  0
             if (connectionTimeout != null && !connectionTimeout.isEmpty()) {
    -  324  0
                 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout);
    -  325   -
             }
    -  326  0
             if (suppressionFile != null && !suppressionFile.isEmpty()) {
    -  327  0
                 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile);
    -  328   -
             }
    -  329   +  312  0
             Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate);
    +  313  0
             Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_SERVER, proxyServer);
    +  314  0
             Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PORT, proxyPort);
    +  315  0
             Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_USERNAME, proxyUser);
    +  316  0
             Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PASSWORD, proxyPass);
    +  317  0
             Settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout);
    +  318  0
             Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile);
    +  319  0
             Settings.setIntIfNotNull(Settings.KEYS.CVE_CHECK_VALID_FOR_HOURS, cveValidForHours);
    +  320  
     
    -  330   +  321  
             //File Type Analyzer Settings
    -  331  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, !cli.isJarDisabled());
    -  332  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, !cli.isArchiveDisabled());
    -  333  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, !cli.isPythonDistributionDisabled());
    -  334  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, !cli.isPythonPackageDisabled());
    -  335  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, !cli.isAutoconfDisabled());
    -  336  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_CMAKE_ENABLED, !cli.isCmakeDisabled());
    -  337  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, !cli.isNuspecDisabled());
    -  338  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, !cli.isAssemblyDisabled());
    -  339  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, !cli.isOpenSSLDisabled());
    -  340  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, !cli.isComposerDisabled());
    -  341  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, !cli.isNodeJsDisabled());
    -  342  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, !cli.isRubyGemspecDisabled());
    -  343   +  322  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, !cli.isJarDisabled());
    +  323  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, !cli.isArchiveDisabled());
    +  324  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, !cli.isPythonDistributionDisabled());
    +  325  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, !cli.isPythonPackageDisabled());
    +  326  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, !cli.isAutoconfDisabled());
    +  327  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_CMAKE_ENABLED, !cli.isCmakeDisabled());
    +  328  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, !cli.isNuspecDisabled());
    +  329  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, !cli.isAssemblyDisabled());
    +  330  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_ENABLED, !cli.isBundleAuditDisabled());
    +  331  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, !cli.isOpenSSLDisabled());
    +  332  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, !cli.isComposerDisabled());
    +  333  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, !cli.isNodeJsDisabled());
    +  334  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, !cli.isRubyGemspecDisabled());
    +  335  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, !cli.isCentralDisabled());
    +  336  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, !cli.isNexusDisabled());
    +  337  
     
    -  344  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, !cli.isCentralDisabled());
    -  345  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, !cli.isNexusDisabled());
    -  346  0
             if (nexusUrl != null && !nexusUrl.isEmpty()) {
    -  347  0
                 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
    -  348   +  338  0
             Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_PATH, cli.getPathToBundleAudit());
    +  339  0
             Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
    +  340  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy);
    +  341  0
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName);
    +  342  0
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath);
    +  343  0
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString);
    +  344  0
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser);
    +  345  0
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword);
    +  346  0
             Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, additionalZipExtensions);
    +  347  0
             Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono);
    +  348  0
             if (cveBase12 != null && !cveBase12.isEmpty()) {
    +  349  0
                 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveBase12);
    +  350  0
                 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveBase20);
    +  351  0
                 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveMod12);
    +  352  0
                 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveMod20);
    +  353  
             }
    -  349  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy);
    -  350  0
             if (databaseDriverName != null && !databaseDriverName.isEmpty()) {
    -  351  0
                 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName);
    -  352   -
             }
    -  353  0
             if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) {
    -  354  0
                 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath);
    +  354  0
         }
     355   -
             }
    -  356  0
             if (connectionString != null && !connectionString.isEmpty()) {
    -  357  0
                 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString);
    -  358   -
             }
    -  359  0
             if (databaseUser != null && !databaseUser.isEmpty()) {
    -  360  0
                 Settings.setString(Settings.KEYS.DB_USER, databaseUser);
    -  361   -
             }
    -  362  0
             if (databasePassword != null && !databasePassword.isEmpty()) {
    -  363  0
                 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword);
    -  364   -
             }
    -  365  0
             if (additionalZipExtensions != null && !additionalZipExtensions.isEmpty()) {
    -  366  0
                 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, additionalZipExtensions);
    -  367   -
             }
    -  368  0
             if (pathToMono != null && !pathToMono.isEmpty()) {
    -  369  0
                 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono);
    -  370   -
             }
    -  371  0
             if (cveBase12 != null && !cveBase12.isEmpty()) {
    -  372  0
                 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveBase12);
    -  373  0
                 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveBase20);
    -  374  0
                 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveMod12);
    -  375  0
                 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveMod20);
    -  376   -
             }
    -  377  0
         }
    -  378  
     
    -  379   +  356  
         /**
    -  380   +  357  
          * Creates a file appender and adds it to logback.
    -  381   +  358  
          *
    -  382   +  359  
          * @param verboseLog the path to the verbose log file
    -  383   +  360  
          */
    -  384   +  361  
         private void prepareLogger(String verboseLog) {
    -  385  0
             final StaticLoggerBinder loggerBinder = StaticLoggerBinder.getSingleton();
    -  386  0
             final LoggerContext context = (LoggerContext) loggerBinder.getLoggerFactory();
    +  362  0
             final StaticLoggerBinder loggerBinder = StaticLoggerBinder.getSingleton();
    +  363  0
             final LoggerContext context = (LoggerContext) loggerBinder.getLoggerFactory();
    +  364   +
     
    +  365  0
             final PatternLayoutEncoder encoder = new PatternLayoutEncoder();
    +  366  0
             encoder.setPattern("%d %C:%L%n%-5level - %msg%n");
    +  367  0
             encoder.setContext(context);
    +  368  0
             encoder.start();
    +  369  0
             final FileAppender fa = new FileAppender();
    +  370  0
             fa.setAppend(true);
    +  371  0
             fa.setEncoder(encoder);
    +  372  0
             fa.setContext(context);
    +  373  0
             fa.setFile(verboseLog);
    +  374  0
             final File f = new File(verboseLog);
    +  375  0
             String name = f.getName();
    +  376  0
             final int i = name.lastIndexOf('.');
    +  377  0
             if (i > 1) {
    +  378  0
                 name = name.substring(0, i);
    +  379   +
             }
    +  380  0
             fa.setName(name);
    +  381  0
             fa.start();
    +  382  0
             final ch.qos.logback.classic.Logger rootLogger = context.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
    +  383  0
             rootLogger.addAppender(fa);
    +  384  0
         }
    +  385   +
     
    +  386   +
         /**
     387   -
     
    -  388  0
             final PatternLayoutEncoder encoder = new PatternLayoutEncoder();
    -  389  0
             encoder.setPattern("%d %C:%L%n%-5level - %msg%n");
    -  390  0
             encoder.setContext(context);
    -  391  0
             encoder.start();
    -  392  0
             final FileAppender fa = new FileAppender();
    -  393  0
             fa.setAppend(true);
    -  394  0
             fa.setEncoder(encoder);
    -  395  0
             fa.setContext(context);
    -  396  0
             fa.setFile(verboseLog);
    -  397  0
             final File f = new File(verboseLog);
    -  398  0
             String name = f.getName();
    -  399  0
             final int i = name.lastIndexOf('.');
    -  400  0
             if (i > 1) {
    -  401  0
                 name = name.substring(0, i);
    -  402   -
             }
    -  403  0
             fa.setName(name);
    -  404  0
             fa.start();
    -  405  0
             final ch.qos.logback.classic.Logger rootLogger = context.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
    -  406  0
             rootLogger.addAppender(fa);
    -  407  0
         }
    -  408   -
     
    -  409   -
         /**
    -  410  
          * Takes a path and resolves it to be a canonical &amp; absolute path. The caveats are that this method will take an Ant style
    -  411   +  388  
          * file selector path (../someDir/**\/*.jar) and convert it to an absolute/canonical path (at least to the left of the first *
    -  412   +  389  
          * or ?).
    -  413   +  390  
          *
    -  414   +  391  
          * @param path the path to canonicalize
    -  415   +  392  
          * @return the canonical path
    -  416   +  393  
          */
    -  417   +  394  
         protected String ensureCanonicalPath(String path) {
    -  418  2
             String basePath = null;
    -  419  2
             String wildCards = null;
    -  420  2
             final String file = path.replace('\\', '/');
    -  421  2
             if (file.contains("*") || file.contains("?")) {
    -  422   +  395  2
             String basePath = null;
    +  396  2
             String wildCards = null;
    +  397  2
             final String file = path.replace('\\', '/');
    +  398  2
             if (file.contains("*") || file.contains("?")) {
    +  399  
     
    -  423  1
                 int pos = getLastFileSeparator(file);
    -  424  1
                 if (pos < 0) {
    -  425  0
                     return file;
    -  426   +  400  1
                 int pos = getLastFileSeparator(file);
    +  401  1
                 if (pos < 0) {
    +  402  0
                     return file;
    +  403  
                 }
    -  427  1
                 pos += 1;
    -  428  1
                 basePath = file.substring(0, pos);
    -  429  1
                 wildCards = file.substring(pos);
    -  430  1
             } else {
    -  431  1
                 basePath = file;
    -  432   +  404  1
                 pos += 1;
    +  405  1
                 basePath = file.substring(0, pos);
    +  406  1
                 wildCards = file.substring(pos);
    +  407  1
             } else {
    +  408  1
                 basePath = file;
    +  409  
             }
    -  433   +  410  
     
    -  434  2
             File f = new File(basePath);
    -  435   +  411  2
             File f = new File(basePath);
    +  412  
             try {
    -  436  2
                 f = f.getCanonicalFile();
    -  437  2
                 if (wildCards != null) {
    -  438  1
                     f = new File(f, wildCards);
    -  439   +  413  2
                 f = f.getCanonicalFile();
    +  414  2
                 if (wildCards != null) {
    +  415  1
                     f = new File(f, wildCards);
    +  416  
                 }
    -  440  0
             } catch (IOException ex) {
    -  441  0
                 LOGGER.warn("Invalid path '{}' was provided.", path);
    -  442  0
                 LOGGER.debug("Invalid path provided", ex);
    -  443  2
             }
    -  444  2
             return f.getAbsolutePath().replace('\\', '/');
    -  445   +  417  0
             } catch (IOException ex) {
    +  418  0
                 LOGGER.warn("Invalid path '{}' was provided.", path);
    +  419  0
                 LOGGER.debug("Invalid path provided", ex);
    +  420  2
             }
    +  421  2
             return f.getAbsolutePath().replace('\\', '/');
    +  422  
         }
    -  446   +  423  
     
    -  447   +  424  
         /**
    -  448   +  425  
          * Returns the position of the last file separator.
    -  449   +  426  
          *
    -  450   +  427  
          * @param file a file path
    -  451   +  428  
          * @return the position of the last file separator
    -  452   +  429  
          */
    -  453   +  430  
         private int getLastFileSeparator(String file) {
    -  454  1
             if (file.contains("*") || file.contains("?")) {
    -  455  1
                 int p1 = file.indexOf('*');
    -  456  1
                 int p2 = file.indexOf('?');
    -  457  1
                 p1 = p1 > 0 ? p1 : file.length();
    -  458  1
                 p2 = p2 > 0 ? p2 : file.length();
    -  459  1
                 int pos = p1 < p2 ? p1 : p2;
    -  460  1
                 pos = file.lastIndexOf('/', pos);
    -  461  1
                 return pos;
    -  462   +  431  1
             if (file.contains("*") || file.contains("?")) {
    +  432  1
                 int p1 = file.indexOf('*');
    +  433  1
                 int p2 = file.indexOf('?');
    +  434  1
                 p1 = p1 > 0 ? p1 : file.length();
    +  435  1
                 p2 = p2 > 0 ? p2 : file.length();
    +  436  1
                 int pos = p1 < p2 ? p1 : p2;
    +  437  1
                 pos = file.lastIndexOf('/', pos);
    +  438  1
                 return pos;
    +  439  
             } else {
    -  463  0
                 return file.lastIndexOf('/');
    -  464   +  440  0
                 return file.lastIndexOf('/');
    +  441  
             }
    -  465   +  442  
         }
    -  466   +  443  
     }
    - + diff --git a/dependency-check-cli/cobertura/org.owasp.dependencycheck.CliParser.html b/dependency-check-cli/cobertura/org.owasp.dependencycheck.CliParser.html index e82579b98..ade418370 100644 --- a/dependency-check-cli/cobertura/org.owasp.dependencycheck.CliParser.html +++ b/dependency-check-cli/cobertura/org.owasp.dependencycheck.CliParser.html @@ -12,8 +12,8 @@
     
    - - + +
    Classes in this File Line Coverage Branch Coverage Complexity
    CliParser
    56%
    121/213
    24%
    40/166
    2.356
    CliParser$ARGUMENT
    0%
    0/1
    N/A
    2.356
    CliParser
    55%
    127/230
    25%
    46/180
    2.452
    CliParser$ARGUMENT
    0%
    0/1
    N/A
    2.452
     
    @@ -192,857 +192,849 @@
          */
     92  
         private void validateArgs() throws FileNotFoundException, ParseException {
    -  93  7
             if (isRunScan()) {
    -  94  2
                 validatePathExists(getScanFiles(), ARGUMENT.SCAN);
    -  95  1
                 validatePathExists(getReportDirectory(), ARGUMENT.OUT);
    -  96  1
                 if (getPathToMono() != null) {
    -  97  0
                     validatePathExists(getPathToMono(), ARGUMENT.PATH_TO_MONO);
    -  98   -
                 }
    -  99  1
                 if (!line.hasOption(ARGUMENT.APP_NAME) && !line.hasOption(ARGUMENT.PROJECT)) {
    -  100  0
                     throw new ParseException("Missing '" + ARGUMENT.PROJECT + "' argument; the scan cannot be run without the an project name.");
    -  101   -
                 }
    -  102  1
                 if (line.hasOption(ARGUMENT.OUTPUT_FORMAT)) {
    -  103  0
                     final String format = line.getOptionValue(ARGUMENT.OUTPUT_FORMAT);
    -  104   +  93  7
             if (isUpdateOnly() || isRunScan()) {
    +  94  2
                 final String value = line.getOptionValue(ARGUMENT.CVE_VALID_FOR_HOURS);
    +  95  2
                 if (value != null) {
    +  96  
                     try {
    -  105  0
                         Format.valueOf(format);
    -  106  0
                     } catch (IllegalArgumentException ex) {
    -  107  0
                         final String msg = String.format("An invalid 'format' of '%s' was specified. "
    -  108   -
                                 + "Supported output formats are XML, HTML, VULN, or ALL", format);
    -  109  0
                         throw new ParseException(msg);
    -  110  0
                     }
    +  97  0
                         final int i = Integer.parseInt(value);
    +  98  0
                         if (i < 0) {
    +  99  0
                             throw new ParseException("Invalid Setting: cveValidForHours must be a number greater than or equal to 0.");
    +  100   +
                         }
    +  101  0
                     } catch (NumberFormatException ex) {
    +  102  0
                         throw new ParseException("Invalid Setting: cveValidForHours must be a number greater than or equal to 0.");
    +  103  0
                     }
    +  104   +
                 }
    +  105   +
             }
    +  106  7
             if (isRunScan()) {
    +  107  2
                 validatePathExists(getScanFiles(), ARGUMENT.SCAN);
    +  108  1
                 validatePathExists(getReportDirectory(), ARGUMENT.OUT);
    +  109  1
                 if (getPathToMono() != null) {
    +  110  0
                     validatePathExists(getPathToMono(), ARGUMENT.PATH_TO_MONO);
     111  
                 }
    -  112  1
                 if ((getBaseCve12Url() != null || getBaseCve20Url() != null || getModifiedCve12Url() != null || getModifiedCve20Url() != null)
    -  113   -
                         && (getBaseCve12Url() == null || getBaseCve20Url() == null || getModifiedCve12Url() == null || getModifiedCve20Url() == null)) {
    -  114  0
                     final String msg = "If one of the CVE URLs is specified they must all be specified; please add the missing CVE URL.";
    -  115  0
                     throw new ParseException(msg);
    -  116   +  112  1
                 if (!line.hasOption(ARGUMENT.APP_NAME) && !line.hasOption(ARGUMENT.PROJECT)) {
    +  113  0
                     throw new ParseException("Missing '" + ARGUMENT.PROJECT + "' argument; the scan cannot be run without the an project name.");
    +  114  
                 }
    -  117  1
                 if (line.hasOption((ARGUMENT.SYM_LINK_DEPTH))) {
    -  118   +  115  1
                 if (line.hasOption(ARGUMENT.OUTPUT_FORMAT)) {
    +  116  0
                     final String format = line.getOptionValue(ARGUMENT.OUTPUT_FORMAT);
    +  117  
                     try {
    -  119  0
                         final int i = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH));
    -  120  0
                         if (i < 0) {
    -  121  0
                             throw new ParseException("Symbolic Link Depth (symLink) must be greater than zero.");
    -  122   -
                         }
    -  123  0
                     } catch (NumberFormatException ex) {
    -  124  0
                         throw new ParseException("Symbolic Link Depth (symLink) is not a number.");
    -  125  0
                     }
    +  118  0
                         Format.valueOf(format);
    +  119  0
                     } catch (IllegalArgumentException ex) {
    +  120  0
                         final String msg = String.format("An invalid 'format' of '%s' was specified. "
    +  121   +
                                 + "Supported output formats are XML, HTML, VULN, or ALL", format);
    +  122  0
                         throw new ParseException(msg);
    +  123  0
                     }
    +  124   +
                 }
    +  125  1
                 if ((getBaseCve12Url() != null || getBaseCve20Url() != null || getModifiedCve12Url() != null || getModifiedCve20Url() != null)
     126   -
                 }
    -  127   -
             }
    -  128  6
         }
    +
                         && (getBaseCve12Url() == null || getBaseCve20Url() == null || getModifiedCve12Url() == null || getModifiedCve20Url() == null)) {
    +  127  0
                     final String msg = "If one of the CVE URLs is specified they must all be specified; please add the missing CVE URL.";
    +  128  0
                     throw new ParseException(msg);
     129   -
     
    -  130   -
         /**
    -  131   -
          * Validates whether or not the path(s) points at a file that exists; if the path(s) does not point to an existing file a
    -  132   -
          * FileNotFoundException is thrown.
    -  133   -
          *
    -  134   -
          * @param paths the paths to validate if they exists
    -  135   -
          * @param optType the option being validated (e.g. scan, out, etc.)
    -  136   -
          * @throws FileNotFoundException is thrown if one of the paths being validated does not exist.
    -  137   -
          */
    -  138   -
         private void validatePathExists(String[] paths, String optType) throws FileNotFoundException {
    -  139  3
             for (String path : paths) {
    -  140  2
                 validatePathExists(path, optType);
    -  141   -
             }
    -  142  1
         }
    -  143   -
     
    -  144   -
         /**
    -  145   -
          * Validates whether or not the path points at a file that exists; if the path does not point to an existing file a
    -  146   -
          * FileNotFoundException is thrown.
    -  147   -
          *
    -  148   -
          * @param path the paths to validate if they exists
    -  149   -
          * @param argumentName the argument being validated (e.g. scan, out, etc.)
    -  150   -
          * @throws FileNotFoundException is thrown if the path being validated does not exist.
    -  151   -
          */
    -  152   -
         private void validatePathExists(String path, String argumentName) throws FileNotFoundException {
    -  153  3
             if (path == null) {
    -  154  0
                 isValid = false;
    -  155  0
                 final String msg = String.format("Invalid '%s' argument: null", argumentName);
    -  156  0
                 throw new FileNotFoundException(msg);
    -  157  3
             } else if (!path.contains("*") && !path.contains("?")) {
    -  158  3
                 File f = new File(path);
    -  159  3
                 if ("o".equalsIgnoreCase(argumentName.substring(0, 1)) && !"ALL".equalsIgnoreCase(this.getReportFormat())) {
    -  160  1
                     final String checkPath = path.toLowerCase();
    -  161  1
                     if (checkPath.endsWith(".html") || checkPath.endsWith(".xml") || checkPath.endsWith(".htm")) {
    -  162  0
                         if (f.getParentFile() == null) {
    -  163  0
                             f = new File(".", path);
    -  164   -
                         }
    -  165  0
                         if (!f.getParentFile().isDirectory()) {
    -  166  0
                             isValid = false;
    -  167  0
                             final String msg = String.format("Invalid '%s' argument: '%s'", argumentName, path);
    -  168  0
                             throw new FileNotFoundException(msg);
    -  169   -
                         }
    -  170   -
                     }
    -  171  1
                 } else {
    -  172  2
                     if (!f.exists()) {
    -  173  1
                         isValid = false;
    -  174  1
                         final String msg = String.format("Invalid '%s' argument: '%s'", argumentName, path);
    -  175  1
                         throw new FileNotFoundException(msg);
    -  176   -
                     }
    -  177  
                 }
    -  178  2
             } else if (path.startsWith("//") || path.startsWith("\\\\")) {
    -  179  0
                 isValid = false;
    -  180  0
                 final String msg = String.format("Invalid '%s' argument: '%s'%nUnable to scan paths that start with '//'.", argumentName, path);
    -  181  0
                 throw new FileNotFoundException(msg);
    -  182   +  130  1
                 if (line.hasOption((ARGUMENT.SYM_LINK_DEPTH))) {
    +  131   +
                     try {
    +  132  0
                         final int i = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH));
    +  133  0
                         if (i < 0) {
    +  134  0
                             throw new ParseException("Symbolic Link Depth (symLink) must be greater than zero.");
    +  135   +
                         }
    +  136  0
                     } catch (NumberFormatException ex) {
    +  137  0
                         throw new ParseException("Symbolic Link Depth (symLink) is not a number.");
    +  138  0
                     }
    +  139   +
                 }
    +  140  
             }
    -  183  2
         }
    -  184   +  141  6
         }
    +  142  
     
    -  185   +  143  
         /**
    -  186   -
          * Generates an Options collection that is used to parse the command line and to display the help message.
    -  187   +  144   +
          * Validates whether or not the path(s) points at a file that exists; if the path(s) does not point to an existing file a
    +  145   +
          * FileNotFoundException is thrown.
    +  146  
          *
    -  188   -
          * @return the command line options used for parsing the command line
    +  147   +
          * @param paths the paths to validate if they exists
    +  148   +
          * @param optType the option being validated (e.g. scan, out, etc.)
    +  149   +
          * @throws FileNotFoundException is thrown if one of the paths being validated does not exist.
    +  150   +
          */
    +  151   +
         private void validatePathExists(String[] paths, String optType) throws FileNotFoundException {
    +  152  3
             for (String path : paths) {
    +  153  2
                 validatePathExists(path, optType);
    +  154   +
             }
    +  155  1
         }
    +  156   +
     
    +  157   +
         /**
    +  158   +
          * Validates whether or not the path points at a file that exists; if the path does not point to an existing file a
    +  159   +
          * FileNotFoundException is thrown.
    +  160   +
          *
    +  161   +
          * @param path the paths to validate if they exists
    +  162   +
          * @param argumentName the argument being validated (e.g. scan, out, etc.)
    +  163   +
          * @throws FileNotFoundException is thrown if the path being validated does not exist.
    +  164   +
          */
    +  165   +
         private void validatePathExists(String path, String argumentName) throws FileNotFoundException {
    +  166  3
             if (path == null) {
    +  167  0
                 isValid = false;
    +  168  0
                 final String msg = String.format("Invalid '%s' argument: null", argumentName);
    +  169  0
                 throw new FileNotFoundException(msg);
    +  170  3
             } else if (!path.contains("*") && !path.contains("?")) {
    +  171  3
                 File f = new File(path);
    +  172  3
                 if ("o".equalsIgnoreCase(argumentName.substring(0, 1)) && !"ALL".equalsIgnoreCase(this.getReportFormat())) {
    +  173  1
                     final String checkPath = path.toLowerCase();
    +  174  1
                     if (checkPath.endsWith(".html") || checkPath.endsWith(".xml") || checkPath.endsWith(".htm")) {
    +  175  0
                         if (f.getParentFile() == null) {
    +  176  0
                             f = new File(".", path);
    +  177   +
                         }
    +  178  0
                         if (!f.getParentFile().isDirectory()) {
    +  179  0
                             isValid = false;
    +  180  0
                             final String msg = String.format("Invalid '%s' argument: '%s'", argumentName, path);
    +  181  0
                             throw new FileNotFoundException(msg);
    +  182   +
                         }
    +  183   +
                     }
    +  184  1
                 } else {
    +  185  2
                     if (!f.exists()) {
    +  186  1
                         isValid = false;
    +  187  1
                         final String msg = String.format("Invalid '%s' argument: '%s'", argumentName, path);
    +  188  1
                         throw new FileNotFoundException(msg);
     189   -
          */
    +
                     }
     190   -
         @SuppressWarnings("static-access")
    -  191   -
         private Options createCommandLineOptions() {
    -  192  9
             final Options options = new Options();
    -  193  9
             addStandardOptions(options);
    -  194  9
             addAdvancedOptions(options);
    -  195  9
             addDeprecatedOptions(options);
    -  196  9
             return options;
    +
                 }
    +  191  2
             } else if (path.startsWith("//") || path.startsWith("\\\\")) {
    +  192  0
                 isValid = false;
    +  193  0
                 final String msg = String.format("Invalid '%s' argument: '%s'%nUnable to scan paths that start with '//'.", argumentName, path);
    +  194  0
                 throw new FileNotFoundException(msg);
    +  195   +
             }
    +  196  2
         }
     197   -
         }
    +
     
     198   -
     
    -  199  
         /**
    +  199   +
          * Generates an Options collection that is used to parse the command line and to display the help message.
     200   -
          * Adds the standard command line options to the given options collection.
    -  201  
          *
    +  201   +
          * @return the command line options used for parsing the command line
     202   -
          * @param options a collection of command line arguments
    -  203   -
          * @throws IllegalArgumentException thrown if there is an exception
    -  204  
          */
    -  205   +  203  
         @SuppressWarnings("static-access")
    -  206   -
         private void addStandardOptions(final Options options) throws IllegalArgumentException {
    -  207  11
             final Option help = new Option(ARGUMENT.HELP_SHORT, ARGUMENT.HELP, false,
    -  208   -
                     "Print this message.");
    -  209   -
     
    -  210  11
             final Option advancedHelp = Option.builder().longOpt(ARGUMENT.ADVANCED_HELP)
    +  204   +
         private Options createCommandLineOptions() {
    +  205  9
             final Options options = new Options();
    +  206  9
             addStandardOptions(options);
    +  207  9
             addAdvancedOptions(options);
    +  208  9
             addDeprecatedOptions(options);
    +  209  9
             return options;
    +  210   +
         }
     211   -
                     .desc("Print the advanced help message.").build();
    +
     
     212   -
     
    -  213  11
             final Option version = new Option(ARGUMENT.VERSION_SHORT, ARGUMENT.VERSION,
    +
         /**
    +  213   +
          * Adds the standard command line options to the given options collection.
     214   -
                     false, "Print the version information.");
    +
          *
     215   -
     
    -  216  11
             final Option noUpdate = new Option(ARGUMENT.DISABLE_AUTO_UPDATE_SHORT, ARGUMENT.DISABLE_AUTO_UPDATE,
    +
          * @param options a collection of command line arguments
    +  216   +
          * @throws IllegalArgumentException thrown if there is an exception
     217   -
                     false, "Disables the automatic updating of the CPE data.");
    +
          */
     218   -
     
    -  219  11
             final Option projectName = Option.builder().hasArg().argName("name").longOpt(ARGUMENT.PROJECT)
    -  220   -
                     .desc("The name of the project being scanned. This is a required argument.")
    +
         @SuppressWarnings("static-access")
    +  219   +
         private void addStandardOptions(final Options options) throws IllegalArgumentException {
    +  220  11
             final Option help = new Option(ARGUMENT.HELP_SHORT, ARGUMENT.HELP, false,
     221   -
                     .build();
    +
                     "Print this message.");
     222  
     
    -  223  11
             final Option path = Option.builder(ARGUMENT.SCAN_SHORT).argName("path").hasArg().longOpt(ARGUMENT.SCAN)
    +  223  11
             final Option advancedHelp = Option.builder().longOpt(ARGUMENT.ADVANCED_HELP)
     224   -
                     .desc("The path to scan - this option can be specified multiple times. Ant style"
    +
                     .desc("Print the advanced help message.").build();
     225   -
                             + " paths are supported (e.g. path/**/*.jar).")
    -  226   -
                     .build();
    +
     
    +  226  11
             final Option version = new Option(ARGUMENT.VERSION_SHORT, ARGUMENT.VERSION,
     227   +
                     false, "Print the version information.");
    +  228  
     
    -  228  11
             final Option excludes = Option.builder().argName("pattern").hasArg().longOpt(ARGUMENT.EXCLUDE)
    -  229   -
                     .desc("Specify and exclusion pattern. This option can be specified multiple times"
    +  229  11
             final Option noUpdate = new Option(ARGUMENT.DISABLE_AUTO_UPDATE_SHORT, ARGUMENT.DISABLE_AUTO_UPDATE,
     230   -
                             + " and it accepts Ant style excludsions.")
    +
                     false, "Disables the automatic updating of the CPE data.");
     231   -
                     .build();
    -  232  
     
    -  233  11
             final Option props = Option.builder(ARGUMENT.PROP_SHORT).argName("file").hasArg().longOpt(ARGUMENT.PROP)
    +  232  11
             final Option projectName = Option.builder().hasArg().argName("name").longOpt(ARGUMENT.PROJECT)
    +  233   +
                     .desc("The name of the project being scanned. This is a required argument.")
     234   -
                     .desc("A property file to load.")
    +
                     .build();
     235   -
                     .build();
    -  236  
     
    -  237  11
             final Option out = Option.builder(ARGUMENT.OUT_SHORT).argName("path").hasArg().longOpt(ARGUMENT.OUT)
    +  236  11
             final Option path = Option.builder(ARGUMENT.SCAN_SHORT).argName("path").hasArg().longOpt(ARGUMENT.SCAN)
    +  237   +
                     .desc("The path to scan - this option can be specified multiple times. Ant style"
     238   -
                     .desc("The folder to write reports to. This defaults to the current directory. "
    +
                             + " paths are supported (e.g. path/**/*.jar).")
     239   -
                             + "It is possible to set this to a specific file name if the format argument is not set to ALL.")
    -  240  
                     .build();
    -  241   +  240  
     
    -  242  11
             final Option outputFormat = Option.builder(ARGUMENT.OUTPUT_FORMAT_SHORT).argName("format").hasArg().longOpt(ARGUMENT.OUTPUT_FORMAT)
    +  241  11
             final Option excludes = Option.builder().argName("pattern").hasArg().longOpt(ARGUMENT.EXCLUDE)
    +  242   +
                     .desc("Specify and exclusion pattern. This option can be specified multiple times"
     243   -
                     .desc("The output format to write to (XML, HTML, VULN, ALL). The default is HTML.")
    +
                             + " and it accepts Ant style excludsions.")
     244  
                     .build();
     245  
     
    -  246  11
             final Option verboseLog = Option.builder(ARGUMENT.VERBOSE_LOG_SHORT).argName("file").hasArg().longOpt(ARGUMENT.VERBOSE_LOG)
    +  246  11
             final Option props = Option.builder(ARGUMENT.PROP_SHORT).argName("file").hasArg().longOpt(ARGUMENT.PROP)
     247   -
                     .desc("The file path to write verbose logging information.")
    +
                     .desc("A property file to load.")
     248  
                     .build();
     249  
     
    -  250  11
             final Option symLinkDepth = Option.builder().argName("depth").hasArg().longOpt(ARGUMENT.SYM_LINK_DEPTH)
    +  250  11
             final Option out = Option.builder(ARGUMENT.OUT_SHORT).argName("path").hasArg().longOpt(ARGUMENT.OUT)
     251   -
                     .desc("Sets how deep nested symbolic links will be followed; 0 indicates symbolic links will not be followed.")
    +
                     .desc("The folder to write reports to. This defaults to the current directory. "
     252   -
                     .build();
    +
                             + "It is possible to set this to a specific file name if the format argument is not set to ALL.")
     253   +
                     .build();
    +  254  
     
    -  254  11
             final Option suppressionFile = Option.builder().argName("file").hasArg().longOpt(ARGUMENT.SUPPRESSION_FILE)
    -  255   -
                     .desc("The file path to the suppression XML file.")
    +  255  11
             final Option outputFormat = Option.builder(ARGUMENT.OUTPUT_FORMAT_SHORT).argName("format").hasArg().longOpt(ARGUMENT.OUTPUT_FORMAT)
     256   -
                     .build();
    +
                     .desc("The output format to write to (XML, HTML, VULN, ALL). The default is HTML.")
     257   -
     
    +
                     .build();
     258   -
             //This is an option group because it can be specified more then once.
    -  259  11
             final OptionGroup og = new OptionGroup();
    -  260  11
             og.addOption(path);
    +
     
    +  259  11
             final Option verboseLog = Option.builder(ARGUMENT.VERBOSE_LOG_SHORT).argName("file").hasArg().longOpt(ARGUMENT.VERBOSE_LOG)
    +  260   +
                     .desc("The file path to write verbose logging information.")
     261   +
                     .build();
    +  262  
     
    -  262  11
             final OptionGroup exog = new OptionGroup();
    -  263  11
             exog.addOption(excludes);
    +  263  11
             final Option symLinkDepth = Option.builder().argName("depth").hasArg().longOpt(ARGUMENT.SYM_LINK_DEPTH)
     264   -
     
    -  265  11
             options.addOptionGroup(og)
    +
                     .desc("Sets how deep nested symbolic links will be followed; 0 indicates symbolic links will not be followed.")
    +  265   +
                     .build();
     266   -
                     .addOptionGroup(exog)
    -  267   -
                     .addOption(projectName)
    +
     
    +  267  11
             final Option suppressionFile = Option.builder().argName("file").hasArg().longOpt(ARGUMENT.SUPPRESSION_FILE)
     268   -
                     .addOption(out)
    +
                     .desc("The file path to the suppression XML file.")
     269   -
                     .addOption(outputFormat)
    +
                     .build();
     270   -
                     .addOption(version)
    -  271   -
                     .addOption(help)
    +
     
    +  271  11
             final Option cveValidForHours = Option.builder().argName("hours").hasArg().longOpt(ARGUMENT.CVE_VALID_FOR_HOURS)
     272   -
                     .addOption(advancedHelp)
    +
                     .desc("The number of hours to wait before checking for new updates from the NVD.")
     273   -
                     .addOption(noUpdate)
    +
                     .build();
     274   -
                     .addOption(symLinkDepth)
    +
     
     275   -
                     .addOption(props)
    -  276   -
                     .addOption(verboseLog)
    -  277   -
                     .addOption(suppressionFile);
    -  278  11
         }
    -  279   +
             //This is an option group because it can be specified more then once.
    +  276  11
             final OptionGroup og = new OptionGroup();
    +  277  11
             og.addOption(path);
    +  278  
     
    -  280   -
         /**
    +  279  11
             final OptionGroup exog = new OptionGroup();
    +  280  11
             exog.addOption(excludes);
     281   -
          * Adds the advanced command line options to the given options collection. These are split out for purposes of being able to
    -  282   -
          * display two different help messages.
    +
     
    +  282  11
             options.addOptionGroup(og)
     283   -
          *
    +
                     .addOptionGroup(exog)
     284   -
          * @param options a collection of command line arguments
    +
                     .addOption(projectName)
     285   -
          * @throws IllegalArgumentException thrown if there is an exception
    +
                     .addOption(out)
     286   -
          */
    +
                     .addOption(outputFormat)
     287   -
         @SuppressWarnings("static-access")
    +
                     .addOption(version)
     288   -
         private void addAdvancedOptions(final Options options) throws IllegalArgumentException {
    +
                     .addOption(help)
     289   -
     
    -  290  9
             final Option cve12Base = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_BASE_12)
    +
                     .addOption(advancedHelp)
    +  290   +
                     .addOption(noUpdate)
     291   -
                     .desc("Base URL for each year’s CVE 1.2, the %d will be replaced with the year. ")
    +
                     .addOption(symLinkDepth)
     292   -
                     .build();
    +
                     .addOption(props)
     293   -
     
    -  294  9
             final Option cve20Base = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_BASE_20)
    +
                     .addOption(verboseLog)
    +  294   +
                     .addOption(suppressionFile)
     295   -
                     .desc("Base URL for each year’s CVE 2.0, the %d will be replaced with the year.")
    -  296   -
                     .build();
    +
                     .addOption(cveValidForHours);
    +  296  11
         }
     297  
     
    -  298  9
             final Option cve12Modified = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_MOD_12)
    +  298   +
         /**
     299   -
                     .desc("URL for the modified CVE 1.2.")
    +
          * Adds the advanced command line options to the given options collection. These are split out for purposes of being able to
     300   -
                     .build();
    +
          * display two different help messages.
     301   -
     
    -  302  9
             final Option cve20Modified = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_MOD_20)
    +
          *
    +  302   +
          * @param options a collection of command line arguments
     303   -
                     .desc("URL for the modified CVE 2.0.")
    +
          * @throws IllegalArgumentException thrown if there is an exception
     304   -
                     .build();
    +
          */
     305   -
     
    -  306  9
             final Option updateOnly = Option.builder().longOpt(ARGUMENT.UPDATE_ONLY)
    +
         @SuppressWarnings("static-access")
    +  306   +
         private void addAdvancedOptions(final Options options) throws IllegalArgumentException {
     307   -
                     .desc("Only update the local NVD data cache; no scan will be executed.").build();
    -  308  
     
    -  309  9
             final Option data = Option.builder(ARGUMENT.DATA_DIRECTORY_SHORT).argName("path").hasArg().longOpt(ARGUMENT.DATA_DIRECTORY)
    +  308  9
             final Option cve12Base = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_BASE_12)
    +  309   +
                     .desc("Base URL for each year’s CVE 1.2, the %d will be replaced with the year. ")
     310   -
                     .desc("The location of the H2 Database file. This option should generally not be set.")
    +
                     .build();
     311   -
                     .build();
    -  312  
     
    -  313  9
             final Option nexusUrl = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.NEXUS_URL)
    +  312  9
             final Option cve20Base = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_BASE_20)
    +  313   +
                     .desc("Base URL for each year’s CVE 2.0, the %d will be replaced with the year.")
     314   -
                     .desc("The url to the Nexus Server's REST API Endpoint (http://domain/nexus/service/local). "
    +
                     .build();
     315   -
                             + "If not set the Nexus Analyzer will be disabled.").build();
    -  316  
     
    -  317  9
             final Option nexusUsesProxy = Option.builder().argName("true/false").hasArg().longOpt(ARGUMENT.NEXUS_USES_PROXY)
    +  316  9
             final Option cve12Modified = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_MOD_12)
    +  317   +
                     .desc("URL for the modified CVE 1.2.")
     318   -
                     .desc("Whether or not the configured proxy should be used when connecting to Nexus.")
    +
                     .build();
     319   -
                     .build();
    -  320  
     
    -  321  9
             final Option additionalZipExtensions = Option.builder().argName("extensions").hasArg()
    +  320  9
             final Option cve20Modified = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_MOD_20)
    +  321   +
                     .desc("URL for the modified CVE 2.0.")
     322   -
                     .longOpt(ARGUMENT.ADDITIONAL_ZIP_EXTENSIONS)
    +
                     .build();
     323   -
                     .desc("A comma separated list of additional extensions to be scanned as ZIP files "
    -  324   -
                             + "(ZIP, EAR, WAR are already treated as zip files)").build();
    +
     
    +  324  9
             final Option updateOnly = Option.builder().longOpt(ARGUMENT.UPDATE_ONLY)
     325   +
                     .desc("Only update the local NVD data cache; no scan will be executed.").build();
    +  326  
     
    -  326  9
             final Option pathToMono = Option.builder().argName("path").hasArg().longOpt(ARGUMENT.PATH_TO_MONO)
    -  327   -
                     .desc("The path to Mono for .NET Assembly analysis on non-windows systems.")
    +  327  9
             final Option data = Option.builder(ARGUMENT.DATA_DIRECTORY_SHORT).argName("path").hasArg().longOpt(ARGUMENT.DATA_DIRECTORY)
     328   -
                     .build();
    +
                     .desc("The location of the H2 Database file. This option should generally not be set.")
     329   -
     
    -  330  9
             final Option connectionTimeout = Option.builder(ARGUMENT.CONNECTION_TIMEOUT_SHORT).argName("timeout").hasArg()
    -  331   -
                     .longOpt(ARGUMENT.CONNECTION_TIMEOUT).desc("The connection timeout (in milliseconds) to use when downloading resources.")
    -  332  
                     .build();
    +  330   +
     
    +  331  9
             final Option nexusUrl = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.NEXUS_URL)
    +  332   +
                     .desc("The url to the Nexus Server's REST API Endpoint (http://domain/nexus/service/local). "
     333   +
                             + "If not set the Nexus Analyzer will be disabled.").build();
    +  334  
     
    -  334  9
             final Option proxyServer = Option.builder().argName("server").hasArg().longOpt(ARGUMENT.PROXY_SERVER)
    -  335   -
                     .desc("The proxy server to use when downloading resources.").build();
    +  335  9
             final Option nexusUsesProxy = Option.builder().argName("true/false").hasArg().longOpt(ARGUMENT.NEXUS_USES_PROXY)
     336   -
     
    -  337  9
             final Option proxyPort = Option.builder().argName("port").hasArg().longOpt(ARGUMENT.PROXY_PORT)
    +
                     .desc("Whether or not the configured proxy should be used when connecting to Nexus.")
    +  337   +
                     .build();
     338   -
                     .desc("The proxy port to use when downloading resources.").build();
    -  339  
     
    -  340  9
             final Option proxyUsername = Option.builder().argName("user").hasArg().longOpt(ARGUMENT.PROXY_USERNAME)
    +  339  9
             final Option additionalZipExtensions = Option.builder().argName("extensions").hasArg()
    +  340   +
                     .longOpt(ARGUMENT.ADDITIONAL_ZIP_EXTENSIONS)
     341   -
                     .desc("The proxy username to use when downloading resources.").build();
    +
                     .desc("A comma separated list of additional extensions to be scanned as ZIP files "
     342   +
                             + "(ZIP, EAR, WAR are already treated as zip files)").build();
    +  343  
     
    -  343  9
             final Option proxyPassword = Option.builder().argName("pass").hasArg().longOpt(ARGUMENT.PROXY_PASSWORD)
    -  344   -
                     .desc("The proxy password to use when downloading resources.").build();
    +  344  9
             final Option pathToMono = Option.builder().argName("path").hasArg().longOpt(ARGUMENT.PATH_TO_MONO)
     345   -
     
    -  346  9
             final Option connectionString = Option.builder().argName("connStr").hasArg().longOpt(ARGUMENT.CONNECTION_STRING)
    +
                     .desc("The path to Mono for .NET Assembly analysis on non-windows systems.")
    +  346   +
                     .build();
     347   -
                     .desc("The connection string to the database.").build();
    -  348   -
     
    -  349  9
             final Option dbUser = Option.builder().argName("user").hasArg().longOpt(ARGUMENT.DB_NAME)
    +
             
    +  348  9
             final Option pathToBundleAudit = Option.builder().argName("path").hasArg()
    +  349   +
                     .longOpt(ARGUMENT.PATH_TO_BUNDLE_AUDIT)
     350   -
                     .desc("The username used to connect to the database.").build();
    +
                     .desc("The path to bundle-audit for Gem bundle analysis.").build();
     351  
     
    -  352  9
             final Option dbPassword = Option.builder().argName("password").hasArg().longOpt(ARGUMENT.DB_PASSWORD)
    +  352  9
             final Option connectionTimeout = Option.builder(ARGUMENT.CONNECTION_TIMEOUT_SHORT).argName("timeout").hasArg()
     353   -
                     .desc("The password for connecting to the database.").build();
    +
                     .longOpt(ARGUMENT.CONNECTION_TIMEOUT).desc("The connection timeout (in milliseconds) to use when downloading resources.")
     354   -
     
    -  355  9
             final Option dbDriver = Option.builder().argName("driver").hasArg().longOpt(ARGUMENT.DB_DRIVER)
    -  356   -
                     .desc("The database driver name.").build();
    -  357   -
     
    -  358  9
             final Option dbDriverPath = Option.builder().argName("path").hasArg().longOpt(ARGUMENT.DB_DRIVER_PATH)
    -  359   -
                     .desc("The path to the database driver; note, this does not need to be set unless the JAR is outside of the classpath.")
    -  360  
                     .build();
    +  355   +
     
    +  356  9
             final Option proxyServer = Option.builder().argName("server").hasArg().longOpt(ARGUMENT.PROXY_SERVER)
    +  357   +
                     .desc("The proxy server to use when downloading resources.").build();
    +  358   +
     
    +  359  9
             final Option proxyPort = Option.builder().argName("port").hasArg().longOpt(ARGUMENT.PROXY_PORT)
    +  360   +
                     .desc("The proxy port to use when downloading resources.").build();
     361  
     
    -  362  9
             final Option disableJarAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_JAR)
    +  362  9
             final Option proxyUsername = Option.builder().argName("user").hasArg().longOpt(ARGUMENT.PROXY_USERNAME)
     363   -
                     .desc("Disable the Jar Analyzer.").build();
    +
                     .desc("The proxy username to use when downloading resources.").build();
     364  
     
    -  365  9
             final Option disableArchiveAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_ARCHIVE)
    +  365  9
             final Option proxyPassword = Option.builder().argName("pass").hasArg().longOpt(ARGUMENT.PROXY_PASSWORD)
     366   -
                     .desc("Disable the Archive Analyzer.").build();
    +
                     .desc("The proxy password to use when downloading resources.").build();
     367  
     
    -  368  9
             final Option disableNuspecAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_NUSPEC)
    +  368  9
             final Option connectionString = Option.builder().argName("connStr").hasArg().longOpt(ARGUMENT.CONNECTION_STRING)
     369   -
                     .desc("Disable the Nuspec Analyzer.").build();
    +
                     .desc("The connection string to the database.").build();
     370  
     
    -  371  9
             final Option disableAssemblyAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_ASSEMBLY)
    +  371  9
             final Option dbUser = Option.builder().argName("user").hasArg().longOpt(ARGUMENT.DB_NAME)
     372   -
                     .desc("Disable the .NET Assembly Analyzer.").build();
    +
                     .desc("The username used to connect to the database.").build();
     373  
     
    -  374  9
             final Option disablePythonDistributionAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_PY_DIST)
    +  374  9
             final Option dbPassword = Option.builder().argName("password").hasArg().longOpt(ARGUMENT.DB_PASSWORD)
     375   -
                     .desc("Disable the Python Distribution Analyzer.").build();
    +
                     .desc("The password for connecting to the database.").build();
     376  
     
    -  377  9
             final Option disablePythonPackageAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_PY_PKG)
    +  377  9
             final Option dbDriver = Option.builder().argName("driver").hasArg().longOpt(ARGUMENT.DB_DRIVER)
     378   -
                     .desc("Disable the Python Package Analyzer.").build();
    +
                     .desc("The database driver name.").build();
     379  
     
    -  380  9
             final Option disableComposerAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_COMPOSER)
    +  380  9
             final Option dbDriverPath = Option.builder().argName("path").hasArg().longOpt(ARGUMENT.DB_DRIVER_PATH)
     381   -
                     .desc("Disable the PHP Composer Analyzer.").build();
    +
                     .desc("The path to the database driver; note, this does not need to be set unless the JAR is outside of the classpath.")
     382   +
                     .build();
    +  383  
     
    -  383  9
             final Option disableAutoconfAnalyzer = Option.builder()
    -  384   -
                     .longOpt(ARGUMENT.DISABLE_AUTOCONF)
    +  384  9
             final Option disableJarAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_JAR)
     385   -
                     .desc("Disable the Autoconf Analyzer.").build();
    +
                     .desc("Disable the Jar Analyzer.").build();
     386  
     
    -  387  9
             final Option disableOpenSSLAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_OPENSSL)
    +  387  9
             final Option disableArchiveAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_ARCHIVE)
     388   -
                     .desc("Disable the OpenSSL Analyzer.").build();
    -  389  9
             final Option disableCmakeAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_CMAKE)
    -  390   -
                     .desc("Disable the Cmake Analyzer.").build();
    -  391   +
                     .desc("Disable the Archive Analyzer.").build();
    +  389  
     
    -  392  9
             final Option disableCentralAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_CENTRAL)
    -  393   -
                     .desc("Disable the Central Analyzer. If this analyzer is disabled it is likely you also want to disable "
    +  390  9
             final Option disableNuspecAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_NUSPEC)
    +  391   +
                     .desc("Disable the Nuspec Analyzer.").build();
    +  392   +
     
    +  393  9
             final Option disableAssemblyAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_ASSEMBLY)
     394   -
                             + "the Nexus Analyzer.").build();
    +
                     .desc("Disable the .NET Assembly Analyzer.").build();
     395  
     
    -  396  9
             final Option disableNexusAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_NEXUS)
    +  396  9
             final Option disablePythonDistributionAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_PY_DIST)
     397   -
                     .desc("Disable the Nexus Analyzer.").build();
    +
                     .desc("Disable the Python Distribution Analyzer.").build();
     398  
     
    -  399  9
             final Option purge = Option.builder().longOpt(ARGUMENT.PURGE_NVD)
    +  399  9
             final Option disablePythonPackageAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_PY_PKG)
     400   -
                     .desc("Purges the local NVD data cache")
    +
                     .desc("Disable the Python Package Analyzer.").build();
     401   -
                     .build();
    -  402  
     
    -  403  9
             options.addOption(updateOnly)
    +  402  9
             final Option disableComposerAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_COMPOSER)
    +  403   +
                     .desc("Disable the PHP Composer Analyzer.").build();
     404   -
                     .addOption(cve12Base)
    -  405   -
                     .addOption(cve20Base)
    +
     
    +  405  9
             final Option disableAutoconfAnalyzer = Option.builder()
     406   -
                     .addOption(cve12Modified)
    +
                     .longOpt(ARGUMENT.DISABLE_AUTOCONF)
     407   -
                     .addOption(cve20Modified)
    +
                     .desc("Disable the Autoconf Analyzer.").build();
     408   -
                     .addOption(proxyPort)
    -  409   -
                     .addOption(proxyServer)
    +
     
    +  409  9
             final Option disableOpenSSLAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_OPENSSL)
     410   -
                     .addOption(proxyUsername)
    -  411   -
                     .addOption(proxyPassword)
    +
                     .desc("Disable the OpenSSL Analyzer.").build();
    +  411  9
             final Option disableCmakeAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_CMAKE)
     412   -
                     .addOption(connectionTimeout)
    +
                     .desc("Disable the Cmake Analyzer.").build();
     413   -
                     .addOption(connectionString)
    -  414   -
                     .addOption(dbUser)
    +
     
    +  414  9
             final Option disableCentralAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_CENTRAL)
     415   -
                     .addOption(data)
    +
                     .desc("Disable the Central Analyzer. If this analyzer is disabled it is likely you also want to disable "
     416   -
                     .addOption(dbPassword)
    +
                             + "the Nexus Analyzer.").build();
     417   -
                     .addOption(dbDriver)
    -  418   -
                     .addOption(dbDriverPath)
    +
     
    +  418  9
             final Option disableNexusAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_NEXUS)
     419   -
                     .addOption(disableJarAnalyzer)
    +
                     .desc("Disable the Nexus Analyzer.").build();
     420   -
                     .addOption(disableArchiveAnalyzer)
    -  421   -
                     .addOption(disableAssemblyAnalyzer)
    +
     
    +  421  9
             final Option purge = Option.builder().longOpt(ARGUMENT.PURGE_NVD)
     422   -
                     .addOption(disablePythonDistributionAnalyzer)
    +
                     .desc("Purges the local NVD data cache")
     423   -
                     .addOption(disableCmakeAnalyzer)
    +
                     .build();
     424   -
                     .addOption(disablePythonPackageAnalyzer)
    -  425   -
                     .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_RUBYGEMS)
    +
     
    +  425  9
             options.addOption(updateOnly)
     426   -
                             .desc("Disable the Ruby Gemspec Analyzer.").build())
    +
                     .addOption(cve12Base)
     427   -
                     .addOption(disableAutoconfAnalyzer)
    +
                     .addOption(cve20Base)
     428   -
                     .addOption(disableComposerAnalyzer)
    +
                     .addOption(cve12Modified)
     429   -
                     .addOption(disableOpenSSLAnalyzer)
    +
                     .addOption(cve20Modified)
     430   -
                     .addOption(disableNuspecAnalyzer)
    +
                     .addOption(proxyPort)
     431   -
                     .addOption(disableCentralAnalyzer)
    +
                     .addOption(proxyServer)
     432   -
                     .addOption(disableNexusAnalyzer)
    +
                     .addOption(proxyUsername)
     433   -
                     .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_NODE_JS)
    +
                     .addOption(proxyPassword)
     434   -
                             .desc("Disable the Node.js Package Analyzer.").build())
    +
                     .addOption(connectionTimeout)
     435   -
                     .addOption(nexusUrl)
    +
                     .addOption(connectionString)
     436   -
                     .addOption(nexusUsesProxy)
    +
                     .addOption(dbUser)
     437   -
                     .addOption(additionalZipExtensions)
    +
                     .addOption(data)
     438   -
                     .addOption(pathToMono)
    +
                     .addOption(dbPassword)
     439   -
                     .addOption(purge);
    -  440  9
         }
    +
                     .addOption(dbDriver)
    +  440   +
                     .addOption(dbDriverPath)
     441   -
     
    +
                     .addOption(disableJarAnalyzer)
     442   -
         /**
    +
                     .addOption(disableArchiveAnalyzer)
     443   -
          * Adds the deprecated command line options to the given options collection. These are split out for purposes of not including
    +
                     .addOption(disableAssemblyAnalyzer)
     444   -
          * them in the help message. We need to add the deprecated options so as not to break existing scripts.
    +
                     .addOption(pathToBundleAudit)
     445   -
          *
    +
                     .addOption(disablePythonDistributionAnalyzer)
     446   -
          * @param options a collection of command line arguments
    +
                     .addOption(disableCmakeAnalyzer)
     447   -
          * @throws IllegalArgumentException thrown if there is an exception
    +
                     .addOption(disablePythonPackageAnalyzer)
     448   -
          */
    +
                     .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_RUBYGEMS)
     449   -
         @SuppressWarnings({"static-access", "deprecation"})
    +
                             .desc("Disable the Ruby Gemspec Analyzer.").build())
     450   -
         private void addDeprecatedOptions(final Options options) throws IllegalArgumentException {
    +
                     .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_BUNDLE_AUDIT)
     451   -
     
    -  452  9
             final Option proxyServer = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.PROXY_URL)
    +
                             .desc("Disable the Ruby Bundler-Audit Analyzer.").build())
    +  452   +
                     .addOption(disableAutoconfAnalyzer)
     453   -
                     .desc("The proxy url argument is deprecated, use proxyserver instead.")
    +
                     .addOption(disableComposerAnalyzer)
     454   -
                     .build();
    -  455  9
             final Option appName = Option.builder(ARGUMENT.APP_NAME_SHORT).argName("name").hasArg().longOpt(ARGUMENT.APP_NAME)
    +
                     .addOption(disableOpenSSLAnalyzer)
    +  455   +
                     .addOption(disableNuspecAnalyzer)
     456   -
                     .desc("The name of the project being scanned.")
    +
                     .addOption(disableCentralAnalyzer)
     457   -
                     .build();
    +
                     .addOption(disableNexusAnalyzer)
     458   -
     
    -  459  9
             options.addOption(proxyServer);
    -  460  9
             options.addOption(appName);
    -  461  9
         }
    +
                     .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_NODE_JS)
    +  459   +
                             .desc("Disable the Node.js Package Analyzer.").build())
    +  460   +
                     .addOption(nexusUrl)
    +  461   +
                     .addOption(nexusUsesProxy)
     462   -
     
    +
                     .addOption(additionalZipExtensions)
     463   -
         /**
    +
                     .addOption(pathToMono)
     464   -
          * Determines if the 'version' command line argument was passed in.
    +
                     .addOption(pathToBundleAudit)
     465   -
          *
    -  466   -
          * @return whether or not the 'version' command line argument was passed in
    +
                     .addOption(purge);
    +  466  9
         }
     467   -
          */
    +
     
     468   -
         public boolean isGetVersion() {
    -  469  7
             return (line != null) && line.hasOption(ARGUMENT.VERSION);
    +
         /**
    +  469   +
          * Adds the deprecated command line options to the given options collection. These are split out for purposes of not including
     470   -
         }
    +
          * them in the help message. We need to add the deprecated options so as not to break existing scripts.
     471   -
     
    +
          *
     472   -
         /**
    +
          * @param options a collection of command line arguments
     473   -
          * Determines if the 'help' command line argument was passed in.
    +
          * @throws IllegalArgumentException thrown if there is an exception
     474   -
          *
    +
          */
     475   -
          * @return whether or not the 'help' command line argument was passed in
    +
         @SuppressWarnings({"static-access", "deprecation"})
     476   -
          */
    +
         private void addDeprecatedOptions(final Options options) throws IllegalArgumentException {
     477   -
         public boolean isGetHelp() {
    -  478  7
             return (line != null) && line.hasOption(ARGUMENT.HELP);
    +
     
    +  478  9
             final Option proxyServer = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.PROXY_URL)
     479   -
         }
    +
                     .desc("The proxy url argument is deprecated, use proxyserver instead.")
     480   -
     
    -  481   -
         /**
    +
                     .build();
    +  481  9
             final Option appName = Option.builder(ARGUMENT.APP_NAME_SHORT).argName("name").hasArg().longOpt(ARGUMENT.APP_NAME)
     482   -
          * Determines if the 'scan' command line argument was passed in.
    +
                     .desc("The name of the project being scanned.")
     483   -
          *
    +
                     .build();
     484   -
          * @return whether or not the 'scan' command line argument was passed in
    -  485   -
          */
    -  486   -
         public boolean isRunScan() {
    -  487  14
             return (line != null) && isValid && line.hasOption(ARGUMENT.SCAN);
    +
     
    +  485  9
             options.addOption(proxyServer);
    +  486  9
             options.addOption(appName);
    +  487  9
         }
     488   -
         }
    +
     
     489   -
     
    +
         /**
     490   -
         /**
    +
          * Determines if the 'version' command line argument was passed in.
     491   -
          * Returns the symbolic link depth (how deeply symbolic links will be followed).
    +
          *
     492   -
          *
    +
          * @return whether or not the 'version' command line argument was passed in
     493   -
          * @return the symbolic link depth
    +
          */
     494   -
          */
    -  495   -
         public int getSymLinkDepth() {
    -  496  0
             int value = 0;
    +
         public boolean isGetVersion() {
    +  495  7
             return (line != null) && line.hasOption(ARGUMENT.VERSION);
    +  496   +
         }
     497   -
             try {
    -  498  0
                 value = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH, "0"));
    -  499  0
                 if (value < 0) {
    -  500  0
                     value = 0;
    +
     
    +  498   +
         /**
    +  499   +
          * Determines if the 'help' command line argument was passed in.
    +  500   +
          *
     501   -
                 }
    -  502  0
             } catch (NumberFormatException ex) {
    -  503  0
                 LOGGER.debug("Symbolic link was not a number");
    -  504  0
             }
    -  505  0
             return value;
    +
          * @return whether or not the 'help' command line argument was passed in
    +  502   +
          */
    +  503   +
         public boolean isGetHelp() {
    +  504  7
             return (line != null) && line.hasOption(ARGUMENT.HELP);
    +  505   +
         }
     506   -
         }
    +
     
     507   -
     
    +
         /**
     508   -
         /**
    +
          * Determines if the 'scan' command line argument was passed in.
     509   -
          * Returns true if the disableJar command line argument was specified.
    +
          *
     510   -
          *
    +
          * @return whether or not the 'scan' command line argument was passed in
     511   -
          * @return true if the disableJar command line argument was specified; otherwise false
    +
          */
     512   -
          */
    -  513   -
         public boolean isJarDisabled() {
    -  514  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_JAR);
    +
         public boolean isRunScan() {
    +  513  21
             return (line != null) && isValid && line.hasOption(ARGUMENT.SCAN);
    +  514   +
         }
     515   -
         }
    +
     
     516   -
     
    +
         /**
     517   -
         /**
    +
          * Returns the symbolic link depth (how deeply symbolic links will be followed).
     518   -
          * Returns true if the disableArchive command line argument was specified.
    +
          *
     519   -
          *
    +
          * @return the symbolic link depth
     520   -
          * @return true if the disableArchive command line argument was specified; otherwise false
    +
          */
     521   -
          */
    -  522   -
         public boolean isArchiveDisabled() {
    -  523  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_ARCHIVE);
    -  524   -
         }
    -  525   -
     
    -  526   -
         /**
    +
         public int getSymLinkDepth() {
    +  522  0
             int value = 0;
    +  523   +
             try {
    +  524  0
                 value = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH, "0"));
    +  525  0
                 if (value < 0) {
    +  526  0
                     value = 0;
     527   -
          * Returns true if the disableNuspec command line argument was specified.
    -  528   -
          *
    -  529   -
          * @return true if the disableNuspec command line argument was specified; otherwise false
    -  530   -
          */
    -  531   -
         public boolean isNuspecDisabled() {
    -  532  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_NUSPEC);
    +
                 }
    +  528  0
             } catch (NumberFormatException ex) {
    +  529  0
                 LOGGER.debug("Symbolic link was not a number");
    +  530  0
             }
    +  531  0
             return value;
    +  532   +
         }
     533   -
         }
    +
     
     534   -
     
    +
         /**
     535   -
         /**
    +
          * Returns true if the disableJar command line argument was specified.
     536   -
          * Returns true if the disableAssembly command line argument was specified.
    +
          *
     537   -
          *
    +
          * @return true if the disableJar command line argument was specified; otherwise false
     538   -
          * @return true if the disableAssembly command line argument was specified; otherwise false
    +
          */
     539   -
          */
    -  540   -
         public boolean isAssemblyDisabled() {
    -  541  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_ASSEMBLY);
    +
         public boolean isJarDisabled() {
    +  540  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_JAR);
    +  541   +
         }
     542   -
         }
    +
     
     543   -
     
    +
         /**
     544   -
         /**
    +
          * Returns true if the disableArchive command line argument was specified.
     545   -
          * Returns true if the disablePyDist command line argument was specified.
    +
          *
     546   -
          *
    +
          * @return true if the disableArchive command line argument was specified; otherwise false
     547   -
          * @return true if the disablePyDist command line argument was specified; otherwise false
    +
          */
     548   -
          */
    -  549   -
         public boolean isPythonDistributionDisabled() {
    -  550  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_DIST);
    +
         public boolean isArchiveDisabled() {
    +  549  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_ARCHIVE);
    +  550   +
         }
     551   -
         }
    +
     
     552   -
     
    +
         /**
     553   -
         /**
    +
          * Returns true if the disableNuspec command line argument was specified.
     554   -
          * Returns true if the disablePyPkg command line argument was specified.
    +
          *
     555   -
          *
    +
          * @return true if the disableNuspec command line argument was specified; otherwise false
     556   -
          * @return true if the disablePyPkg command line argument was specified; otherwise false
    +
          */
     557   -
          */
    -  558   -
         public boolean isPythonPackageDisabled() {
    -  559  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_PKG);
    +
         public boolean isNuspecDisabled() {
    +  558  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_NUSPEC);
    +  559   +
         }
     560   -
         }
    +
     
     561   -
     
    +
         /**
     562   -
         /**
    +
          * Returns true if the disableAssembly command line argument was specified.
     563   -
          * Returns whether the Ruby gemspec analyzer is disabled.
    +
          *
     564   -
          *
    +
          * @return true if the disableAssembly command line argument was specified; otherwise false
     565   -
          * @return true if the {@link ARGUMENT#DISABLE_RUBYGEMS} command line argument was specified; otherwise false
    +
          */
     566   -
          */
    -  567   -
         public boolean isRubyGemspecDisabled() {
    -  568  0
             return (null != line) && line.hasOption(ARGUMENT.DISABLE_RUBYGEMS);
    +
         public boolean isAssemblyDisabled() {
    +  567  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_ASSEMBLY);
    +  568   +
         }
     569   -
         }
    -  570  
     
    -  571   +  570  
         /**
    +  571   +
          * Returns true if the disableBundleAudit command line argument was specified.
     572   -
          * Returns true if the disableCmake command line argument was specified.
    -  573  
          *
    +  573   +
          * @return true if the disableBundleAudit command line argument was specified; otherwise false
     574   -
          * @return true if the disableCmake command line argument was specified; otherwise false
    -  575  
          */
    -  576   -
         public boolean isCmakeDisabled() {
    -  577  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_CMAKE);
    -  578   +  575   +
         public boolean isBundleAuditDisabled() {
    +  576  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_BUNDLE_AUDIT);
    +  577  
         }
    +  578   +
     
     579  
     
     580  
         /**
     581   -
          * Returns true if the disableAutoconf command line argument was specified.
    +
          * Returns true if the disablePyDist command line argument was specified.
     582  
          *
     583   -
          * @return true if the disableAutoconf command line argument was specified; otherwise false
    +
          * @return true if the disablePyDist command line argument was specified; otherwise false
     584  
          */
     585   -
         public boolean isAutoconfDisabled() {
    -  586  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_AUTOCONF);
    +
         public boolean isPythonDistributionDisabled() {
    +  586  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_DIST);
     587  
         }
     588   @@ -1050,16 +1042,16 @@  589  
         /**
     590   -
          * Returns true if the disableComposer command line argument was specified.
    +
          * Returns true if the disablePyPkg command line argument was specified.
     591  
          *
     592   -
          * @return true if the disableComposer command line argument was specified; otherwise false
    +
          * @return true if the disablePyPkg command line argument was specified; otherwise false
     593  
          */
     594   -
         public boolean isComposerDisabled() {
    -  595  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_COMPOSER);
    +
         public boolean isPythonPackageDisabled() {
    +  595  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_PKG);
     596  
         }
     597   @@ -1067,16 +1059,16 @@  598  
         /**
     599   -
          * Returns true if the disableNexus command line argument was specified.
    +
          * Returns whether the Ruby gemspec analyzer is disabled.
     600  
          *
     601   -
          * @return true if the disableNexus command line argument was specified; otherwise false
    +
          * @return true if the {@link ARGUMENT#DISABLE_RUBYGEMS} command line argument was specified; otherwise false
     602  
          */
     603   -
         public boolean isNexusDisabled() {
    -  604  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_NEXUS);
    +
         public boolean isRubyGemspecDisabled() {
    +  604  0
             return (null != line) && line.hasOption(ARGUMENT.DISABLE_RUBYGEMS);
     605  
         }
     606   @@ -1084,16 +1076,16 @@  607  
         /**
     608   -
          * Returns true if the disableOpenSSL command line argument was specified.
    +
          * Returns true if the disableCmake command line argument was specified.
     609  
          *
     610   -
          * @return true if the disableOpenSSL command line argument was specified; otherwise false
    +
          * @return true if the disableCmake command line argument was specified; otherwise false
     611  
          */
     612   -
         public boolean isOpenSSLDisabled() {
    -  613  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_OPENSSL);
    +
         public boolean isCmakeDisabled() {
    +  613  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_CMAKE);
     614  
         }
     615   @@ -1101,16 +1093,16 @@  616  
         /**
     617   -
          * Returns true if the disableNodeJS command line argument was specified.
    +
          * Returns true if the disableAutoconf command line argument was specified.
     618  
          *
     619   -
          * @return true if the disableNodeJS command line argument was specified; otherwise false
    +
          * @return true if the disableAutoconf command line argument was specified; otherwise false
     620  
          */
     621   -
         public boolean isNodeJsDisabled() {
    -  622  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_NODE_JS);
    +
         public boolean isAutoconfDisabled() {
    +  622  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_AUTOCONF);
     623  
         }
     624   @@ -1118,16 +1110,16 @@  625  
         /**
     626   -
          * Returns true if the disableCentral command line argument was specified.
    +
          * Returns true if the disableComposer command line argument was specified.
     627  
          *
     628   -
          * @return true if the disableCentral command line argument was specified; otherwise false
    +
          * @return true if the disableComposer command line argument was specified; otherwise false
     629  
          */
     630   -
         public boolean isCentralDisabled() {
    -  631  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_CENTRAL);
    +
         public boolean isComposerDisabled() {
    +  631  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_COMPOSER);
     632  
         }
     633   @@ -1135,178 +1127,178 @@  634  
         /**
     635   -
          * Returns the url to the nexus server if one was specified.
    +
          * Returns true if the disableNexus command line argument was specified.
     636  
          *
     637   -
          * @return the url to the nexus server; if none was specified this will return null;
    +
          * @return true if the disableNexus command line argument was specified; otherwise false
     638  
          */
     639   -
         public String getNexusUrl() {
    -  640  0
             if (line == null || !line.hasOption(ARGUMENT.NEXUS_URL)) {
    -  641  0
                 return null;
    +
         public boolean isNexusDisabled() {
    +  640  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_NEXUS);
    +  641   +
         }
     642   -
             } else {
    -  643  0
                 return line.getOptionValue(ARGUMENT.NEXUS_URL);
    +
     
    +  643   +
         /**
     644   -
             }
    +
          * Returns true if the disableOpenSSL command line argument was specified.
     645   -
         }
    +
          *
     646   -
     
    +
          * @return true if the disableOpenSSL command line argument was specified; otherwise false
     647   -
         /**
    +
          */
     648   -
          * Returns true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false is returned.
    -  649   -
          *
    +
         public boolean isOpenSSLDisabled() {
    +  649  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_OPENSSL);
     650   -
          * @return true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false
    +
         }
     651   -
          */
    +
     
     652   -
         public boolean isNexusUsesProxy() {
    +
         /**
     653   -
             // If they didn't specify whether Nexus needs to use the proxy, we should
    +
          * Returns true if the disableNodeJS command line argument was specified.
     654   -
             // still honor the property if it's set.
    -  655  0
             if (line == null || !line.hasOption(ARGUMENT.NEXUS_USES_PROXY)) {
    +
          *
    +  655   +
          * @return true if the disableNodeJS command line argument was specified; otherwise false
     656   -
                 try {
    -  657  0
                     return Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY);
    -  658  0
                 } catch (InvalidSettingException ise) {
    -  659  0
                     return true;
    +
          */
    +  657   +
         public boolean isNodeJsDisabled() {
    +  658  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_NODE_JS);
    +  659   +
         }
     660   -
                 }
    +
     
     661   -
             } else {
    -  662  0
                 return Boolean.parseBoolean(line.getOptionValue(ARGUMENT.NEXUS_USES_PROXY));
    +
         /**
    +  662   +
          * Returns true if the disableCentral command line argument was specified.
     663   -
             }
    +
          *
     664   -
         }
    +
          * @return true if the disableCentral command line argument was specified; otherwise false
     665   -
     
    +
          */
     666   -
         /**
    -  667   -
          * Displays the command line help message to the standard output.
    +
         public boolean isCentralDisabled() {
    +  667  0
             return (line != null) && line.hasOption(ARGUMENT.DISABLE_CENTRAL);
     668   -
          */
    +
         }
     669   -
         public void printHelp() {
    -  670  2
             final HelpFormatter formatter = new HelpFormatter();
    -  671  2
             final Options options = new Options();
    -  672  2
             addStandardOptions(options);
    -  673  2
             if (line != null && line.hasOption(ARGUMENT.ADVANCED_HELP)) {
    -  674  0
                 addAdvancedOptions(options);
    +
     
    +  670   +
         /**
    +  671   +
          * Returns the url to the nexus server if one was specified.
    +  672   +
          *
    +  673   +
          * @return the url to the nexus server; if none was specified this will return null;
    +  674   +
          */
     675   -
             }
    -  676  2
             final String helpMsg = String.format("%n%s"
    -  677   -
                     + " can be used to identify if there are any known CVE vulnerabilities in libraries utilized by an application. "
    +
         public String getNexusUrl() {
    +  676  0
             if (line == null || !line.hasOption(ARGUMENT.NEXUS_URL)) {
    +  677  0
                 return null;
     678   -
                     + "%s will automatically update required data from the Internet, such as the CVE and CPE data files from nvd.nist.gov.%n%n",
    -  679   -
                     Settings.getString("application.name", "DependencyCheck"),
    +
             } else {
    +  679  0
                 return line.getOptionValue(ARGUMENT.NEXUS_URL);
     680   -
                     Settings.getString("application.name", "DependencyCheck"));
    +
             }
     681   +
         }
    +  682  
     
    -  682  2
             formatter.printHelp(Settings.getString("application.name", "DependencyCheck"),
     683   -
                     helpMsg,
    +
         /**
     684   -
                     options,
    +
          * Returns true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false is returned.
     685   -
                     "",
    +
          *
     686   -
                     true);
    -  687  2
         }
    +
          * @return true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false
    +  687   +
          */
     688   -
     
    +
         public boolean isNexusUsesProxy() {
     689   -
         /**
    +
             // If they didn't specify whether Nexus needs to use the proxy, we should
     690   -
          * Retrieves the file command line parameter(s) specified for the 'scan' argument.
    -  691   -
          *
    +
             // still honor the property if it's set.
    +  691  0
             if (line == null || !line.hasOption(ARGUMENT.NEXUS_USES_PROXY)) {
     692   -
          * @return the file paths specified on the command line for scan
    -  693   -
          */
    -  694   -
         public String[] getScanFiles() {
    -  695  3
             return line.getOptionValues(ARGUMENT.SCAN);
    +
                 try {
    +  693  0
                     return Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY);
    +  694  0
                 } catch (InvalidSettingException ise) {
    +  695  0
                     return true;
     696   -
         }
    +
                 }
     697   -
     
    -  698   -
         /**
    +
             } else {
    +  698  0
                 return Boolean.parseBoolean(line.getOptionValue(ARGUMENT.NEXUS_USES_PROXY));
     699   -
          * Retrieves the list of excluded file patterns specified by the 'exclude' argument.
    +
             }
     700   -
          *
    +
         }
     701   -
          * @return the excluded file patterns
    +
     
     702   -
          */
    +
         /**
     703   -
         public String[] getExcludeList() {
    -  704  0
             return line.getOptionValues(ARGUMENT.EXCLUDE);
    +
          * Displays the command line help message to the standard output.
    +  704   +
          */
     705   -
         }
    -  706   -
     
    -  707   -
         /**
    -  708   -
          * Returns the directory to write the reports to specified on the command line.
    -  709   -
          *
    -  710   -
          * @return the path to the reports directory.
    +
         public void printHelp() {
    +  706  2
             final HelpFormatter formatter = new HelpFormatter();
    +  707  2
             final Options options = new Options();
    +  708  2
             addStandardOptions(options);
    +  709  2
             if (line != null && line.hasOption(ARGUMENT.ADVANCED_HELP)) {
    +  710  0
                 addAdvancedOptions(options);
     711   -
          */
    -  712   -
         public String getReportDirectory() {
    -  713  1
             return line.getOptionValue(ARGUMENT.OUT, ".");
    +
             }
    +  712  2
             final String helpMsg = String.format("%n%s"
    +  713   +
                     + " can be used to identify if there are any known CVE vulnerabilities in libraries utilized by an application. "
     714   -
         }
    +
                     + "%s will automatically update required data from the Internet, such as the CVE and CPE data files from nvd.nist.gov.%n%n",
     715   -
     
    +
                     Settings.getString("application.name", "DependencyCheck"),
     716   -
         /**
    +
                     Settings.getString("application.name", "DependencyCheck"));
     717   -
          * Returns the path to Mono for .NET Assembly analysis on non-windows systems.
    -  718   -
          *
    +
     
    +  718  2
             formatter.printHelp(Settings.getString("application.name", "DependencyCheck"),
     719   -
          * @return the path to Mono
    +
                     helpMsg,
     720   -
          */
    +
                     options,
     721   -
         public String getPathToMono() {
    -  722  1
             return line.getOptionValue(ARGUMENT.PATH_TO_MONO);
    -  723   -
         }
    +
                     "",
    +  722   +
                     true);
    +  723  2
         }
     724  
     
     725  
         /**
     726   -
          * Returns the output format specified on the command line. Defaults to HTML if no format was specified.
    +
          * Retrieves the file command line parameter(s) specified for the 'scan' argument.
     727  
          *
     728   -
          * @return the output format name.
    +
          * @return the file paths specified on the command line for scan
     729  
          */
     730   -
         public String getReportFormat() {
    -  731  1
             return line.getOptionValue(ARGUMENT.OUTPUT_FORMAT, "HTML");
    +
         public String[] getScanFiles() {
    +  731  3
             return line.getOptionValues(ARGUMENT.SCAN);
     732  
         }
     733   @@ -1314,108 +1306,108 @@  734  
         /**
     735   -
          * Returns the application name specified on the command line.
    +
          * Retrieves the list of excluded file patterns specified by the 'exclude' argument.
     736  
          *
     737   -
          * @return the application name.
    +
          * @return the excluded file patterns
     738  
          */
     739   -
         public String getProjectName() {
    -  740  0
             final String appName = line.getOptionValue(ARGUMENT.APP_NAME);
    -  741  0
             String name = line.getOptionValue(ARGUMENT.PROJECT);
    -  742  0
             if (name == null && appName != null) {
    -  743  0
                 name = appName;
    -  744  0
                 LOGGER.warn("The '" + ARGUMENT.APP_NAME + "' argument should no longer be used; use '" + ARGUMENT.PROJECT + "' instead.");
    +
         public String[] getExcludeList() {
    +  740  0
             return line.getOptionValues(ARGUMENT.EXCLUDE);
    +  741   +
         }
    +  742   +
     
    +  743   +
         /**
    +  744   +
          * Returns the directory to write the reports to specified on the command line.
     745   -
             }
    -  746  0
             return name;
    +
          *
    +  746   +
          * @return the path to the reports directory.
     747   -
         }
    +
          */
     748   -
     
    -  749   -
         /**
    +
         public String getReportDirectory() {
    +  749  1
             return line.getOptionValue(ARGUMENT.OUT, ".");
     750   -
          * Returns the base URL for the CVE 1.2 XMl file.
    +
         }
     751   -
          *
    +
     
     752   -
          * @return the URL to the CVE 1.2 XML file.
    +
         /**
     753   -
          */
    +
          * Returns the path to Mono for .NET Assembly analysis on non-windows systems.
     754   -
         public String getBaseCve12Url() {
    -  755  1
             return line.getOptionValue(ARGUMENT.CVE_BASE_12);
    +
          *
    +  755   +
          * @return the path to Mono
     756   -
         }
    +
          */
     757   -
     
    -  758   -
         /**
    +
         public String getPathToMono() {
    +  758  1
             return line.getOptionValue(ARGUMENT.PATH_TO_MONO);
     759   -
          * Returns the base URL for the CVE 2.0 XMl file.
    +
         }
     760   -
          *
    +
     
     761   -
          * @return the URL to the CVE 2.0 XML file.
    +
         /**
     762   -
          */
    +
          * Returns the path to bundle-audit for Ruby bundle analysis.
     763   -
         public String getBaseCve20Url() {
    -  764  1
             return line.getOptionValue(ARGUMENT.CVE_BASE_20);
    +
          *
    +  764   +
          * @return the path to Mono
     765   -
         }
    +
          */
     766   -
     
    -  767   -
         /**
    +
         public String getPathToBundleAudit() {
    +  767  0
             return line.getOptionValue(ARGUMENT.PATH_TO_BUNDLE_AUDIT);
     768   -
          * Returns the URL for the modified CVE 1.2 XMl file.
    +
         }
     769   -
          *
    +
     
     770   -
          * @return the URL to the modified CVE 1.2 XML file.
    +
         /**
     771   -
          */
    +
          * Returns the output format specified on the command line. Defaults to HTML if no format was specified.
     772   -
         public String getModifiedCve12Url() {
    -  773  1
             return line.getOptionValue(ARGUMENT.CVE_MOD_12);
    +
          *
    +  773   +
          * @return the output format name.
     774   -
         }
    +
          */
     775   -
     
    -  776   -
         /**
    +
         public String getReportFormat() {
    +  776  1
             return line.getOptionValue(ARGUMENT.OUTPUT_FORMAT, "HTML");
     777   -
          * Returns the URL for the modified CVE 2.0 XMl file.
    -  778   -
          *
    -  779   -
          * @return the URL to the modified CVE 2.0 XML file.
    -  780   -
          */
    -  781   -
         public String getModifiedCve20Url() {
    -  782  1
             return line.getOptionValue(ARGUMENT.CVE_MOD_20);
    -  783  
         }
    -  784   +  778  
     
    -  785   +  779  
         /**
    -  786   -
          * Returns the connection timeout.
    -  787   +  780   +
          * Returns the application name specified on the command line.
    +  781  
          *
    -  788   -
          * @return the connection timeout
    -  789   +  782   +
          * @return the application name.
    +  783  
          */
    +  784   +
         public String getProjectName() {
    +  785  0
             final String appName = line.getOptionValue(ARGUMENT.APP_NAME);
    +  786  0
             String name = line.getOptionValue(ARGUMENT.PROJECT);
    +  787  0
             if (name == null && appName != null) {
    +  788  0
                 name = appName;
    +  789  0
                 LOGGER.warn("The '" + ARGUMENT.APP_NAME + "' argument should no longer be used; use '" + ARGUMENT.PROJECT + "' instead.");
     790   -
         public String getConnectionTimeout() {
    -  791  0
             return line.getOptionValue(ARGUMENT.CONNECTION_TIMEOUT);
    +
             }
    +  791  0
             return name;
     792  
         }
     793   @@ -1423,29 +1415,33 @@  794  
         /**
     795   -
          * Returns the proxy server.
    +
          * Returns the base URL for the CVE 1.2 XMl file.
     796  
          *
     797   -
          * @return the proxy server
    +
          * @return the URL to the CVE 1.2 XML file.
     798  
          */
     799   -
         @SuppressWarnings("deprecation")
    -  800   -
         public String getProxyServer() {
    +
         public String getBaseCve12Url() {
    +  800  1
             return line.getOptionValue(ARGUMENT.CVE_BASE_12);
     801   +
         }
    +  802  
     
    -  802  0
             String server = line.getOptionValue(ARGUMENT.PROXY_SERVER);
    -  803  0
             if (server == null) {
    -  804  0
                 server = line.getOptionValue(ARGUMENT.PROXY_URL);
    -  805  0
                 if (server != null) {
    -  806  0
                     LOGGER.warn("An old command line argument 'proxyurl' was detected; use proxyserver instead");
    +  803   +
         /**
    +  804   +
          * Returns the base URL for the CVE 2.0 XMl file.
    +  805   +
          *
    +  806   +
          * @return the URL to the CVE 2.0 XML file.
     807   -
                 }
    +
          */
     808   -
             }
    -  809  0
             return server;
    +
         public String getBaseCve20Url() {
    +  809  1
             return line.getOptionValue(ARGUMENT.CVE_BASE_20);
     810  
         }
     811   @@ -1453,16 +1449,16 @@  812  
         /**
     813   -
          * Returns the proxy port.
    +
          * Returns the URL for the modified CVE 1.2 XMl file.
     814  
          *
     815   -
          * @return the proxy port
    +
          * @return the URL to the modified CVE 1.2 XML file.
     816  
          */
     817   -
         public String getProxyPort() {
    -  818  0
             return line.getOptionValue(ARGUMENT.PROXY_PORT);
    +
         public String getModifiedCve12Url() {
    +  818  1
             return line.getOptionValue(ARGUMENT.CVE_MOD_12);
     819  
         }
     820   @@ -1470,16 +1466,16 @@  821  
         /**
     822   -
          * Returns the proxy username.
    +
          * Returns the URL for the modified CVE 2.0 XMl file.
     823  
          *
     824   -
          * @return the proxy username
    +
          * @return the URL to the modified CVE 2.0 XML file.
     825  
          */
     826   -
         public String getProxyUsername() {
    -  827  0
             return line.getOptionValue(ARGUMENT.PROXY_USERNAME);
    +
         public String getModifiedCve20Url() {
    +  827  1
             return line.getOptionValue(ARGUMENT.CVE_MOD_20);
     828  
         }
     829   @@ -1487,16 +1483,16 @@  830  
         /**
     831   -
          * Returns the proxy password.
    +
          * Returns the connection timeout.
     832  
          *
     833   -
          * @return the proxy password
    +
          * @return the connection timeout
     834  
          */
     835   -
         public String getProxyPassword() {
    -  836  0
             return line.getOptionValue(ARGUMENT.PROXY_PASSWORD);
    +
         public String getConnectionTimeout() {
    +  836  0
             return line.getOptionValue(ARGUMENT.CONNECTION_TIMEOUT);
     837  
         }
     838   @@ -1504,197 +1500,193 @@  839  
         /**
     840   -
          * Get the value of dataDirectory.
    +
          * Returns the proxy server.
     841  
          *
     842   -
          * @return the value of dataDirectory
    +
          * @return the proxy server
     843  
          */
     844   -
         public String getDataDirectory() {
    -  845  0
             return line.getOptionValue(ARGUMENT.DATA_DIRECTORY);
    +
         @SuppressWarnings("deprecation")
    +  845   +
         public String getProxyServer() {
     846   -
         }
    -  847  
     
    -  848   -
         /**
    -  849   -
          * Returns the properties file specified on the command line.
    -  850   -
          *
    -  851   -
          * @return the properties file specified on the command line
    +  847  0
             String server = line.getOptionValue(ARGUMENT.PROXY_SERVER);
    +  848  0
             if (server == null) {
    +  849  0
                 server = line.getOptionValue(ARGUMENT.PROXY_URL);
    +  850  0
                 if (server != null) {
    +  851  0
                     LOGGER.warn("An old command line argument 'proxyurl' was detected; use proxyserver instead");
     852   -
          */
    +
                 }
     853   -
         public File getPropertiesFile() {
    -  854  0
             final String path = line.getOptionValue(ARGUMENT.PROP);
    -  855  0
             if (path != null) {
    -  856  0
                 return new File(path);
    -  857  
             }
    -  858  0
             return null;
    +  854  0
             return server;
    +  855   +
         }
    +  856   +
     
    +  857   +
         /**
    +  858   +
          * Returns the proxy port.
     859   -
         }
    +
          *
     860   -
     
    +
          * @return the proxy port
     861   -
         /**
    +
          */
     862   -
          * Returns the path to the verbose log file.
    -  863   -
          *
    +
         public String getProxyPort() {
    +  863  0
             return line.getOptionValue(ARGUMENT.PROXY_PORT);
     864   -
          * @return the path to the verbose log file
    +
         }
     865   -
          */
    +
     
     866   -
         public String getVerboseLog() {
    -  867  0
             return line.getOptionValue(ARGUMENT.VERBOSE_LOG);
    +
         /**
    +  867   +
          * Returns the proxy username.
     868   -
         }
    +
          *
     869   -
     
    +
          * @return the proxy username
     870   -
         /**
    +
          */
     871   -
          * Returns the path to the suppression file.
    -  872   -
          *
    +
         public String getProxyUsername() {
    +  872  0
             return line.getOptionValue(ARGUMENT.PROXY_USERNAME);
     873   -
          * @return the path to the suppression file
    +
         }
     874   -
          */
    +
     
     875   -
         public String getSuppressionFile() {
    -  876  0
             return line.getOptionValue(ARGUMENT.SUPPRESSION_FILE);
    +
         /**
    +  876   +
          * Returns the proxy password.
     877   -
         }
    +
          *
     878   -
     
    +
          * @return the proxy password
     879   -
         /**
    +
          */
     880   -
          * <p>
    -  881   -
          * Prints the manifest information to standard output.</p>
    +
         public String getProxyPassword() {
    +  881  0
             return line.getOptionValue(ARGUMENT.PROXY_PASSWORD);
     882   -
          * <ul><li>Implementation-Title: ${pom.name}</li>
    +
         }
     883   -
          * <li>Implementation-Version: ${pom.version}</li></ul>
    +
     
     884   -
          */
    +
         /**
     885   -
         public void printVersionInfo() {
    -  886  1
             final String version = String.format("%s version %s",
    +
          * Get the value of dataDirectory.
    +  886   +
          *
     887   -
                     Settings.getString(Settings.KEYS.APPLICATION_VAME, "dependency-check"),
    +
          * @return the value of dataDirectory
     888   -
                     Settings.getString(Settings.KEYS.APPLICATION_VERSION, "Unknown"));
    -  889  1
             System.out.println(version);
    -  890  1
         }
    +
          */
    +  889   +
         public String getDataDirectory() {
    +  890  0
             return line.getOptionValue(ARGUMENT.DATA_DIRECTORY);
     891   -
     
    +
         }
     892   -
         /**
    +
     
     893   -
          * Checks if the auto update feature has been disabled. If it has been disabled via the command line this will return false.
    +
         /**
     894   -
          *
    +
          * Returns the properties file specified on the command line.
     895   -
          * @return <code>true</code> if auto-update is allowed; otherwise <code>false</code>
    +
          *
     896   -
          */
    +
          * @return the properties file specified on the command line
     897   -
         public boolean isAutoUpdate() {
    -  898  0
             return line != null && !line.hasOption(ARGUMENT.DISABLE_AUTO_UPDATE);
    -  899   -
         }
    -  900   -
     
    -  901   -
         /**
    +
          */
    +  898   +
         public File getPropertiesFile() {
    +  899  0
             final String path = line.getOptionValue(ARGUMENT.PROP);
    +  900  0
             if (path != null) {
    +  901  0
                 return new File(path);
     902   -
          * Checks if the update only flag has been set.
    -  903   -
          *
    +
             }
    +  903  0
             return null;
     904   -
          * @return <code>true</code> if the update only flag has been set; otherwise <code>false</code>.
    +
         }
     905   -
          */
    +
     
     906   -
         public boolean isUpdateOnly() {
    -  907  0
             return line != null && line.hasOption(ARGUMENT.UPDATE_ONLY);
    +
         /**
    +  907   +
          * Returns the path to the verbose log file.
     908   -
         }
    +
          *
     909   -
     
    +
          * @return the path to the verbose log file
     910   -
         /**
    +
          */
     911   -
          * Checks if the purge NVD flag has been set.
    -  912   -
          *
    +
         public String getVerboseLog() {
    +  912  0
             return line.getOptionValue(ARGUMENT.VERBOSE_LOG);
     913   -
          * @return <code>true</code> if the purge nvd flag has been set; otherwise <code>false</code>.
    +
         }
     914   -
          */
    +
     
     915   -
         public boolean isPurge() {
    -  916  0
             return line != null && line.hasOption(ARGUMENT.PURGE_NVD);
    +
         /**
    +  916   +
          * Returns the path to the suppression file.
     917   -
         }
    +
          *
     918   -
     
    +
          * @return the path to the suppression file
     919   -
         /**
    +
          */
     920   -
          * Returns the database driver name if specified; otherwise null is returned.
    -  921   -
          *
    +
         public String getSuppressionFile() {
    +  921  0
             return line.getOptionValue(ARGUMENT.SUPPRESSION_FILE);
     922   -
          * @return the database driver name if specified; otherwise null is returned
    +
         }
     923   -
          */
    -  924   -
         public String getDatabaseDriverName() {
    -  925  0
             return line.getOptionValue(ARGUMENT.DB_DRIVER);
    -  926   -
         }
    -  927  
     
    -  928   +  924  
         /**
    +  925   +
          * <p>
    +  926   +
          * Prints the manifest information to standard output.</p>
    +  927   +
          * <ul><li>Implementation-Title: ${pom.name}</li>
    +  928   +
          * <li>Implementation-Version: ${pom.version}</li></ul>
     929   -
          * Returns the database driver path if specified; otherwise null is returned.
    -  930   -
          *
    -  931   -
          * @return the database driver name if specified; otherwise null is returned
    -  932  
          */
    +  930   +
         public void printVersionInfo() {
    +  931  1
             final String version = String.format("%s version %s",
    +  932   +
                     Settings.getString(Settings.KEYS.APPLICATION_VAME, "dependency-check"),
     933   -
         public String getDatabaseDriverPath() {
    -  934  0
             return line.getOptionValue(ARGUMENT.DB_DRIVER_PATH);
    -  935   -
         }
    +
                     Settings.getString(Settings.KEYS.APPLICATION_VERSION, "Unknown"));
    +  934  1
             System.out.println(version);
    +  935  1
         }
     936  
     
     937  
         /**
     938   -
          * Returns the database connection string if specified; otherwise null is returned.
    +
          * Checks if the auto update feature has been disabled. If it has been disabled via the command line this will return false.
     939  
          *
     940   -
          * @return the database connection string if specified; otherwise null is returned
    +
          * @return <code>true</code> if auto-update is allowed; otherwise <code>false</code>
     941  
          */
     942   -
         public String getConnectionString() {
    -  943  0
             return line.getOptionValue(ARGUMENT.CONNECTION_STRING);
    +
         public boolean isAutoUpdate() {
    +  943  0
             return line != null && !line.hasOption(ARGUMENT.DISABLE_AUTO_UPDATE);
     944  
         }
     945   @@ -1702,16 +1694,16 @@  946  
         /**
     947   -
          * Returns the database database user name if specified; otherwise null is returned.
    +
          * Checks if the update only flag has been set.
     948  
          *
     949   -
          * @return the database database user name if specified; otherwise null is returned
    +
          * @return <code>true</code> if the update only flag has been set; otherwise <code>false</code>.
     950  
          */
     951   -
         public String getDatabaseUser() {
    -  952  0
             return line.getOptionValue(ARGUMENT.DB_NAME);
    +
         public boolean isUpdateOnly() {
    +  952  7
             return line != null && line.hasOption(ARGUMENT.UPDATE_ONLY);
     953  
         }
     954   @@ -1719,16 +1711,16 @@  955  
         /**
     956   -
          * Returns the database database password if specified; otherwise null is returned.
    +
          * Checks if the purge NVD flag has been set.
     957  
          *
     958   -
          * @return the database database password if specified; otherwise null is returned
    +
          * @return <code>true</code> if the purge nvd flag has been set; otherwise <code>false</code>.
     959  
          */
     960   -
         public String getDatabasePassword() {
    -  961  0
             return line.getOptionValue(ARGUMENT.DB_PASSWORD);
    +
         public boolean isPurge() {
    +  961  0
             return line != null && line.hasOption(ARGUMENT.PURGE_NVD);
     962  
         }
     963   @@ -1736,16 +1728,16 @@  964  
         /**
     965   -
          * Returns the additional Extensions if specified; otherwise null is returned.
    +
          * Returns the database driver name if specified; otherwise null is returned.
     966  
          *
     967   -
          * @return the additional Extensions; otherwise null is returned
    +
          * @return the database driver name if specified; otherwise null is returned
     968  
          */
     969   -
         public String getAdditionalZipExtensions() {
    -  970  0
             return line.getOptionValue(ARGUMENT.ADDITIONAL_ZIP_EXTENSIONS);
    +
         public String getDatabaseDriverName() {
    +  970  0
             return line.getOptionValue(ARGUMENT.DB_DRIVER);
     971  
         }
     972   @@ -1753,526 +1745,657 @@  973  
         /**
     974   -
          * A collection of static final strings that represent the possible command line arguments.
    +
          * Returns the database driver path if specified; otherwise null is returned.
     975   -
          */
    -  976  9
         public static class ARGUMENT {
    +
          *
    +  976   +
          * @return the database driver name if specified; otherwise null is returned
     977   -
     
    +
          */
     978   -
             /**
    -  979   -
              * The long CLI argument name specifying the directory/file to scan.
    +
         public String getDatabaseDriverPath() {
    +  979  0
             return line.getOptionValue(ARGUMENT.DB_DRIVER_PATH);
     980   -
              */
    +
         }
     981   -
             public static final String SCAN = "scan";
    +
     
     982   -
             /**
    +
         /**
     983   -
              * The short CLI argument name specifying the directory/file to scan.
    +
          * Returns the database connection string if specified; otherwise null is returned.
     984   -
              */
    +
          *
     985   -
             public static final String SCAN_SHORT = "s";
    +
          * @return the database connection string if specified; otherwise null is returned
     986   -
             /**
    +
          */
     987   -
              * The long CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated.
    -  988   -
              */
    +
         public String getConnectionString() {
    +  988  0
             return line.getOptionValue(ARGUMENT.CONNECTION_STRING);
     989   -
             public static final String DISABLE_AUTO_UPDATE = "noupdate";
    +
         }
     990   -
             /**
    +
     
     991   -
              * The short CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated.
    +
         /**
     992   -
              */
    +
          * Returns the database database user name if specified; otherwise null is returned.
     993   -
             public static final String DISABLE_AUTO_UPDATE_SHORT = "n";
    +
          *
     994   -
             /**
    +
          * @return the database database user name if specified; otherwise null is returned
     995   -
              * The long CLI argument name specifying that only the update phase should be executed; no scan should be run.
    +
          */
     996   -
              */
    -  997   -
             public static final String UPDATE_ONLY = "updateonly";
    +
         public String getDatabaseUser() {
    +  997  0
             return line.getOptionValue(ARGUMENT.DB_NAME);
     998   -
             /**
    +
         }
     999   -
              * The long CLI argument name specifying that only the update phase should be executed; no scan should be run.
    +
     
     1000   -
              */
    +
         /**
     1001   -
             public static final String PURGE_NVD = "purge";
    +
          * Returns the database database password if specified; otherwise null is returned.
     1002   -
             /**
    +
          *
     1003   -
              * The long CLI argument name specifying the directory to write the reports to.
    +
          * @return the database database password if specified; otherwise null is returned
     1004   -
              */
    +
          */
     1005   -
             public static final String OUT = "out";
    -  1006   -
             /**
    +
         public String getDatabasePassword() {
    +  1006  0
             return line.getOptionValue(ARGUMENT.DB_PASSWORD);
     1007   -
              * The short CLI argument name specifying the directory to write the reports to.
    +
         }
     1008   -
              */
    +
     
     1009   -
             public static final String OUT_SHORT = "o";
    +
         /**
     1010   -
             /**
    +
          * Returns the additional Extensions if specified; otherwise null is returned.
     1011   -
              * The long CLI argument name specifying the output format to write the reports to.
    +
          *
     1012   -
              */
    +
          * @return the additional Extensions; otherwise null is returned
     1013   -
             public static final String OUTPUT_FORMAT = "format";
    +
          */
     1014   -
             /**
    -  1015   -
              * The short CLI argument name specifying the output format to write the reports to.
    +
         public String getAdditionalZipExtensions() {
    +  1015  0
             return line.getOptionValue(ARGUMENT.ADDITIONAL_ZIP_EXTENSIONS);
     1016   -
              */
    +
         }
     1017   -
             public static final String OUTPUT_FORMAT_SHORT = "f";
    +
     
     1018   -
             /**
    +
         /**
     1019   -
              * The long CLI argument name specifying the name of the project to be scanned.
    +
          * Get the value of cveValidForHours.
     1020   -
              */
    +
          *
     1021   -
             public static final String PROJECT = "project";
    +
          * @return the value of cveValidForHours
     1022   -
             /**
    +
          */
     1023   -
              * The long CLI argument name specifying the name of the application to be scanned.
    -  1024   -
              *
    -  1025   -
              * @deprecated project should be used instead
    -  1026   -
              */
    +
         public Integer getCveValidForHours() {
    +  1024  0
             final String v = line.getOptionValue(ARGUMENT.CVE_VALID_FOR_HOURS);
    +  1025  0
             if (v != null) {
    +  1026  0
                 return Integer.parseInt(v);
     1027   -
             @Deprecated
    -  1028   -
             public static final String APP_NAME = "app";
    +
             }
    +  1028  0
             return null;
     1029   -
             /**
    +
         }
     1030   -
              * The short CLI argument name specifying the name of the application to be scanned.
    +
     
     1031   -
              *
    +
         /**
     1032   -
              * @deprecated project should be used instead
    +
          * A collection of static final strings that represent the possible command line arguments.
     1033   -
              */
    -  1034   -
             @Deprecated
    +
          */
    +  1034  9
         public static class ARGUMENT {
     1035   -
             public static final String APP_NAME_SHORT = "a";
    +
     
     1036  
             /**
     1037   -
              * The long CLI argument name asking for help.
    +
              * The long CLI argument name specifying the directory/file to scan.
     1038  
              */
     1039   -
             public static final String HELP = "help";
    +
             public static final String SCAN = "scan";
     1040  
             /**
     1041   -
              * The long CLI argument name asking for advanced help.
    +
              * The short CLI argument name specifying the directory/file to scan.
     1042  
              */
     1043   -
             public static final String ADVANCED_HELP = "advancedHelp";
    +
             public static final String SCAN_SHORT = "s";
     1044  
             /**
     1045   -
              * The short CLI argument name asking for help.
    +
              * The long CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated.
     1046  
              */
     1047   -
             public static final String HELP_SHORT = "h";
    +
             public static final String DISABLE_AUTO_UPDATE = "noupdate";
     1048  
             /**
     1049   -
              * The long CLI argument name asking for the version.
    +
              * The short CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated.
     1050  
              */
     1051   -
             public static final String VERSION_SHORT = "v";
    +
             public static final String DISABLE_AUTO_UPDATE_SHORT = "n";
     1052  
             /**
     1053   -
              * The short CLI argument name asking for the version.
    +
              * The long CLI argument name specifying that only the update phase should be executed; no scan should be run.
     1054  
              */
     1055   -
             public static final String VERSION = "version";
    +
             public static final String UPDATE_ONLY = "updateonly";
     1056  
             /**
     1057   -
              * The CLI argument name indicating the proxy port.
    +
              * The long CLI argument name specifying that only the update phase should be executed; no scan should be run.
     1058  
              */
     1059   -
             public static final String PROXY_PORT = "proxyport";
    +
             public static final String PURGE_NVD = "purge";
     1060  
             /**
     1061   -
              * The CLI argument name indicating the proxy server.
    +
              * The long CLI argument name specifying the directory to write the reports to.
     1062  
              */
     1063   -
             public static final String PROXY_SERVER = "proxyserver";
    +
             public static final String OUT = "out";
     1064  
             /**
     1065   -
              * The CLI argument name indicating the proxy url.
    +
              * The short CLI argument name specifying the directory to write the reports to.
     1066   -
              *
    +
              */
     1067   -
              * @deprecated use {@link #PROXY_SERVER} instead
    +
             public static final String OUT_SHORT = "o";
     1068   -
              */
    +
             /**
     1069   -
             @Deprecated
    +
              * The long CLI argument name specifying the output format to write the reports to.
     1070   -
             public static final String PROXY_URL = "proxyurl";
    +
              */
     1071   -
             /**
    +
             public static final String OUTPUT_FORMAT = "format";
     1072   -
              * The CLI argument name indicating the proxy username.
    +
             /**
     1073   -
              */
    +
              * The short CLI argument name specifying the output format to write the reports to.
     1074   -
             public static final String PROXY_USERNAME = "proxyuser";
    +
              */
     1075   -
             /**
    +
             public static final String OUTPUT_FORMAT_SHORT = "f";
     1076   -
              * The CLI argument name indicating the proxy password.
    +
             /**
     1077   -
              */
    +
              * The long CLI argument name specifying the name of the project to be scanned.
     1078   -
             public static final String PROXY_PASSWORD = "proxypass";
    +
              */
     1079   -
             /**
    +
             public static final String PROJECT = "project";
     1080   -
              * The short CLI argument name indicating the connection timeout.
    -  1081   -
              */
    -  1082   -
             public static final String CONNECTION_TIMEOUT_SHORT = "c";
    -  1083  
             /**
    +  1081   +
              * The long CLI argument name specifying the name of the application to be scanned.
    +  1082   +
              *
    +  1083   +
              * @deprecated project should be used instead
     1084   -
              * The CLI argument name indicating the connection timeout.
    -  1085  
              */
    +  1085   +
             @Deprecated
     1086   -
             public static final String CONNECTION_TIMEOUT = "connectiontimeout";
    +
             public static final String APP_NAME = "app";
     1087  
             /**
     1088   -
              * The short CLI argument name for setting the location of an additional properties file.
    +
              * The short CLI argument name specifying the name of the application to be scanned.
     1089   -
              */
    +
              *
     1090   -
             public static final String PROP_SHORT = "P";
    +
              * @deprecated project should be used instead
     1091   -
             /**
    +
              */
     1092   -
              * The CLI argument name for setting the location of an additional properties file.
    +
             @Deprecated
     1093   -
              */
    +
             public static final String APP_NAME_SHORT = "a";
     1094   -
             public static final String PROP = "propertyfile";
    +
             /**
     1095   -
             /**
    +
              * The long CLI argument name asking for help.
     1096   -
              * The CLI argument name for setting the location of the data directory.
    +
              */
     1097   -
              */
    +
             public static final String HELP = "help";
     1098   -
             public static final String DATA_DIRECTORY = "data";
    +
             /**
     1099   -
             /**
    +
              * The long CLI argument name asking for advanced help.
     1100   -
              * The CLI argument name for setting the URL for the CVE Data Files.
    +
              */
     1101   -
              */
    +
             public static final String ADVANCED_HELP = "advancedHelp";
     1102   -
             public static final String CVE_MOD_12 = "cveUrl12Modified";
    +
             /**
     1103   -
             /**
    +
              * The short CLI argument name asking for help.
     1104   -
              * The CLI argument name for setting the URL for the CVE Data Files.
    +
              */
     1105   -
              */
    +
             public static final String HELP_SHORT = "h";
     1106   -
             public static final String CVE_MOD_20 = "cveUrl20Modified";
    +
             /**
     1107   -
             /**
    +
              * The long CLI argument name asking for the version.
     1108   -
              * The CLI argument name for setting the URL for the CVE Data Files.
    +
              */
     1109   -
              */
    +
             public static final String VERSION_SHORT = "v";
     1110   -
             public static final String CVE_BASE_12 = "cveUrl12Base";
    +
             /**
     1111   -
             /**
    +
              * The short CLI argument name asking for the version.
     1112   -
              * The CLI argument name for setting the URL for the CVE Data Files.
    +
              */
     1113   -
              */
    +
             public static final String VERSION = "version";
     1114   -
             public static final String CVE_BASE_20 = "cveUrl20Base";
    +
             /**
     1115   -
             /**
    +
              * The CLI argument name indicating the proxy port.
     1116   -
              * The short CLI argument name for setting the location of the data directory.
    +
              */
     1117   -
              */
    +
             public static final String PROXY_PORT = "proxyport";
     1118   -
             public static final String DATA_DIRECTORY_SHORT = "d";
    +
             /**
     1119   -
             /**
    +
              * The CLI argument name indicating the proxy server.
     1120   -
              * The CLI argument name for setting the location of the data directory.
    +
              */
     1121   -
              */
    +
             public static final String PROXY_SERVER = "proxyserver";
     1122   -
             public static final String VERBOSE_LOG = "log";
    +
             /**
     1123   -
             /**
    +
              * The CLI argument name indicating the proxy url.
     1124   -
              * The short CLI argument name for setting the location of the data directory.
    +
              *
     1125   -
              */
    +
              * @deprecated use {@link #PROXY_SERVER} instead
     1126   -
             public static final String VERBOSE_LOG_SHORT = "l";
    +
              */
     1127   -
     
    +
             @Deprecated
     1128   -
             /**
    +
             public static final String PROXY_URL = "proxyurl";
     1129   -
              * The CLI argument name for setting the depth of symbolic links that will be followed.
    +
             /**
     1130   -
              */
    +
              * The CLI argument name indicating the proxy username.
     1131   -
             public static final String SYM_LINK_DEPTH = "symLink";
    +
              */
     1132   -
             /**
    +
             public static final String PROXY_USERNAME = "proxyuser";
     1133   -
              * The CLI argument name for setting the location of the suppression file.
    +
             /**
     1134   -
              */
    +
              * The CLI argument name indicating the proxy password.
     1135   -
             public static final String SUPPRESSION_FILE = "suppression";
    +
              */
     1136   -
             /**
    +
             public static final String PROXY_PASSWORD = "proxypass";
     1137   -
              * Disables the Jar Analyzer.
    +
             /**
     1138   -
              */
    +
              * The short CLI argument name indicating the connection timeout.
     1139   -
             public static final String DISABLE_JAR = "disableJar";
    +
              */
     1140   -
             /**
    +
             public static final String CONNECTION_TIMEOUT_SHORT = "c";
     1141   -
              * Disables the Archive Analyzer.
    +
             /**
     1142   -
              */
    +
              * The CLI argument name indicating the connection timeout.
     1143   -
             public static final String DISABLE_ARCHIVE = "disableArchive";
    +
              */
     1144   -
             /**
    +
             public static final String CONNECTION_TIMEOUT = "connectiontimeout";
     1145   -
              * Disables the Python Distribution Analyzer.
    +
             /**
     1146   -
              */
    +
              * The short CLI argument name for setting the location of an additional properties file.
     1147   -
             public static final String DISABLE_PY_DIST = "disablePyDist";
    +
              */
     1148   -
             /**
    +
             public static final String PROP_SHORT = "P";
     1149   -
              * Disables the Python Package Analyzer.
    +
             /**
     1150   -
              */
    +
              * The CLI argument name for setting the location of an additional properties file.
     1151   -
             public static final String DISABLE_PY_PKG = "disablePyPkg";
    +
              */
     1152   -
             /**
    +
             public static final String PROP = "propertyfile";
     1153   -
              * Disables the Python Package Analyzer.
    +
             /**
     1154   -
              */
    +
              * The CLI argument name for setting the location of the data directory.
     1155   -
             public static final String DISABLE_COMPOSER = "disableComposer";
    +
              */
     1156   -
             /**
    +
             public static final String DATA_DIRECTORY = "data";
     1157   -
              * Disables the Ruby Gemspec Analyzer.
    +
             /**
     1158   -
              */
    +
              * The CLI argument name for setting the URL for the CVE Data Files.
     1159   -
             public static final String DISABLE_RUBYGEMS = "disableRubygems";
    +
              */
     1160   -
             /**
    +
             public static final String CVE_MOD_12 = "cveUrl12Modified";
     1161   -
              * Disables the Autoconf Analyzer.
    +
             /**
     1162   -
              */
    +
              * The CLI argument name for setting the URL for the CVE Data Files.
     1163   -
             public static final String DISABLE_AUTOCONF = "disableAutoconf";
    +
              */
     1164   -
             /**
    +
             public static final String CVE_MOD_20 = "cveUrl20Modified";
     1165   -
              * Disables the Cmake Analyzer.
    +
             /**
     1166   -
              */
    +
              * The CLI argument name for setting the URL for the CVE Data Files.
     1167   -
             public static final String DISABLE_CMAKE = "disableCmake";
    +
              */
     1168   -
             /**
    +
             public static final String CVE_BASE_12 = "cveUrl12Base";
     1169   -
              * Disables the Assembly Analyzer.
    +
             /**
     1170   -
              */
    +
              * The CLI argument name for setting the URL for the CVE Data Files.
     1171   -
             public static final String DISABLE_ASSEMBLY = "disableAssembly";
    +
              */
     1172   -
             /**
    +
             public static final String CVE_BASE_20 = "cveUrl20Base";
     1173   -
              * Disables the Nuspec Analyzer.
    +
             /**
     1174   -
              */
    +
              * The short CLI argument name for setting the location of the data directory.
     1175   -
             public static final String DISABLE_NUSPEC = "disableNuspec";
    +
              */
     1176   -
             /**
    +
             public static final String DATA_DIRECTORY_SHORT = "d";
     1177   -
              * Disables the Central Analyzer.
    +
             /**
     1178   -
              */
    +
              * The CLI argument name for setting the location of the data directory.
     1179   -
             public static final String DISABLE_CENTRAL = "disableCentral";
    +
              */
     1180   -
             /**
    +
             public static final String VERBOSE_LOG = "log";
     1181   -
              * Disables the Nexus Analyzer.
    +
             /**
     1182   -
              */
    +
              * The short CLI argument name for setting the location of the data directory.
     1183   -
             public static final String DISABLE_NEXUS = "disableNexus";
    +
              */
     1184   -
             /**
    +
             public static final String VERBOSE_LOG_SHORT = "l";
     1185   -
              * Disables the OpenSSL Analyzer.
    +
     
     1186   -
              */
    +
             /**
     1187   -
             public static final String DISABLE_OPENSSL = "disableOpenSSL";
    +
              * The CLI argument name for setting the depth of symbolic links that will be followed.
     1188   -
             /**
    +
              */
     1189   -
              * Disables the Node.js Package Analyzer.
    +
             public static final String SYM_LINK_DEPTH = "symLink";
     1190   -
              */
    +
             /**
     1191   -
             public static final String DISABLE_NODE_JS = "disableNodeJS";
    +
              * The CLI argument name for setting the location of the suppression file.
     1192   -
             /**
    +
              */
     1193   -
              * The URL of the nexus server.
    +
             public static final String SUPPRESSION_FILE = "suppression";
     1194   -
              */
    +
             /**
     1195   -
             public static final String NEXUS_URL = "nexus";
    +
              * The CLI argument name for setting the location of the suppression file.
     1196   -
             /**
    +
              */
     1197   -
              * Whether or not the defined proxy should be used when connecting to Nexus.
    +
             public static final String CVE_VALID_FOR_HOURS = "cveValidForHours";
     1198   -
              */
    +
             /**
     1199   -
             public static final String NEXUS_USES_PROXY = "nexusUsesProxy";
    +
              * Disables the Jar Analyzer.
     1200   -
             /**
    +
              */
     1201   -
              * The CLI argument name for setting the connection string.
    +
             public static final String DISABLE_JAR = "disableJar";
     1202   -
              */
    +
             /**
     1203   -
             public static final String CONNECTION_STRING = "connectionString";
    +
              * Disables the Archive Analyzer.
     1204   -
             /**
    +
              */
     1205   -
              * The CLI argument name for setting the database user name.
    +
             public static final String DISABLE_ARCHIVE = "disableArchive";
     1206   -
              */
    +
             /**
     1207   -
             public static final String DB_NAME = "dbUser";
    +
              * Disables the Python Distribution Analyzer.
     1208   -
             /**
    +
              */
     1209   -
              * The CLI argument name for setting the database password.
    +
             public static final String DISABLE_PY_DIST = "disablePyDist";
     1210   -
              */
    +
             /**
     1211   -
             public static final String DB_PASSWORD = "dbPassword";
    +
              * Disables the Python Package Analyzer.
     1212   -
             /**
    +
              */
     1213   -
              * The CLI argument name for setting the database driver name.
    +
             public static final String DISABLE_PY_PKG = "disablePyPkg";
     1214   -
              */
    +
             /**
     1215   -
             public static final String DB_DRIVER = "dbDriverName";
    +
              * Disables the Python Package Analyzer.
     1216   -
             /**
    +
              */
     1217   -
              * The CLI argument name for setting the path to the database driver; in case it is not on the class path.
    +
             public static final String DISABLE_COMPOSER = "disableComposer";
     1218   -
              */
    +
             /**
     1219   -
             public static final String DB_DRIVER_PATH = "dbDriverPath";
    +
              * Disables the Ruby Gemspec Analyzer.
     1220   -
             /**
    +
              */
     1221   -
              * The CLI argument name for setting the path to mono for .NET Assembly analysis on non-windows systems.
    +
             public static final String DISABLE_RUBYGEMS = "disableRubygems";
     1222   -
              */
    +
             /**
     1223   -
             public static final String PATH_TO_MONO = "mono";
    +
              * Disables the Autoconf Analyzer.
     1224   -
             /**
    +
              */
     1225   -
              * The CLI argument name for setting extra extensions.
    +
             public static final String DISABLE_AUTOCONF = "disableAutoconf";
     1226   -
              */
    -  1227   -
             public static final String ADDITIONAL_ZIP_EXTENSIONS = "zipExtensions";
    -  1228  
             /**
    -  1229   -
              * Exclude path argument.
    -  1230   +  1227   +
              * Disables the Cmake Analyzer.
    +  1228  
              */
    +  1229   +
             public static final String DISABLE_CMAKE = "disableCmake";
    +  1230   +
             /**
     1231   -
             public static final String EXCLUDE = "exclude";
    +
              * Disables the Assembly Analyzer.
     1232   -
         }
    +
              */
     1233   +
             public static final String DISABLE_ASSEMBLY = "disableAssembly";
    +  1234   +
             /**
    +  1235   +
              * Disables the Ruby Bundler Audit Analyzer.
    +  1236   +
              */
    +  1237   +
             public static final String DISABLE_BUNDLE_AUDIT = "disableBundleAudit";
    +  1238   +
             /**
    +  1239   +
              * Disables the Nuspec Analyzer.
    +  1240   +
              */
    +  1241   +
             public static final String DISABLE_NUSPEC = "disableNuspec";
    +  1242   +
             /**
    +  1243   +
              * Disables the Central Analyzer.
    +  1244   +
              */
    +  1245   +
             public static final String DISABLE_CENTRAL = "disableCentral";
    +  1246   +
             /**
    +  1247   +
              * Disables the Nexus Analyzer.
    +  1248   +
              */
    +  1249   +
             public static final String DISABLE_NEXUS = "disableNexus";
    +  1250   +
             /**
    +  1251   +
              * Disables the OpenSSL Analyzer.
    +  1252   +
              */
    +  1253   +
             public static final String DISABLE_OPENSSL = "disableOpenSSL";
    +  1254   +
             /**
    +  1255   +
              * Disables the Node.js Package Analyzer.
    +  1256   +
              */
    +  1257   +
             public static final String DISABLE_NODE_JS = "disableNodeJS";
    +  1258   +
             /**
    +  1259   +
              * The URL of the nexus server.
    +  1260   +
              */
    +  1261   +
             public static final String NEXUS_URL = "nexus";
    +  1262   +
             /**
    +  1263   +
              * Whether or not the defined proxy should be used when connecting to Nexus.
    +  1264   +
              */
    +  1265   +
             public static final String NEXUS_USES_PROXY = "nexusUsesProxy";
    +  1266   +
             /**
    +  1267   +
              * The CLI argument name for setting the connection string.
    +  1268   +
              */
    +  1269   +
             public static final String CONNECTION_STRING = "connectionString";
    +  1270   +
             /**
    +  1271   +
              * The CLI argument name for setting the database user name.
    +  1272   +
              */
    +  1273   +
             public static final String DB_NAME = "dbUser";
    +  1274   +
             /**
    +  1275   +
              * The CLI argument name for setting the database password.
    +  1276   +
              */
    +  1277   +
             public static final String DB_PASSWORD = "dbPassword";
    +  1278   +
             /**
    +  1279   +
              * The CLI argument name for setting the database driver name.
    +  1280   +
              */
    +  1281   +
             public static final String DB_DRIVER = "dbDriverName";
    +  1282   +
             /**
    +  1283   +
              * The CLI argument name for setting the path to the database driver; in case it is not on the class path.
    +  1284   +
              */
    +  1285   +
             public static final String DB_DRIVER_PATH = "dbDriverPath";
    +  1286   +
             /**
    +  1287   +
              * The CLI argument name for setting the path to mono for .NET Assembly analysis on non-windows systems.
    +  1288   +
              */
    +  1289   +
             public static final String PATH_TO_MONO = "mono";
    +  1290   +
             /**
    +  1291   +
              * The CLI argument name for setting extra extensions.
    +  1292   +
              */
    +  1293   +
             public static final String ADDITIONAL_ZIP_EXTENSIONS = "zipExtensions";
    +  1294   +
             /**
    +  1295   +
              * Exclude path argument.
    +  1296   +
              */
    +  1297   +
             public static final String EXCLUDE = "exclude";
    +  1298   +
             /**
    +  1299   +
              * The CLI argument name for setting the path to bundle-audit for Ruby bundle analysis.
    +  1300   +
              */
    +  1301   +
             public static final String PATH_TO_BUNDLE_AUDIT = "bundleAudit";
    +  1302   +
         }
    +  1303  
     }
    - + diff --git a/dependency-check-cli/cobertura/org.owasp.dependencycheck.InvalidScanPathException.html b/dependency-check-cli/cobertura/org.owasp.dependencycheck.InvalidScanPathException.html index 406c1b954..a07e306ad 100644 --- a/dependency-check-cli/cobertura/org.owasp.dependencycheck.InvalidScanPathException.html +++ b/dependency-check-cli/cobertura/org.owasp.dependencycheck.InvalidScanPathException.html @@ -66,7 +66,7 @@  24  
      */
     25   -
     class InvalidScanPathException extends Exception {
    +
     public class InvalidScanPathException extends Exception {
     26  
     
     27   @@ -143,6 +143,6 @@
     }
    - + diff --git a/dependency-check-cli/dependency-analysis.html b/dependency-check-cli/dependency-analysis.html index ea33e7284..695fa5645 100644 --- a/dependency-check-cli/dependency-analysis.html +++ b/dependency-check-cli/dependency-analysis.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Dependencies Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -262,7 +262,7 @@ org.owasp dependency-check-core -1.3.1 +1.3.2 compile jar @@ -270,7 +270,7 @@ org.owasp dependency-check-utils -1.3.1 +1.3.2 compile jar @@ -278,7 +278,7 @@ org.slf4j slf4j-api -1.7.12 +1.7.13 compile jar @@ -340,7 +340,7 @@ com.google.code.findbugs annotations -3.0.0 +3.0.1u2 provided jar diff --git a/dependency-check-cli/dependency-updates-report.html b/dependency-check-cli/dependency-updates-report.html index 48e4dd6dc..5b33c9033 100644 --- a/dependency-check-cli/dependency-updates-report.html +++ b/dependency-check-cli/dependency-updates-report.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Dependency Updates Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -245,7 +245,7 @@ # of dependencies using the latest version available -27 +24 # of dependencies where the next version available is smaller than an incremental version update @@ -253,7 +253,7 @@ # of dependencies where the next version available is an incremental version update -0 +3 # of dependencies where the next version available is a minor version update @@ -305,7 +305,7 @@ com.google.code.findbugs annotations -3.0.0 +3.0.1u2 jar @@ -470,7 +470,7 @@ 4.8.0 5.0.0 - + org.apache.maven maven-core 3.3.3 @@ -478,11 +478,11 @@ jar - +3.3.9 - + org.apache.maven maven-plugin-api 3.3.3 @@ -490,11 +490,11 @@ jar - +3.3.9 - + org.apache.maven maven-settings 3.3.3 @@ -502,7 +502,7 @@ jar - +3.3.9 @@ -593,7 +593,7 @@ org.jmockit jmockit -1.19 +1.20 test jar @@ -617,7 +617,7 @@ org.slf4j slf4j-api -1.7.12 +1.7.13 jar @@ -629,7 +629,7 @@ org.slf4j slf4j-simple -1.7.12 +1.7.13 jar @@ -668,7 +668,7 @@ org.owasp dependency-check-core -1.3.1 +1.3.2 compile jar @@ -680,7 +680,7 @@ org.owasp dependency-check-utils -1.3.1 +1.3.2 compile jar @@ -765,7 +765,7 @@ annotations Current Version -3.0.0 +3.0.1u2 Scope @@ -801,7 +801,7 @@ jar Newer versions -1.4.177 Next Minor
    1.4.178
    1.4.179
    1.4.180
    1.4.181
    1.4.182
    1.4.183
    1.4.184
    1.4.185
    1.4.186
    1.4.187
    1.4.188
    1.4.189 Latest Minor +1.4.177 Next Minor
    1.4.178
    1.4.179
    1.4.180
    1.4.181
    1.4.182
    1.4.183
    1.4.184
    1.4.185
    1.4.186
    1.4.187
    1.4.188
    1.4.189
    1.4.190 Latest Minor

    com.sun.mail:mailapi

    @@ -1020,7 +1020,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-core

    @@ -1047,7 +1047,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-queryparser

    @@ -1074,7 +1074,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-test-framework

    @@ -1101,13 +1101,13 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.maven:maven-core

    - + @@ -1125,13 +1125,16 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven:maven-plugin-api

    - + @@ -1149,13 +1152,16 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven:maven-settings

    - + @@ -1173,7 +1179,10 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven.plugin-testing:maven-plugin-testing-harness

    @@ -1356,7 +1365,7 @@ - + @@ -1404,7 +1413,7 @@ - + @@ -1428,7 +1437,7 @@ - + @@ -1452,7 +1461,7 @@ - + @@ -1476,7 +1485,7 @@ - + diff --git a/dependency-check-cli/findbugs.html b/dependency-check-cli/findbugs.html index 16716e6a6..d12781009 100644 --- a/dependency-check-cli/findbugs.html +++ b/dependency-check-cli/findbugs.html @@ -1,13 +1,13 @@ - + dependency-check-cli – FindBugs Bug Detector Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-cli/index.html b/dependency-check-cli/index.html index 12ed07797..73424c913 100644 --- a/dependency-check-cli/index.html +++ b/dependency-check-cli/index.html @@ -1,13 +1,13 @@ - + dependency-check-cli – About @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -155,7 +155,7 @@

    About

    OWASP dependency-check-cli is an command line tool that uses dependency-check-core to detect publicly disclosed vulnerabilities associated with the scanned project dependencies. The tool will generate a report listing the dependency, any identified Common Platform Enumeration (CPE) identifiers, and the associated Common Vulnerability and Exposure (CVE) entries.

    Installation & Usage

    -

    Download the dependency-check command line tool here. Extract the zip file to a location on your computer and put the ‘bin’ directory into the path environment variable. On *nix systems you will likely need to make the shell script executable:

    +

    Download the dependency-check command line tool here. Extract the zip file to a location on your computer and put the ‘bin’ directory into the path environment variable. On *nix systems you will likely need to make the shell script executable:

    $ chmod +777 dependency-check.sh
    @@ -173,13 +173,13 @@
     

    Windows

    -
    dependency-check.bat --app "My App Name" --scan "c:\java\application\lib"
    +
    dependency-check.bat --project "My App Name" --scan "c:\java\application\lib"
     

    *nix

    -
    dependency-check.sh --app "My App Name" --scan "/java/application/lib"
    +
    dependency-check.sh --project "My App Name" --scan "/java/application/lib"
     

    To view the command line arguments, see the arguments page, or you can run:

    diff --git a/dependency-check-cli/integration.html b/dependency-check-cli/integration.html index f81f0fca1..480a38331 100644 --- a/dependency-check-cli/integration.html +++ b/dependency-check-cli/integration.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Continuous Integration @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-cli/issue-tracking.html b/dependency-check-cli/issue-tracking.html index 92d147fd3..a26c43b1f 100644 --- a/dependency-check-cli/issue-tracking.html +++ b/dependency-check-cli/issue-tracking.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Issue Tracking @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-cli/license.html b/dependency-check-cli/license.html index 6b19d8683..be87b0f46 100644 --- a/dependency-check-cli/license.html +++ b/dependency-check-cli/license.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Project License @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-cli/mail-lists.html b/dependency-check-cli/mail-lists.html index c99723edf..f587f0eb1 100644 --- a/dependency-check-cli/mail-lists.html +++ b/dependency-check-cli/mail-lists.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Project Mailing Lists @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-cli/plugin-updates-report.html b/dependency-check-cli/plugin-updates-report.html index a9bf56a83..c2c29ea36 100644 --- a/dependency-check-cli/plugin-updates-report.html +++ b/dependency-check-cli/plugin-updates-report.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Plugin Updates Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -257,7 +257,7 @@
    - + @@ -293,7 +293,7 @@ - + @@ -353,7 +353,7 @@ - + @@ -390,16 +390,26 @@ + + + + + + + + + + - + - + @@ -409,7 +419,7 @@ - + @@ -419,6 +429,16 @@ + + + + + + + + + + @@ -494,7 +514,7 @@ -
    jmockit
    Current Version1.19
    1.20
    Scope test
    dependency-check-core
    Current Version1.3.1
    1.3.2
    Scope compile
    dependency-check-utils
    Current Version1.3.1
    1.3.2
    Scope compile
    slf4j-api
    Current Version1.7.12
    1.7.13
    Scope
    slf4j-simple
    Current Version1.7.12
    1.7.13
    Scope
    # of plugins where the next version available is a minor version update0
    2
    # of plugins where the next version available is a major version update org.apache.maven.plugins maven-assembly-plugin2.5.52.6 org.apache.maven.plugins maven-failsafe-plugin2.18.12.19
    org.apache.maven.pluginsmaven-javadoc-plugin2.9.12.10
    org.apache.maven.plugins maven-release-plugin2.5.22.5.3
    org.apache.maven.plugins maven-resources-plugin
    org.apache.maven.plugins maven-site-plugin
    org.apache.maven.pluginsmaven-source-plugin2.2.12.3
    org.apache.maven.pluginsmaven-assembly-plugin
    Current Version2.5.5
    +2.6

    Plugin org.apache.maven.plugins:maven-clean-plugin

    @@ -584,7 +604,7 @@ -
    maven-failsafe-plugin
    Current Version2.18.1
    +2.19

    Plugin org.apache.maven.plugins:maven-gpg-plugin

    @@ -631,6 +651,24 @@
    Current Version 2.6
    +

    Plugin org.apache.maven.plugins:maven-javadoc-plugin

    + + + + + + + + + + + + + + + +
    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-javadoc-plugin
    Current Version2.9.1
    Newer versions2.10 Next Minor
    2.10.1
    2.10.2
    2.10.3 Latest Minor
    +

    Plugin org.apache.maven.plugins:maven-release-plugin

    @@ -644,7 +682,7 @@ -
    maven-release-plugin
    Current Version2.5.2
    +2.5.3

    Plugin org.apache.maven.plugins:maven-resources-plugin

    @@ -676,6 +714,24 @@
    Current Version 3.4
    +

    Plugin org.apache.maven.plugins:maven-source-plugin

    + + + + + + + + + + + + + + + +
    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-source-plugin
    Current Version2.2.1
    Newer versions2.3 Next Minor
    2.4 Latest Minor
    +

    Plugin org.apache.maven.plugins:maven-surefire-plugin

    diff --git a/dependency-check-cli/pmd.html b/dependency-check-cli/pmd.html index 5ec414982..bf3b4616a 100644 --- a/dependency-check-cli/pmd.html +++ b/dependency-check-cli/pmd.html @@ -1,13 +1,13 @@ - + dependency-check-cli – PMD Results @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -250,50 +250,44 @@ + + + -
    Violation Line
    Avoid unused imports such as 'org.apache.commons.lang.StringUtils'30
    Useless parentheses.169
    +170

    org/owasp/dependencycheck/CliParser.java

    - + - - - - + - + - + - + - + - + - + - + - - - - - - - + @@ -311,7 +305,19 @@ -
    Violation Line
    Useless parentheses.117
    Useless parentheses.469
    130
    Useless parentheses.478
    495
    Useless parentheses.487
    504
    Useless parentheses.514
    513
    Useless parentheses.523
    540
    Useless parentheses.532
    549
    Useless parentheses.541
    558
    Useless parentheses.550
    567
    Useless parentheses.559
    Useless parentheses.568
    Useless parentheses.577
    576
    Useless parentheses. 586
    622
    Useless parentheses.631
    +631 + +Useless parentheses. +640 + +Useless parentheses. +649 + +Useless parentheses. +658 + +Useless parentheses. +667 diff --git a/dependency-check-cli/project-info.html b/dependency-check-cli/project-info.html index b490afcda..697ac625c 100644 --- a/dependency-check-cli/project-info.html +++ b/dependency-check-cli/project-info.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Project Information @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-cli/project-reports.html b/dependency-check-cli/project-reports.html index b6fc4a9b2..69a61bd9f 100644 --- a/dependency-check-cli/project-reports.html +++ b/dependency-check-cli/project-reports.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Generated Reports @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-cli/project-summary.html b/dependency-check-cli/project-summary.html index cc0ca8bbe..b76d3b475 100644 --- a/dependency-check-cli/project-summary.html +++ b/dependency-check-cli/project-summary.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Project Summary @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -246,7 +246,7 @@ dependency-check-cli Version -1.3.1 +1.3.2 Type jar diff --git a/dependency-check-cli/source-repository.html b/dependency-check-cli/source-repository.html index 10bd79c21..ed5489e00 100644 --- a/dependency-check-cli/source-repository.html +++ b/dependency-check-cli/source-repository.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Source Repository @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-cli/surefire-report.html b/dependency-check-cli/surefire-report.html index 1df721792..25808e151 100644 --- a/dependency-check-cli/surefire-report.html +++ b/dependency-check-cli/surefire-report.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Surefire Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -274,7 +274,7 @@ function toggleDisplay(elementId) { 0 0 100% -0.343
    +0.371

    Note: failures are anticipated and checked for with assertions while errors are unanticipated.


    Package List

    @@ -295,7 +295,7 @@ function toggleDisplay(elementId) { 0 0 100% -0.343
    +0.371

    Note: package statistics are not computed recursively, they only sum up all of its testsuites numbers.

    org.owasp.dependencycheck

    @@ -326,7 +326,7 @@ function toggleDisplay(elementId) { 0 0 100% -0.031

    +0.059

    Test Cases

    [Summary] [Package List] [Test Cases]

    @@ -335,51 +335,51 @@ function toggleDisplay(elementId) { - + - +
    testEnsureCanonicalPath2testEnsureCanonicalPath2 0.312
    testEnsureCanonicalPathtestEnsureCanonicalPath 0

    CliParserTest

    - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - -
    testParse_printHelp0.031
    testParse_printHelp0.035
    testParse_printVersionInfo0
    testParse_printVersionInfo0.001
    testParse_help0
    testParse_help0.001
    testParse_scan0
    testParse_scan0.001
    testParse0
    testParse0.001
    testParse_unknown0
    testParse_unknown0.001
    testParse_version0
    testParse_version0.003
    testParse_scan_unknownFile0
    testParse_scan_unknownFile0.007
    testParse_scan_withFileExists0

    +testParse_scan_withFileExists +0.009
    diff --git a/dependency-check-cli/taglist.html b/dependency-check-cli/taglist.html index d6a6ebe0e..4efaba96b 100644 --- a/dependency-check-cli/taglist.html +++ b/dependency-check-cli/taglist.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Tag List report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-cli/team-list.html b/dependency-check-cli/team-list.html index 5da9bc47e..524387699 100644 --- a/dependency-check-cli/team-list.html +++ b/dependency-check-cli/team-list.html @@ -1,13 +1,13 @@ - + dependency-check-cli – Project Team @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-cli/xref-test/index.html b/dependency-check-cli/xref-test/index.html index 4c5e0e83d..146ec5974 100644 --- a/dependency-check-cli/xref-test/index.html +++ b/dependency-check-cli/xref-test/index.html @@ -4,7 +4,7 @@ - Dependency-Check Command Line 1.3.1 Reference + Dependency-Check Command Line 1.3.2 Reference diff --git a/dependency-check-cli/xref-test/org/owasp/dependencycheck/package-frame.html b/dependency-check-cli/xref-test/org/owasp/dependencycheck/package-frame.html index c43920d1c..d7e625d47 100644 --- a/dependency-check-cli/xref-test/org/owasp/dependencycheck/package-frame.html +++ b/dependency-check-cli/xref-test/org/owasp/dependencycheck/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Command Line 1.3.1 Reference Package org.owasp.dependencycheck + Dependency-Check Command Line 1.3.2 Reference Package org.owasp.dependencycheck diff --git a/dependency-check-cli/xref-test/org/owasp/dependencycheck/package-summary.html b/dependency-check-cli/xref-test/org/owasp/dependencycheck/package-summary.html index b01dc5397..e257a24cb 100644 --- a/dependency-check-cli/xref-test/org/owasp/dependencycheck/package-summary.html +++ b/dependency-check-cli/xref-test/org/owasp/dependencycheck/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Command Line 1.3.1 Reference Package org.owasp.dependencycheck + Dependency-Check Command Line 1.3.2 Reference Package org.owasp.dependencycheck diff --git a/dependency-check-cli/xref-test/overview-frame.html b/dependency-check-cli/xref-test/overview-frame.html index 781dad3e5..1c5f45fcb 100644 --- a/dependency-check-cli/xref-test/overview-frame.html +++ b/dependency-check-cli/xref-test/overview-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Command Line 1.3.1 Reference + Dependency-Check Command Line 1.3.2 Reference diff --git a/dependency-check-cli/xref-test/overview-summary.html b/dependency-check-cli/xref-test/overview-summary.html index 2560b61d1..47747f41b 100644 --- a/dependency-check-cli/xref-test/overview-summary.html +++ b/dependency-check-cli/xref-test/overview-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Command Line 1.3.1 Reference + Dependency-Check Command Line 1.3.2 Reference @@ -24,7 +24,7 @@ -

    Dependency-Check Command Line 1.3.1 Reference

    +

    Dependency-Check Command Line 1.3.2 Reference

    diff --git a/dependency-check-cli/xref/index.html b/dependency-check-cli/xref/index.html index 4c5e0e83d..146ec5974 100644 --- a/dependency-check-cli/xref/index.html +++ b/dependency-check-cli/xref/index.html @@ -4,7 +4,7 @@ - Dependency-Check Command Line 1.3.1 Reference + Dependency-Check Command Line 1.3.2 Reference diff --git a/dependency-check-cli/xref/org/owasp/dependencycheck/App.html b/dependency-check-cli/xref/org/owasp/dependencycheck/App.html index 95406627f..927524989 100644 --- a/dependency-check-cli/xref/org/owasp/dependencycheck/App.html +++ b/dependency-check-cli/xref/org/owasp/dependencycheck/App.html @@ -35,443 +35,420 @@ 27import java.util.List; 28import java.util.Set; 29import org.apache.commons.cli.ParseException; -30import org.owasp.dependencycheck.data.nvdcve.CveDB; -31import org.owasp.dependencycheck.data.nvdcve.DatabaseException; -32import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties; -33import org.owasp.dependencycheck.dependency.Dependency; -34import org.apache.tools.ant.DirectoryScanner; -35import org.owasp.dependencycheck.reporting.ReportGenerator; -36import org.owasp.dependencycheck.utils.Settings; -37import org.slf4j.Logger; -38import org.slf4j.LoggerFactory; -39import ch.qos.logback.core.FileAppender; -40import org.slf4j.impl.StaticLoggerBinder; -41 -42/** -43 * The command line interface for the DependencyCheck application. -44 * -45 * @author Jeremy Long -46 */ -47publicclassApp { -48 -49/** -50 * The logger. -51 */ -52privatestaticfinal Logger LOGGER = LoggerFactory.getLogger(App.class); -53 -54/** -55 * The main method for the application. -56 * -57 * @param args the command line arguments -58 */ -59publicstaticvoid main(String[] args) { -60try { -61 Settings.initialize(); -62finalApp app = newApp(); -63 app.run(args); -64 } finally { -65 Settings.cleanup(true); -66 } -67 } -68 -69/** -70 * Main CLI entry-point into the application. -71 * -72 * @param args the command line arguments -73 */ -74publicvoid run(String[] args) { -75finalCliParser cli = newCliParser(); -76 -77try { -78 cli.parse(args); -79 } catch (FileNotFoundException ex) { -80 System.err.println(ex.getMessage()); -81 cli.printHelp(); -82return; -83 } catch (ParseException ex) { -84 System.err.println(ex.getMessage()); -85 cli.printHelp(); -86return; -87 } -88 -89if (cli.getVerboseLog() != null) { -90 prepareLogger(cli.getVerboseLog()); -91 } -92 -93if (cli.isPurge()) { -94if (cli.getConnectionString() != null) { -95 LOGGER.error("Unable to purge the database when using a non-default connection string"); -96 } else { -97 populateSettings(cli); -98 File db; -99try { -100 db = new File(Settings.getDataDirectory(), "dc.h2.db"); -101if (db.exists()) { -102if (db.delete()) { -103 LOGGER.info("Database file purged; local copy of the NVD has been removed"); -104 } else { -105 LOGGER.error("Unable to delete '{}'; please delete the file manually", db.getAbsolutePath()); -106 } -107 } else { -108 LOGGER.error("Unable to purge database; the database file does not exists: {}", db.getAbsolutePath()); -109 } -110 } catch (IOException ex) { -111 LOGGER.error("Unable to delete the database"); -112 } -113 } -114 } elseif (cli.isGetVersion()) { -115 cli.printVersionInfo(); -116 } elseif (cli.isUpdateOnly()) { -117 populateSettings(cli); -118 runUpdateOnly(); -119 } elseif (cli.isRunScan()) { -120 populateSettings(cli); -121try { -122 runScan(cli.getReportDirectory(), cli.getReportFormat(), cli.getProjectName(), cli.getScanFiles(), -123 cli.getExcludeList(), cli.getSymLinkDepth()); -124 } catch (InvalidScanPathException ex) { -125 LOGGER.error("An invalid scan path was detected; unable to scan '//*' paths"); -126 } -127 } else { -128 cli.printHelp(); -129 } -130 } -131 -132/** -133 * Scans the specified directories and writes the dependency reports to the reportDirectory. -134 * -135 * @param reportDirectory the path to the directory where the reports will be written -136 * @param outputFormat the output format of the report -137 * @param applicationName the application name for the report -138 * @param files the files/directories to scan -139 * @param excludes the patterns for files/directories to exclude -140 * @param symLinkDepth the depth that symbolic links will be followed -141 * -142 * @throws InvalidScanPathException thrown if the path to scan starts with "//" -143 */ -144privatevoid runScan(String reportDirectory, String outputFormat, String applicationName, String[] files, -145 String[] excludes, int symLinkDepth) throws InvalidScanPathException { -146 Engine engine = null; -147try { -148 engine = new Engine(); -149final List<String> antStylePaths = new ArrayList<String>(); -150for (String file : files) { -151final String antPath = ensureCanonicalPath(file); -152 antStylePaths.add(antPath); -153 } -154 -155final Set<File> paths = new HashSet<File>(); -156for (String file : antStylePaths) { -157 LOGGER.debug("Scanning {}", file); -158final DirectoryScanner scanner = new DirectoryScanner(); -159 String include = file.replace('\\', '/'); -160 File baseDir; -161 -162if (include.startsWith("//")) { -163thrownewInvalidScanPathException("Unable to scan paths specified by //"); -164 } else { -165finalint pos = getLastFileSeparator(include); -166final String tmpBase = include.substring(0, pos); -167final String tmpInclude = include.substring(pos + 1); -168if (tmpInclude.indexOf('*') >= 0 || tmpInclude.indexOf('?') >= 0 -169 || (new File(include)).isFile()) { -170 baseDir = new File(tmpBase); -171 include = tmpInclude; -172 } else { -173 baseDir = new File(tmpBase, tmpInclude); -174 include = "**/*"; -175 } -176 } -177//LOGGER.debug("baseDir: {}", baseDir); -178//LOGGER.debug("include: {}", include); -179 scanner.setBasedir(baseDir); -180final String[] includes = {include}; -181 scanner.setIncludes(includes); -182 scanner.setMaxLevelsOfSymlinks(symLinkDepth); -183if (symLinkDepth <= 0) { -184 scanner.setFollowSymlinks(false); -185 } -186if (excludes != null && excludes.length > 0) { -187 scanner.addExcludes(excludes); -188 } -189 scanner.scan(); -190if (scanner.getIncludedFilesCount() > 0) { -191for (String s : scanner.getIncludedFiles()) { -192final File f = new File(baseDir, s); -193 LOGGER.debug("Found file {}", f.toString()); -194 paths.add(f); -195 } -196 } -197 } -198 engine.scan(paths); -199 -200 engine.analyzeDependencies(); -201final List<Dependency> dependencies = engine.getDependencies(); -202 DatabaseProperties prop = null; -203 CveDB cve = null; -204try { -205 cve = new CveDB(); -206 cve.open(); -207 prop = cve.getDatabaseProperties(); -208 } catch (DatabaseException ex) { -209 LOGGER.debug("Unable to retrieve DB Properties", ex); -210 } finally { -211if (cve != null) { -212 cve.close(); -213 } -214 } -215final ReportGenerator report = new ReportGenerator(applicationName, dependencies, engine.getAnalyzers(), prop); -216try { -217 report.generateReports(reportDirectory, outputFormat); -218 } catch (IOException ex) { -219 LOGGER.error("There was an IO error while attempting to generate the report."); -220 LOGGER.debug("", ex); -221 } catch (Throwable ex) { -222 LOGGER.error("There was an error while attempting to generate the report."); -223 LOGGER.debug("", ex); -224 } -225 } catch (DatabaseException ex) { -226 LOGGER.error("Unable to connect to the dependency-check database; analysis has stopped"); -227 LOGGER.debug("", ex); -228 } finally { -229if (engine != null) { -230 engine.cleanup(); -231 } -232 } -233 } -234 -235/** -236 * Only executes the update phase of dependency-check. -237 */ -238privatevoid runUpdateOnly() { -239 Engine engine = null; -240try { -241 engine = new Engine(); -242 engine.doUpdates(); -243 } catch (DatabaseException ex) { -244 LOGGER.error("Unable to connect to the dependency-check database; analysis has stopped"); -245 LOGGER.debug("", ex); -246 } finally { -247if (engine != null) { -248 engine.cleanup(); -249 } -250 } -251 } -252 -253/** -254 * Updates the global Settings. -255 * -256 * @param cli a reference to the CLI Parser that contains the command line arguments used to set the corresponding settings in -257 * the core engine. -258 */ -259privatevoid populateSettings(CliParser cli) { -260 -261finalboolean autoUpdate = cli.isAutoUpdate(); -262final String connectionTimeout = cli.getConnectionTimeout(); -263final String proxyServer = cli.getProxyServer(); -264final String proxyPort = cli.getProxyPort(); -265final String proxyUser = cli.getProxyUsername(); -266final String proxyPass = cli.getProxyPassword(); -267final String dataDirectory = cli.getDataDirectory(); -268final File propertiesFile = cli.getPropertiesFile(); -269final String suppressionFile = cli.getSuppressionFile(); -270final String nexusUrl = cli.getNexusUrl(); -271final String databaseDriverName = cli.getDatabaseDriverName(); -272final String databaseDriverPath = cli.getDatabaseDriverPath(); -273final String connectionString = cli.getConnectionString(); -274final String databaseUser = cli.getDatabaseUser(); -275final String databasePassword = cli.getDatabasePassword(); -276final String additionalZipExtensions = cli.getAdditionalZipExtensions(); -277final String pathToMono = cli.getPathToMono(); -278final String cveMod12 = cli.getModifiedCve12Url(); -279final String cveMod20 = cli.getModifiedCve20Url(); -280final String cveBase12 = cli.getBaseCve12Url(); -281final String cveBase20 = cli.getBaseCve20Url(); -282 -283if (propertiesFile != null) { -284try { -285 Settings.mergeProperties(propertiesFile); -286 } catch (FileNotFoundException ex) { -287 LOGGER.error("Unable to load properties file '{}'", propertiesFile.getPath()); -288 LOGGER.debug("", ex); -289 } catch (IOException ex) { -290 LOGGER.error("Unable to find properties file '{}'", propertiesFile.getPath()); -291 LOGGER.debug("", ex); -292 } -293 } -294// We have to wait until we've merged the properties before attempting to set whether we use -295// the proxy for Nexus since it could be disabled in the properties, but not explicitly stated -296// on the command line -297finalboolean nexusUsesProxy = cli.isNexusUsesProxy(); -298if (dataDirectory != null) { -299 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory); -300 } elseif (System.getProperty("basedir") != null) { -301final File dataDir = new File(System.getProperty("basedir"), "data"); -302 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); -303 } else { -304final File jarPath = new File(App.class.getProtectionDomain().getCodeSource().getLocation().getPath()); -305final File base = jarPath.getParentFile(); -306final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY); -307final File dataDir = new File(base, sub); -308 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); -309 } -310 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); -311if (proxyServer != null && !proxyServer.isEmpty()) { -312 Settings.setString(Settings.KEYS.PROXY_SERVER, proxyServer); -313 } -314if (proxyPort != null && !proxyPort.isEmpty()) { -315 Settings.setString(Settings.KEYS.PROXY_PORT, proxyPort); -316 } -317if (proxyUser != null && !proxyUser.isEmpty()) { -318 Settings.setString(Settings.KEYS.PROXY_USERNAME, proxyUser); -319 } -320if (proxyPass != null && !proxyPass.isEmpty()) { -321 Settings.setString(Settings.KEYS.PROXY_PASSWORD, proxyPass); -322 } -323if (connectionTimeout != null && !connectionTimeout.isEmpty()) { -324 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); -325 } -326if (suppressionFile != null && !suppressionFile.isEmpty()) { -327 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); -328 } -329 -330//File Type Analyzer Settings -331 Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, !cli.isJarDisabled()); -332 Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, !cli.isArchiveDisabled()); -333 Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, !cli.isPythonDistributionDisabled()); -334 Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, !cli.isPythonPackageDisabled()); -335 Settings.setBoolean(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, !cli.isAutoconfDisabled()); -336 Settings.setBoolean(Settings.KEYS.ANALYZER_CMAKE_ENABLED, !cli.isCmakeDisabled()); -337 Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, !cli.isNuspecDisabled()); -338 Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, !cli.isAssemblyDisabled()); -339 Settings.setBoolean(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, !cli.isOpenSSLDisabled()); -340 Settings.setBoolean(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, !cli.isComposerDisabled()); -341 Settings.setBoolean(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, !cli.isNodeJsDisabled()); -342 Settings.setBoolean(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, !cli.isRubyGemspecDisabled()); -343 -344 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, !cli.isCentralDisabled()); -345 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, !cli.isNexusDisabled()); -346if (nexusUrl != null && !nexusUrl.isEmpty()) { -347 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); -348 } -349 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy); -350if (databaseDriverName != null && !databaseDriverName.isEmpty()) { -351 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); -352 } -353if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) { -354 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); -355 } -356if (connectionString != null && !connectionString.isEmpty()) { -357 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString); -358 } -359if (databaseUser != null && !databaseUser.isEmpty()) { -360 Settings.setString(Settings.KEYS.DB_USER, databaseUser); -361 } -362if (databasePassword != null && !databasePassword.isEmpty()) { -363 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword); -364 } -365if (additionalZipExtensions != null && !additionalZipExtensions.isEmpty()) { -366 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, additionalZipExtensions); -367 } -368if (pathToMono != null && !pathToMono.isEmpty()) { -369 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); -370 } -371if (cveBase12 != null && !cveBase12.isEmpty()) { -372 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveBase12); -373 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveBase20); -374 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveMod12); -375 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveMod20); -376 } -377 } -378 -379/** -380 * Creates a file appender and adds it to logback. -381 * -382 * @param verboseLog the path to the verbose log file -383 */ -384privatevoid prepareLogger(String verboseLog) { -385final StaticLoggerBinder loggerBinder = StaticLoggerBinder.getSingleton(); -386final LoggerContext context = (LoggerContext) loggerBinder.getLoggerFactory(); -387 -388final PatternLayoutEncoder encoder = new PatternLayoutEncoder(); -389 encoder.setPattern("%d %C:%L%n%-5level - %msg%n"); -390 encoder.setContext(context); -391 encoder.start(); -392final FileAppender fa = new FileAppender(); -393 fa.setAppend(true); -394 fa.setEncoder(encoder); -395 fa.setContext(context); -396 fa.setFile(verboseLog); -397final File f = new File(verboseLog); -398 String name = f.getName(); -399finalint i = name.lastIndexOf('.'); -400if (i > 1) { -401 name = name.substring(0, i); -402 } -403 fa.setName(name); -404 fa.start(); -405final ch.qos.logback.classic.Logger rootLogger = context.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME); -406 rootLogger.addAppender(fa); -407 } -408 -409/** -410 * Takes a path and resolves it to be a canonical &amp; absolute path. The caveats are that this method will take an Ant style -411 * file selector path (../someDir/**\/*.jar) and convert it to an absolute/canonical path (at least to the left of the first * -412 * or ?). -413 * -414 * @param path the path to canonicalize -415 * @return the canonical path -416 */ -417protected String ensureCanonicalPath(String path) { -418 String basePath = null; -419 String wildCards = null; -420final String file = path.replace('\\', '/'); -421if (file.contains("*") || file.contains("?")) { -422 -423int pos = getLastFileSeparator(file); -424if (pos < 0) { -425return file; -426 } -427 pos += 1; -428 basePath = file.substring(0, pos); -429 wildCards = file.substring(pos); -430 } else { -431 basePath = file; -432 } -433 -434 File f = new File(basePath); -435try { -436 f = f.getCanonicalFile(); -437if (wildCards != null) { -438 f = new File(f, wildCards); -439 } -440 } catch (IOException ex) { -441 LOGGER.warn("Invalid path '{}' was provided.", path); -442 LOGGER.debug("Invalid path provided", ex); -443 } -444return f.getAbsolutePath().replace('\\', '/'); -445 } -446 -447/** -448 * Returns the position of the last file separator. -449 * -450 * @param file a file path -451 * @return the position of the last file separator -452 */ -453privateint getLastFileSeparator(String file) { -454if (file.contains("*") || file.contains("?")) { -455int p1 = file.indexOf('*'); -456int p2 = file.indexOf('?'); -457 p1 = p1 > 0 ? p1 : file.length(); -458 p2 = p2 > 0 ? p2 : file.length(); -459int pos = p1 < p2 ? p1 : p2; -460 pos = file.lastIndexOf('/', pos); -461return pos; -462 } else { -463return file.lastIndexOf('/'); -464 } -465 } -466 } +30import org.apache.commons.lang.StringUtils; +31import org.owasp.dependencycheck.data.nvdcve.CveDB; +32import org.owasp.dependencycheck.data.nvdcve.DatabaseException; +33import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties; +34import org.owasp.dependencycheck.dependency.Dependency; +35import org.apache.tools.ant.DirectoryScanner; +36import org.owasp.dependencycheck.reporting.ReportGenerator; +37import org.owasp.dependencycheck.utils.Settings; +38import org.slf4j.Logger; +39import org.slf4j.LoggerFactory; +40import ch.qos.logback.core.FileAppender; +41import org.slf4j.impl.StaticLoggerBinder; +42 +43/** +44 * The command line interface for the DependencyCheck application. +45 * +46 * @author Jeremy Long +47 */ +48publicclassApp { +49 +50/** +51 * The logger. +52 */ +53privatestaticfinal Logger LOGGER = LoggerFactory.getLogger(App.class); +54 +55/** +56 * The main method for the application. +57 * +58 * @param args the command line arguments +59 */ +60publicstaticvoid main(String[] args) { +61try { +62 Settings.initialize(); +63finalApp app = newApp(); +64 app.run(args); +65 } finally { +66 Settings.cleanup(true); +67 } +68 } +69 +70/** +71 * Main CLI entry-point into the application. +72 * +73 * @param args the command line arguments +74 */ +75publicvoid run(String[] args) { +76finalCliParser cli = newCliParser(); +77 +78try { +79 cli.parse(args); +80 } catch (FileNotFoundException ex) { +81 System.err.println(ex.getMessage()); +82 cli.printHelp(); +83return; +84 } catch (ParseException ex) { +85 System.err.println(ex.getMessage()); +86 cli.printHelp(); +87return; +88 } +89 +90if (cli.getVerboseLog() != null) { +91 prepareLogger(cli.getVerboseLog()); +92 } +93 +94if (cli.isPurge()) { +95if (cli.getConnectionString() != null) { +96 LOGGER.error("Unable to purge the database when using a non-default connection string"); +97 } else { +98 populateSettings(cli); +99 File db; +100try { +101 db = new File(Settings.getDataDirectory(), "dc.h2.db"); +102if (db.exists()) { +103if (db.delete()) { +104 LOGGER.info("Database file purged; local copy of the NVD has been removed"); +105 } else { +106 LOGGER.error("Unable to delete '{}'; please delete the file manually", db.getAbsolutePath()); +107 } +108 } else { +109 LOGGER.error("Unable to purge database; the database file does not exists: {}", db.getAbsolutePath()); +110 } +111 } catch (IOException ex) { +112 LOGGER.error("Unable to delete the database"); +113 } +114 } +115 } elseif (cli.isGetVersion()) { +116 cli.printVersionInfo(); +117 } elseif (cli.isUpdateOnly()) { +118 populateSettings(cli); +119 runUpdateOnly(); +120 } elseif (cli.isRunScan()) { +121 populateSettings(cli); +122try { +123 runScan(cli.getReportDirectory(), cli.getReportFormat(), cli.getProjectName(), cli.getScanFiles(), +124 cli.getExcludeList(), cli.getSymLinkDepth()); +125 } catch (InvalidScanPathException ex) { +126 LOGGER.error("An invalid scan path was detected; unable to scan '//*' paths"); +127 } +128 } else { +129 cli.printHelp(); +130 } +131 } +132 +133/** +134 * Scans the specified directories and writes the dependency reports to the reportDirectory. +135 * +136 * @param reportDirectory the path to the directory where the reports will be written +137 * @param outputFormat the output format of the report +138 * @param applicationName the application name for the report +139 * @param files the files/directories to scan +140 * @param excludes the patterns for files/directories to exclude +141 * @param symLinkDepth the depth that symbolic links will be followed +142 * +143 * @throws InvalidScanPathException thrown if the path to scan starts with "//" +144 */ +145privatevoid runScan(String reportDirectory, String outputFormat, String applicationName, String[] files, +146 String[] excludes, int symLinkDepth) throws InvalidScanPathException { +147 Engine engine = null; +148try { +149 engine = new Engine(); +150final List<String> antStylePaths = new ArrayList<String>(); +151for (String file : files) { +152final String antPath = ensureCanonicalPath(file); +153 antStylePaths.add(antPath); +154 } +155 +156final Set<File> paths = new HashSet<File>(); +157for (String file : antStylePaths) { +158 LOGGER.debug("Scanning {}", file); +159final DirectoryScanner scanner = new DirectoryScanner(); +160 String include = file.replace('\\', '/'); +161 File baseDir; +162 +163if (include.startsWith("//")) { +164thrownewInvalidScanPathException("Unable to scan paths specified by //"); +165 } else { +166finalint pos = getLastFileSeparator(include); +167final String tmpBase = include.substring(0, pos); +168final String tmpInclude = include.substring(pos + 1); +169if (tmpInclude.indexOf('*') >= 0 || tmpInclude.indexOf('?') >= 0 +170 || (new File(include)).isFile()) { +171 baseDir = new File(tmpBase); +172 include = tmpInclude; +173 } else { +174 baseDir = new File(tmpBase, tmpInclude); +175 include = "**/*"; +176 } +177 } +178//LOGGER.debug("baseDir: {}", baseDir); +179//LOGGER.debug("include: {}", include); +180 scanner.setBasedir(baseDir); +181final String[] includes = {include}; +182 scanner.setIncludes(includes); +183 scanner.setMaxLevelsOfSymlinks(symLinkDepth); +184if (symLinkDepth <= 0) { +185 scanner.setFollowSymlinks(false); +186 } +187if (excludes != null && excludes.length > 0) { +188 scanner.addExcludes(excludes); +189 } +190 scanner.scan(); +191if (scanner.getIncludedFilesCount() > 0) { +192for (String s : scanner.getIncludedFiles()) { +193final File f = new File(baseDir, s); +194 LOGGER.debug("Found file {}", f.toString()); +195 paths.add(f); +196 } +197 } +198 } +199 engine.scan(paths); +200 +201 engine.analyzeDependencies(); +202final List<Dependency> dependencies = engine.getDependencies(); +203 DatabaseProperties prop = null; +204 CveDB cve = null; +205try { +206 cve = new CveDB(); +207 cve.open(); +208 prop = cve.getDatabaseProperties(); +209 } catch (DatabaseException ex) { +210 LOGGER.debug("Unable to retrieve DB Properties", ex); +211 } finally { +212if (cve != null) { +213 cve.close(); +214 } +215 } +216final ReportGenerator report = new ReportGenerator(applicationName, dependencies, engine.getAnalyzers(), prop); +217try { +218 report.generateReports(reportDirectory, outputFormat); +219 } catch (IOException ex) { +220 LOGGER.error("There was an IO error while attempting to generate the report."); +221 LOGGER.debug("", ex); +222 } catch (Throwable ex) { +223 LOGGER.error("There was an error while attempting to generate the report."); +224 LOGGER.debug("", ex); +225 } +226 } catch (DatabaseException ex) { +227 LOGGER.error("Unable to connect to the dependency-check database; analysis has stopped"); +228 LOGGER.debug("", ex); +229 } finally { +230if (engine != null) { +231 engine.cleanup(); +232 } +233 } +234 } +235 +236/** +237 * Only executes the update phase of dependency-check. +238 */ +239privatevoid runUpdateOnly() { +240 Engine engine = null; +241try { +242 engine = new Engine(); +243 engine.doUpdates(); +244 } catch (DatabaseException ex) { +245 LOGGER.error("Unable to connect to the dependency-check database; analysis has stopped"); +246 LOGGER.debug("", ex); +247 } finally { +248if (engine != null) { +249 engine.cleanup(); +250 } +251 } +252 } +253 +254/** +255 * Updates the global Settings. +256 * +257 * @param cli a reference to the CLI Parser that contains the command line arguments used to set the corresponding settings in +258 * the core engine. +259 */ +260privatevoid populateSettings(CliParser cli) { +261 +262finalboolean autoUpdate = cli.isAutoUpdate(); +263final String connectionTimeout = cli.getConnectionTimeout(); +264final String proxyServer = cli.getProxyServer(); +265final String proxyPort = cli.getProxyPort(); +266final String proxyUser = cli.getProxyUsername(); +267final String proxyPass = cli.getProxyPassword(); +268final String dataDirectory = cli.getDataDirectory(); +269final File propertiesFile = cli.getPropertiesFile(); +270final String suppressionFile = cli.getSuppressionFile(); +271final String nexusUrl = cli.getNexusUrl(); +272final String databaseDriverName = cli.getDatabaseDriverName(); +273final String databaseDriverPath = cli.getDatabaseDriverPath(); +274final String connectionString = cli.getConnectionString(); +275final String databaseUser = cli.getDatabaseUser(); +276final String databasePassword = cli.getDatabasePassword(); +277final String additionalZipExtensions = cli.getAdditionalZipExtensions(); +278final String pathToMono = cli.getPathToMono(); +279final String cveMod12 = cli.getModifiedCve12Url(); +280final String cveMod20 = cli.getModifiedCve20Url(); +281final String cveBase12 = cli.getBaseCve12Url(); +282final String cveBase20 = cli.getBaseCve20Url(); +283final Integer cveValidForHours = cli.getCveValidForHours(); +284 +285if (propertiesFile != null) { +286try { +287 Settings.mergeProperties(propertiesFile); +288 } catch (FileNotFoundException ex) { +289 LOGGER.error("Unable to load properties file '{}'", propertiesFile.getPath()); +290 LOGGER.debug("", ex); +291 } catch (IOException ex) { +292 LOGGER.error("Unable to find properties file '{}'", propertiesFile.getPath()); +293 LOGGER.debug("", ex); +294 } +295 } +296// We have to wait until we've merged the properties before attempting to set whether we use +297// the proxy for Nexus since it could be disabled in the properties, but not explicitly stated +298// on the command line +299finalboolean nexusUsesProxy = cli.isNexusUsesProxy(); +300if (dataDirectory != null) { +301 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory); +302 } elseif (System.getProperty("basedir") != null) { +303final File dataDir = new File(System.getProperty("basedir"), "data"); +304 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); +305 } else { +306final File jarPath = new File(App.class.getProtectionDomain().getCodeSource().getLocation().getPath()); +307final File base = jarPath.getParentFile(); +308final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY); +309final File dataDir = new File(base, sub); +310 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); +311 } +312 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); +313 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_SERVER, proxyServer); +314 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PORT, proxyPort); +315 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_USERNAME, proxyUser); +316 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PASSWORD, proxyPass); +317 Settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); +318 Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); +319 Settings.setIntIfNotNull(Settings.KEYS.CVE_CHECK_VALID_FOR_HOURS, cveValidForHours); +320 +321//File Type Analyzer Settings +322 Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, !cli.isJarDisabled()); +323 Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, !cli.isArchiveDisabled()); +324 Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, !cli.isPythonDistributionDisabled()); +325 Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, !cli.isPythonPackageDisabled()); +326 Settings.setBoolean(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, !cli.isAutoconfDisabled()); +327 Settings.setBoolean(Settings.KEYS.ANALYZER_CMAKE_ENABLED, !cli.isCmakeDisabled()); +328 Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, !cli.isNuspecDisabled()); +329 Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, !cli.isAssemblyDisabled()); +330 Settings.setBoolean(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_ENABLED, !cli.isBundleAuditDisabled()); +331 Settings.setBoolean(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, !cli.isOpenSSLDisabled()); +332 Settings.setBoolean(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, !cli.isComposerDisabled()); +333 Settings.setBoolean(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, !cli.isNodeJsDisabled()); +334 Settings.setBoolean(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, !cli.isRubyGemspecDisabled()); +335 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, !cli.isCentralDisabled()); +336 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, !cli.isNexusDisabled()); +337 +338 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_PATH, cli.getPathToBundleAudit()); +339 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); +340 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy); +341 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); +342 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); +343 Settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString); +344 Settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser); +345 Settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword); +346 Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, additionalZipExtensions); +347 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); +348if (cveBase12 != null && !cveBase12.isEmpty()) { +349 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveBase12); +350 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveBase20); +351 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveMod12); +352 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveMod20); +353 } +354 } +355 +356/** +357 * Creates a file appender and adds it to logback. +358 * +359 * @param verboseLog the path to the verbose log file +360 */ +361privatevoid prepareLogger(String verboseLog) { +362final StaticLoggerBinder loggerBinder = StaticLoggerBinder.getSingleton(); +363final LoggerContext context = (LoggerContext) loggerBinder.getLoggerFactory(); +364 +365final PatternLayoutEncoder encoder = new PatternLayoutEncoder(); +366 encoder.setPattern("%d %C:%L%n%-5level - %msg%n"); +367 encoder.setContext(context); +368 encoder.start(); +369final FileAppender fa = new FileAppender(); +370 fa.setAppend(true); +371 fa.setEncoder(encoder); +372 fa.setContext(context); +373 fa.setFile(verboseLog); +374final File f = new File(verboseLog); +375 String name = f.getName(); +376finalint i = name.lastIndexOf('.'); +377if (i > 1) { +378 name = name.substring(0, i); +379 } +380 fa.setName(name); +381 fa.start(); +382final ch.qos.logback.classic.Logger rootLogger = context.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME); +383 rootLogger.addAppender(fa); +384 } +385 +386/** +387 * Takes a path and resolves it to be a canonical &amp; absolute path. The caveats are that this method will take an Ant style +388 * file selector path (../someDir/**\/*.jar) and convert it to an absolute/canonical path (at least to the left of the first * +389 * or ?). +390 * +391 * @param path the path to canonicalize +392 * @return the canonical path +393 */ +394protected String ensureCanonicalPath(String path) { +395 String basePath = null; +396 String wildCards = null; +397final String file = path.replace('\\', '/'); +398if (file.contains("*") || file.contains("?")) { +399 +400int pos = getLastFileSeparator(file); +401if (pos < 0) { +402return file; +403 } +404 pos += 1; +405 basePath = file.substring(0, pos); +406 wildCards = file.substring(pos); +407 } else { +408 basePath = file; +409 } +410 +411 File f = new File(basePath); +412try { +413 f = f.getCanonicalFile(); +414if (wildCards != null) { +415 f = new File(f, wildCards); +416 } +417 } catch (IOException ex) { +418 LOGGER.warn("Invalid path '{}' was provided.", path); +419 LOGGER.debug("Invalid path provided", ex); +420 } +421return f.getAbsolutePath().replace('\\', '/'); +422 } +423 +424/** +425 * Returns the position of the last file separator. +426 * +427 * @param file a file path +428 * @return the position of the last file separator +429 */ +430privateint getLastFileSeparator(String file) { +431if (file.contains("*") || file.contains("?")) { +432int p1 = file.indexOf('*'); +433int p2 = file.indexOf('?'); +434 p1 = p1 > 0 ? p1 : file.length(); +435 p2 = p2 > 0 ? p2 : file.length(); +436int pos = p1 < p2 ? p1 : p2; +437 pos = file.lastIndexOf('/', pos); +438return pos; +439 } else { +440return file.lastIndexOf('/'); +441 } +442 } +443 }
    diff --git a/dependency-check-cli/xref/org/owasp/dependencycheck/CliParser.html b/dependency-check-cli/xref/org/owasp/dependencycheck/CliParser.html index aeaf079ee..84c4f2ba4 100644 --- a/dependency-check-cli/xref/org/owasp/dependencycheck/CliParser.html +++ b/dependency-check-cli/xref/org/owasp/dependencycheck/CliParser.html @@ -98,1147 +98,1217 @@ 90 * @throws ParseException is thrown if there is an exception parsing the command line.91 */92privatevoid validateArgs() throws FileNotFoundException, ParseException { -93if (isRunScan()) { -94 validatePathExists(getScanFiles(), ARGUMENT.SCAN); -95 validatePathExists(getReportDirectory(), ARGUMENT.OUT); -96if (getPathToMono() != null) { -97 validatePathExists(getPathToMono(), ARGUMENT.PATH_TO_MONO); -98 } -99if (!line.hasOption(ARGUMENT.APP_NAME) && !line.hasOption(ARGUMENT.PROJECT)) { -100thrownew ParseException("Missing '" + ARGUMENT.PROJECT + "' argument; the scan cannot be run without the an project name."); -101 } -102if (line.hasOption(ARGUMENT.OUTPUT_FORMAT)) { -103final String format = line.getOptionValue(ARGUMENT.OUTPUT_FORMAT); -104try { -105 Format.valueOf(format); -106 } catch (IllegalArgumentException ex) { -107final String msg = String.format("An invalid 'format' of '%s' was specified. " -108 + "Supported output formats are XML, HTML, VULN, or ALL", format); -109thrownew ParseException(msg); -110 } +93if (isUpdateOnly() || isRunScan()) { +94final String value = line.getOptionValue(ARGUMENT.CVE_VALID_FOR_HOURS); +95if (value != null) { +96try { +97finalint i = Integer.parseInt(value); +98if (i < 0) { +99thrownew ParseException("Invalid Setting: cveValidForHours must be a number greater than or equal to 0."); +100 } +101 } catch (NumberFormatException ex) { +102thrownew ParseException("Invalid Setting: cveValidForHours must be a number greater than or equal to 0."); +103 } +104 } +105 } +106if (isRunScan()) { +107 validatePathExists(getScanFiles(), ARGUMENT.SCAN); +108 validatePathExists(getReportDirectory(), ARGUMENT.OUT); +109if (getPathToMono() != null) { +110 validatePathExists(getPathToMono(), ARGUMENT.PATH_TO_MONO); 111 } -112if ((getBaseCve12Url() != null || getBaseCve20Url() != null || getModifiedCve12Url() != null || getModifiedCve20Url() != null) -113 && (getBaseCve12Url() == null || getBaseCve20Url() == null || getModifiedCve12Url() == null || getModifiedCve20Url() == null)) { -114final String msg = "If one of the CVE URLs is specified they must all be specified; please add the missing CVE URL."; -115thrownew ParseException(msg); -116 } -117if (line.hasOption((ARGUMENT.SYM_LINK_DEPTH))) { -118try { -119finalint i = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH)); -120if (i < 0) { -121thrownew ParseException("Symbolic Link Depth (symLink) must be greater than zero."); -122 } -123 } catch (NumberFormatException ex) { -124thrownew ParseException("Symbolic Link Depth (symLink) is not a number."); -125 } -126 } -127 } -128 } -129 -130/** -131 * Validates whether or not the path(s) points at a file that exists; if the path(s) does not point to an existing file a -132 * FileNotFoundException is thrown. -133 * -134 * @param paths the paths to validate if they exists -135 * @param optType the option being validated (e.g. scan, out, etc.) -136 * @throws FileNotFoundException is thrown if one of the paths being validated does not exist. -137 */ -138privatevoid validatePathExists(String[] paths, String optType) throws FileNotFoundException { -139for (String path : paths) { -140 validatePathExists(path, optType); -141 } -142 } -143 -144/** -145 * Validates whether or not the path points at a file that exists; if the path does not point to an existing file a -146 * FileNotFoundException is thrown. -147 * -148 * @param path the paths to validate if they exists -149 * @param argumentName the argument being validated (e.g. scan, out, etc.) -150 * @throws FileNotFoundException is thrown if the path being validated does not exist. -151 */ -152privatevoid validatePathExists(String path, String argumentName) throws FileNotFoundException { -153if (path == null) { -154 isValid = false; -155final String msg = String.format("Invalid '%s' argument: null", argumentName); -156thrownew FileNotFoundException(msg); -157 } elseif (!path.contains("*") && !path.contains("?")) { -158 File f = new File(path); -159if ("o".equalsIgnoreCase(argumentName.substring(0, 1)) && !"ALL".equalsIgnoreCase(this.getReportFormat())) { -160final String checkPath = path.toLowerCase(); -161if (checkPath.endsWith(".html") || checkPath.endsWith(".xml") || checkPath.endsWith(".htm")) { -162if (f.getParentFile() == null) { -163 f = new File(".", path); -164 } -165if (!f.getParentFile().isDirectory()) { -166 isValid = false; -167final String msg = String.format("Invalid '%s' argument: '%s'", argumentName, path); -168thrownew FileNotFoundException(msg); -169 } -170 } -171 } else { -172if (!f.exists()) { -173 isValid = false; -174final String msg = String.format("Invalid '%s' argument: '%s'", argumentName, path); -175thrownew FileNotFoundException(msg); -176 } -177 } -178 } elseif (path.startsWith("//") || path.startsWith("\\\\")) { -179 isValid = false; -180final String msg = String.format("Invalid '%s' argument: '%s'%nUnable to scan paths that start with '//'.", argumentName, path); -181thrownew FileNotFoundException(msg); -182 } -183 } -184 -185/** -186 * Generates an Options collection that is used to parse the command line and to display the help message. -187 * -188 * @return the command line options used for parsing the command line -189 */ -190 @SuppressWarnings("static-access") -191private Options createCommandLineOptions() { -192final Options options = new Options(); -193 addStandardOptions(options); -194 addAdvancedOptions(options); -195 addDeprecatedOptions(options); -196return options; -197 } -198 -199/** -200 * Adds the standard command line options to the given options collection. -201 * -202 * @param options a collection of command line arguments -203 * @throws IllegalArgumentException thrown if there is an exception -204 */ -205 @SuppressWarnings("static-access") -206privatevoid addStandardOptions(final Options options) throws IllegalArgumentException { -207final Option help = new Option(ARGUMENT.HELP_SHORT, ARGUMENT.HELP, false, -208"Print this message."); -209 -210final Option advancedHelp = Option.builder().longOpt(ARGUMENT.ADVANCED_HELP) -211 .desc("Print the advanced help message.").build(); -212 -213final Option version = new Option(ARGUMENT.VERSION_SHORT, ARGUMENT.VERSION, -214 false, "Print the version information."); -215 -216final Option noUpdate = new Option(ARGUMENT.DISABLE_AUTO_UPDATE_SHORT, ARGUMENT.DISABLE_AUTO_UPDATE, -217 false, "Disables the automatic updating of the CPE data."); -218 -219final Option projectName = Option.builder().hasArg().argName("name").longOpt(ARGUMENT.PROJECT) -220 .desc("The name of the project being scanned. This is a required argument.") -221 .build(); +112if (!line.hasOption(ARGUMENT.APP_NAME) && !line.hasOption(ARGUMENT.PROJECT)) { +113thrownew ParseException("Missing '" + ARGUMENT.PROJECT + "' argument; the scan cannot be run without the an project name."); +114 } +115if (line.hasOption(ARGUMENT.OUTPUT_FORMAT)) { +116final String format = line.getOptionValue(ARGUMENT.OUTPUT_FORMAT); +117try { +118 Format.valueOf(format); +119 } catch (IllegalArgumentException ex) { +120final String msg = String.format("An invalid 'format' of '%s' was specified. " +121 + "Supported output formats are XML, HTML, VULN, or ALL", format); +122thrownew ParseException(msg); +123 } +124 } +125if ((getBaseCve12Url() != null || getBaseCve20Url() != null || getModifiedCve12Url() != null || getModifiedCve20Url() != null) +126 && (getBaseCve12Url() == null || getBaseCve20Url() == null || getModifiedCve12Url() == null || getModifiedCve20Url() == null)) { +127final String msg = "If one of the CVE URLs is specified they must all be specified; please add the missing CVE URL."; +128thrownew ParseException(msg); +129 } +130if (line.hasOption((ARGUMENT.SYM_LINK_DEPTH))) { +131try { +132finalint i = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH)); +133if (i < 0) { +134thrownew ParseException("Symbolic Link Depth (symLink) must be greater than zero."); +135 } +136 } catch (NumberFormatException ex) { +137thrownew ParseException("Symbolic Link Depth (symLink) is not a number."); +138 } +139 } +140 } +141 } +142 +143/** +144 * Validates whether or not the path(s) points at a file that exists; if the path(s) does not point to an existing file a +145 * FileNotFoundException is thrown. +146 * +147 * @param paths the paths to validate if they exists +148 * @param optType the option being validated (e.g. scan, out, etc.) +149 * @throws FileNotFoundException is thrown if one of the paths being validated does not exist. +150 */ +151privatevoid validatePathExists(String[] paths, String optType) throws FileNotFoundException { +152for (String path : paths) { +153 validatePathExists(path, optType); +154 } +155 } +156 +157/** +158 * Validates whether or not the path points at a file that exists; if the path does not point to an existing file a +159 * FileNotFoundException is thrown. +160 * +161 * @param path the paths to validate if they exists +162 * @param argumentName the argument being validated (e.g. scan, out, etc.) +163 * @throws FileNotFoundException is thrown if the path being validated does not exist. +164 */ +165privatevoid validatePathExists(String path, String argumentName) throws FileNotFoundException { +166if (path == null) { +167 isValid = false; +168final String msg = String.format("Invalid '%s' argument: null", argumentName); +169thrownew FileNotFoundException(msg); +170 } elseif (!path.contains("*") && !path.contains("?")) { +171 File f = new File(path); +172if ("o".equalsIgnoreCase(argumentName.substring(0, 1)) && !"ALL".equalsIgnoreCase(this.getReportFormat())) { +173final String checkPath = path.toLowerCase(); +174if (checkPath.endsWith(".html") || checkPath.endsWith(".xml") || checkPath.endsWith(".htm")) { +175if (f.getParentFile() == null) { +176 f = new File(".", path); +177 } +178if (!f.getParentFile().isDirectory()) { +179 isValid = false; +180final String msg = String.format("Invalid '%s' argument: '%s'", argumentName, path); +181thrownew FileNotFoundException(msg); +182 } +183 } +184 } else { +185if (!f.exists()) { +186 isValid = false; +187final String msg = String.format("Invalid '%s' argument: '%s'", argumentName, path); +188thrownew FileNotFoundException(msg); +189 } +190 } +191 } elseif (path.startsWith("//") || path.startsWith("\\\\")) { +192 isValid = false; +193final String msg = String.format("Invalid '%s' argument: '%s'%nUnable to scan paths that start with '//'.", argumentName, path); +194thrownew FileNotFoundException(msg); +195 } +196 } +197 +198/** +199 * Generates an Options collection that is used to parse the command line and to display the help message. +200 * +201 * @return the command line options used for parsing the command line +202 */ +203 @SuppressWarnings("static-access") +204private Options createCommandLineOptions() { +205final Options options = new Options(); +206 addStandardOptions(options); +207 addAdvancedOptions(options); +208 addDeprecatedOptions(options); +209return options; +210 } +211 +212/** +213 * Adds the standard command line options to the given options collection. +214 * +215 * @param options a collection of command line arguments +216 * @throws IllegalArgumentException thrown if there is an exception +217 */ +218 @SuppressWarnings("static-access") +219privatevoid addStandardOptions(final Options options) throws IllegalArgumentException { +220final Option help = new Option(ARGUMENT.HELP_SHORT, ARGUMENT.HELP, false, +221"Print this message."); 222 -223final Option path = Option.builder(ARGUMENT.SCAN_SHORT).argName("path").hasArg().longOpt(ARGUMENT.SCAN) -224 .desc("The path to scan - this option can be specified multiple times. Ant style" -225 + " paths are supported (e.g. path/**/*.jar).") -226 .build(); -227 -228final Option excludes = Option.builder().argName("pattern").hasArg().longOpt(ARGUMENT.EXCLUDE) -229 .desc("Specify and exclusion pattern. This option can be specified multiple times" -230 + " and it accepts Ant style excludsions.") -231 .build(); -232 -233final Option props = Option.builder(ARGUMENT.PROP_SHORT).argName("file").hasArg().longOpt(ARGUMENT.PROP) -234 .desc("A property file to load.") -235 .build(); -236 -237final Option out = Option.builder(ARGUMENT.OUT_SHORT).argName("path").hasArg().longOpt(ARGUMENT.OUT) -238 .desc("The folder to write reports to. This defaults to the current directory. " -239 + "It is possible to set this to a specific file name if the format argument is not set to ALL.") -240 .build(); -241 -242final Option outputFormat = Option.builder(ARGUMENT.OUTPUT_FORMAT_SHORT).argName("format").hasArg().longOpt(ARGUMENT.OUTPUT_FORMAT) -243 .desc("The output format to write to (XML, HTML, VULN, ALL). The default is HTML.") +223final Option advancedHelp = Option.builder().longOpt(ARGUMENT.ADVANCED_HELP) +224 .desc("Print the advanced help message.").build(); +225 +226final Option version = new Option(ARGUMENT.VERSION_SHORT, ARGUMENT.VERSION, +227 false, "Print the version information."); +228 +229final Option noUpdate = new Option(ARGUMENT.DISABLE_AUTO_UPDATE_SHORT, ARGUMENT.DISABLE_AUTO_UPDATE, +230 false, "Disables the automatic updating of the CPE data."); +231 +232final Option projectName = Option.builder().hasArg().argName("name").longOpt(ARGUMENT.PROJECT) +233 .desc("The name of the project being scanned. This is a required argument.") +234 .build(); +235 +236final Option path = Option.builder(ARGUMENT.SCAN_SHORT).argName("path").hasArg().longOpt(ARGUMENT.SCAN) +237 .desc("The path to scan - this option can be specified multiple times. Ant style" +238 + " paths are supported (e.g. path/**/*.jar).") +239 .build(); +240 +241final Option excludes = Option.builder().argName("pattern").hasArg().longOpt(ARGUMENT.EXCLUDE) +242 .desc("Specify and exclusion pattern. This option can be specified multiple times" +243 + " and it accepts Ant style excludsions.") 244 .build(); 245 -246final Option verboseLog = Option.builder(ARGUMENT.VERBOSE_LOG_SHORT).argName("file").hasArg().longOpt(ARGUMENT.VERBOSE_LOG) -247 .desc("The file path to write verbose logging information.") +246final Option props = Option.builder(ARGUMENT.PROP_SHORT).argName("file").hasArg().longOpt(ARGUMENT.PROP) +247 .desc("A property file to load.") 248 .build(); 249 -250final Option symLinkDepth = Option.builder().argName("depth").hasArg().longOpt(ARGUMENT.SYM_LINK_DEPTH) -251 .desc("Sets how deep nested symbolic links will be followed; 0 indicates symbolic links will not be followed.") -252 .build(); -253 -254final Option suppressionFile = Option.builder().argName("file").hasArg().longOpt(ARGUMENT.SUPPRESSION_FILE) -255 .desc("The file path to the suppression XML file.") -256 .build(); -257 -258//This is an option group because it can be specified more then once. -259final OptionGroup og = new OptionGroup(); -260 og.addOption(path); -261 -262final OptionGroup exog = new OptionGroup(); -263 exog.addOption(excludes); -264 -265 options.addOptionGroup(og) -266 .addOptionGroup(exog) -267 .addOption(projectName) -268 .addOption(out) -269 .addOption(outputFormat) -270 .addOption(version) -271 .addOption(help) -272 .addOption(advancedHelp) -273 .addOption(noUpdate) -274 .addOption(symLinkDepth) -275 .addOption(props) -276 .addOption(verboseLog) -277 .addOption(suppressionFile); -278 } -279 -280/** -281 * Adds the advanced command line options to the given options collection. These are split out for purposes of being able to -282 * display two different help messages. -283 * -284 * @param options a collection of command line arguments -285 * @throws IllegalArgumentException thrown if there is an exception -286 */ -287 @SuppressWarnings("static-access") -288privatevoid addAdvancedOptions(final Options options) throws IllegalArgumentException { -289 -290final Option cve12Base = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_BASE_12) -291 .desc("Base URL for each year’s CVE 1.2, the %d will be replaced with the year. ") -292 .build(); -293 -294final Option cve20Base = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_BASE_20) -295 .desc("Base URL for each year’s CVE 2.0, the %d will be replaced with the year.") -296 .build(); +250final Option out = Option.builder(ARGUMENT.OUT_SHORT).argName("path").hasArg().longOpt(ARGUMENT.OUT) +251 .desc("The folder to write reports to. This defaults to the current directory. " +252 + "It is possible to set this to a specific file name if the format argument is not set to ALL.") +253 .build(); +254 +255final Option outputFormat = Option.builder(ARGUMENT.OUTPUT_FORMAT_SHORT).argName("format").hasArg().longOpt(ARGUMENT.OUTPUT_FORMAT) +256 .desc("The output format to write to (XML, HTML, VULN, ALL). The default is HTML.") +257 .build(); +258 +259final Option verboseLog = Option.builder(ARGUMENT.VERBOSE_LOG_SHORT).argName("file").hasArg().longOpt(ARGUMENT.VERBOSE_LOG) +260 .desc("The file path to write verbose logging information.") +261 .build(); +262 +263final Option symLinkDepth = Option.builder().argName("depth").hasArg().longOpt(ARGUMENT.SYM_LINK_DEPTH) +264 .desc("Sets how deep nested symbolic links will be followed; 0 indicates symbolic links will not be followed.") +265 .build(); +266 +267final Option suppressionFile = Option.builder().argName("file").hasArg().longOpt(ARGUMENT.SUPPRESSION_FILE) +268 .desc("The file path to the suppression XML file.") +269 .build(); +270 +271final Option cveValidForHours = Option.builder().argName("hours").hasArg().longOpt(ARGUMENT.CVE_VALID_FOR_HOURS) +272 .desc("The number of hours to wait before checking for new updates from the NVD.") +273 .build(); +274 +275//This is an option group because it can be specified more then once. +276final OptionGroup og = new OptionGroup(); +277 og.addOption(path); +278 +279final OptionGroup exog = new OptionGroup(); +280 exog.addOption(excludes); +281 +282 options.addOptionGroup(og) +283 .addOptionGroup(exog) +284 .addOption(projectName) +285 .addOption(out) +286 .addOption(outputFormat) +287 .addOption(version) +288 .addOption(help) +289 .addOption(advancedHelp) +290 .addOption(noUpdate) +291 .addOption(symLinkDepth) +292 .addOption(props) +293 .addOption(verboseLog) +294 .addOption(suppressionFile) +295 .addOption(cveValidForHours); +296 } 297 -298final Option cve12Modified = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_MOD_12) -299 .desc("URL for the modified CVE 1.2.") -300 .build(); -301 -302final Option cve20Modified = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_MOD_20) -303 .desc("URL for the modified CVE 2.0.") -304 .build(); -305 -306final Option updateOnly = Option.builder().longOpt(ARGUMENT.UPDATE_ONLY) -307 .desc("Only update the local NVD data cache; no scan will be executed.").build(); -308 -309final Option data = Option.builder(ARGUMENT.DATA_DIRECTORY_SHORT).argName("path").hasArg().longOpt(ARGUMENT.DATA_DIRECTORY) -310 .desc("The location of the H2 Database file. This option should generally not be set.") -311 .build(); -312 -313final Option nexusUrl = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.NEXUS_URL) -314 .desc("The url to the Nexus Server's REST API Endpoint (http://domain/nexus/service/local). " -315 + "If not set the Nexus Analyzer will be disabled.").build(); -316 -317final Option nexusUsesProxy = Option.builder().argName("true/false").hasArg().longOpt(ARGUMENT.NEXUS_USES_PROXY) -318 .desc("Whether or not the configured proxy should be used when connecting to Nexus.") -319 .build(); -320 -321final Option additionalZipExtensions = Option.builder().argName("extensions").hasArg() -322 .longOpt(ARGUMENT.ADDITIONAL_ZIP_EXTENSIONS) -323 .desc("A comma separated list of additional extensions to be scanned as ZIP files " -324 + "(ZIP, EAR, WAR are already treated as zip files)").build(); -325 -326final Option pathToMono = Option.builder().argName("path").hasArg().longOpt(ARGUMENT.PATH_TO_MONO) -327 .desc("The path to Mono for .NET Assembly analysis on non-windows systems.") -328 .build(); -329 -330final Option connectionTimeout = Option.builder(ARGUMENT.CONNECTION_TIMEOUT_SHORT).argName("timeout").hasArg() -331 .longOpt(ARGUMENT.CONNECTION_TIMEOUT).desc("The connection timeout (in milliseconds) to use when downloading resources.") -332 .build(); -333 -334final Option proxyServer = Option.builder().argName("server").hasArg().longOpt(ARGUMENT.PROXY_SERVER) -335 .desc("The proxy server to use when downloading resources.").build(); -336 -337final Option proxyPort = Option.builder().argName("port").hasArg().longOpt(ARGUMENT.PROXY_PORT) -338 .desc("The proxy port to use when downloading resources.").build(); -339 -340final Option proxyUsername = Option.builder().argName("user").hasArg().longOpt(ARGUMENT.PROXY_USERNAME) -341 .desc("The proxy username to use when downloading resources.").build(); -342 -343final Option proxyPassword = Option.builder().argName("pass").hasArg().longOpt(ARGUMENT.PROXY_PASSWORD) -344 .desc("The proxy password to use when downloading resources.").build(); -345 -346final Option connectionString = Option.builder().argName("connStr").hasArg().longOpt(ARGUMENT.CONNECTION_STRING) -347 .desc("The connection string to the database.").build(); -348 -349final Option dbUser = Option.builder().argName("user").hasArg().longOpt(ARGUMENT.DB_NAME) -350 .desc("The username used to connect to the database.").build(); +298/** +299 * Adds the advanced command line options to the given options collection. These are split out for purposes of being able to +300 * display two different help messages. +301 * +302 * @param options a collection of command line arguments +303 * @throws IllegalArgumentException thrown if there is an exception +304 */ +305 @SuppressWarnings("static-access") +306privatevoid addAdvancedOptions(final Options options) throws IllegalArgumentException { +307 +308final Option cve12Base = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_BASE_12) +309 .desc("Base URL for each year’s CVE 1.2, the %d will be replaced with the year. ") +310 .build(); +311 +312final Option cve20Base = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_BASE_20) +313 .desc("Base URL for each year’s CVE 2.0, the %d will be replaced with the year.") +314 .build(); +315 +316final Option cve12Modified = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_MOD_12) +317 .desc("URL for the modified CVE 1.2.") +318 .build(); +319 +320final Option cve20Modified = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_MOD_20) +321 .desc("URL for the modified CVE 2.0.") +322 .build(); +323 +324final Option updateOnly = Option.builder().longOpt(ARGUMENT.UPDATE_ONLY) +325 .desc("Only update the local NVD data cache; no scan will be executed.").build(); +326 +327final Option data = Option.builder(ARGUMENT.DATA_DIRECTORY_SHORT).argName("path").hasArg().longOpt(ARGUMENT.DATA_DIRECTORY) +328 .desc("The location of the H2 Database file. This option should generally not be set.") +329 .build(); +330 +331final Option nexusUrl = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.NEXUS_URL) +332 .desc("The url to the Nexus Server's REST API Endpoint (http://domain/nexus/service/local). " +333 + "If not set the Nexus Analyzer will be disabled.").build(); +334 +335final Option nexusUsesProxy = Option.builder().argName("true/false").hasArg().longOpt(ARGUMENT.NEXUS_USES_PROXY) +336 .desc("Whether or not the configured proxy should be used when connecting to Nexus.") +337 .build(); +338 +339final Option additionalZipExtensions = Option.builder().argName("extensions").hasArg() +340 .longOpt(ARGUMENT.ADDITIONAL_ZIP_EXTENSIONS) +341 .desc("A comma separated list of additional extensions to be scanned as ZIP files " +342 + "(ZIP, EAR, WAR are already treated as zip files)").build(); +343 +344final Option pathToMono = Option.builder().argName("path").hasArg().longOpt(ARGUMENT.PATH_TO_MONO) +345 .desc("The path to Mono for .NET Assembly analysis on non-windows systems.") +346 .build(); +347 +348final Option pathToBundleAudit = Option.builder().argName("path").hasArg() +349 .longOpt(ARGUMENT.PATH_TO_BUNDLE_AUDIT) +350 .desc("The path to bundle-audit for Gem bundle analysis.").build(); 351 -352final Option dbPassword = Option.builder().argName("password").hasArg().longOpt(ARGUMENT.DB_PASSWORD) -353 .desc("The password for connecting to the database.").build(); -354 -355final Option dbDriver = Option.builder().argName("driver").hasArg().longOpt(ARGUMENT.DB_DRIVER) -356 .desc("The database driver name.").build(); -357 -358final Option dbDriverPath = Option.builder().argName("path").hasArg().longOpt(ARGUMENT.DB_DRIVER_PATH) -359 .desc("The path to the database driver; note, this does not need to be set unless the JAR is outside of the classpath.") -360 .build(); +352final Option connectionTimeout = Option.builder(ARGUMENT.CONNECTION_TIMEOUT_SHORT).argName("timeout").hasArg() +353 .longOpt(ARGUMENT.CONNECTION_TIMEOUT).desc("The connection timeout (in milliseconds) to use when downloading resources.") +354 .build(); +355 +356final Option proxyServer = Option.builder().argName("server").hasArg().longOpt(ARGUMENT.PROXY_SERVER) +357 .desc("The proxy server to use when downloading resources.").build(); +358 +359final Option proxyPort = Option.builder().argName("port").hasArg().longOpt(ARGUMENT.PROXY_PORT) +360 .desc("The proxy port to use when downloading resources.").build(); 361 -362final Option disableJarAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_JAR) -363 .desc("Disable the Jar Analyzer.").build(); +362final Option proxyUsername = Option.builder().argName("user").hasArg().longOpt(ARGUMENT.PROXY_USERNAME) +363 .desc("The proxy username to use when downloading resources.").build(); 364 -365final Option disableArchiveAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_ARCHIVE) -366 .desc("Disable the Archive Analyzer.").build(); +365final Option proxyPassword = Option.builder().argName("pass").hasArg().longOpt(ARGUMENT.PROXY_PASSWORD) +366 .desc("The proxy password to use when downloading resources.").build(); 367 -368final Option disableNuspecAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_NUSPEC) -369 .desc("Disable the Nuspec Analyzer.").build(); +368final Option connectionString = Option.builder().argName("connStr").hasArg().longOpt(ARGUMENT.CONNECTION_STRING) +369 .desc("The connection string to the database.").build(); 370 -371final Option disableAssemblyAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_ASSEMBLY) -372 .desc("Disable the .NET Assembly Analyzer.").build(); +371final Option dbUser = Option.builder().argName("user").hasArg().longOpt(ARGUMENT.DB_NAME) +372 .desc("The username used to connect to the database.").build(); 373 -374final Option disablePythonDistributionAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_PY_DIST) -375 .desc("Disable the Python Distribution Analyzer.").build(); +374final Option dbPassword = Option.builder().argName("password").hasArg().longOpt(ARGUMENT.DB_PASSWORD) +375 .desc("The password for connecting to the database.").build(); 376 -377final Option disablePythonPackageAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_PY_PKG) -378 .desc("Disable the Python Package Analyzer.").build(); +377final Option dbDriver = Option.builder().argName("driver").hasArg().longOpt(ARGUMENT.DB_DRIVER) +378 .desc("The database driver name.").build(); 379 -380final Option disableComposerAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_COMPOSER) -381 .desc("Disable the PHP Composer Analyzer.").build(); -382 -383final Option disableAutoconfAnalyzer = Option.builder() -384 .longOpt(ARGUMENT.DISABLE_AUTOCONF) -385 .desc("Disable the Autoconf Analyzer.").build(); +380final Option dbDriverPath = Option.builder().argName("path").hasArg().longOpt(ARGUMENT.DB_DRIVER_PATH) +381 .desc("The path to the database driver; note, this does not need to be set unless the JAR is outside of the classpath.") +382 .build(); +383 +384final Option disableJarAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_JAR) +385 .desc("Disable the Jar Analyzer.").build(); 386 -387final Option disableOpenSSLAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_OPENSSL) -388 .desc("Disable the OpenSSL Analyzer.").build(); -389final Option disableCmakeAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_CMAKE) -390 .desc("Disable the Cmake Analyzer.").build(); -391 -392final Option disableCentralAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_CENTRAL) -393 .desc("Disable the Central Analyzer. If this analyzer is disabled it is likely you also want to disable " -394 + "the Nexus Analyzer.").build(); +387final Option disableArchiveAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_ARCHIVE) +388 .desc("Disable the Archive Analyzer.").build(); +389 +390final Option disableNuspecAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_NUSPEC) +391 .desc("Disable the Nuspec Analyzer.").build(); +392 +393final Option disableAssemblyAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_ASSEMBLY) +394 .desc("Disable the .NET Assembly Analyzer.").build(); 395 -396final Option disableNexusAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_NEXUS) -397 .desc("Disable the Nexus Analyzer.").build(); +396final Option disablePythonDistributionAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_PY_DIST) +397 .desc("Disable the Python Distribution Analyzer.").build(); 398 -399final Option purge = Option.builder().longOpt(ARGUMENT.PURGE_NVD) -400 .desc("Purges the local NVD data cache") -401 .build(); -402 -403 options.addOption(updateOnly) -404 .addOption(cve12Base) -405 .addOption(cve20Base) -406 .addOption(cve12Modified) -407 .addOption(cve20Modified) -408 .addOption(proxyPort) -409 .addOption(proxyServer) -410 .addOption(proxyUsername) -411 .addOption(proxyPassword) -412 .addOption(connectionTimeout) -413 .addOption(connectionString) -414 .addOption(dbUser) -415 .addOption(data) -416 .addOption(dbPassword) -417 .addOption(dbDriver) -418 .addOption(dbDriverPath) -419 .addOption(disableJarAnalyzer) -420 .addOption(disableArchiveAnalyzer) -421 .addOption(disableAssemblyAnalyzer) -422 .addOption(disablePythonDistributionAnalyzer) -423 .addOption(disableCmakeAnalyzer) -424 .addOption(disablePythonPackageAnalyzer) -425 .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_RUBYGEMS) -426 .desc("Disable the Ruby Gemspec Analyzer.").build()) -427 .addOption(disableAutoconfAnalyzer) -428 .addOption(disableComposerAnalyzer) -429 .addOption(disableOpenSSLAnalyzer) -430 .addOption(disableNuspecAnalyzer) -431 .addOption(disableCentralAnalyzer) -432 .addOption(disableNexusAnalyzer) -433 .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_NODE_JS) -434 .desc("Disable the Node.js Package Analyzer.").build()) -435 .addOption(nexusUrl) -436 .addOption(nexusUsesProxy) -437 .addOption(additionalZipExtensions) -438 .addOption(pathToMono) -439 .addOption(purge); -440 } -441 -442/** -443 * Adds the deprecated command line options to the given options collection. These are split out for purposes of not including -444 * them in the help message. We need to add the deprecated options so as not to break existing scripts. -445 * -446 * @param options a collection of command line arguments -447 * @throws IllegalArgumentException thrown if there is an exception -448 */ -449 @SuppressWarnings({"static-access", "deprecation"}) -450privatevoid addDeprecatedOptions(final Options options) throws IllegalArgumentException { -451 -452final Option proxyServer = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.PROXY_URL) -453 .desc("The proxy url argument is deprecated, use proxyserver instead.") -454 .build(); -455final Option appName = Option.builder(ARGUMENT.APP_NAME_SHORT).argName("name").hasArg().longOpt(ARGUMENT.APP_NAME) -456 .desc("The name of the project being scanned.") -457 .build(); -458 -459 options.addOption(proxyServer); -460 options.addOption(appName); -461 } -462 -463/** -464 * Determines if the 'version' command line argument was passed in. -465 * -466 * @return whether or not the 'version' command line argument was passed in -467 */ -468publicboolean isGetVersion() { -469return (line != null) && line.hasOption(ARGUMENT.VERSION); -470 } -471 -472/** -473 * Determines if the 'help' command line argument was passed in. -474 * -475 * @return whether or not the 'help' command line argument was passed in -476 */ -477publicboolean isGetHelp() { -478return (line != null) && line.hasOption(ARGUMENT.HELP); -479 } -480 -481/** -482 * Determines if the 'scan' command line argument was passed in. -483 * -484 * @return whether or not the 'scan' command line argument was passed in -485 */ -486publicboolean isRunScan() { -487return (line != null) && isValid && line.hasOption(ARGUMENT.SCAN); -488 } -489 -490/** -491 * Returns the symbolic link depth (how deeply symbolic links will be followed). -492 * -493 * @return the symbolic link depth -494 */ -495publicint getSymLinkDepth() { -496int value = 0; -497try { -498 value = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH, "0")); -499if (value < 0) { -500 value = 0; -501 } -502 } catch (NumberFormatException ex) { -503 LOGGER.debug("Symbolic link was not a number"); -504 } -505return value; -506 } -507 -508/** -509 * Returns true if the disableJar command line argument was specified. -510 * -511 * @return true if the disableJar command line argument was specified; otherwise false -512 */ -513publicboolean isJarDisabled() { -514return (line != null) && line.hasOption(ARGUMENT.DISABLE_JAR); -515 } -516 -517/** -518 * Returns true if the disableArchive command line argument was specified. -519 * -520 * @return true if the disableArchive command line argument was specified; otherwise false -521 */ -522publicboolean isArchiveDisabled() { -523return (line != null) && line.hasOption(ARGUMENT.DISABLE_ARCHIVE); -524 } -525 -526/** -527 * Returns true if the disableNuspec command line argument was specified. -528 * -529 * @return true if the disableNuspec command line argument was specified; otherwise false -530 */ -531publicboolean isNuspecDisabled() { -532return (line != null) && line.hasOption(ARGUMENT.DISABLE_NUSPEC); -533 } -534 -535/** -536 * Returns true if the disableAssembly command line argument was specified. -537 * -538 * @return true if the disableAssembly command line argument was specified; otherwise false -539 */ -540publicboolean isAssemblyDisabled() { -541return (line != null) && line.hasOption(ARGUMENT.DISABLE_ASSEMBLY); -542 } -543 -544/** -545 * Returns true if the disablePyDist command line argument was specified. -546 * -547 * @return true if the disablePyDist command line argument was specified; otherwise false -548 */ -549publicboolean isPythonDistributionDisabled() { -550return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_DIST); -551 } -552 -553/** -554 * Returns true if the disablePyPkg command line argument was specified. -555 * -556 * @return true if the disablePyPkg command line argument was specified; otherwise false -557 */ -558publicboolean isPythonPackageDisabled() { -559return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_PKG); -560 } -561 -562/** -563 * Returns whether the Ruby gemspec analyzer is disabled. -564 * -565 * @return true if the {@link ARGUMENT#DISABLE_RUBYGEMS} command line argument was specified; otherwise false -566 */ -567publicboolean isRubyGemspecDisabled() { -568return (null != line) && line.hasOption(ARGUMENT.DISABLE_RUBYGEMS); -569 } -570 -571/** -572 * Returns true if the disableCmake command line argument was specified. -573 * -574 * @return true if the disableCmake command line argument was specified; otherwise false -575 */ -576publicboolean isCmakeDisabled() { -577return (line != null) && line.hasOption(ARGUMENT.DISABLE_CMAKE); -578 } +399final Option disablePythonPackageAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_PY_PKG) +400 .desc("Disable the Python Package Analyzer.").build(); +401 +402final Option disableComposerAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_COMPOSER) +403 .desc("Disable the PHP Composer Analyzer.").build(); +404 +405final Option disableAutoconfAnalyzer = Option.builder() +406 .longOpt(ARGUMENT.DISABLE_AUTOCONF) +407 .desc("Disable the Autoconf Analyzer.").build(); +408 +409final Option disableOpenSSLAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_OPENSSL) +410 .desc("Disable the OpenSSL Analyzer.").build(); +411final Option disableCmakeAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_CMAKE) +412 .desc("Disable the Cmake Analyzer.").build(); +413 +414final Option disableCentralAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_CENTRAL) +415 .desc("Disable the Central Analyzer. If this analyzer is disabled it is likely you also want to disable " +416 + "the Nexus Analyzer.").build(); +417 +418final Option disableNexusAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_NEXUS) +419 .desc("Disable the Nexus Analyzer.").build(); +420 +421final Option purge = Option.builder().longOpt(ARGUMENT.PURGE_NVD) +422 .desc("Purges the local NVD data cache") +423 .build(); +424 +425 options.addOption(updateOnly) +426 .addOption(cve12Base) +427 .addOption(cve20Base) +428 .addOption(cve12Modified) +429 .addOption(cve20Modified) +430 .addOption(proxyPort) +431 .addOption(proxyServer) +432 .addOption(proxyUsername) +433 .addOption(proxyPassword) +434 .addOption(connectionTimeout) +435 .addOption(connectionString) +436 .addOption(dbUser) +437 .addOption(data) +438 .addOption(dbPassword) +439 .addOption(dbDriver) +440 .addOption(dbDriverPath) +441 .addOption(disableJarAnalyzer) +442 .addOption(disableArchiveAnalyzer) +443 .addOption(disableAssemblyAnalyzer) +444 .addOption(pathToBundleAudit) +445 .addOption(disablePythonDistributionAnalyzer) +446 .addOption(disableCmakeAnalyzer) +447 .addOption(disablePythonPackageAnalyzer) +448 .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_RUBYGEMS) +449 .desc("Disable the Ruby Gemspec Analyzer.").build()) +450 .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_BUNDLE_AUDIT) +451 .desc("Disable the Ruby Bundler-Audit Analyzer.").build()) +452 .addOption(disableAutoconfAnalyzer) +453 .addOption(disableComposerAnalyzer) +454 .addOption(disableOpenSSLAnalyzer) +455 .addOption(disableNuspecAnalyzer) +456 .addOption(disableCentralAnalyzer) +457 .addOption(disableNexusAnalyzer) +458 .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_NODE_JS) +459 .desc("Disable the Node.js Package Analyzer.").build()) +460 .addOption(nexusUrl) +461 .addOption(nexusUsesProxy) +462 .addOption(additionalZipExtensions) +463 .addOption(pathToMono) +464 .addOption(pathToBundleAudit) +465 .addOption(purge); +466 } +467 +468/** +469 * Adds the deprecated command line options to the given options collection. These are split out for purposes of not including +470 * them in the help message. We need to add the deprecated options so as not to break existing scripts. +471 * +472 * @param options a collection of command line arguments +473 * @throws IllegalArgumentException thrown if there is an exception +474 */ +475 @SuppressWarnings({"static-access", "deprecation"}) +476privatevoid addDeprecatedOptions(final Options options) throws IllegalArgumentException { +477 +478final Option proxyServer = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.PROXY_URL) +479 .desc("The proxy url argument is deprecated, use proxyserver instead.") +480 .build(); +481final Option appName = Option.builder(ARGUMENT.APP_NAME_SHORT).argName("name").hasArg().longOpt(ARGUMENT.APP_NAME) +482 .desc("The name of the project being scanned.") +483 .build(); +484 +485 options.addOption(proxyServer); +486 options.addOption(appName); +487 } +488 +489/** +490 * Determines if the 'version' command line argument was passed in. +491 * +492 * @return whether or not the 'version' command line argument was passed in +493 */ +494publicboolean isGetVersion() { +495return (line != null) && line.hasOption(ARGUMENT.VERSION); +496 } +497 +498/** +499 * Determines if the 'help' command line argument was passed in. +500 * +501 * @return whether or not the 'help' command line argument was passed in +502 */ +503publicboolean isGetHelp() { +504return (line != null) && line.hasOption(ARGUMENT.HELP); +505 } +506 +507/** +508 * Determines if the 'scan' command line argument was passed in. +509 * +510 * @return whether or not the 'scan' command line argument was passed in +511 */ +512publicboolean isRunScan() { +513return (line != null) && isValid && line.hasOption(ARGUMENT.SCAN); +514 } +515 +516/** +517 * Returns the symbolic link depth (how deeply symbolic links will be followed). +518 * +519 * @return the symbolic link depth +520 */ +521publicint getSymLinkDepth() { +522int value = 0; +523try { +524 value = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH, "0")); +525if (value < 0) { +526 value = 0; +527 } +528 } catch (NumberFormatException ex) { +529 LOGGER.debug("Symbolic link was not a number"); +530 } +531return value; +532 } +533 +534/** +535 * Returns true if the disableJar command line argument was specified. +536 * +537 * @return true if the disableJar command line argument was specified; otherwise false +538 */ +539publicboolean isJarDisabled() { +540return (line != null) && line.hasOption(ARGUMENT.DISABLE_JAR); +541 } +542 +543/** +544 * Returns true if the disableArchive command line argument was specified. +545 * +546 * @return true if the disableArchive command line argument was specified; otherwise false +547 */ +548publicboolean isArchiveDisabled() { +549return (line != null) && line.hasOption(ARGUMENT.DISABLE_ARCHIVE); +550 } +551 +552/** +553 * Returns true if the disableNuspec command line argument was specified. +554 * +555 * @return true if the disableNuspec command line argument was specified; otherwise false +556 */ +557publicboolean isNuspecDisabled() { +558return (line != null) && line.hasOption(ARGUMENT.DISABLE_NUSPEC); +559 } +560 +561/** +562 * Returns true if the disableAssembly command line argument was specified. +563 * +564 * @return true if the disableAssembly command line argument was specified; otherwise false +565 */ +566publicboolean isAssemblyDisabled() { +567return (line != null) && line.hasOption(ARGUMENT.DISABLE_ASSEMBLY); +568 } +569 +570/** +571 * Returns true if the disableBundleAudit command line argument was specified. +572 * +573 * @return true if the disableBundleAudit command line argument was specified; otherwise false +574 */ +575publicboolean isBundleAuditDisabled() { +576return (line != null) && line.hasOption(ARGUMENT.DISABLE_BUNDLE_AUDIT); +577 } +578579580/** -581 * Returns true if the disableAutoconf command line argument was specified. +581 * Returns true if the disablePyDist command line argument was specified.582 * -583 * @return true if the disableAutoconf command line argument was specified; otherwise false +583 * @return true if the disablePyDist command line argument was specified; otherwise false584 */ -585publicboolean isAutoconfDisabled() { -586return (line != null) && line.hasOption(ARGUMENT.DISABLE_AUTOCONF); +585publicboolean isPythonDistributionDisabled() { +586return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_DIST); 587 } 588589/** -590 * Returns true if the disableComposer command line argument was specified. +590 * Returns true if the disablePyPkg command line argument was specified.591 * -592 * @return true if the disableComposer command line argument was specified; otherwise false +592 * @return true if the disablePyPkg command line argument was specified; otherwise false593 */ -594publicboolean isComposerDisabled() { -595return (line != null) && line.hasOption(ARGUMENT.DISABLE_COMPOSER); +594publicboolean isPythonPackageDisabled() { +595return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_PKG); 596 } 597598/** -599 * Returns true if the disableNexus command line argument was specified. +599 * Returns whether the Ruby gemspec analyzer is disabled.600 * -601 * @return true if the disableNexus command line argument was specified; otherwise false +601 * @return true if the {@link ARGUMENT#DISABLE_RUBYGEMS} command line argument was specified; otherwise false602 */ -603publicboolean isNexusDisabled() { -604return (line != null) && line.hasOption(ARGUMENT.DISABLE_NEXUS); +603publicboolean isRubyGemspecDisabled() { +604return (null != line) && line.hasOption(ARGUMENT.DISABLE_RUBYGEMS); 605 } 606607/** -608 * Returns true if the disableOpenSSL command line argument was specified. +608 * Returns true if the disableCmake command line argument was specified.609 * -610 * @return true if the disableOpenSSL command line argument was specified; otherwise false +610 * @return true if the disableCmake command line argument was specified; otherwise false611 */ -612publicboolean isOpenSSLDisabled() { -613return (line != null) && line.hasOption(ARGUMENT.DISABLE_OPENSSL); +612publicboolean isCmakeDisabled() { +613return (line != null) && line.hasOption(ARGUMENT.DISABLE_CMAKE); 614 } 615616/** -617 * Returns true if the disableNodeJS command line argument was specified. +617 * Returns true if the disableAutoconf command line argument was specified.618 * -619 * @return true if the disableNodeJS command line argument was specified; otherwise false +619 * @return true if the disableAutoconf command line argument was specified; otherwise false620 */ -621publicboolean isNodeJsDisabled() { -622return (line != null) && line.hasOption(ARGUMENT.DISABLE_NODE_JS); +621publicboolean isAutoconfDisabled() { +622return (line != null) && line.hasOption(ARGUMENT.DISABLE_AUTOCONF); 623 } 624625/** -626 * Returns true if the disableCentral command line argument was specified. +626 * Returns true if the disableComposer command line argument was specified.627 * -628 * @return true if the disableCentral command line argument was specified; otherwise false +628 * @return true if the disableComposer command line argument was specified; otherwise false629 */ -630publicboolean isCentralDisabled() { -631return (line != null) && line.hasOption(ARGUMENT.DISABLE_CENTRAL); +630publicboolean isComposerDisabled() { +631return (line != null) && line.hasOption(ARGUMENT.DISABLE_COMPOSER); 632 } 633634/** -635 * Returns the url to the nexus server if one was specified. +635 * Returns true if the disableNexus command line argument was specified.636 * -637 * @return the url to the nexus server; if none was specified this will return null; +637 * @return true if the disableNexus command line argument was specified; otherwise false638 */ -639public String getNexusUrl() { -640if (line == null || !line.hasOption(ARGUMENT.NEXUS_URL)) { -641returnnull; -642 } else { -643return line.getOptionValue(ARGUMENT.NEXUS_URL); -644 } -645 } -646 -647/** -648 * Returns true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false is returned. -649 * -650 * @return true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false -651 */ -652publicboolean isNexusUsesProxy() { -653// If they didn't specify whether Nexus needs to use the proxy, we should -654// still honor the property if it's set. -655if (line == null || !line.hasOption(ARGUMENT.NEXUS_USES_PROXY)) { -656try { -657return Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY); -658 } catch (InvalidSettingException ise) { -659returntrue; -660 } -661 } else { -662return Boolean.parseBoolean(line.getOptionValue(ARGUMENT.NEXUS_USES_PROXY)); -663 } -664 } -665 -666/** -667 * Displays the command line help message to the standard output. -668 */ -669publicvoid printHelp() { -670final HelpFormatter formatter = new HelpFormatter(); -671final Options options = new Options(); -672 addStandardOptions(options); -673if (line != null && line.hasOption(ARGUMENT.ADVANCED_HELP)) { -674 addAdvancedOptions(options); -675 } -676final String helpMsg = String.format("%n%s" -677 + " can be used to identify if there are any known CVE vulnerabilities in libraries utilized by an application. " -678 + "%s will automatically update required data from the Internet, such as the CVE and CPE data files from nvd.nist.gov.%n%n", -679 Settings.getString("application.name", "DependencyCheck"), -680 Settings.getString("application.name", "DependencyCheck")); -681 -682 formatter.printHelp(Settings.getString("application.name", "DependencyCheck"), -683 helpMsg, -684 options, -685"", -686true); -687 } -688 -689/** -690 * Retrieves the file command line parameter(s) specified for the 'scan' argument. -691 * -692 * @return the file paths specified on the command line for scan -693 */ -694public String[] getScanFiles() { -695return line.getOptionValues(ARGUMENT.SCAN); -696 } -697 -698/** -699 * Retrieves the list of excluded file patterns specified by the 'exclude' argument. -700 * -701 * @return the excluded file patterns -702 */ -703public String[] getExcludeList() { -704return line.getOptionValues(ARGUMENT.EXCLUDE); -705 } -706 -707/** -708 * Returns the directory to write the reports to specified on the command line. -709 * -710 * @return the path to the reports directory. -711 */ -712public String getReportDirectory() { -713return line.getOptionValue(ARGUMENT.OUT, "."); -714 } -715 -716/** -717 * Returns the path to Mono for .NET Assembly analysis on non-windows systems. -718 * -719 * @return the path to Mono -720 */ -721public String getPathToMono() { -722return line.getOptionValue(ARGUMENT.PATH_TO_MONO); +639publicboolean isNexusDisabled() { +640return (line != null) && line.hasOption(ARGUMENT.DISABLE_NEXUS); +641 } +642 +643/** +644 * Returns true if the disableOpenSSL command line argument was specified. +645 * +646 * @return true if the disableOpenSSL command line argument was specified; otherwise false +647 */ +648publicboolean isOpenSSLDisabled() { +649return (line != null) && line.hasOption(ARGUMENT.DISABLE_OPENSSL); +650 } +651 +652/** +653 * Returns true if the disableNodeJS command line argument was specified. +654 * +655 * @return true if the disableNodeJS command line argument was specified; otherwise false +656 */ +657publicboolean isNodeJsDisabled() { +658return (line != null) && line.hasOption(ARGUMENT.DISABLE_NODE_JS); +659 } +660 +661/** +662 * Returns true if the disableCentral command line argument was specified. +663 * +664 * @return true if the disableCentral command line argument was specified; otherwise false +665 */ +666publicboolean isCentralDisabled() { +667return (line != null) && line.hasOption(ARGUMENT.DISABLE_CENTRAL); +668 } +669 +670/** +671 * Returns the url to the nexus server if one was specified. +672 * +673 * @return the url to the nexus server; if none was specified this will return null; +674 */ +675public String getNexusUrl() { +676if (line == null || !line.hasOption(ARGUMENT.NEXUS_URL)) { +677returnnull; +678 } else { +679return line.getOptionValue(ARGUMENT.NEXUS_URL); +680 } +681 } +682 +683/** +684 * Returns true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false is returned. +685 * +686 * @return true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false +687 */ +688publicboolean isNexusUsesProxy() { +689// If they didn't specify whether Nexus needs to use the proxy, we should +690// still honor the property if it's set. +691if (line == null || !line.hasOption(ARGUMENT.NEXUS_USES_PROXY)) { +692try { +693return Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY); +694 } catch (InvalidSettingException ise) { +695returntrue; +696 } +697 } else { +698return Boolean.parseBoolean(line.getOptionValue(ARGUMENT.NEXUS_USES_PROXY)); +699 } +700 } +701 +702/** +703 * Displays the command line help message to the standard output. +704 */ +705publicvoid printHelp() { +706final HelpFormatter formatter = new HelpFormatter(); +707final Options options = new Options(); +708 addStandardOptions(options); +709if (line != null && line.hasOption(ARGUMENT.ADVANCED_HELP)) { +710 addAdvancedOptions(options); +711 } +712final String helpMsg = String.format("%n%s" +713 + " can be used to identify if there are any known CVE vulnerabilities in libraries utilized by an application. " +714 + "%s will automatically update required data from the Internet, such as the CVE and CPE data files from nvd.nist.gov.%n%n", +715 Settings.getString("application.name", "DependencyCheck"), +716 Settings.getString("application.name", "DependencyCheck")); +717 +718 formatter.printHelp(Settings.getString("application.name", "DependencyCheck"), +719 helpMsg, +720 options, +721"", +722true); 723 } 724725/** -726 * Returns the output format specified on the command line. Defaults to HTML if no format was specified. +726 * Retrieves the file command line parameter(s) specified for the 'scan' argument.727 * -728 * @return the output format name. +728 * @return the file paths specified on the command line for scan729 */ -730public String getReportFormat() { -731return line.getOptionValue(ARGUMENT.OUTPUT_FORMAT, "HTML"); +730public String[] getScanFiles() { +731return line.getOptionValues(ARGUMENT.SCAN); 732 } 733734/** -735 * Returns the application name specified on the command line. +735 * Retrieves the list of excluded file patterns specified by the 'exclude' argument.736 * -737 * @return the application name. +737 * @return the excluded file patterns738 */ -739public String getProjectName() { -740final String appName = line.getOptionValue(ARGUMENT.APP_NAME); -741 String name = line.getOptionValue(ARGUMENT.PROJECT); -742if (name == null && appName != null) { -743 name = appName; -744 LOGGER.warn("The '" + ARGUMENT.APP_NAME + "' argument should no longer be used; use '" + ARGUMENT.PROJECT + "' instead."); -745 } -746return name; -747 } -748 -749/** -750 * Returns the base URL for the CVE 1.2 XMl file. -751 * -752 * @return the URL to the CVE 1.2 XML file. -753 */ -754public String getBaseCve12Url() { -755return line.getOptionValue(ARGUMENT.CVE_BASE_12); -756 } -757 -758/** -759 * Returns the base URL for the CVE 2.0 XMl file. -760 * -761 * @return the URL to the CVE 2.0 XML file. -762 */ -763public String getBaseCve20Url() { -764return line.getOptionValue(ARGUMENT.CVE_BASE_20); -765 } -766 -767/** -768 * Returns the URL for the modified CVE 1.2 XMl file. -769 * -770 * @return the URL to the modified CVE 1.2 XML file. -771 */ -772public String getModifiedCve12Url() { -773return line.getOptionValue(ARGUMENT.CVE_MOD_12); -774 } -775 -776/** -777 * Returns the URL for the modified CVE 2.0 XMl file. -778 * -779 * @return the URL to the modified CVE 2.0 XML file. -780 */ -781public String getModifiedCve20Url() { -782return line.getOptionValue(ARGUMENT.CVE_MOD_20); -783 } -784 -785/** -786 * Returns the connection timeout. -787 * -788 * @return the connection timeout -789 */ -790public String getConnectionTimeout() { -791return line.getOptionValue(ARGUMENT.CONNECTION_TIMEOUT); +739public String[] getExcludeList() { +740return line.getOptionValues(ARGUMENT.EXCLUDE); +741 } +742 +743/** +744 * Returns the directory to write the reports to specified on the command line. +745 * +746 * @return the path to the reports directory. +747 */ +748public String getReportDirectory() { +749return line.getOptionValue(ARGUMENT.OUT, "."); +750 } +751 +752/** +753 * Returns the path to Mono for .NET Assembly analysis on non-windows systems. +754 * +755 * @return the path to Mono +756 */ +757public String getPathToMono() { +758return line.getOptionValue(ARGUMENT.PATH_TO_MONO); +759 } +760 +761/** +762 * Returns the path to bundle-audit for Ruby bundle analysis. +763 * +764 * @return the path to Mono +765 */ +766public String getPathToBundleAudit() { +767return line.getOptionValue(ARGUMENT.PATH_TO_BUNDLE_AUDIT); +768 } +769 +770/** +771 * Returns the output format specified on the command line. Defaults to HTML if no format was specified. +772 * +773 * @return the output format name. +774 */ +775public String getReportFormat() { +776return line.getOptionValue(ARGUMENT.OUTPUT_FORMAT, "HTML"); +777 } +778 +779/** +780 * Returns the application name specified on the command line. +781 * +782 * @return the application name. +783 */ +784public String getProjectName() { +785final String appName = line.getOptionValue(ARGUMENT.APP_NAME); +786 String name = line.getOptionValue(ARGUMENT.PROJECT); +787if (name == null && appName != null) { +788 name = appName; +789 LOGGER.warn("The '" + ARGUMENT.APP_NAME + "' argument should no longer be used; use '" + ARGUMENT.PROJECT + "' instead."); +790 } +791return name; 792 } 793794/** -795 * Returns the proxy server. +795 * Returns the base URL for the CVE 1.2 XMl file.796 * -797 * @return the proxy server +797 * @return the URL to the CVE 1.2 XML file.798 */ -799 @SuppressWarnings("deprecation") -800public String getProxyServer() { -801 -802 String server = line.getOptionValue(ARGUMENT.PROXY_SERVER); -803if (server == null) { -804 server = line.getOptionValue(ARGUMENT.PROXY_URL); -805if (server != null) { -806 LOGGER.warn("An old command line argument 'proxyurl' was detected; use proxyserver instead"); -807 } -808 } -809return server; +799public String getBaseCve12Url() { +800return line.getOptionValue(ARGUMENT.CVE_BASE_12); +801 } +802 +803/** +804 * Returns the base URL for the CVE 2.0 XMl file. +805 * +806 * @return the URL to the CVE 2.0 XML file. +807 */ +808public String getBaseCve20Url() { +809return line.getOptionValue(ARGUMENT.CVE_BASE_20); 810 } 811812/** -813 * Returns the proxy port. +813 * Returns the URL for the modified CVE 1.2 XMl file.814 * -815 * @return the proxy port +815 * @return the URL to the modified CVE 1.2 XML file.816 */ -817public String getProxyPort() { -818return line.getOptionValue(ARGUMENT.PROXY_PORT); +817public String getModifiedCve12Url() { +818return line.getOptionValue(ARGUMENT.CVE_MOD_12); 819 } 820821/** -822 * Returns the proxy username. +822 * Returns the URL for the modified CVE 2.0 XMl file.823 * -824 * @return the proxy username +824 * @return the URL to the modified CVE 2.0 XML file.825 */ -826public String getProxyUsername() { -827return line.getOptionValue(ARGUMENT.PROXY_USERNAME); +826public String getModifiedCve20Url() { +827return line.getOptionValue(ARGUMENT.CVE_MOD_20); 828 } 829830/** -831 * Returns the proxy password. +831 * Returns the connection timeout.832 * -833 * @return the proxy password +833 * @return the connection timeout834 */ -835public String getProxyPassword() { -836return line.getOptionValue(ARGUMENT.PROXY_PASSWORD); +835public String getConnectionTimeout() { +836return line.getOptionValue(ARGUMENT.CONNECTION_TIMEOUT); 837 } 838839/** -840 * Get the value of dataDirectory. +840 * Returns the proxy server.841 * -842 * @return the value of dataDirectory +842 * @return the proxy server843 */ -844public String getDataDirectory() { -845return line.getOptionValue(ARGUMENT.DATA_DIRECTORY); -846 } -847 -848/** -849 * Returns the properties file specified on the command line. -850 * -851 * @return the properties file specified on the command line -852 */ -853public File getPropertiesFile() { -854final String path = line.getOptionValue(ARGUMENT.PROP); -855if (path != null) { -856returnnew File(path); -857 } -858returnnull; -859 } -860 -861/** -862 * Returns the path to the verbose log file. -863 * -864 * @return the path to the verbose log file -865 */ -866public String getVerboseLog() { -867return line.getOptionValue(ARGUMENT.VERBOSE_LOG); -868 } -869 -870/** -871 * Returns the path to the suppression file. -872 * -873 * @return the path to the suppression file -874 */ -875public String getSuppressionFile() { -876return line.getOptionValue(ARGUMENT.SUPPRESSION_FILE); -877 } -878 -879/** -880 * <p> -881 * Prints the manifest information to standard output.</p> -882 * <ul><li>Implementation-Title: ${pom.name}</li> -883 * <li>Implementation-Version: ${pom.version}</li></ul> -884 */ -885publicvoid printVersionInfo() { -886final String version = String.format("%s version %s", -887 Settings.getString(Settings.KEYS.APPLICATION_VAME, "dependency-check"), -888 Settings.getString(Settings.KEYS.APPLICATION_VERSION, "Unknown")); -889 System.out.println(version); -890 } -891 -892/** -893 * Checks if the auto update feature has been disabled. If it has been disabled via the command line this will return false. -894 * -895 * @return <code>true</code> if auto-update is allowed; otherwise <code>false</code> -896 */ -897publicboolean isAutoUpdate() { -898return line != null && !line.hasOption(ARGUMENT.DISABLE_AUTO_UPDATE); -899 } -900 -901/** -902 * Checks if the update only flag has been set. -903 * -904 * @return <code>true</code> if the update only flag has been set; otherwise <code>false</code>. -905 */ -906publicboolean isUpdateOnly() { -907return line != null && line.hasOption(ARGUMENT.UPDATE_ONLY); -908 } -909 -910/** -911 * Checks if the purge NVD flag has been set. -912 * -913 * @return <code>true</code> if the purge nvd flag has been set; otherwise <code>false</code>. -914 */ -915publicboolean isPurge() { -916return line != null && line.hasOption(ARGUMENT.PURGE_NVD); -917 } -918 -919/** -920 * Returns the database driver name if specified; otherwise null is returned. -921 * -922 * @return the database driver name if specified; otherwise null is returned -923 */ -924public String getDatabaseDriverName() { -925return line.getOptionValue(ARGUMENT.DB_DRIVER); -926 } -927 -928/** -929 * Returns the database driver path if specified; otherwise null is returned. -930 * -931 * @return the database driver name if specified; otherwise null is returned -932 */ -933public String getDatabaseDriverPath() { -934return line.getOptionValue(ARGUMENT.DB_DRIVER_PATH); +844 @SuppressWarnings("deprecation") +845public String getProxyServer() { +846 +847 String server = line.getOptionValue(ARGUMENT.PROXY_SERVER); +848if (server == null) { +849 server = line.getOptionValue(ARGUMENT.PROXY_URL); +850if (server != null) { +851 LOGGER.warn("An old command line argument 'proxyurl' was detected; use proxyserver instead"); +852 } +853 } +854return server; +855 } +856 +857/** +858 * Returns the proxy port. +859 * +860 * @return the proxy port +861 */ +862public String getProxyPort() { +863return line.getOptionValue(ARGUMENT.PROXY_PORT); +864 } +865 +866/** +867 * Returns the proxy username. +868 * +869 * @return the proxy username +870 */ +871public String getProxyUsername() { +872return line.getOptionValue(ARGUMENT.PROXY_USERNAME); +873 } +874 +875/** +876 * Returns the proxy password. +877 * +878 * @return the proxy password +879 */ +880public String getProxyPassword() { +881return line.getOptionValue(ARGUMENT.PROXY_PASSWORD); +882 } +883 +884/** +885 * Get the value of dataDirectory. +886 * +887 * @return the value of dataDirectory +888 */ +889public String getDataDirectory() { +890return line.getOptionValue(ARGUMENT.DATA_DIRECTORY); +891 } +892 +893/** +894 * Returns the properties file specified on the command line. +895 * +896 * @return the properties file specified on the command line +897 */ +898public File getPropertiesFile() { +899final String path = line.getOptionValue(ARGUMENT.PROP); +900if (path != null) { +901returnnew File(path); +902 } +903returnnull; +904 } +905 +906/** +907 * Returns the path to the verbose log file. +908 * +909 * @return the path to the verbose log file +910 */ +911public String getVerboseLog() { +912return line.getOptionValue(ARGUMENT.VERBOSE_LOG); +913 } +914 +915/** +916 * Returns the path to the suppression file. +917 * +918 * @return the path to the suppression file +919 */ +920public String getSuppressionFile() { +921return line.getOptionValue(ARGUMENT.SUPPRESSION_FILE); +922 } +923 +924/** +925 * <p> +926 * Prints the manifest information to standard output.</p> +927 * <ul><li>Implementation-Title: ${pom.name}</li> +928 * <li>Implementation-Version: ${pom.version}</li></ul> +929 */ +930publicvoid printVersionInfo() { +931final String version = String.format("%s version %s", +932 Settings.getString(Settings.KEYS.APPLICATION_VAME, "dependency-check"), +933 Settings.getString(Settings.KEYS.APPLICATION_VERSION, "Unknown")); +934 System.out.println(version); 935 } 936937/** -938 * Returns the database connection string if specified; otherwise null is returned. +938 * Checks if the auto update feature has been disabled. If it has been disabled via the command line this will return false.939 * -940 * @return the database connection string if specified; otherwise null is returned +940 * @return <code>true</code> if auto-update is allowed; otherwise <code>false</code>941 */ -942public String getConnectionString() { -943return line.getOptionValue(ARGUMENT.CONNECTION_STRING); +942publicboolean isAutoUpdate() { +943return line != null && !line.hasOption(ARGUMENT.DISABLE_AUTO_UPDATE); 944 } 945946/** -947 * Returns the database database user name if specified; otherwise null is returned. +947 * Checks if the update only flag has been set.948 * -949 * @return the database database user name if specified; otherwise null is returned +949 * @return <code>true</code> if the update only flag has been set; otherwise <code>false</code>.950 */ -951public String getDatabaseUser() { -952return line.getOptionValue(ARGUMENT.DB_NAME); +951publicboolean isUpdateOnly() { +952return line != null && line.hasOption(ARGUMENT.UPDATE_ONLY); 953 } 954955/** -956 * Returns the database database password if specified; otherwise null is returned. +956 * Checks if the purge NVD flag has been set.957 * -958 * @return the database database password if specified; otherwise null is returned +958 * @return <code>true</code> if the purge nvd flag has been set; otherwise <code>false</code>.959 */ -960public String getDatabasePassword() { -961return line.getOptionValue(ARGUMENT.DB_PASSWORD); +960publicboolean isPurge() { +961return line != null && line.hasOption(ARGUMENT.PURGE_NVD); 962 } 963964/** -965 * Returns the additional Extensions if specified; otherwise null is returned. +965 * Returns the database driver name if specified; otherwise null is returned.966 * -967 * @return the additional Extensions; otherwise null is returned +967 * @return the database driver name if specified; otherwise null is returned968 */ -969public String getAdditionalZipExtensions() { -970return line.getOptionValue(ARGUMENT.ADDITIONAL_ZIP_EXTENSIONS); +969public String getDatabaseDriverName() { +970return line.getOptionValue(ARGUMENT.DB_DRIVER); 971 } 972973/** -974 * A collection of static final strings that represent the possible command line arguments. -975 */ -976publicstaticclassARGUMENT { -977 -978/** -979 * The long CLI argument name specifying the directory/file to scan. -980 */ -981publicstaticfinal String SCAN = "scan"; -982/** -983 * The short CLI argument name specifying the directory/file to scan. -984 */ -985publicstaticfinal String SCAN_SHORT = "s"; -986/** -987 * The long CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated. -988 */ -989publicstaticfinal String DISABLE_AUTO_UPDATE = "noupdate"; -990/** -991 * The short CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated. -992 */ -993publicstaticfinal String DISABLE_AUTO_UPDATE_SHORT = "n"; -994/** -995 * The long CLI argument name specifying that only the update phase should be executed; no scan should be run. -996 */ -997publicstaticfinal String UPDATE_ONLY = "updateonly"; -998/** -999 * The long CLI argument name specifying that only the update phase should be executed; no scan should be run. -1000 */ -1001publicstaticfinal String PURGE_NVD = "purge"; -1002/** -1003 * The long CLI argument name specifying the directory to write the reports to. -1004 */ -1005publicstaticfinal String OUT = "out"; -1006/** -1007 * The short CLI argument name specifying the directory to write the reports to. -1008 */ -1009publicstaticfinal String OUT_SHORT = "o"; -1010/** -1011 * The long CLI argument name specifying the output format to write the reports to. -1012 */ -1013publicstaticfinal String OUTPUT_FORMAT = "format"; -1014/** -1015 * The short CLI argument name specifying the output format to write the reports to. -1016 */ -1017publicstaticfinal String OUTPUT_FORMAT_SHORT = "f"; -1018/** -1019 * The long CLI argument name specifying the name of the project to be scanned. -1020 */ -1021publicstaticfinal String PROJECT = "project"; -1022/** -1023 * The long CLI argument name specifying the name of the application to be scanned. -1024 * -1025 * @deprecated project should be used instead -1026 */ -1027 @Deprecated -1028publicstaticfinal String APP_NAME = "app"; -1029/** -1030 * The short CLI argument name specifying the name of the application to be scanned. -1031 * -1032 * @deprecated project should be used instead -1033 */ -1034 @Deprecated -1035publicstaticfinal String APP_NAME_SHORT = "a"; +974 * Returns the database driver path if specified; otherwise null is returned. +975 * +976 * @return the database driver name if specified; otherwise null is returned +977 */ +978public String getDatabaseDriverPath() { +979return line.getOptionValue(ARGUMENT.DB_DRIVER_PATH); +980 } +981 +982/** +983 * Returns the database connection string if specified; otherwise null is returned. +984 * +985 * @return the database connection string if specified; otherwise null is returned +986 */ +987public String getConnectionString() { +988return line.getOptionValue(ARGUMENT.CONNECTION_STRING); +989 } +990 +991/** +992 * Returns the database database user name if specified; otherwise null is returned. +993 * +994 * @return the database database user name if specified; otherwise null is returned +995 */ +996public String getDatabaseUser() { +997return line.getOptionValue(ARGUMENT.DB_NAME); +998 } +999 +1000/** +1001 * Returns the database database password if specified; otherwise null is returned. +1002 * +1003 * @return the database database password if specified; otherwise null is returned +1004 */ +1005public String getDatabasePassword() { +1006return line.getOptionValue(ARGUMENT.DB_PASSWORD); +1007 } +1008 +1009/** +1010 * Returns the additional Extensions if specified; otherwise null is returned. +1011 * +1012 * @return the additional Extensions; otherwise null is returned +1013 */ +1014public String getAdditionalZipExtensions() { +1015return line.getOptionValue(ARGUMENT.ADDITIONAL_ZIP_EXTENSIONS); +1016 } +1017 +1018/** +1019 * Get the value of cveValidForHours. +1020 * +1021 * @return the value of cveValidForHours +1022 */ +1023public Integer getCveValidForHours() { +1024final String v = line.getOptionValue(ARGUMENT.CVE_VALID_FOR_HOURS); +1025if (v != null) { +1026return Integer.parseInt(v); +1027 } +1028returnnull; +1029 } +1030 +1031/** +1032 * A collection of static final strings that represent the possible command line arguments. +1033 */ +1034publicstaticclassARGUMENT { +10351036/** -1037 * The long CLI argument name asking for help. +1037 * The long CLI argument name specifying the directory/file to scan.1038 */ -1039publicstaticfinal String HELP = "help"; +1039publicstaticfinal String SCAN = "scan"; 1040/** -1041 * The long CLI argument name asking for advanced help. +1041 * The short CLI argument name specifying the directory/file to scan.1042 */ -1043publicstaticfinal String ADVANCED_HELP = "advancedHelp"; +1043publicstaticfinal String SCAN_SHORT = "s"; 1044/** -1045 * The short CLI argument name asking for help. +1045 * The long CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated.1046 */ -1047publicstaticfinal String HELP_SHORT = "h"; +1047publicstaticfinal String DISABLE_AUTO_UPDATE = "noupdate"; 1048/** -1049 * The long CLI argument name asking for the version. +1049 * The short CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated.1050 */ -1051publicstaticfinal String VERSION_SHORT = "v"; +1051publicstaticfinal String DISABLE_AUTO_UPDATE_SHORT = "n"; 1052/** -1053 * The short CLI argument name asking for the version. +1053 * The long CLI argument name specifying that only the update phase should be executed; no scan should be run.1054 */ -1055publicstaticfinal String VERSION = "version"; +1055publicstaticfinal String UPDATE_ONLY = "updateonly"; 1056/** -1057 * The CLI argument name indicating the proxy port. +1057 * The long CLI argument name specifying that only the update phase should be executed; no scan should be run.1058 */ -1059publicstaticfinal String PROXY_PORT = "proxyport"; +1059publicstaticfinal String PURGE_NVD = "purge"; 1060/** -1061 * The CLI argument name indicating the proxy server. +1061 * The long CLI argument name specifying the directory to write the reports to.1062 */ -1063publicstaticfinal String PROXY_SERVER = "proxyserver"; +1063publicstaticfinal String OUT = "out"; 1064/** -1065 * The CLI argument name indicating the proxy url. -1066 * -1067 * @deprecated use {@link #PROXY_SERVER} instead -1068 */ -1069 @Deprecated -1070publicstaticfinal String PROXY_URL = "proxyurl"; -1071/** -1072 * The CLI argument name indicating the proxy username. -1073 */ -1074publicstaticfinal String PROXY_USERNAME = "proxyuser"; -1075/** -1076 * The CLI argument name indicating the proxy password. -1077 */ -1078publicstaticfinal String PROXY_PASSWORD = "proxypass"; -1079/** -1080 * The short CLI argument name indicating the connection timeout. -1081 */ -1082publicstaticfinal String CONNECTION_TIMEOUT_SHORT = "c"; -1083/** -1084 * The CLI argument name indicating the connection timeout. -1085 */ -1086publicstaticfinal String CONNECTION_TIMEOUT = "connectiontimeout"; +1065 * The short CLI argument name specifying the directory to write the reports to. +1066 */ +1067publicstaticfinal String OUT_SHORT = "o"; +1068/** +1069 * The long CLI argument name specifying the output format to write the reports to. +1070 */ +1071publicstaticfinal String OUTPUT_FORMAT = "format"; +1072/** +1073 * The short CLI argument name specifying the output format to write the reports to. +1074 */ +1075publicstaticfinal String OUTPUT_FORMAT_SHORT = "f"; +1076/** +1077 * The long CLI argument name specifying the name of the project to be scanned. +1078 */ +1079publicstaticfinal String PROJECT = "project"; +1080/** +1081 * The long CLI argument name specifying the name of the application to be scanned. +1082 * +1083 * @deprecated project should be used instead +1084 */ +1085 @Deprecated +1086publicstaticfinal String APP_NAME = "app"; 1087/** -1088 * The short CLI argument name for setting the location of an additional properties file. -1089 */ -1090publicstaticfinal String PROP_SHORT = "P"; -1091/** -1092 * The CLI argument name for setting the location of an additional properties file. -1093 */ -1094publicstaticfinal String PROP = "propertyfile"; -1095/** -1096 * The CLI argument name for setting the location of the data directory. -1097 */ -1098publicstaticfinal String DATA_DIRECTORY = "data"; -1099/** -1100 * The CLI argument name for setting the URL for the CVE Data Files. -1101 */ -1102publicstaticfinal String CVE_MOD_12 = "cveUrl12Modified"; -1103/** -1104 * The CLI argument name for setting the URL for the CVE Data Files. -1105 */ -1106publicstaticfinal String CVE_MOD_20 = "cveUrl20Modified"; -1107/** -1108 * The CLI argument name for setting the URL for the CVE Data Files. -1109 */ -1110publicstaticfinal String CVE_BASE_12 = "cveUrl12Base"; -1111/** -1112 * The CLI argument name for setting the URL for the CVE Data Files. -1113 */ -1114publicstaticfinal String CVE_BASE_20 = "cveUrl20Base"; -1115/** -1116 * The short CLI argument name for setting the location of the data directory. -1117 */ -1118publicstaticfinal String DATA_DIRECTORY_SHORT = "d"; -1119/** -1120 * The CLI argument name for setting the location of the data directory. -1121 */ -1122publicstaticfinal String VERBOSE_LOG = "log"; -1123/** -1124 * The short CLI argument name for setting the location of the data directory. -1125 */ -1126publicstaticfinal String VERBOSE_LOG_SHORT = "l"; -1127 -1128/** -1129 * The CLI argument name for setting the depth of symbolic links that will be followed. -1130 */ -1131publicstaticfinal String SYM_LINK_DEPTH = "symLink"; -1132/** -1133 * The CLI argument name for setting the location of the suppression file. -1134 */ -1135publicstaticfinal String SUPPRESSION_FILE = "suppression"; -1136/** -1137 * Disables the Jar Analyzer. -1138 */ -1139publicstaticfinal String DISABLE_JAR = "disableJar"; -1140/** -1141 * Disables the Archive Analyzer. -1142 */ -1143publicstaticfinal String DISABLE_ARCHIVE = "disableArchive"; -1144/** -1145 * Disables the Python Distribution Analyzer. -1146 */ -1147publicstaticfinal String DISABLE_PY_DIST = "disablePyDist"; -1148/** -1149 * Disables the Python Package Analyzer. -1150 */ -1151publicstaticfinal String DISABLE_PY_PKG = "disablePyPkg"; -1152/** -1153 * Disables the Python Package Analyzer. -1154 */ -1155publicstaticfinal String DISABLE_COMPOSER = "disableComposer"; -1156/** -1157 * Disables the Ruby Gemspec Analyzer. -1158 */ -1159publicstaticfinal String DISABLE_RUBYGEMS = "disableRubygems"; -1160/** -1161 * Disables the Autoconf Analyzer. -1162 */ -1163publicstaticfinal String DISABLE_AUTOCONF = "disableAutoconf"; -1164/** -1165 * Disables the Cmake Analyzer. -1166 */ -1167publicstaticfinal String DISABLE_CMAKE = "disableCmake"; -1168/** -1169 * Disables the Assembly Analyzer. -1170 */ -1171publicstaticfinal String DISABLE_ASSEMBLY = "disableAssembly"; -1172/** -1173 * Disables the Nuspec Analyzer. -1174 */ -1175publicstaticfinal String DISABLE_NUSPEC = "disableNuspec"; -1176/** -1177 * Disables the Central Analyzer. -1178 */ -1179publicstaticfinal String DISABLE_CENTRAL = "disableCentral"; -1180/** -1181 * Disables the Nexus Analyzer. -1182 */ -1183publicstaticfinal String DISABLE_NEXUS = "disableNexus"; -1184/** -1185 * Disables the OpenSSL Analyzer. -1186 */ -1187publicstaticfinal String DISABLE_OPENSSL = "disableOpenSSL"; -1188/** -1189 * Disables the Node.js Package Analyzer. -1190 */ -1191publicstaticfinal String DISABLE_NODE_JS = "disableNodeJS"; -1192/** -1193 * The URL of the nexus server. -1194 */ -1195publicstaticfinal String NEXUS_URL = "nexus"; -1196/** -1197 * Whether or not the defined proxy should be used when connecting to Nexus. -1198 */ -1199publicstaticfinal String NEXUS_USES_PROXY = "nexusUsesProxy"; -1200/** -1201 * The CLI argument name for setting the connection string. -1202 */ -1203publicstaticfinal String CONNECTION_STRING = "connectionString"; -1204/** -1205 * The CLI argument name for setting the database user name. -1206 */ -1207publicstaticfinal String DB_NAME = "dbUser"; -1208/** -1209 * The CLI argument name for setting the database password. -1210 */ -1211publicstaticfinal String DB_PASSWORD = "dbPassword"; -1212/** -1213 * The CLI argument name for setting the database driver name. -1214 */ -1215publicstaticfinal String DB_DRIVER = "dbDriverName"; -1216/** -1217 * The CLI argument name for setting the path to the database driver; in case it is not on the class path. -1218 */ -1219publicstaticfinal String DB_DRIVER_PATH = "dbDriverPath"; -1220/** -1221 * The CLI argument name for setting the path to mono for .NET Assembly analysis on non-windows systems. -1222 */ -1223publicstaticfinal String PATH_TO_MONO = "mono"; -1224/** -1225 * The CLI argument name for setting extra extensions. -1226 */ -1227publicstaticfinal String ADDITIONAL_ZIP_EXTENSIONS = "zipExtensions"; -1228/** -1229 * Exclude path argument. -1230 */ -1231publicstaticfinal String EXCLUDE = "exclude"; -1232 } -1233 } +1088 * The short CLI argument name specifying the name of the application to be scanned. +1089 * +1090 * @deprecated project should be used instead +1091 */ +1092 @Deprecated +1093publicstaticfinal String APP_NAME_SHORT = "a"; +1094/** +1095 * The long CLI argument name asking for help. +1096 */ +1097publicstaticfinal String HELP = "help"; +1098/** +1099 * The long CLI argument name asking for advanced help. +1100 */ +1101publicstaticfinal String ADVANCED_HELP = "advancedHelp"; +1102/** +1103 * The short CLI argument name asking for help. +1104 */ +1105publicstaticfinal String HELP_SHORT = "h"; +1106/** +1107 * The long CLI argument name asking for the version. +1108 */ +1109publicstaticfinal String VERSION_SHORT = "v"; +1110/** +1111 * The short CLI argument name asking for the version. +1112 */ +1113publicstaticfinal String VERSION = "version"; +1114/** +1115 * The CLI argument name indicating the proxy port. +1116 */ +1117publicstaticfinal String PROXY_PORT = "proxyport"; +1118/** +1119 * The CLI argument name indicating the proxy server. +1120 */ +1121publicstaticfinal String PROXY_SERVER = "proxyserver"; +1122/** +1123 * The CLI argument name indicating the proxy url. +1124 * +1125 * @deprecated use {@link #PROXY_SERVER} instead +1126 */ +1127 @Deprecated +1128publicstaticfinal String PROXY_URL = "proxyurl"; +1129/** +1130 * The CLI argument name indicating the proxy username. +1131 */ +1132publicstaticfinal String PROXY_USERNAME = "proxyuser"; +1133/** +1134 * The CLI argument name indicating the proxy password. +1135 */ +1136publicstaticfinal String PROXY_PASSWORD = "proxypass"; +1137/** +1138 * The short CLI argument name indicating the connection timeout. +1139 */ +1140publicstaticfinal String CONNECTION_TIMEOUT_SHORT = "c"; +1141/** +1142 * The CLI argument name indicating the connection timeout. +1143 */ +1144publicstaticfinal String CONNECTION_TIMEOUT = "connectiontimeout"; +1145/** +1146 * The short CLI argument name for setting the location of an additional properties file. +1147 */ +1148publicstaticfinal String PROP_SHORT = "P"; +1149/** +1150 * The CLI argument name for setting the location of an additional properties file. +1151 */ +1152publicstaticfinal String PROP = "propertyfile"; +1153/** +1154 * The CLI argument name for setting the location of the data directory. +1155 */ +1156publicstaticfinal String DATA_DIRECTORY = "data"; +1157/** +1158 * The CLI argument name for setting the URL for the CVE Data Files. +1159 */ +1160publicstaticfinal String CVE_MOD_12 = "cveUrl12Modified"; +1161/** +1162 * The CLI argument name for setting the URL for the CVE Data Files. +1163 */ +1164publicstaticfinal String CVE_MOD_20 = "cveUrl20Modified"; +1165/** +1166 * The CLI argument name for setting the URL for the CVE Data Files. +1167 */ +1168publicstaticfinal String CVE_BASE_12 = "cveUrl12Base"; +1169/** +1170 * The CLI argument name for setting the URL for the CVE Data Files. +1171 */ +1172publicstaticfinal String CVE_BASE_20 = "cveUrl20Base"; +1173/** +1174 * The short CLI argument name for setting the location of the data directory. +1175 */ +1176publicstaticfinal String DATA_DIRECTORY_SHORT = "d"; +1177/** +1178 * The CLI argument name for setting the location of the data directory. +1179 */ +1180publicstaticfinal String VERBOSE_LOG = "log"; +1181/** +1182 * The short CLI argument name for setting the location of the data directory. +1183 */ +1184publicstaticfinal String VERBOSE_LOG_SHORT = "l"; +1185 +1186/** +1187 * The CLI argument name for setting the depth of symbolic links that will be followed. +1188 */ +1189publicstaticfinal String SYM_LINK_DEPTH = "symLink"; +1190/** +1191 * The CLI argument name for setting the location of the suppression file. +1192 */ +1193publicstaticfinal String SUPPRESSION_FILE = "suppression"; +1194/** +1195 * The CLI argument name for setting the location of the suppression file. +1196 */ +1197publicstaticfinal String CVE_VALID_FOR_HOURS = "cveValidForHours"; +1198/** +1199 * Disables the Jar Analyzer. +1200 */ +1201publicstaticfinal String DISABLE_JAR = "disableJar"; +1202/** +1203 * Disables the Archive Analyzer. +1204 */ +1205publicstaticfinal String DISABLE_ARCHIVE = "disableArchive"; +1206/** +1207 * Disables the Python Distribution Analyzer. +1208 */ +1209publicstaticfinal String DISABLE_PY_DIST = "disablePyDist"; +1210/** +1211 * Disables the Python Package Analyzer. +1212 */ +1213publicstaticfinal String DISABLE_PY_PKG = "disablePyPkg"; +1214/** +1215 * Disables the Python Package Analyzer. +1216 */ +1217publicstaticfinal String DISABLE_COMPOSER = "disableComposer"; +1218/** +1219 * Disables the Ruby Gemspec Analyzer. +1220 */ +1221publicstaticfinal String DISABLE_RUBYGEMS = "disableRubygems"; +1222/** +1223 * Disables the Autoconf Analyzer. +1224 */ +1225publicstaticfinal String DISABLE_AUTOCONF = "disableAutoconf"; +1226/** +1227 * Disables the Cmake Analyzer. +1228 */ +1229publicstaticfinal String DISABLE_CMAKE = "disableCmake"; +1230/** +1231 * Disables the Assembly Analyzer. +1232 */ +1233publicstaticfinal String DISABLE_ASSEMBLY = "disableAssembly"; +1234/** +1235 * Disables the Ruby Bundler Audit Analyzer. +1236 */ +1237publicstaticfinal String DISABLE_BUNDLE_AUDIT = "disableBundleAudit"; +1238/** +1239 * Disables the Nuspec Analyzer. +1240 */ +1241publicstaticfinal String DISABLE_NUSPEC = "disableNuspec"; +1242/** +1243 * Disables the Central Analyzer. +1244 */ +1245publicstaticfinal String DISABLE_CENTRAL = "disableCentral"; +1246/** +1247 * Disables the Nexus Analyzer. +1248 */ +1249publicstaticfinal String DISABLE_NEXUS = "disableNexus"; +1250/** +1251 * Disables the OpenSSL Analyzer. +1252 */ +1253publicstaticfinal String DISABLE_OPENSSL = "disableOpenSSL"; +1254/** +1255 * Disables the Node.js Package Analyzer. +1256 */ +1257publicstaticfinal String DISABLE_NODE_JS = "disableNodeJS"; +1258/** +1259 * The URL of the nexus server. +1260 */ +1261publicstaticfinal String NEXUS_URL = "nexus"; +1262/** +1263 * Whether or not the defined proxy should be used when connecting to Nexus. +1264 */ +1265publicstaticfinal String NEXUS_USES_PROXY = "nexusUsesProxy"; +1266/** +1267 * The CLI argument name for setting the connection string. +1268 */ +1269publicstaticfinal String CONNECTION_STRING = "connectionString"; +1270/** +1271 * The CLI argument name for setting the database user name. +1272 */ +1273publicstaticfinal String DB_NAME = "dbUser"; +1274/** +1275 * The CLI argument name for setting the database password. +1276 */ +1277publicstaticfinal String DB_PASSWORD = "dbPassword"; +1278/** +1279 * The CLI argument name for setting the database driver name. +1280 */ +1281publicstaticfinal String DB_DRIVER = "dbDriverName"; +1282/** +1283 * The CLI argument name for setting the path to the database driver; in case it is not on the class path. +1284 */ +1285publicstaticfinal String DB_DRIVER_PATH = "dbDriverPath"; +1286/** +1287 * The CLI argument name for setting the path to mono for .NET Assembly analysis on non-windows systems. +1288 */ +1289publicstaticfinal String PATH_TO_MONO = "mono"; +1290/** +1291 * The CLI argument name for setting extra extensions. +1292 */ +1293publicstaticfinal String ADDITIONAL_ZIP_EXTENSIONS = "zipExtensions"; +1294/** +1295 * Exclude path argument. +1296 */ +1297publicstaticfinal String EXCLUDE = "exclude"; +1298/** +1299 * The CLI argument name for setting the path to bundle-audit for Ruby bundle analysis. +1300 */ +1301publicstaticfinal String PATH_TO_BUNDLE_AUDIT = "bundleAudit"; +1302 } +1303 }
    diff --git a/dependency-check-cli/xref/org/owasp/dependencycheck/InvalidScanPathException.html b/dependency-check-cli/xref/org/owasp/dependencycheck/InvalidScanPathException.html index fe9582c50..86f3183a8 100644 --- a/dependency-check-cli/xref/org/owasp/dependencycheck/InvalidScanPathException.html +++ b/dependency-check-cli/xref/org/owasp/dependencycheck/InvalidScanPathException.html @@ -30,7 +30,7 @@ 22 *23 * @author Jeremy Long24 */ -25classInvalidScanPathExceptionextends Exception { +25publicclassInvalidScanPathExceptionextends Exception { 2627/**28 * The serial version UID for serialization. diff --git a/dependency-check-cli/xref/org/owasp/dependencycheck/package-frame.html b/dependency-check-cli/xref/org/owasp/dependencycheck/package-frame.html index ff54436b0..530bdf670 100644 --- a/dependency-check-cli/xref/org/owasp/dependencycheck/package-frame.html +++ b/dependency-check-cli/xref/org/owasp/dependencycheck/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Command Line 1.3.1 Reference Package org.owasp.dependencycheck + Dependency-Check Command Line 1.3.2 Reference Package org.owasp.dependencycheck diff --git a/dependency-check-cli/xref/org/owasp/dependencycheck/package-summary.html b/dependency-check-cli/xref/org/owasp/dependencycheck/package-summary.html index 379fc30af..a35f76f32 100644 --- a/dependency-check-cli/xref/org/owasp/dependencycheck/package-summary.html +++ b/dependency-check-cli/xref/org/owasp/dependencycheck/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Command Line 1.3.1 Reference Package org.owasp.dependencycheck + Dependency-Check Command Line 1.3.2 Reference Package org.owasp.dependencycheck diff --git a/dependency-check-cli/xref/overview-frame.html b/dependency-check-cli/xref/overview-frame.html index 781dad3e5..1c5f45fcb 100644 --- a/dependency-check-cli/xref/overview-frame.html +++ b/dependency-check-cli/xref/overview-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Command Line 1.3.1 Reference + Dependency-Check Command Line 1.3.2 Reference diff --git a/dependency-check-cli/xref/overview-summary.html b/dependency-check-cli/xref/overview-summary.html index 2560b61d1..47747f41b 100644 --- a/dependency-check-cli/xref/overview-summary.html +++ b/dependency-check-cli/xref/overview-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Command Line 1.3.1 Reference + Dependency-Check Command Line 1.3.2 Reference @@ -24,7 +24,7 @@ -

    Dependency-Check Command Line 1.3.1 Reference

    +

    Dependency-Check Command Line 1.3.2 Reference

    diff --git a/dependency-check-core/apidocs/allclasses-frame.html b/dependency-check-core/apidocs/allclasses-frame.html index e5f0a0ae9..980c46966 100644 --- a/dependency-check-core/apidocs/allclasses-frame.html +++ b/dependency-check-core/apidocs/allclasses-frame.html @@ -2,10 +2,10 @@ - + -All Classes (Dependency-Check Core 1.3.1 API) - +All Classes (Dependency-Check Core 1.3.2 API) + @@ -36,6 +36,7 @@
  • ComposerLockParser
  • Confidence
  • ConnectionFactory
  • +
  • CorruptDatabaseException
  • Cpe
  • CPEAnalyzer
  • CPEHandler
  • @@ -87,7 +88,6 @@
  • NexusSearch
  • NoDataException
  • NodePackageAnalyzer
  • -
  • NonClosingStream
  • NugetPackage
  • NuspecAnalyzer
  • NuspecParseException
  • @@ -112,6 +112,7 @@
  • Reference
  • ReportGenerator
  • ReportGenerator.Format
  • +
  • RubyBundleAuditAnalyzer
  • RubyGemspecAnalyzer
  • ScanAgentException
  • SearchFieldAnalyzer
  • diff --git a/dependency-check-core/apidocs/allclasses-noframe.html b/dependency-check-core/apidocs/allclasses-noframe.html index e48903c97..ab4a4e56f 100644 --- a/dependency-check-core/apidocs/allclasses-noframe.html +++ b/dependency-check-core/apidocs/allclasses-noframe.html @@ -2,10 +2,10 @@ - + -All Classes (Dependency-Check Core 1.3.1 API) - +All Classes (Dependency-Check Core 1.3.2 API) + @@ -36,6 +36,7 @@
  • ComposerLockParser
  • Confidence
  • ConnectionFactory
  • +
  • CorruptDatabaseException
  • Cpe
  • CPEAnalyzer
  • CPEHandler
  • @@ -87,7 +88,6 @@
  • NexusSearch
  • NoDataException
  • NodePackageAnalyzer
  • -
  • NonClosingStream
  • NugetPackage
  • NuspecAnalyzer
  • NuspecParseException
  • @@ -112,6 +112,7 @@
  • Reference
  • ReportGenerator
  • ReportGenerator.Format
  • +
  • RubyBundleAuditAnalyzer
  • RubyGemspecAnalyzer
  • ScanAgentException
  • SearchFieldAnalyzer
  • diff --git a/dependency-check-core/apidocs/constant-values.html b/dependency-check-core/apidocs/constant-values.html index 44b729972..8f20a647d 100644 --- a/dependency-check-core/apidocs/constant-values.html +++ b/dependency-check-core/apidocs/constant-values.html @@ -2,16 +2,16 @@ - + -Constant Field Values (Dependency-Check Core 1.3.1 API) - +Constant Field Values (Dependency-Check Core 1.3.2 API) + @@ -132,6 +132,46 @@
    +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    org.owasp.dependencycheck.analyzer.RubyBundleAuditAnalyzer 
    Modifier and TypeConstant FieldValue
    + +public static final StringADVISORY"Advisory: "
    + +public static final StringCRITICALITY"Criticality: "
    + +public static final StringNAME"Name: "
    + +public static final StringVERSION"Version: "
    +
  • @@ -240,6 +245,16 @@ the order they are declared.
    Initialization phase.
    + + + + @@ -430,6 +445,6 @@ not permitted.) -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/Analyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/Analyzer.html index 415d6e538..c26a70110 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/Analyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/Analyzer.html @@ -2,16 +2,16 @@ - + -Analyzer (Dependency-Check Core 1.3.1 API) - +Analyzer (Dependency-Check Core 1.3.2 API) + @@ -93,7 +93,7 @@
    All Known Implementing Classes:
    -
    AbstractAnalyzer, AbstractFileTypeAnalyzer, AbstractSuppressionAnalyzer, ArchiveAnalyzer, AssemblyAnalyzer, AutoconfAnalyzer, CentralAnalyzer, CMakeAnalyzer, ComposerLockAnalyzer, CPEAnalyzer, CpeSuppressionAnalyzer, DependencyBundlingAnalyzer, FalsePositiveAnalyzer, FileNameAnalyzer, HintAnalyzer, JarAnalyzer, NexusAnalyzer, NodePackageAnalyzer, NuspecAnalyzer, NvdCveAnalyzer, OpenSSLAnalyzer, PythonDistributionAnalyzer, PythonPackageAnalyzer, RubyGemspecAnalyzer, VulnerabilitySuppressionAnalyzer
    +
    AbstractAnalyzer, AbstractFileTypeAnalyzer, AbstractSuppressionAnalyzer, ArchiveAnalyzer, AssemblyAnalyzer, AutoconfAnalyzer, CentralAnalyzer, CMakeAnalyzer, ComposerLockAnalyzer, CPEAnalyzer, CpeSuppressionAnalyzer, DependencyBundlingAnalyzer, FalsePositiveAnalyzer, FileNameAnalyzer, HintAnalyzer, JarAnalyzer, NexusAnalyzer, NodePackageAnalyzer, NuspecAnalyzer, NvdCveAnalyzer, OpenSSLAnalyzer, PythonDistributionAnalyzer, PythonPackageAnalyzer, RubyBundleAuditAnalyzer, RubyGemspecAnalyzer, VulnerabilitySuppressionAnalyzer


    @@ -299,6 +299,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/AnalyzerService.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/AnalyzerService.html index 0095c2c05..dbae93248 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/AnalyzerService.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/AnalyzerService.html @@ -2,16 +2,16 @@ - + -AnalyzerService (Dependency-Check Core 1.3.1 API) - +AnalyzerService (Dependency-Check Core 1.3.2 API) + @@ -265,6 +265,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.html index c9e9c06bc..915f96364 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.html @@ -2,16 +2,16 @@ - + -ArchiveAnalyzer (Dependency-Check Core 1.3.1 API) - +ArchiveAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -420,6 +420,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.html index 2288112ad..41e9746fa 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.html @@ -2,16 +2,16 @@ - + -AssemblyAnalyzer (Dependency-Check Core 1.3.1 API) - +AssemblyAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -417,6 +417,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/AutoconfAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/AutoconfAnalyzer.html index c1a4bfd13..408bee82a 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/AutoconfAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/AutoconfAnalyzer.html @@ -2,16 +2,16 @@ - + -AutoconfAnalyzer (Dependency-Check Core 1.3.1 API) - +AutoconfAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -403,6 +403,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.html index 004b57da6..f7cd94633 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.html @@ -2,16 +2,16 @@ - + -CMakeAnalyzer (Dependency-Check Core 1.3.1 API) - +CMakeAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -409,6 +409,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CPEAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CPEAnalyzer.html index a9cb3ce14..b8b3936f4 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CPEAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CPEAnalyzer.html @@ -2,16 +2,16 @@ - + -CPEAnalyzer (Dependency-Check Core 1.3.1 API) - +CPEAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -548,6 +548,6 @@ implements
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CentralAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CentralAnalyzer.html index 838f7c014..2d74cb8ad 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CentralAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CentralAnalyzer.html @@ -2,16 +2,16 @@ - + -CentralAnalyzer (Dependency-Check Core 1.3.1 API) - +CentralAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -428,6 +428,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/ComposerLockAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/ComposerLockAnalyzer.html index 95cd6ae5c..1c99f6161 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/ComposerLockAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/ComposerLockAnalyzer.html @@ -2,16 +2,16 @@ - + -ComposerLockAnalyzer (Dependency-Check Core 1.3.1 API) - +ComposerLockAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -399,6 +399,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CpeSuppressionAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CpeSuppressionAnalyzer.html index a605b2ea3..44d2e46a5 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CpeSuppressionAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/CpeSuppressionAnalyzer.html @@ -2,16 +2,16 @@ - + -CpeSuppressionAnalyzer (Dependency-Check Core 1.3.1 API) - +CpeSuppressionAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -332,6 +332,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.html index a4e5f3f72..0398b9c3f 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.html @@ -2,16 +2,16 @@ - + -DependencyBundlingAnalyzer (Dependency-Check Core 1.3.1 API) - +DependencyBundlingAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -360,6 +360,6 @@ implements
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.html index 7024d508f..d73da1284 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.html @@ -2,16 +2,16 @@ - + -FalsePositiveAnalyzer (Dependency-Check Core 1.3.1 API) - +FalsePositiveAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -402,6 +402,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/FileNameAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/FileNameAnalyzer.html index 142117d52..581fff480 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/FileNameAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/FileNameAnalyzer.html @@ -2,16 +2,16 @@ - + -FileNameAnalyzer (Dependency-Check Core 1.3.1 API) - +FileNameAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -332,6 +332,6 @@ implements
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/FileTypeAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/FileTypeAnalyzer.html index 44fb1be60..437a2c206 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/FileTypeAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/FileTypeAnalyzer.html @@ -2,16 +2,16 @@ - + -FileTypeAnalyzer (Dependency-Check Core 1.3.1 API) - +FileTypeAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -93,7 +93,7 @@
    All Known Implementing Classes:
    -
    AbstractFileTypeAnalyzer, ArchiveAnalyzer, AssemblyAnalyzer, AutoconfAnalyzer, CentralAnalyzer, CMakeAnalyzer, ComposerLockAnalyzer, JarAnalyzer, NexusAnalyzer, NodePackageAnalyzer, NuspecAnalyzer, OpenSSLAnalyzer, PythonDistributionAnalyzer, PythonPackageAnalyzer, RubyGemspecAnalyzer
    +
    AbstractFileTypeAnalyzer, ArchiveAnalyzer, AssemblyAnalyzer, AutoconfAnalyzer, CentralAnalyzer, CMakeAnalyzer, ComposerLockAnalyzer, JarAnalyzer, NexusAnalyzer, NodePackageAnalyzer, NuspecAnalyzer, OpenSSLAnalyzer, PythonDistributionAnalyzer, PythonPackageAnalyzer, RubyBundleAuditAnalyzer, RubyGemspecAnalyzer


    @@ -232,6 +232,6 @@ extends -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/HintAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/HintAnalyzer.html index 58dfefc33..aa5076d42 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/HintAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/HintAnalyzer.html @@ -2,16 +2,16 @@ - + -HintAnalyzer (Dependency-Check Core 1.3.1 API) - +HintAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -333,6 +333,6 @@ implements Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/JarAnalyzer.ClassNameInformation.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/JarAnalyzer.ClassNameInformation.html index 2b4649981..091eaf188 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/JarAnalyzer.ClassNameInformation.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/JarAnalyzer.ClassNameInformation.html @@ -2,16 +2,16 @@ - + -JarAnalyzer.ClassNameInformation (Dependency-Check Core 1.3.1 API) - +JarAnalyzer.ClassNameInformation (Dependency-Check Core 1.3.2 API) + @@ -262,6 +262,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/JarAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/JarAnalyzer.html index 16d262434..4bb632684 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/JarAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/JarAnalyzer.html @@ -2,16 +2,16 @@ - + -JarAnalyzer (Dependency-Check Core 1.3.1 API) - +JarAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -580,6 +580,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NexusAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NexusAnalyzer.html index ba8670311..69e678d24 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NexusAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NexusAnalyzer.html @@ -2,16 +2,16 @@ - + -NexusAnalyzer (Dependency-Check Core 1.3.1 API) - +NexusAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -468,6 +468,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.html index 9e1be9184..618dacfff 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.html @@ -2,16 +2,16 @@ - + -NodePackageAnalyzer (Dependency-Check Core 1.3.1 API) - +NodePackageAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -443,6 +443,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NuspecAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NuspecAnalyzer.html index 27c3105ab..0ef047e0a 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NuspecAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NuspecAnalyzer.html @@ -2,16 +2,16 @@ - + -NuspecAnalyzer (Dependency-Check Core 1.3.1 API) - +NuspecAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -399,6 +399,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.html index 87ce55338..9ec2a7729 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.html @@ -2,16 +2,16 @@ - + -NvdCveAnalyzer (Dependency-Check Core 1.3.1 API) - +NvdCveAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -420,6 +420,6 @@ implements
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/OpenSSLAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/OpenSSLAnalyzer.html index 67512e739..510439f5c 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/OpenSSLAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/OpenSSLAnalyzer.html @@ -2,16 +2,16 @@ - + -OpenSSLAnalyzer (Dependency-Check Core 1.3.1 API) - +OpenSSLAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -402,6 +402,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.html index e0517ed49..b79e51937 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.html @@ -2,16 +2,16 @@ - + -PythonDistributionAnalyzer (Dependency-Check Core 1.3.1 API) - +PythonDistributionAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -410,6 +410,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/PythonPackageAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/PythonPackageAnalyzer.html index 43cdff76b..b1ccd3ba3 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/PythonPackageAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/PythonPackageAnalyzer.html @@ -2,16 +2,16 @@ - + -PythonPackageAnalyzer (Dependency-Check Core 1.3.1 API) - +PythonPackageAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -38,7 +38,7 @@
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AbstractFileTypeAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AbstractFileTypeAnalyzer.html index a9605d7df..09ebc308b 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AbstractFileTypeAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AbstractFileTypeAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.AbstractFileTypeAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.AbstractFileTypeAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -184,6 +184,12 @@ class  +RubyBundleAuditAnalyzer +
    Used to analyze Ruby Bundler Gemspec.lock files utilizing the 3rd party bundle-audit tool.
    + + + +class  RubyGemspecAnalyzer
    Used to analyze Ruby Gem specifications and collect information that can be used to determine the associated CPE.
    @@ -240,6 +246,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AbstractSuppressionAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AbstractSuppressionAnalyzer.html index 2a49d71b7..456c89fcd 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AbstractSuppressionAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AbstractSuppressionAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.AbstractSuppressionAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.AbstractSuppressionAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -162,6 +162,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AnalysisPhase.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AnalysisPhase.html index 56c9bb675..4bbfdce73 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AnalysisPhase.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AnalysisPhase.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.AnalysisPhase (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.AnalysisPhase (Dependency-Check Core 1.3.2 API) + @@ -138,137 +138,143 @@ AnalysisPhase +RubyBundleAuditAnalyzer.getAnalysisPhase() +
    Returns the phase that the analyzer is intended to run in.
    + + + +AnalysisPhase PythonPackageAnalyzer.getAnalysisPhase()
    Tell that we are used for information collection.
    - + AnalysisPhase PythonDistributionAnalyzer.getAnalysisPhase()
    Returns the phase that the analyzer is intended to run in.
    - + AnalysisPhase OpenSSLAnalyzer.getAnalysisPhase()
    Tell that we are used for information collection.
    - + AnalysisPhase NvdCveAnalyzer.getAnalysisPhase()
    Returns the analysis phase that this analyzer should run in.
    - + AnalysisPhase NuspecAnalyzer.getAnalysisPhase()
    Returns the analysis phase under which the analyzer runs.
    - + AnalysisPhase NodePackageAnalyzer.getAnalysisPhase()
    Returns the phase that the analyzer is intended to run in.
    - + AnalysisPhase NexusAnalyzer.getAnalysisPhase()
    Returns the analysis phase under which the analyzer runs.
    - + AnalysisPhase JarAnalyzer.getAnalysisPhase()
    Returns the phase that the analyzer is intended to run in.
    - + AnalysisPhase HintAnalyzer.getAnalysisPhase()
    Returns the phase that the analyzer is intended to run in.
    - + AnalysisPhase FileNameAnalyzer.getAnalysisPhase()
    Returns the phase that the analyzer is intended to run in.
    - + AnalysisPhase FalsePositiveAnalyzer.getAnalysisPhase()
    Returns the phase that the analyzer is intended to run in.
    - + AnalysisPhase DependencyBundlingAnalyzer.getAnalysisPhase()
    Returns the phase that the analyzer is intended to run in.
    - + AnalysisPhase CpeSuppressionAnalyzer.getAnalysisPhase()
    Returns the phase that the analyzer is intended to run in.
    - + AnalysisPhase CPEAnalyzer.getAnalysisPhase()
    Returns the analysis phase that this analyzer should run in.
    - + AnalysisPhase ComposerLockAnalyzer.getAnalysisPhase()
    Returns the phase this analyzer should run under.
    - + AnalysisPhase CMakeAnalyzer.getAnalysisPhase()
    Tell that we are used for information collection.
    - + AnalysisPhase CentralAnalyzer.getAnalysisPhase()
    Returns the analysis phase under which the analyzer runs.
    - + AnalysisPhase AutoconfAnalyzer.getAnalysisPhase()
    Returns the phase that the analyzer is intended to run in.
    - + AnalysisPhase AssemblyAnalyzer.getAnalysisPhase()
    Returns the phase this analyzer runs under.
    - + AnalysisPhase ArchiveAnalyzer.getAnalysisPhase()
    Returns the phase that the analyzer is intended to run in.
    - + AnalysisPhase Analyzer.getAnalysisPhase()
    Returns the phase that the analyzer is intended to run in.
    - + static AnalysisPhase AnalysisPhase.valueOf(String name)
    Returns the enum constant of this type with the specified name.
    - + static AnalysisPhase[] AnalysisPhase.values()
    Returns an array containing the constants of this enum type, in @@ -327,6 +333,6 @@ the order they are declared.
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/Analyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/Analyzer.html index b0f07e9dc..227c02158 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/Analyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/Analyzer.html @@ -2,16 +2,16 @@ - + -Uses of Interface org.owasp.dependencycheck.analyzer.Analyzer (Dependency-Check Core 1.3.1 API) - +Uses of Interface org.owasp.dependencycheck.analyzer.Analyzer (Dependency-Check Core 1.3.2 API) + @@ -331,11 +331,17 @@ class  +RubyBundleAuditAnalyzer +
    Used to analyze Ruby Bundler Gemspec.lock files utilizing the 3rd party bundle-audit tool.
    + + + +class  RubyGemspecAnalyzer
    Used to analyze Ruby Gem specifications and collect information that can be used to determine the associated CPE.
    - + class  VulnerabilitySuppressionAnalyzer
    The suppression analyzer processes an externally defined XML document that complies with the suppressions.xsd schema.
    @@ -429,6 +435,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AnalyzerService.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AnalyzerService.html index 335428e83..ea88a8876 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AnalyzerService.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AnalyzerService.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.AnalyzerService (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.AnalyzerService (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/ArchiveAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/ArchiveAnalyzer.html index 0bd7c426b..a78c0cbc0 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/ArchiveAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/ArchiveAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.ArchiveAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.ArchiveAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AssemblyAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AssemblyAnalyzer.html index 965632c5c..c7f0c77a9 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AssemblyAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AssemblyAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.AssemblyAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.AssemblyAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AutoconfAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AutoconfAnalyzer.html index 1130ba17e..23b3f2769 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AutoconfAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/AutoconfAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.AutoconfAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.AutoconfAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CMakeAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CMakeAnalyzer.html index dc03d28a9..2b3218484 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CMakeAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CMakeAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.CMakeAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.CMakeAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CPEAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CPEAnalyzer.html index a87e0227b..f1f21a9da 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CPEAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CPEAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.CPEAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.CPEAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CentralAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CentralAnalyzer.html index 305e0004b..b983d907c 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CentralAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CentralAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.CentralAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.CentralAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/ComposerLockAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/ComposerLockAnalyzer.html index 69239efef..6e7b2c2fd 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/ComposerLockAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/ComposerLockAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.ComposerLockAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.ComposerLockAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CpeSuppressionAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CpeSuppressionAnalyzer.html index 24745e178..8926fc0c8 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CpeSuppressionAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/CpeSuppressionAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.CpeSuppressionAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.CpeSuppressionAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/DependencyBundlingAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/DependencyBundlingAnalyzer.html index 53cfbba15..b436c9edc 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/DependencyBundlingAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/DependencyBundlingAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/FalsePositiveAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/FalsePositiveAnalyzer.html index 8d221bbaf..486386237 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/FalsePositiveAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/FalsePositiveAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.FalsePositiveAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.FalsePositiveAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/FileNameAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/FileNameAnalyzer.html index a5d321197..106c970bf 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/FileNameAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/FileNameAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.FileNameAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.FileNameAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/FileTypeAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/FileTypeAnalyzer.html index fe86005a2..6b94aaa11 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/FileTypeAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/FileTypeAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Interface org.owasp.dependencycheck.analyzer.FileTypeAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Interface org.owasp.dependencycheck.analyzer.FileTypeAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -216,6 +216,12 @@ class  +RubyBundleAuditAnalyzer +
    Used to analyze Ruby Bundler Gemspec.lock files utilizing the 3rd party bundle-audit tool.
    + + + +class  RubyGemspecAnalyzer
    Used to analyze Ruby Gem specifications and collect information that can be used to determine the associated CPE.
    @@ -272,6 +278,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/HintAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/HintAnalyzer.html index 34c01b6c3..41ca67fae 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/HintAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/HintAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.HintAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.HintAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/JarAnalyzer.ClassNameInformation.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/JarAnalyzer.ClassNameInformation.html index 53ae8cdb0..2b6ffc49b 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/JarAnalyzer.ClassNameInformation.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/JarAnalyzer.ClassNameInformation.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.JarAnalyzer.ClassNameInformation (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.JarAnalyzer.ClassNameInformation (Dependency-Check Core 1.3.2 API) + @@ -183,6 +183,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/JarAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/JarAnalyzer.html index 47399ae33..df419009e 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/JarAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/JarAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.JarAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.JarAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NexusAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NexusAnalyzer.html index 141540c97..5ae826c10 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NexusAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NexusAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.NexusAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.NexusAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NodePackageAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NodePackageAnalyzer.html index 8452c283b..6eb1090d4 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NodePackageAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NodePackageAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.NodePackageAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.NodePackageAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NuspecAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NuspecAnalyzer.html index 383e3435b..bab1fb527 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NuspecAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NuspecAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.NuspecAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.NuspecAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NvdCveAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NvdCveAnalyzer.html index f792b6545..805a6bbce 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NvdCveAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/NvdCveAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.NvdCveAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.NvdCveAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/OpenSSLAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/OpenSSLAnalyzer.html index 208f6f8f3..5f8470434 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/OpenSSLAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/OpenSSLAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.OpenSSLAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.OpenSSLAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/PythonDistributionAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/PythonDistributionAnalyzer.html index 30650a880..bb4335bf7 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/PythonDistributionAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/PythonDistributionAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.PythonDistributionAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.PythonDistributionAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/PythonPackageAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/PythonPackageAnalyzer.html index 11579b6e8..0cf47de4a 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/PythonPackageAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/PythonPackageAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.PythonPackageAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.PythonPackageAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/RubyBundleAuditAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/RubyBundleAuditAnalyzer.html new file mode 100644 index 000000000..4e3cae98e --- /dev/null +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/RubyBundleAuditAnalyzer.html @@ -0,0 +1,117 @@ + + + + + + +Uses of Class org.owasp.dependencycheck.analyzer.RubyBundleAuditAnalyzer (Dependency-Check Core 1.3.2 API) + + + + + + + +
    + + + + + +
    + + +
    +

    Uses of Class
    org.owasp.dependencycheck.analyzer.RubyBundleAuditAnalyzer

    +
    +
    No usage of org.owasp.dependencycheck.analyzer.RubyBundleAuditAnalyzer
    + +
    + + + + + +
    + + +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    + + diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/RubyGemspecAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/RubyGemspecAnalyzer.html index 14a03b6aa..fe84f26c1 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/RubyGemspecAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/RubyGemspecAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.RubyGemspecAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.RubyGemspecAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/VulnerabilitySuppressionAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/VulnerabilitySuppressionAnalyzer.html index 9f53f9104..3c8280a22 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/VulnerabilitySuppressionAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/class-use/VulnerabilitySuppressionAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.VulnerabilitySuppressionAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.VulnerabilitySuppressionAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/AnalysisException.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/AnalysisException.html index 231a2e204..060667b7d 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/AnalysisException.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/AnalysisException.html @@ -2,16 +2,16 @@ - + -AnalysisException (Dependency-Check Core 1.3.1 API) - +AnalysisException (Dependency-Check Core 1.3.2 API) + @@ -303,6 +303,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/ArchiveExtractionException.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/ArchiveExtractionException.html index 22624dbd8..0c7faf05e 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/ArchiveExtractionException.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/ArchiveExtractionException.html @@ -2,16 +2,16 @@ - + -ArchiveExtractionException (Dependency-Check Core 1.3.1 API) - +ArchiveExtractionException (Dependency-Check Core 1.3.2 API) + @@ -303,6 +303,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/class-use/AnalysisException.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/class-use/AnalysisException.html index b4afbb8cb..9af545b3f 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/class-use/AnalysisException.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/class-use/AnalysisException.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.exception.AnalysisException (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.exception.AnalysisException (Dependency-Check Core 1.3.2 API) + @@ -178,43 +178,48 @@ protected void +RubyBundleAuditAnalyzer.
    analyzeFileType(Dependency dependency, + Engine engine)  + + +protected void PythonPackageAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Analyzes python packages and adds evidence to the dependency.
    - + protected void PythonDistributionAnalyzer.analyzeFileType(Dependency dependency, Engine engine)  - + protected void OpenSSLAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Analyzes python packages and adds evidence to the dependency.
    - + void NuspecAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Performs the analysis.
    - + protected void NodePackageAnalyzer.analyzeFileType(Dependency dependency, Engine engine)  - + void NexusAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Performs the analysis.
    - + void JarAnalyzer.analyzeFileType(Dependency dependency, Engine engine) @@ -222,54 +227,54 @@ information. - + protected void ComposerLockAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Entry point for the analyzer.
    - + protected void CMakeAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Analyzes python packages and adds evidence to the dependency.
    - + void CentralAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Performs the analysis.
    - + protected void AutoconfAnalyzer.analyzeFileType(Dependency dependency, Engine engine)  - + void AssemblyAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Performs the analysis on a single Dependency.
    - + void ArchiveAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Analyzes a given dependency.
    - + protected abstract void AbstractFileTypeAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Analyzes a given dependency.
    - + protected boolean JarAnalyzer.analyzePOM(Dependency dependency, List<JarAnalyzer.ClassNameInformation> classes, @@ -363,6 +368,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/class-use/ArchiveExtractionException.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/class-use/ArchiveExtractionException.html index 9229352a4..45716f52f 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/class-use/ArchiveExtractionException.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/class-use/ArchiveExtractionException.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.analyzer.exception.ArchiveExtractionException (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.analyzer.exception.ArchiveExtractionException (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-frame.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-frame.html index 3d10c5385..c775f2aa5 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-frame.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.analyzer.exception (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.analyzer.exception (Dependency-Check Core 1.3.2 API) + diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-summary.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-summary.html index 127faec1d..cb3e8305a 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-summary.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.analyzer.exception (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.analyzer.exception (Dependency-Check Core 1.3.2 API) + @@ -147,6 +147,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-tree.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-tree.html index 59b880569..055242791 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-tree.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.analyzer.exception Class Hierarchy (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.analyzer.exception Class Hierarchy (Dependency-Check Core 1.3.2 API) + @@ -134,6 +134,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-use.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-use.html index e4f83d509..058774f8a 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-use.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/exception/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.analyzer.exception (Dependency-Check Core 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.analyzer.exception (Dependency-Check Core 1.3.2 API) + @@ -172,6 +172,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-frame.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-frame.html index 8b0963c14..a1bd10e3f 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-frame.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.analyzer (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.analyzer (Dependency-Check Core 1.3.2 API) + @@ -43,6 +43,7 @@
  • OpenSSLAnalyzer
  • PythonDistributionAnalyzer
  • PythonPackageAnalyzer
  • +
  • RubyBundleAuditAnalyzer
  • RubyGemspecAnalyzer
  • VulnerabilitySuppressionAnalyzer
  • diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-summary.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-summary.html index 6cd6cdd9d..4ae139013 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-summary.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.analyzer (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.analyzer (Dependency-Check Core 1.3.2 API) + @@ -258,12 +258,18 @@ +RubyBundleAuditAnalyzer + +
    Used to analyze Ruby Bundler Gemspec.lock files utilizing the 3rd party bundle-audit tool.
    + + + RubyGemspecAnalyzer
    Used to analyze Ruby Gem specifications and collect information that can be used to determine the associated CPE.
    - + VulnerabilitySuppressionAnalyzer
    The suppression analyzer processes an externally defined XML document that complies with the suppressions.xsd schema.
    @@ -341,6 +347,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-tree.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-tree.html index 29b911ee1..82d4ffe92 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-tree.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.analyzer Class Hierarchy (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.analyzer Class Hierarchy (Dependency-Check Core 1.3.2 API) + @@ -92,6 +92,7 @@
  • org.owasp.dependencycheck.analyzer.OpenSSLAnalyzer
  • org.owasp.dependencycheck.analyzer.PythonDistributionAnalyzer
  • org.owasp.dependencycheck.analyzer.PythonPackageAnalyzer
  • +
  • org.owasp.dependencycheck.analyzer.RubyBundleAuditAnalyzer
  • org.owasp.dependencycheck.analyzer.RubyGemspecAnalyzer
  • @@ -185,6 +186,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-use.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-use.html index e2302e034..716bb1b36 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-use.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/analyzer/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.analyzer (Dependency-Check Core 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.analyzer (Dependency-Check Core 1.3.2 API) + @@ -233,6 +233,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/class-use/Engine.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/class-use/Engine.html index e77361a91..ccef390bb 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/class-use/Engine.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/class-use/Engine.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.Engine (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.Engine (Dependency-Check Core 1.3.2 API) + @@ -205,43 +205,48 @@ protected void +RubyBundleAuditAnalyzer.analyzeFileType(Dependency dependency, + Engine engine)  + + +protected void PythonPackageAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Analyzes python packages and adds evidence to the dependency.
    - + protected void PythonDistributionAnalyzer.analyzeFileType(Dependency dependency, Engine engine)  - + protected void OpenSSLAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Analyzes python packages and adds evidence to the dependency.
    - + void NuspecAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Performs the analysis.
    - + protected void NodePackageAnalyzer.analyzeFileType(Dependency dependency, Engine engine)  - + void NexusAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Performs the analysis.
    - + void JarAnalyzer.analyzeFileType(Dependency dependency, Engine engine) @@ -249,54 +254,54 @@ information. - + protected void ComposerLockAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Entry point for the analyzer.
    - + protected void CMakeAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Analyzes python packages and adds evidence to the dependency.
    - + void CentralAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Performs the analysis.
    - + protected void AutoconfAnalyzer.analyzeFileType(Dependency dependency, Engine engine)  - + void AssemblyAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Performs the analysis on a single Dependency.
    - + void ArchiveAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Analyzes a given dependency.
    - + protected abstract void AbstractFileTypeAnalyzer.analyzeFileType(Dependency dependency, Engine engine)
    Analyzes a given dependency.
    - + protected boolean JarAnalyzer.analyzePOM(Dependency dependency, List<JarAnalyzer.ClassNameInformation> classes, @@ -378,6 +383,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/CentralSearch.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/CentralSearch.html index 9dc13c637..162963703 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/CentralSearch.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/CentralSearch.html @@ -2,16 +2,16 @@ - + -CentralSearch (Dependency-Check Core 1.3.1 API) - +CentralSearch (Dependency-Check Core 1.3.2 API) + @@ -270,6 +270,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/class-use/CentralSearch.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/class-use/CentralSearch.html index 7edf08294..c98724ee1 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/class-use/CentralSearch.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/class-use/CentralSearch.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.central.CentralSearch (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.central.CentralSearch (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-frame.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-frame.html index 321c5c860..89d7ec5bd 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-frame.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.data.central (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.central (Dependency-Check Core 1.3.2 API) + diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-summary.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-summary.html index 676c2e522..94b65dca8 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-summary.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.central (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.central (Dependency-Check Core 1.3.2 API) + @@ -145,6 +145,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-tree.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-tree.html index b3e923949..ef2c47b8a 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-tree.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.central Class Hierarchy (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.central Class Hierarchy (Dependency-Check Core 1.3.2 API) + @@ -125,6 +125,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-use.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-use.html index 62b547876..4f369d176 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-use.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/central/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.data.central (Dependency-Check Core 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.data.central (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/ComposerDependency.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/ComposerDependency.html index 261bb5463..b78db1f49 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/ComposerDependency.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/ComposerDependency.html @@ -2,16 +2,16 @@ - + -ComposerDependency (Dependency-Check Core 1.3.1 API) - +ComposerDependency (Dependency-Check Core 1.3.2 API) + @@ -336,6 +336,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/ComposerException.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/ComposerException.html index 3341bdfac..21b52a984 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/ComposerException.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/ComposerException.html @@ -2,16 +2,16 @@ - + -ComposerException (Dependency-Check Core 1.3.1 API) - +ComposerException (Dependency-Check Core 1.3.2 API) + @@ -292,6 +292,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/ComposerLockParser.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/ComposerLockParser.html index 0d4843c60..b3c158aae 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/ComposerLockParser.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/ComposerLockParser.html @@ -2,16 +2,16 @@ - + -ComposerLockParser (Dependency-Check Core 1.3.1 API) - +ComposerLockParser (Dependency-Check Core 1.3.2 API) + @@ -280,6 +280,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/class-use/ComposerDependency.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/class-use/ComposerDependency.html index fcf99e26b..7e2da8b95 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/class-use/ComposerDependency.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/class-use/ComposerDependency.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.composer.ComposerDependency (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.composer.ComposerDependency (Dependency-Check Core 1.3.2 API) + @@ -156,6 +156,6 @@
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/class-use/ComposerException.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/class-use/ComposerException.html index 557a06fcb..6f544640b 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/class-use/ComposerException.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/class-use/ComposerException.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.composer.ComposerException (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.composer.ComposerException (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/class-use/ComposerLockParser.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/class-use/ComposerLockParser.html index 13c23eacd..3eaa48bc9 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/class-use/ComposerLockParser.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/class-use/ComposerLockParser.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.composer.ComposerLockParser (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.composer.ComposerLockParser (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-frame.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-frame.html index 552667e05..983e60be9 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-frame.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.data.composer (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.composer (Dependency-Check Core 1.3.2 API) + diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-summary.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-summary.html index 4f23a7d25..2443395bb 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-summary.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.composer (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.composer (Dependency-Check Core 1.3.2 API) + @@ -164,6 +164,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-tree.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-tree.html index 4806acfe9..01806e6df 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-tree.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.composer Class Hierarchy (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.composer Class Hierarchy (Dependency-Check Core 1.3.2 API) + @@ -139,6 +139,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-use.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-use.html index e9eaf6b3f..6d36b00cd 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-use.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/composer/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.data.composer (Dependency-Check Core 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.data.composer (Dependency-Check Core 1.3.2 API) + @@ -149,6 +149,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.html index 32bd22c91..41951e67d 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.html @@ -2,16 +2,16 @@ - + -CpeMemoryIndex (Dependency-Check Core 1.3.1 API) - +CpeMemoryIndex (Dependency-Check Core 1.3.2 API) + @@ -158,21 +158,13 @@ extends -void -saveEntry(String vendor, - String product, - org.apache.lucene.index.IndexWriter indexWriter) -
    Saves a CPE IndexEntry into the Lucene index.
    - - - org.apache.lucene.search.TopDocs search(org.apache.lucene.search.Query query, int maxQueryResults)
    Searches the index using the given query.
    - + org.apache.lucene.search.TopDocs search(String searchString, int maxQueryResults) @@ -237,24 +229,6 @@ extends Returns:
    whether or not the index is open
    -
    - - -
      -
    • -

      saveEntry

      -
      public void saveEntry(String vendor,
      -             String product,
      -             org.apache.lucene.index.IndexWriter indexWriter)
      -               throws org.apache.lucene.index.CorruptIndexException,
      -                      IOException
      -
      Saves a CPE IndexEntry into the Lucene index.
      -
      Parameters:
      vendor - the vendor to index
      product - the product to index
      indexWriter - the index writer to write the entry into
      -
      Throws:
      -
      org.apache.lucene.index.CorruptIndexException - is thrown if the index is corrupt
      -
      IOException - is thrown if an IOException occurs
      -
    • -
    @@ -394,6 +368,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/Fields.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/Fields.html index 409533d88..c2d39a489 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/Fields.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/Fields.html @@ -2,16 +2,16 @@ - + -Fields (Dependency-Check Core 1.3.1 API) - +Fields (Dependency-Check Core 1.3.2 API) + @@ -268,6 +268,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/IndexEntry.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/IndexEntry.html index b8091d5aa..61c19e830 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/IndexEntry.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/IndexEntry.html @@ -2,16 +2,16 @@ - + -IndexEntry (Dependency-Check Core 1.3.1 API) - +IndexEntry (Dependency-Check Core 1.3.2 API) + @@ -475,6 +475,6 @@ implements
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/IndexException.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/IndexException.html index e7daea07a..381799934 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/IndexException.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/IndexException.html @@ -2,16 +2,16 @@ - + -IndexException (Dependency-Check Core 1.3.1 API) - +IndexException (Dependency-Check Core 1.3.2 API) + @@ -303,6 +303,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/CpeMemoryIndex.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/CpeMemoryIndex.html index 2a846fd25..010f21383 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/CpeMemoryIndex.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/CpeMemoryIndex.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.cpe.CpeMemoryIndex (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.cpe.CpeMemoryIndex (Dependency-Check Core 1.3.2 API) + @@ -156,6 +156,6 @@
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/Fields.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/Fields.html index dc080d0ec..d02d4b640 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/Fields.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/Fields.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.cpe.Fields (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.cpe.Fields (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/IndexEntry.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/IndexEntry.html index c8c2ff7ec..f45e26c15 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/IndexEntry.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/IndexEntry.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.cpe.IndexEntry (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.cpe.IndexEntry (Dependency-Check Core 1.3.2 API) + @@ -187,6 +187,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/IndexException.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/IndexException.html index 1c6a0794e..2ca206179 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/IndexException.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/class-use/IndexException.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.cpe.IndexException (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.cpe.IndexException (Dependency-Check Core 1.3.2 API) + @@ -156,6 +156,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-frame.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-frame.html index e4159fd68..4b0007aeb 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-frame.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.data.cpe (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.cpe (Dependency-Check Core 1.3.2 API) + diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-summary.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-summary.html index 55fed5d28..54c496cf7 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-summary.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.cpe (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.cpe (Dependency-Check Core 1.3.2 API) + @@ -171,6 +171,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-tree.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-tree.html index 8f5073859..19c89adcc 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-tree.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.cpe Class Hierarchy (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.cpe Class Hierarchy (Dependency-Check Core 1.3.2 API) + @@ -136,6 +136,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-use.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-use.html index 75545d8fb..60e17815c 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-use.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cpe/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.data.cpe (Dependency-Check Core 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.data.cpe (Dependency-Check Core 1.3.2 API) + @@ -201,6 +201,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/CweDB.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/CweDB.html index adea72391..7d5547672 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/CweDB.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/CweDB.html @@ -2,16 +2,16 @@ - + -CweDB (Dependency-Check Core 1.3.1 API) - +CweDB (Dependency-Check Core 1.3.2 API) + @@ -228,6 +228,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/CweHandler.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/CweHandler.html index cb56ab1ef..55fd6d270 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/CweHandler.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/CweHandler.html @@ -2,16 +2,16 @@ - + -CweHandler (Dependency-Check Core 1.3.1 API) - +CweHandler (Dependency-Check Core 1.3.2 API) + @@ -303,6 +303,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/class-use/CweDB.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/class-use/CweDB.html index db452b9b7..d0e22e8df 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/class-use/CweDB.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/class-use/CweDB.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.cwe.CweDB (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.cwe.CweDB (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/class-use/CweHandler.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/class-use/CweHandler.html index 657422e47..016bc2ec3 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/class-use/CweHandler.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/class-use/CweHandler.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.cwe.CweHandler (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.cwe.CweHandler (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-frame.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-frame.html index d81c6fdf5..0fcaab7d8 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-frame.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.data.cwe (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.cwe (Dependency-Check Core 1.3.2 API) + diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-summary.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-summary.html index 07587ea4b..da4e04b71 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-summary.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.cwe (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.cwe (Dependency-Check Core 1.3.2 API) + @@ -145,6 +145,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-tree.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-tree.html index 9ad1ee8ac..0ce2bfbac 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-tree.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.cwe Class Hierarchy (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.cwe Class Hierarchy (Dependency-Check Core 1.3.2 API) + @@ -130,6 +130,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-use.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-use.html index 30419abc1..e267ad039 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-use.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/cwe/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.data.cwe (Dependency-Check Core 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.data.cwe (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/AbstractTokenizingFilter.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/AbstractTokenizingFilter.html index e22d91b9c..59b6e3d21 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/AbstractTokenizingFilter.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/AbstractTokenizingFilter.html @@ -2,16 +2,16 @@ - + -AbstractTokenizingFilter (Dependency-Check Core 1.3.1 API) - +AbstractTokenizingFilter (Dependency-Check Core 1.3.2 API) + @@ -372,6 +372,6 @@ extends org.apache.lucene.analysis.TokenFilter -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/AlphaNumericTokenizer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/AlphaNumericTokenizer.html index 0ab3db520..97dac8fa5 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/AlphaNumericTokenizer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/AlphaNumericTokenizer.html @@ -2,16 +2,16 @@ - + -AlphaNumericTokenizer (Dependency-Check Core 1.3.1 API) - +AlphaNumericTokenizer (Dependency-Check Core 1.3.2 API) + @@ -365,6 +365,6 @@ extends org.apache.lucene.analysis.util.CharTokenizer -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/DependencySimilarity.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/DependencySimilarity.html index 8a3726eb4..d63a0e181 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/DependencySimilarity.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/DependencySimilarity.html @@ -2,16 +2,16 @@ - + -DependencySimilarity (Dependency-Check Core 1.3.1 API) - +DependencySimilarity (Dependency-Check Core 1.3.2 API) + @@ -328,6 +328,6 @@ extends org.apache.lucene.search.similarities.DefaultSimilarity -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/FieldAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/FieldAnalyzer.html index 7fc5bda25..2cbf711b8 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/FieldAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/FieldAnalyzer.html @@ -2,16 +2,16 @@ - + -FieldAnalyzer (Dependency-Check Core 1.3.1 API) - +FieldAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -318,6 +318,6 @@ extends org.apache.lucene.analysis.Analyzer -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/LuceneUtils.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/LuceneUtils.html index 37ba45921..376368811 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/LuceneUtils.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/LuceneUtils.html @@ -2,16 +2,16 @@ - + -LuceneUtils (Dependency-Check Core 1.3.1 API) - +LuceneUtils (Dependency-Check Core 1.3.2 API) + @@ -287,6 +287,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/SearchFieldAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/SearchFieldAnalyzer.html index eba1de461..6a7b2a34b 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/SearchFieldAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/SearchFieldAnalyzer.html @@ -2,16 +2,16 @@ - + -SearchFieldAnalyzer (Dependency-Check Core 1.3.1 API) - +SearchFieldAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -336,6 +336,6 @@ extends org.apache.lucene.analysis.Analyzer
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/TokenPairConcatenatingFilter.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/TokenPairConcatenatingFilter.html index 6ec8fa2cc..bae80c2d2 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/TokenPairConcatenatingFilter.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/TokenPairConcatenatingFilter.html @@ -2,16 +2,16 @@ - + -TokenPairConcatenatingFilter (Dependency-Check Core 1.3.1 API) - +TokenPairConcatenatingFilter (Dependency-Check Core 1.3.2 API) + @@ -433,6 +433,6 @@ extends org.apache.lucene.analysis.TokenFilter -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/UrlTokenizingFilter.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/UrlTokenizingFilter.html index 886c972f2..b9cd1a978 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/UrlTokenizingFilter.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/UrlTokenizingFilter.html @@ -2,16 +2,16 @@ - + -UrlTokenizingFilter (Dependency-Check Core 1.3.1 API) - +UrlTokenizingFilter (Dependency-Check Core 1.3.2 API) + @@ -350,6 +350,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/AbstractTokenizingFilter.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/AbstractTokenizingFilter.html index eeb6d950f..320755c8f 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/AbstractTokenizingFilter.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/AbstractTokenizingFilter.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.lucene.AbstractTokenizingFilter (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.lucene.AbstractTokenizingFilter (Dependency-Check Core 1.3.2 API) + @@ -157,6 +157,6 @@
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/AlphaNumericTokenizer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/AlphaNumericTokenizer.html index 7bda936ba..4cfb8f051 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/AlphaNumericTokenizer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/AlphaNumericTokenizer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.lucene.AlphaNumericTokenizer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.lucene.AlphaNumericTokenizer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/DependencySimilarity.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/DependencySimilarity.html index c7875c8e3..557c48974 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/DependencySimilarity.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/DependencySimilarity.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.lucene.DependencySimilarity (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.lucene.DependencySimilarity (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/FieldAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/FieldAnalyzer.html index 1da5296d2..e64f6a68e 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/FieldAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/FieldAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.lucene.FieldAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.lucene.FieldAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/LuceneUtils.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/LuceneUtils.html index c7f1457a2..e48c31bb4 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/LuceneUtils.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/LuceneUtils.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.lucene.LuceneUtils (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.lucene.LuceneUtils (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/SearchFieldAnalyzer.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/SearchFieldAnalyzer.html index 9d959eb6d..01e014144 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/SearchFieldAnalyzer.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/SearchFieldAnalyzer.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.lucene.SearchFieldAnalyzer (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.lucene.SearchFieldAnalyzer (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/TokenPairConcatenatingFilter.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/TokenPairConcatenatingFilter.html index 894b9cd32..cf14c5e6f 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/TokenPairConcatenatingFilter.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/TokenPairConcatenatingFilter.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.lucene.TokenPairConcatenatingFilter (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.lucene.TokenPairConcatenatingFilter (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/UrlTokenizingFilter.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/UrlTokenizingFilter.html index 45b9edd89..acbe2b99a 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/UrlTokenizingFilter.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/class-use/UrlTokenizingFilter.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.lucene.UrlTokenizingFilter (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.lucene.UrlTokenizingFilter (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-frame.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-frame.html index ffc584545..0717e5fad 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-frame.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.data.lucene (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.lucene (Dependency-Check Core 1.3.2 API) + diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-summary.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-summary.html index 111e6a19b..d12701234 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-summary.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.lucene (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.lucene (Dependency-Check Core 1.3.2 API) + @@ -185,6 +185,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-tree.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-tree.html index 1d07c615b..f4fe84eb8 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-tree.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.lucene Class Hierarchy (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.lucene Class Hierarchy (Dependency-Check Core 1.3.2 API) + @@ -171,6 +171,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-use.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-use.html index 8d8af9015..ce16ecd2d 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-use.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/lucene/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.data.lucene (Dependency-Check Core 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.data.lucene (Dependency-Check Core 1.3.2 API) + @@ -149,6 +149,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/MavenArtifact.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/MavenArtifact.html index eef64e785..a9cccccdf 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/MavenArtifact.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/MavenArtifact.html @@ -2,16 +2,16 @@ - + -MavenArtifact (Dependency-Check Core 1.3.1 API) - +MavenArtifact (Dependency-Check Core 1.3.2 API) + @@ -504,6 +504,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/NexusSearch.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/NexusSearch.html index 37d4d11b5..c681af0c5 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/NexusSearch.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/NexusSearch.html @@ -2,16 +2,16 @@ - + -NexusSearch (Dependency-Check Core 1.3.1 API) - +NexusSearch (Dependency-Check Core 1.3.2 API) + @@ -287,6 +287,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/class-use/MavenArtifact.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/class-use/MavenArtifact.html index cfd7357a8..3d1b060b0 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/class-use/MavenArtifact.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/class-use/MavenArtifact.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.nexus.MavenArtifact (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.nexus.MavenArtifact (Dependency-Check Core 1.3.2 API) + @@ -214,6 +214,6 @@
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/class-use/NexusSearch.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/class-use/NexusSearch.html index d843f909c..f14a48364 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/class-use/NexusSearch.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/class-use/NexusSearch.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.nexus.NexusSearch (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.nexus.NexusSearch (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-frame.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-frame.html index 0a8600ec8..9b09f7712 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-frame.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.data.nexus (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.nexus (Dependency-Check Core 1.3.2 API) + diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-summary.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-summary.html index 975114244..2b4e9b02f 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-summary.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.nexus (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.nexus (Dependency-Check Core 1.3.2 API) + @@ -151,6 +151,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-tree.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-tree.html index 8c181dd41..c7baf291e 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-tree.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.nexus Class Hierarchy (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.nexus Class Hierarchy (Dependency-Check Core 1.3.2 API) + @@ -126,6 +126,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-use.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-use.html index 2bb5294d6..e870cd0ed 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-use.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nexus/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.data.nexus (Dependency-Check Core 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.data.nexus (Dependency-Check Core 1.3.2 API) + @@ -199,6 +199,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/NugetPackage.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/NugetPackage.html index 698c4c56d..c73dcd5bf 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/NugetPackage.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/NugetPackage.html @@ -2,16 +2,16 @@ - + -NugetPackage (Dependency-Check Core 1.3.1 API) - +NugetPackage (Dependency-Check Core 1.3.2 API) + @@ -484,6 +484,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/NuspecParseException.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/NuspecParseException.html index e5fff1acc..ee21dfbfa 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/NuspecParseException.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/NuspecParseException.html @@ -2,16 +2,16 @@ - + -NuspecParseException (Dependency-Check Core 1.3.1 API) - +NuspecParseException (Dependency-Check Core 1.3.2 API) + @@ -297,6 +297,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/NuspecParser.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/NuspecParser.html index c8a6f3db1..86e249a68 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/NuspecParser.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/NuspecParser.html @@ -2,16 +2,16 @@ - + -NuspecParser (Dependency-Check Core 1.3.1 API) - +NuspecParser (Dependency-Check Core 1.3.2 API) + @@ -218,6 +218,6 @@
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/XPathNuspecParser.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/XPathNuspecParser.html index 05812af2e..51e57238d 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/XPathNuspecParser.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/XPathNuspecParser.html @@ -2,16 +2,16 @@ - + -XPathNuspecParser (Dependency-Check Core 1.3.1 API) - +XPathNuspecParser (Dependency-Check Core 1.3.2 API) + @@ -272,6 +272,6 @@ implements Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/NugetPackage.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/NugetPackage.html index 257908866..f85a90c99 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/NugetPackage.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/NugetPackage.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.nuget.NugetPackage (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.nuget.NugetPackage (Dependency-Check Core 1.3.2 API) + @@ -163,6 +163,6 @@
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/NuspecParseException.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/NuspecParseException.html index 73f1ce6f5..55d2bf8c6 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/NuspecParseException.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/NuspecParseException.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.nuget.NuspecParseException (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.nuget.NuspecParseException (Dependency-Check Core 1.3.2 API) + @@ -163,6 +163,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/NuspecParser.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/NuspecParser.html index c19699c84..4575d0745 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/NuspecParser.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/NuspecParser.html @@ -2,16 +2,16 @@ - + -Uses of Interface org.owasp.dependencycheck.data.nuget.NuspecParser (Dependency-Check Core 1.3.1 API) - +Uses of Interface org.owasp.dependencycheck.data.nuget.NuspecParser (Dependency-Check Core 1.3.2 API) + @@ -157,6 +157,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/XPathNuspecParser.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/XPathNuspecParser.html index 8cd282a4c..afbbf6478 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/XPathNuspecParser.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/class-use/XPathNuspecParser.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.data.nuget.XPathNuspecParser (Dependency-Check Core 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.data.nuget.XPathNuspecParser (Dependency-Check Core 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-frame.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-frame.html index 0ed4e49ac..da43d6cb0 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-frame.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.data.nuget (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.nuget (Dependency-Check Core 1.3.2 API) + diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-summary.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-summary.html index 85915b5e6..ef5f6fb6e 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-summary.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.nuget (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.nuget (Dependency-Check Core 1.3.2 API) + @@ -183,6 +183,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-tree.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-tree.html index e10bcd680..fdb4d62d9 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-tree.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.data.nuget Class Hierarchy (Dependency-Check Core 1.3.1 API) - +org.owasp.dependencycheck.data.nuget Class Hierarchy (Dependency-Check Core 1.3.2 API) + @@ -139,6 +139,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-use.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-use.html index 823b8c20c..b7d4285bb 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-use.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nuget/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.data.nuget (Dependency-Check Core 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.data.nuget (Dependency-Check Core 1.3.2 API) + @@ -160,6 +160,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.html b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.html index 15b0b07f7..c3f16dee7 100644 --- a/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.html +++ b/dependency-check-core/apidocs/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.html @@ -2,16 +2,16 @@ - + -ConnectionFactory (Dependency-Check Core 1.3.1 API) - +ConnectionFactory (Dependency-Check Core 1.3.2 API) + @@ -38,7 +38,7 @@ + +static String +UPGRADE_HELP_URL +
    The URL that discusses upgrading non-H2 databases.
    + + @@ -218,7 +224,7 @@ extends - @@ -301,7 +318,7 @@ extends @@ -97,7 +97,7 @@ Project Information - +
  • @@ -140,13 +140,6 @@ Surefire Report
  • -
  • - - - - Failsafe Report -
  • -
  • diff --git a/dependency-check-core/dependency-analysis.html b/dependency-check-core/dependency-analysis.html index a88d907c0..4979b1fd7 100644 --- a/dependency-check-core/dependency-analysis.html +++ b/dependency-check-core/dependency-analysis.html @@ -1,13 +1,13 @@ - + dependency-check-core – Dependencies Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -97,7 +97,7 @@ Project Information - +
  • @@ -138,13 +138,6 @@ Surefire Report
  • -
  • - - - - Failsafe Report -
  • -
  • @@ -260,7 +253,7 @@ com.google.code.findbugs annotations -3.0.0 +3.0.1u2 compile jar @@ -268,7 +261,7 @@ org.slf4j slf4j-api -1.7.12 +1.7.13 compile jar @@ -276,7 +269,7 @@ org.owasp dependency-check-utils -1.3.1 +1.3.2 compile jar @@ -292,7 +285,7 @@ org.jmockit jmockit -1.19 +1.20 test jar diff --git a/dependency-check-core/dependency-updates-report.html b/dependency-check-core/dependency-updates-report.html index 3d11a3e9d..7497f1920 100644 --- a/dependency-check-core/dependency-updates-report.html +++ b/dependency-check-core/dependency-updates-report.html @@ -1,13 +1,13 @@ - + dependency-check-core – Dependency Updates Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -97,7 +97,7 @@ Project Information - +
  • @@ -140,13 +140,6 @@ Surefire Report
  • -
  • - - - - Failsafe Report -
  • -
  • @@ -251,7 +244,7 @@ # of dependencies using the latest version available -28 +25 # of dependencies where the next version available is smaller than an incremental version update @@ -259,7 +252,7 @@ # of dependencies where the next version available is an incremental version update -6 +9 # of dependencies where the next version available is a minor version update @@ -311,7 +304,7 @@ com.google.code.findbugs annotations -3.0.0 +3.0.1u2 jar @@ -476,7 +469,7 @@ 4.8.0 5.0.0 - + org.apache.maven maven-core 3.3.3 @@ -484,11 +477,11 @@ jar - +3.3.9 - + org.apache.maven maven-plugin-api 3.3.3 @@ -496,11 +489,11 @@ jar - +3.3.9 - + org.apache.maven maven-settings 3.3.3 @@ -508,7 +501,7 @@ jar - +3.3.9 @@ -599,7 +592,7 @@ org.jmockit jmockit -1.19 +1.20 test jar @@ -623,7 +616,7 @@ org.slf4j slf4j-api -1.7.12 +1.7.13 jar @@ -635,7 +628,7 @@ org.slf4j slf4j-simple -1.7.12 +1.7.13 jar @@ -818,7 +811,7 @@ org.owasp dependency-check-utils -1.3.1 +1.3.2 compile jar @@ -951,7 +944,7 @@ annotations Current Version -3.0.0 +3.0.1u2 Scope @@ -1014,7 +1007,7 @@ jar Newer versions -1.4.177 Next Minor
    1.4.178
    1.4.179
    1.4.180
    1.4.181
    1.4.182
    1.4.183
    1.4.184
    1.4.185
    1.4.186
    1.4.187
    1.4.188
    1.4.189 Latest Minor +1.4.177 Next Minor
    1.4.178
    1.4.179
    1.4.180
    1.4.181
    1.4.182
    1.4.183
    1.4.184
    1.4.185
    1.4.186
    1.4.187
    1.4.188
    1.4.189
    1.4.190 Latest Minor

    com.hazelcast:hazelcast

    @@ -1041,7 +1034,7 @@ -
    jar
    Newer versions2.5.1 Next Incremental
    2.6 Next Minor
    2.6.1
    2.6.2
    2.6.3
    2.6.4
    2.6.5
    2.6.6
    2.6.7
    2.6.8
    2.6.9
    3.0-RC1
    3.0-RC2 Latest Minor
    3.0 Next Major
    3.0.1
    3.0.2
    3.0.3
    3.1
    3.1.1
    3.1.2
    3.1.3
    3.1.4
    3.1.5
    3.1.6
    3.1.7
    3.1.8
    3.2-RC1
    3.2-RC2
    3.2
    3.2.1
    3.2.2
    3.2.3
    3.2.4
    3.2.5
    3.2.6
    3.3-RC1
    3.3-RC2
    3.3-RC3
    3.3
    3.3-EA
    3.3-EA2
    3.3.1
    3.3.2
    3.3.3
    3.3.4
    3.3.5
    3.4
    3.4-EA
    3.4.1
    3.4.2
    3.4.5
    3.4.6
    3.5-EA
    3.5.1
    3.5.2 Latest Major
    +2.5.1 Next Incremental
    2.6 Next Minor
    2.6.1
    2.6.2
    2.6.3
    2.6.4
    2.6.5
    2.6.6
    2.6.7
    2.6.8
    2.6.9
    3.0-RC1
    3.0-RC2 Latest Minor
    3.0 Next Major
    3.0.1
    3.0.2
    3.0.3
    3.1
    3.1.1
    3.1.2
    3.1.3
    3.1.4
    3.1.5
    3.1.6
    3.1.7
    3.1.8
    3.2-RC1
    3.2-RC2
    3.2
    3.2.1
    3.2.2
    3.2.3
    3.2.4
    3.2.5
    3.2.6
    3.3-RC1
    3.3-RC2
    3.3-RC3
    3.3
    3.3-EA
    3.3-EA2
    3.3.1
    3.3.2
    3.3.3
    3.3.4
    3.3.5
    3.4
    3.4-EA
    3.4.1
    3.4.2
    3.4.5
    3.4.6
    3.5-EA
    3.5.1
    3.5.2
    3.5.3
    3.5.4
    3.6-EA
    3.6-EA2 Latest Major

    com.sun.mail:mailapi

    @@ -1365,7 +1358,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-core

    @@ -1392,7 +1385,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-queryparser

    @@ -1419,7 +1412,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-test-framework

    @@ -1446,13 +1439,13 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.maven:maven-core

    - + @@ -1470,13 +1463,16 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven:maven-plugin-api

    - + @@ -1494,13 +1490,16 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven:maven-settings

    - + @@ -1518,7 +1517,10 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven.plugin-testing:maven-plugin-testing-harness

    @@ -1695,7 +1697,7 @@ -
    jar
    Newer versions2.1.6 Next Incremental
    2.1.8
    2.1.8.1 Latest Incremental
    2.2.1 Next Minor
    2.2.1.1
    2.2.3
    2.2.3.1
    2.3.1
    2.3.1.1
    2.3.1.2
    2.3.3
    2.3.4
    2.3.4.1
    2.3.7
    2.3.8
    2.3.12
    2.3.14
    2.3.14.1
    2.3.14.2
    2.3.14.3
    2.3.15
    2.3.15.1
    2.3.15.2
    2.3.15.3
    2.3.16
    2.3.16.1
    2.3.16.2
    2.3.16.3
    2.3.20
    2.3.20.1
    2.3.24
    2.5-BETA1 Latest Minor
    +2.1.6 Next Incremental
    2.1.8
    2.1.8.1 Latest Incremental
    2.2.1 Next Minor
    2.2.1.1
    2.2.3
    2.2.3.1
    2.3.1
    2.3.1.1
    2.3.1.2
    2.3.3
    2.3.4
    2.3.4.1
    2.3.7
    2.3.8
    2.3.12
    2.3.14
    2.3.14.1
    2.3.14.2
    2.3.14.3
    2.3.15
    2.3.15.1
    2.3.15.2
    2.3.15.3
    2.3.16
    2.3.16.1
    2.3.16.2
    2.3.16.3
    2.3.20
    2.3.20.1
    2.3.24
    2.3.24.1
    2.5-BETA1
    2.5-BETA2 Latest Minor

    org.apache.velocity:velocity

    @@ -1797,7 +1799,7 @@ -
    war
    Newer versions4.1 Next Minor
    +4.1 Next Minor
    4.1.1 Latest Minor

    org.hamcrest:hamcrest-core

    @@ -1836,7 +1838,7 @@ - + @@ -1911,7 +1913,7 @@ - + @@ -1935,7 +1937,7 @@ - + @@ -1959,7 +1961,7 @@ - + @@ -1995,7 +1997,7 @@ -
    jmockit
    Current Version1.19
    1.20
    Scope test
    dependency-check-utils
    Current Version1.3.1
    1.3.2
    Scope compile
    slf4j-api
    Current Version1.7.12
    1.7.13
    Scope
    slf4j-simple
    Current Version1.7.12
    1.7.13
    Scope
    jar
    Newer versions2.5.6 Next Incremental
    2.5.6.SEC01
    2.5.6.SEC02
    2.5.6.SEC03 Latest Incremental
    3.0.0.RELEASE Next Major
    3.0.1.RELEASE
    3.0.2.RELEASE
    3.0.3.RELEASE
    3.0.4.RELEASE
    3.0.5.RELEASE
    3.0.6.RELEASE
    3.0.7.RELEASE
    3.1.0.RELEASE
    3.1.1.RELEASE
    3.1.2.RELEASE
    3.2.0.RELEASE
    3.2.1.RELEASE
    3.2.2.RELEASE
    3.2.3.RELEASE
    3.2.4.RELEASE
    3.2.5.RELEASE
    3.2.6.RELEASE
    3.2.7.RELEASE
    3.2.8.RELEASE
    3.2.9.RELEASE
    3.2.10.RELEASE
    3.2.11.RELEASE
    3.2.12.RELEASE
    3.2.13.RELEASE
    3.2.14.RELEASE
    4.0.0.RELEASE
    4.0.1.RELEASE
    4.0.2.RELEASE
    4.0.3.RELEASE
    4.0.4.RELEASE
    4.0.5.RELEASE
    4.0.6.RELEASE
    4.0.7.RELEASE
    4.0.8.RELEASE
    4.0.9.RELEASE
    4.1.0.RELEASE
    4.1.1.RELEASE
    4.1.2.RELEASE
    4.1.3.RELEASE
    4.1.4.RELEASE
    4.1.5.RELEASE
    4.1.6.RELEASE
    4.1.7.RELEASE
    4.2.0.RELEASE
    4.2.1.RELEASE Latest Major
    +2.5.6 Next Incremental
    2.5.6.SEC01
    2.5.6.SEC02
    2.5.6.SEC03 Latest Incremental
    3.0.0.RELEASE Next Major
    3.0.1.RELEASE
    3.0.2.RELEASE
    3.0.3.RELEASE
    3.0.4.RELEASE
    3.0.5.RELEASE
    3.0.6.RELEASE
    3.0.7.RELEASE
    3.1.0.RELEASE
    3.1.1.RELEASE
    3.1.2.RELEASE
    3.2.0.RELEASE
    3.2.1.RELEASE
    3.2.2.RELEASE
    3.2.3.RELEASE
    3.2.4.RELEASE
    3.2.5.RELEASE
    3.2.6.RELEASE
    3.2.7.RELEASE
    3.2.8.RELEASE
    3.2.9.RELEASE
    3.2.10.RELEASE
    3.2.11.RELEASE
    3.2.12.RELEASE
    3.2.13.RELEASE
    3.2.14.RELEASE
    3.2.15.RELEASE
    4.0.0.RELEASE
    4.0.1.RELEASE
    4.0.2.RELEASE
    4.0.3.RELEASE
    4.0.4.RELEASE
    4.0.5.RELEASE
    4.0.6.RELEASE
    4.0.7.RELEASE
    4.0.8.RELEASE
    4.0.9.RELEASE
    4.1.0.RELEASE
    4.1.1.RELEASE
    4.1.2.RELEASE
    4.1.3.RELEASE
    4.1.4.RELEASE
    4.1.5.RELEASE
    4.1.6.RELEASE
    4.1.7.RELEASE
    4.1.8.RELEASE
    4.2.0.RELEASE
    4.2.1.RELEASE
    4.2.2.RELEASE
    4.2.3.RELEASE Latest Major

    org.springframework.retry:spring-retry

    @@ -2049,7 +2051,7 @@ -
    jar
    Newer versions3.0.1.RELEASE Next Incremental
    3.0.2.RELEASE
    3.0.3.RELEASE
    3.0.4.RELEASE
    3.0.5.RELEASE
    3.0.6.RELEASE
    3.0.7.RELEASE
    3.0.8.RELEASE Latest Incremental
    3.1.0.RELEASE Next Minor
    3.1.1.RELEASE
    3.1.2.RELEASE
    3.1.3.RELEASE
    3.1.4.RELEASE
    3.1.5.RELEASE
    3.1.6.RELEASE
    3.1.7.RELEASE
    3.2.0.RELEASE
    3.2.1.RELEASE
    3.2.2.RELEASE
    3.2.3.RELEASE
    3.2.4.RELEASE
    3.2.5.RELEASE
    3.2.6.RELEASE
    3.2.7.RELEASE
    3.2.8.RELEASE Latest Minor
    4.0.0.RELEASE Next Major
    4.0.1.RELEASE
    4.0.2.RELEASE Latest Major
    +3.0.1.RELEASE Next Incremental
    3.0.2.RELEASE
    3.0.3.RELEASE
    3.0.4.RELEASE
    3.0.5.RELEASE
    3.0.6.RELEASE
    3.0.7.RELEASE
    3.0.8.RELEASE Latest Incremental
    3.1.0.RELEASE Next Minor
    3.1.1.RELEASE
    3.1.2.RELEASE
    3.1.3.RELEASE
    3.1.4.RELEASE
    3.1.5.RELEASE
    3.1.6.RELEASE
    3.1.7.RELEASE
    3.2.0.RELEASE
    3.2.1.RELEASE
    3.2.2.RELEASE
    3.2.3.RELEASE
    3.2.4.RELEASE
    3.2.5.RELEASE
    3.2.6.RELEASE
    3.2.7.RELEASE
    3.2.8.RELEASE
    3.2.9.RELEASE Latest Minor
    4.0.0.RELEASE Next Major
    4.0.1.RELEASE
    4.0.2.RELEASE
    4.0.3.RELEASE Latest Major

    uk.ltd.getahead:dwr

    diff --git a/dependency-check-core/findbugs.html b/dependency-check-core/findbugs.html index a3226cdaa..1e8b21321 100644 --- a/dependency-check-core/findbugs.html +++ b/dependency-check-core/findbugs.html @@ -1,13 +1,13 @@ - + dependency-check-core – FindBugs Bug Detector Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -97,7 +97,7 @@ Project Information - +
  • @@ -140,13 +140,6 @@ Surefire Report
  • -
  • - - - - Failsafe Report -
  • -
  • @@ -259,8 +252,8 @@
  • - - + +
    Errors Missing Classes
    13271334 0 0
    -
    -

    org.owasp.dependencycheck.analyzer.ArchiveAnalyzer

    - - - - - - - - - - - - -
    BugCategoryDetailsLinePriority
    Possible null pointer dereference in org.owasp.dependencycheck.analyzer.ArchiveAnalyzer.close() due to return value of called methodSTYLENP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE198Medium
    -
    -

    org.owasp.dependencycheck.analyzer.AssemblyAnalyzer

    - - - - - - - - - - - - -
    BugCategoryDetailsLinePriority
    org.owasp.dependencycheck.analyzer.AssemblyAnalyzer.initializeFileTypeAnalyzer() discards result of readLine after checking if it is non-nullSTYLERV_DONT_JUST_NULL_CHECK_READLINE242Medium
    +org.owasp.dependencycheck.analyzer.RubyBundleAuditAnalyzer +1

    org.owasp.dependencycheck.analyzer.CMakeAnalyzer

    - + - + - +
    Bug Category Details Line Priority
    Found reliance on default encoding in org.owasp.dependencycheck.analyzer.CMakeAnalyzer.analyzeSetVersionCommand(Dependency, Engine, String): String.getBytes() I18N DM_DEFAULT_ENCODING199216 High

    org.owasp.dependencycheck.analyzer.FalsePositiveAnalyzer

    - + - + - + -
    Bug Category Details Line Priority
    Possible null pointer dereference of currentVersion on branch that might be infeasible in org.owasp.dependencycheck.analyzer.FalsePositiveAnalyzer.removeSpuriousCPE(Dependency) STYLE NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE 188 Medium
    Possible null pointer dereference of nextVersion on branch that might be infeasible in org.owasp.dependencycheck.analyzer.FalsePositiveAnalyzer.removeSpuriousCPE(Dependency) STYLE NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE 188Medium
    +Medium
    -

    org.owasp.dependencycheck.analyzer.PythonPackageAnalyzer

    +

    org.owasp.dependencycheck.analyzer.RubyBundleAuditAnalyzer

    - + - - - - - -
    Bug Category Details Line Priority
    Possible null pointer dereference in org.owasp.dependencycheck.analyzer.PythonPackageAnalyzer.analyzeFileType(Dependency, Engine) due to return value of called methodSTYLENP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE178Medium
    -
    -

    org.owasp.dependencycheck.data.nvdcve.DriverLoader

    - - - - - - - - + - - + +
    BugCategoryDetailsLinePriority
    Possible null pointer dereference in org.owasp.dependencycheck.data.nvdcve.DriverLoader.load(String, String) due to return value of called methodDereference of the result of readLine() without nullcheck in org.owasp.dependencycheck.analyzer.RubyBundleAuditAnalyzer.initializeFileTypeAnalyzer() STYLENP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE87NP_DEREFERENCE_OF_READLINE_VALUE116 Medium
    diff --git a/dependency-check-core/index.html b/dependency-check-core/index.html index e65e6db7d..31c22ccd9 100644 --- a/dependency-check-core/index.html +++ b/dependency-check-core/index.html @@ -1,13 +1,13 @@ - + dependency-check-core – About @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -95,7 +95,7 @@ Project Information - +
  • diff --git a/dependency-check-core/integration.html b/dependency-check-core/integration.html index 2ad5fbccf..0ea4e5078 100644 --- a/dependency-check-core/integration.html +++ b/dependency-check-core/integration.html @@ -1,13 +1,13 @@ - + dependency-check-core – Continuous Integration @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -146,7 +146,7 @@ - +
  • diff --git a/dependency-check-core/issue-tracking.html b/dependency-check-core/issue-tracking.html index 5cd916eac..373abfa07 100644 --- a/dependency-check-core/issue-tracking.html +++ b/dependency-check-core/issue-tracking.html @@ -1,13 +1,13 @@ - + dependency-check-core – Issue Tracking @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -146,7 +146,7 @@ - +
  • diff --git a/dependency-check-core/license.html b/dependency-check-core/license.html index 32a9c08c7..a082fb084 100644 --- a/dependency-check-core/license.html +++ b/dependency-check-core/license.html @@ -1,13 +1,13 @@ - + dependency-check-core – Project License @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -146,7 +146,7 @@ - +
  • diff --git a/dependency-check-core/mail-lists.html b/dependency-check-core/mail-lists.html index 3c0482945..f0bfc5d1c 100644 --- a/dependency-check-core/mail-lists.html +++ b/dependency-check-core/mail-lists.html @@ -1,13 +1,13 @@ - + dependency-check-core – Project Mailing Lists @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -146,7 +146,7 @@ - +
  • diff --git a/dependency-check-core/plugin-updates-report.html b/dependency-check-core/plugin-updates-report.html index 51ce809e3..89a94c7ad 100644 --- a/dependency-check-core/plugin-updates-report.html +++ b/dependency-check-core/plugin-updates-report.html @@ -1,13 +1,13 @@ - + dependency-check-core – Plugin Updates Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -97,7 +97,7 @@ Project Information - +
  • @@ -140,13 +140,6 @@ Surefire Report
  • -
  • - - - - Failsafe Report -
  • -
  • @@ -263,7 +256,7 @@ # of plugins where the next version available is a minor version update -0 +2 # of plugins where the next version available is a major version update @@ -299,7 +292,7 @@ org.apache.maven.plugins maven-assembly-plugin -2.5.5 +2.6 @@ -359,7 +352,7 @@ org.apache.maven.plugins maven-failsafe-plugin -2.18.1 +2.19 @@ -396,16 +389,26 @@ + +org.apache.maven.plugins +maven-javadoc-plugin +2.9.1 + + +2.10 + + + org.apache.maven.plugins maven-release-plugin -2.5.2 +2.5.3 - + org.apache.maven.plugins maven-resources-plugin @@ -415,7 +418,7 @@ - + org.apache.maven.plugins maven-site-plugin @@ -425,6 +428,16 @@ + + +org.apache.maven.plugins +maven-source-plugin +2.2.1 + + +2.3 + + org.apache.maven.plugins @@ -500,7 +513,7 @@ maven-assembly-plugin Current Version -2.5.5 +2.6

    Plugin org.apache.maven.plugins:maven-clean-plugin

    @@ -590,7 +603,7 @@ -
    maven-failsafe-plugin
    Current Version2.18.1
    +2.19

    Plugin org.apache.maven.plugins:maven-gpg-plugin

    @@ -637,6 +650,24 @@
    Current Version 2.6
    +

    Plugin org.apache.maven.plugins:maven-javadoc-plugin

    + + + + + + + + + + + + + + + +
    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-javadoc-plugin
    Current Version2.9.1
    Newer versions2.10 Next Minor
    2.10.1
    2.10.2
    2.10.3 Latest Minor
    +

    Plugin org.apache.maven.plugins:maven-release-plugin

    @@ -650,7 +681,7 @@ -
    maven-release-plugin
    Current Version2.5.2
    +2.5.3

    Plugin org.apache.maven.plugins:maven-resources-plugin

    @@ -682,6 +713,24 @@
    Current Version 3.4
    +

    Plugin org.apache.maven.plugins:maven-source-plugin

    + + + + + + + + + + + + + + + +
    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-source-plugin
    Current Version2.2.1
    Newer versions2.3 Next Minor
    2.4 Latest Minor
    +

    Plugin org.apache.maven.plugins:maven-surefire-plugin

    diff --git a/dependency-check-core/pmd.html b/dependency-check-core/pmd.html index 093a116e7..d5fe93d14 100644 --- a/dependency-check-core/pmd.html +++ b/dependency-check-core/pmd.html @@ -1,13 +1,13 @@ - + dependency-check-core – PMD Results @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -97,7 +97,7 @@ Project Information - +
  • @@ -140,13 +140,6 @@ Surefire Report
  • -
  • - - - - Failsafe Report -
  • -
  • @@ -250,24 +243,6 @@

    Files

    -

    org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.java

    -
  • - - - - - -
    ViolationLine
    These nested if statements could be combined419422
    -
    -

    org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java

    - - - - - - -
    ViolationLine
    Avoid empty while statements242244
    -

    org/owasp/dependencycheck/analyzer/CPEAnalyzer.java

    @@ -275,22 +250,13 @@ - + - + -
    Line
    These nested if statements could be combined535540
    542547
    These nested if statements could be combined536539
    543546
    These nested if statements could be combined545548
    -
    -

    org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java

    - - - - - - -
    ViolationLine
    These nested if statements could be combined217219
    +552555

    org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.java

    @@ -322,24 +288,6 @@
    Useless parentheses. 374
    -

    org/owasp/dependencycheck/analyzer/NexusAnalyzer.java

    - - - - - - -
    ViolationLine
    Useless parentheses.107
    -
    -

    org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.java

    - - - - - - -
    ViolationLine
    Useless parentheses.76
    -

    org/owasp/dependencycheck/analyzer/OpenSSLAnalyzer.java

    @@ -358,6 +306,21 @@
    These nested if statements could be combined 283286
    +

    org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java

    + + + + + + + + + + + + +
    ViolationLine
    These nested if statements could be combined247249
    Useless parentheses.255
    Useless parentheses.266
    +

    org/owasp/dependencycheck/data/cpe/IndexEntry.java

    @@ -386,10 +349,10 @@ - + -
    Line
    These nested if statements could be combined629631
    601603
    These nested if statements could be combined736738
    +708710

    org/owasp/dependencycheck/data/nvdcve/DriverShim.java

    @@ -407,7 +370,7 @@ -
    Line
    Useless parentheses.116
    +147

    org/owasp/dependencycheck/dependency/Identifier.java

    @@ -481,39 +444,27 @@
    Useless parentheses. 197
    -

    org/owasp/dependencycheck/utils/ExtractionUtil.java

    - - - - - - - - - -
    ViolationLine
    These nested if statements could be combined186191
    These nested if statements could be combined268273
    -

    org/owasp/dependencycheck/xml/pom/License.java

    - + - + - +
    Violation Line
    Useless parentheses. 118
    Useless parentheses. 121

    org/owasp/dependencycheck/xml/pom/PomHandler.java

    - + - + - +
    Violation Line
    These nested if statements could be combined 168174
    These nested if statements could be combined 169173
    diff --git a/dependency-check-core/project-info.html b/dependency-check-core/project-info.html index 8efa35152..925845682 100644 --- a/dependency-check-core/project-info.html +++ b/dependency-check-core/project-info.html @@ -1,13 +1,13 @@ - + dependency-check-core – Project Information @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -146,7 +146,7 @@ - +
  • diff --git a/dependency-check-core/project-reports.html b/dependency-check-core/project-reports.html index c661ace4a..853b2e6c3 100644 --- a/dependency-check-core/project-reports.html +++ b/dependency-check-core/project-reports.html @@ -1,13 +1,13 @@ - + dependency-check-core – Generated Reports @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -97,7 +97,7 @@ Project Information - +
  • Project Reports @@ -138,13 +138,6 @@ Surefire Report
  • -
  • - - - - Failsafe Report -
  • -
  • @@ -269,30 +262,27 @@ Surefire Report Report on the test results of the project. -Failsafe Report -Report on the integration test results of the project. - Cobertura Test Coverage Cobertura Test Coverage Report. - + FindBugs Generates a source code report with the FindBugs Library. - + Tag List Report on various tags found in the code. - + Dependency Updates Report Provides details of the dependencies which have updated versions available. - + Plugin Updates Report Provides details of the plugins used by this project which have newer versions available. - + Checkstyle Report on coding style conventions. - + CPD Duplicate code detection. - + PMD Verification of coding rules. diff --git a/dependency-check-core/project-summary.html b/dependency-check-core/project-summary.html index aa37c20e4..650927bd7 100644 --- a/dependency-check-core/project-summary.html +++ b/dependency-check-core/project-summary.html @@ -1,13 +1,13 @@ - + dependency-check-core – Project Summary @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -146,7 +146,7 @@ - +
  • @@ -238,7 +238,7 @@ dependency-check-core Version -1.3.1 +1.3.2 Type jar diff --git a/dependency-check-core/source-repository.html b/dependency-check-core/source-repository.html index 4c2e96116..1cea675e4 100644 --- a/dependency-check-core/source-repository.html +++ b/dependency-check-core/source-repository.html @@ -1,13 +1,13 @@ - + dependency-check-core – Source Repository @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -146,7 +146,7 @@ - +
  • diff --git a/dependency-check-core/surefire-report.html b/dependency-check-core/surefire-report.html index 76f9c13cf..7196a2f9e 100644 --- a/dependency-check-core/surefire-report.html +++ b/dependency-check-core/surefire-report.html @@ -1,13 +1,13 @@ - + dependency-check-core – Surefire Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -97,7 +97,7 @@ Project Information - +
  • @@ -138,13 +138,6 @@ Surefire Report
  • -
  • - - - - Failsafe Report -
  • -
  • @@ -275,12 +268,12 @@ function toggleDisplay(elementId) { Success Rate Time -220 +224 0 0 -5 -97.727% -13.223
    +9 +95.982% +12.629

    Note: failures are anticipated and checked for with assertions while errors are unanticipated.


    Package List

    @@ -301,7 +294,7 @@ function toggleDisplay(elementId) { 0 0 100% -0.031 +0 org.owasp.dependencycheck.data.cwe 1 @@ -325,7 +318,7 @@ function toggleDisplay(elementId) { 0 0 100% -1.079 +0.845 org.owasp.dependencycheck.dependency 26 @@ -341,15 +334,15 @@ function toggleDisplay(elementId) { 0 0 100% -0.267 +0.516 org.owasp.dependencycheck.analyzer -68 +72 0 0 -1 -98.529% -8.916 +5 +93.056% +7.641 org.owasp.dependencycheck.data.update 6 @@ -357,15 +350,15 @@ function toggleDisplay(elementId) { 0 0 100% -1.808 +2.432 org.owasp.dependencycheck.suppression -37 +36 0 0 0 100% -0.001 +0 org.owasp.dependencycheck.xml.pom 23 @@ -373,7 +366,7 @@ function toggleDisplay(elementId) { 0 0 100% -0.001 +0 org.owasp.dependencycheck.data.cpe 1 @@ -389,7 +382,7 @@ function toggleDisplay(elementId) { 0 0 100% -0.032 +0.031 org.owasp.dependencycheck.utils 13 @@ -400,12 +393,12 @@ function toggleDisplay(elementId) { 0 org.owasp.dependencycheck.data.nvdcve -6 +7 0 0 0 100% -0.11 +0.647 org.owasp.dependencycheck.data.lucene 10 @@ -413,7 +406,7 @@ function toggleDisplay(elementId) { 0 0 100% -0.946
    +0.485

    Note: package statistics are not computed recursively, they only sum up all of its testsuites numbers.

    org.owasp.dependencycheck.data.composer

    @@ -435,7 +428,7 @@ function toggleDisplay(elementId) { 0 0 100% -0.031
    +0

    org.owasp.dependencycheck.data.cwe

    @@ -498,7 +491,7 @@ function toggleDisplay(elementId) { - + @@ -516,7 +509,7 @@ function toggleDisplay(elementId) { - + @@ -525,7 +518,7 @@ function toggleDisplay(elementId) { - + @@ -594,7 +587,7 @@ function toggleDisplay(elementId) { -
    0 0 100%0.954
    0.766
    NvdCveInfoTest0 0 100%0.031
    0.016
    NvdCve_2_0_HandlerTest0 0 100%0.094
    0.063
    UpdateableNvdCveTest0 0 100%0.267
    +0.516

    org.owasp.dependencycheck.analyzer

    @@ -615,7 +608,7 @@ function toggleDisplay(elementId) { - + @@ -624,7 +617,7 @@ function toggleDisplay(elementId) { - + @@ -633,8 +626,17 @@ function toggleDisplay(elementId) { - + + + + + + + + + + @@ -642,8 +644,8 @@ function toggleDisplay(elementId) { - - + + @@ -651,8 +653,8 @@ function toggleDisplay(elementId) { - - + + @@ -660,8 +662,8 @@ function toggleDisplay(elementId) { - - + + @@ -669,8 +671,8 @@ function toggleDisplay(elementId) { - - + + @@ -678,8 +680,8 @@ function toggleDisplay(elementId) { - - + + @@ -688,7 +690,7 @@ function toggleDisplay(elementId) { - + @@ -696,8 +698,8 @@ function toggleDisplay(elementId) { - - + + @@ -705,8 +707,8 @@ function toggleDisplay(elementId) { - - + + @@ -714,8 +716,8 @@ function toggleDisplay(elementId) { - - + + @@ -724,7 +726,7 @@ function toggleDisplay(elementId) { - + @@ -733,7 +735,7 @@ function toggleDisplay(elementId) { - + @@ -742,7 +744,7 @@ function toggleDisplay(elementId) { - + @@ -750,8 +752,8 @@ function toggleDisplay(elementId) { - - + + @@ -760,6 +762,15 @@ function toggleDisplay(elementId) { + + + + + + + + + @@ -789,7 +800,7 @@ function toggleDisplay(elementId) { - + @@ -798,7 +809,7 @@ function toggleDisplay(elementId) { -
    0 0 100%0.015
    0.031
    AbstractSuppressionAnalyzerTest0 0 100%0.438
    0.313
    AnalyzerServiceTest0 0 100%0.063
    0.047
    ArchiveAnalyzerTest10010%0
    AssemblyAnalyzerTest 50 1 80%0.797
    0.635
    AutoconfAnalyzerTest 60 0 100%0.172
    0.094
    CMakeAnalyzerTest 50 0 100%1.011
    0.853
    ComposerLockAnalyzerTest 30 0 100%0.141
    0.122
    DependencyBundlingAnalyzerTest 50 0 100%0
    0.001
    FalsePositiveAnalyzerTest 30 100% 0
    FileNameAnalyzerTest 50 0 100%0.01
    0.006
    HintAnalyzerTest 30 0 100%6.05
    5.446
    JarAnalyzerTest 30 0 100%0.156
    0.062
    NodePackageAnalyzerTest 30 100% 0
    NuspecAnalyzerTest 30 100% 0
    OpenSSLAnalyzerTest 40 100% 0
    PythonDistributionAnalyzerTest 80 0 100%0.063
    0.031
    PythonPackageAnalyzerTest 30 100% 0
    RubyBundleAuditAnalyzerTest30030%0
    RubyGemspecAnalyzerTest0 0 100%1.667
    2.276
    EngineVersionCheckTest0 0 100%0.141
    +0.156

    org.owasp.dependencycheck.suppression

    @@ -841,12 +852,12 @@ function toggleDisplay(elementId) { - + -
    SuppressionRuleTest3130 0 0 0 100%0.001
    +0

    org.owasp.dependencycheck.xml.pom

    @@ -867,7 +878,7 @@ function toggleDisplay(elementId) { - + @@ -918,7 +929,7 @@ function toggleDisplay(elementId) { -
    0 0 100%0.001
    0
    PomUtilsTest0 0 100%0.032
    +0.031

    org.owasp.dependencycheck.utils

    @@ -980,6 +991,15 @@ function toggleDisplay(elementId) { + + + + + + + + + @@ -987,7 +1007,7 @@ function toggleDisplay(elementId) { -
    Success Rate Time
    ConnectionFactoryTest1000100%0.569
    DriverLoaderTest 60 0 100%0.11
    +0.078

    org.owasp.dependencycheck.data.lucene

    @@ -1026,7 +1046,7 @@ function toggleDisplay(elementId) { - + @@ -1035,7 +1055,7 @@ function toggleDisplay(elementId) { -
    0 0 100%0.055
    0.078
    UrlTokenizingFilterTest0 0 100%0.891

    +0.407

    Test Cases

    [Summary] [Package List] [Test Cases]

    @@ -1044,48 +1064,60 @@ function toggleDisplay(elementId) { - -
    testNewHashSet0.015
    +testNewHashSet +0.031

    AbstractSuppressionAnalyzerTest

    - - + + - - + + - - + + - +
    testFailureToLocateSuppressionFileAnywhere0.274
    testFailureToLocateSuppressionFileAnywhere0.188
    testGetRulesFromSuppressionFileFromURL0.133
    testGetRulesFromSuppressionFileFromURL0.109
    testGetRulesFromSuppressionFileInClasspath0.031
    testGetRulesFromSuppressionFileInClasspath0.016
    testGetSupportedExtensionstestGetSupportedExtensions 0

    AnalyzerServiceTest

    - -
    testGetAnalyzers0.063
    +testGetAnalyzers +0.047 +
    +

    ArchiveAnalyzerTest

    + + + + + + + + +
    testZippableExtensions +0
    skipped

    AssemblyAnalyzerTest

    - - + + - - + + - @@ -1094,396 +1126,426 @@ function toggleDisplay(elementId) { - - + + - -
    testGetName0.312
    testGetName0.235
    testAnalysis0.156
    testAnalysis0.109
    testWithSettingMono +testWithSettingMono 0
    testNonexistent0.094
    testNonexistent0.087
    testLog4Net0.235
    +testLog4Net +0.204

    AutoconfAnalyzerTest

    - + + + + + + + + + + + + + - - - - - + - - - - - - - - - +
    testAnalyzeReadableConfigureScripttestAnalyzeReadableConfigureScript0.031
    testGetName0
    testSupportsFileExtension0
    testAnalyzeConfigureScript 0.063
    testGetName0
    testSupportsFileExtensiontestAnalyzeConfigureAC1 0
    testAnalyzeConfigureScript0.093
    testAnalyzeConfigureAC10.016
    testAnalyzeConfigureAC2testAnalyzeConfigureAC2 0

    CMakeAnalyzerTest

    - + - + - + - - + + - -
    testAnalyzeCMakeListsZlibtestAnalyzeCMakeListsZlib 0
    testAnalyzeCMakeListsOpenCVtestAnalyzeCMakeListsOpenCV 0.015
    testGetNametestGetName 0
    testAnalyzeCMakeListsOpenCV3rdParty0.996
    testAnalyzeCMakeListsOpenCV3rdParty0.822
    testAccept0
    +testAccept +0.016

    ComposerLockAnalyzerTest

    - + - - + + - +
    testGetNametestGetName 0
    testAnalyzePackageJson0.141
    testAnalyzePackageJson0.122
    testSupportsFilestestSupportsFiles 0

    DependencyBundlingAnalyzerTest

    - - + + - + - + - + - +
    testAnalyze0
    testAnalyze0.001
    testGetAnalysisPhasetestGetAnalysisPhase 0
    testGetNametestGetName 0
    testFirstPathIsShortesttestFirstPathIsShortest 0
    testIsCoretestIsCore 0

    FalsePositiveAnalyzerTest

    - + - + - +
    testAnalyzetestAnalyze 0
    testGetAnalysisPhasetestGetAnalysisPhase 0
    testGetNametestGetName 0

    FileNameAnalyzerTest

    - - + + - - - - - + + + + + - + - +
    testAnalyze0.009
    testAnalyze0.005
    testClose0
    testGetAnalysisPhasetestClose 0.001
    testGetAnalysisPhase0
    testGetNametestGetName 0
    testInitializetestInitialize 0

    HintAnalyzerTest

    - - + + - + - +
    testAnalyze6.05
    testAnalyze5.446
    testGetAnalysisPhasetestGetAnalysisPhase 0
    testGetNametestGetName 0

    JarAnalyzerTest

    - - + + - + - +
    testAnalyze0.156
    testAnalyze0.062
    testGetNametestGetName 0
    testAcceptSupportedExtensionstestAcceptSupportedExtensions 0

    NodePackageAnalyzerTest

    - + - + - +
    testGetNametestGetName 0
    testAnalyzePackageJsontestAnalyzePackageJson 0
    testSupportsFilestestSupportsFiles 0

    NuspecAnalyzerTest

    - + - + - +
    testSupportsFileExtensionstestSupportsFileExtensions 0
    testGetAnalysisPhazetestGetAnalysisPhaze 0
    testGetAnalyzerNametestGetAnalyzerName 0

    OpenSSLAnalyzerTest

    - + - + - + - +
    testGetNametestGetName 0
    testVersionConstantExamplestestVersionConstantExamples 0
    testOpenSSLVersionHeaderFiletestOpenSSLVersionHeaderFile 0
    testAccepttestAccept 0

    PythonDistributionAnalyzerTest

    - - - - - - - - - + - - + + - + + + + + + + + + - + - + - -
    testAnalyzeEggFolder0.016
    testGetName0
    testAnalyzeEggArchivetestAnalyzeEggFolder 0
    testAnalyzeEggArchiveNamedZip0.016
    testGetName0
    testAnalyzeWheeltestAnalyzeEggArchive0.016
    testAnalyzeEggArchiveNamedZip0
    testAnalyzeWheel 0.015
    testAnalyzeEggInfoFoldertestAnalyzeEggInfoFolder 0
    testAnalyzeSitePackagetestAnalyzeSitePackage 0
    testSupportsFiles0.016
    +testSupportsFiles +0

    PythonPackageAnalyzerTest

    - + - + - +
    testAnalyzeSourceMetadatatestAnalyzeSourceMetadata 0
    testGetNametestGetName 0
    testSupportsFileExtensiontestSupportsFileExtension 0
    +

    RubyBundleAuditAnalyzerTest

    + + + + + + + + + + + + + + + + + + + + + + + + +
    testGetName +0
    skipped
    testAnalysis +0
    skipped
    testSupportsFiles +0
    skipped
    +

    RubyGemspecAnalyzerTest

    - + - + - +
    testGetNametestGetName 0
    testAnalyzePackageJsontestAnalyzePackageJson 0
    testSupportsFilestestSupportsFiles 0

    CentralSearchTest

    - - + + - + - + - - + + - -
    testMultipleReturns0.189
    testMultipleReturns0.297
    testNullSha1testNullSha1 0
    testMalformedSha1testMalformedSha1 0
    testValidSha10.046
    testValidSha10.062
    testMissingSha10.032
    +testMissingSha1 +0.157

    ComposerLockParserTest

    - + - - + + - + - -
    testNotPackagesArraytestNotPackagesArray 0
    testValidComposerLock0.015
    testValidComposerLock0
    testNotComposertestNotComposer 0
    testNotJSON0.016
    +testNotJSON +0

    IndexEntryTest

    - +
    testSetNametestSetName 0

    CweDBTest

    - +
    testGetCweNametestGetCweName 0

    FieldAnalyzerTest

    - +
    testAnalyzerstestAnalyzers 0

    LuceneUtilsTest

    - + - + - + - +
    testAppendEscapedLuceneQuerytestAppendEscapedLuceneQuery 0
    testEscapeLuceneQuerytestEscapeLuceneQuery 0
    testEscapeLuceneQuery_nulltestEscapeLuceneQuery_null 0
    testAppendEscapedLuceneQuery_nulltestAppendEscapedLuceneQuery_null 0

    TokenPairConcatenatingFilterTest

    - - + + - -
    testExamples0.048
    testClear0.062
    testClear0.007
    +testExamples +0.016

    UrlTokenizingFilterTest

    - - + + - - + + - -
    testEmptyTerm0
    testExamples0.032
    testExamples0.047
    testRandomStrings0.359
    testRandomStrings0.844
    +testEmptyTerm +0.016

    NexusSearchTest

    - @@ -1492,7 +1554,7 @@ function toggleDisplay(elementId) { - @@ -1501,7 +1563,7 @@ function toggleDisplay(elementId) { - @@ -1510,7 +1572,7 @@ function toggleDisplay(elementId) { - @@ -1522,574 +1584,577 @@ function toggleDisplay(elementId) {
    testNullSha1 +testNullSha1 0
    testMalformedSha1 +testMalformedSha1 0
    testValidSha1 +testValidSha1 0
    testMissingSha1 +testMissingSha1 0
    - + - + - -
    testGoodDocumenttestGoodDocument 0.016
    testMissingDocumenttestMissingDocument 0
    testNotNuspec0.016
    +testNotNuspec +0.015 +
    +

    ConnectionFactoryTest

    + + + + +
    testInitialize0.569

    DriverLoaderTest

    - + - + - + - + - - + + - -
    testLoad_StringtestLoad_String 0
    testLoad_String_extestLoad_String_ex 0
    testLoad_String_String_badClassNametestLoad_String_String_badClassName 0
    testLoad_String_String_badPathtestLoad_String_String_badPath 0
    testLoad_String_String0.032
    testLoad_String_String0.031
    testLoad_String_String_multiple_paths0.078
    +testLoad_String_String_multiple_paths +0.047

    BaseUpdaterTest

    - + - - + + - - + + - -
    testGetCveDBtestGetCveDB 0
    testOpenDataStores0.57
    testOpenDataStores1.162
    testGetProperties0.565
    testGetProperties0.577
    testCloseDataStores0.532
    +testCloseDataStores +0.537

    EngineVersionCheckTest

    - - + + - +
    testShouldUpdate0.125
    testShouldUpdate0.14
    testGetCurrentReleaseVersiontestGetCurrentReleaseVersion 0.016

    DownloadTaskTest

    - -
    testCall0.954
    +testCall +0.766

    NvdCveInfoTest

    - + - + - + - + - +
    testSetGetTimestamptestSetGetTimestamp 0
    testSetGetNeedsUpdatetestSetGetNeedsUpdate 0
    testSetGetOldSchemaVersionUrltestSetGetOldSchemaVersionUrl 0
    testSetGetUrltestSetGetUrl 0
    testSetGetIdtestSetGetId 0

    NvdCve_1_2_HandlerTest

    - -
    testParse0.031
    +testParse +0.016

    NvdCve_2_0_HandlerTest

    - -
    testParse0.094
    +testParse +0.063

    UpdateableNvdCveTest

    - + - + - + - + - +
    testCleartestClear 0
    testAdd_3argstestAdd_3args 0
    testAdd_4argstestAdd_4args 0
    testIsUpdateNeededtestIsUpdateNeeded 0
    testIteratortestIterator 0

    DependencyTest

    - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
    testGetEvidenceUsedtestGetEvidenceUsed 0
    testGetSha1sumtestGetSha1sum 0.016
    testGetProductEvidencetestGetProductEvidence 0
    testGetActualFilePathtestGetActualFilePath 0
    testAddAsEvidencetestAddAsEvidence 0
    testAddAsEvidenceWithEmptyArtefacttestAddAsEvidenceWithEmptyArtefact 0
    testGetIdentifierstestGetIdentifiers 0
    testSetSha1sumtestSetSha1sum 0
    testAddIdentifiertestAddIdentifier 0
    testGetVendorEvidencetestGetVendorEvidence 0
    testSetFileNametestSetFileName 0
    testSetFilePathtestSetFilePath 0
    testGetFileNametestGetFileName 0
    testGetFilePathtestGetFilePath 0
    testSetMd5sumtestSetMd5sum 0
    testGetMd5sumtestGetMd5sum 0.016
    testGetEvidencetestGetEvidence 0
    testSetIdentifierstestSetIdentifiers 0
    testGetVersionEvidencetestGetVersionEvidence 0
    testSetActualFilePathtestSetActualFilePath 0

    EvidenceTest

    - + - + - +
    testCompareTotestCompareTo 0
    testHashcodeContracttestHashcodeContract 0
    testEqualstestEquals 0

    VulnerableSoftwareTest

    - + - + - +
    testCompareTotestCompareTo 0
    testHashCodetestHashCode 0
    testEqualstestEquals 0

    PropertyTypeTest

    - + - + - + - +
    testSetGetValuetestSetGetValue 0
    testMatchestestMatches 0
    testIsRegextestIsRegex 0
    testIsCaseSensitivetestIsCaseSensitive 0

    SuppressionHandlerTest

    - +
    testHandlertestHandler 0

    SuppressionParserTest

    - +
    testParseSuppressionRulestestParseSuppressionRules 0

    SuppressionRuleTest

    - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - + - + - + - + - + + + + +
    testCpeHasNoVersiontestCpeHasNoVersion 0
    testCpetestCpe 0
    testCvetestCve 0
    testCwetestCwe 0
    testBasetestBase 0
    testSha1testSha1 0
    testCpeMatchestestCpeMatches 0
    testHasCvssBelowtestHasCvssBelow 0
    testProcesstestProcess 0
    testGetSha1testGetSha1 0
    testProcessGAVtestProcessGAV 0
    testAddCvssBelowtestAddCvssBelow 0
    testFilePathtestFilePath 0
    testGetCvssBelowtestGetCvssBelow 0
    testSetFilePathtestSetFilePath 0
    testGetFilePathtestGetFilePath 0
    testAddCpetestAddCpe 0
    testAddCvetestAddCve 0
    testAddCwetestAddCwe 0
    testGetCpetestGetCpe 0
    testGetCvetestGetCve 0
    testGetCwetestGetCwe 0
    testHasCpetestHasCpe 0
    testHasCvetestHasCve 0
    testHasCwe0.001
    testSetCvssBelow0
    testSetSha1testHasCwe 0
    testSetCpetestSetCvssBelow 0
    testSetCvetestSetSha1 0
    testSetCwetestSetCpe 0
    testCountCharactertestSetCve0
    testSetCwe 0

    DateUtilTest

    - +
    testWithinDateRangetestWithinDateRange 0

    DependencyVersionTest

    - + - + - + - + - + - + - + - + - +
    testSetVersionPartstestSetVersionParts 0
    testMatchesAtLeastThreeLevelstestMatchesAtLeastThreeLevels 0
    testToStringtestToString 0
    testCompareTotestCompareTo 0
    testParseVersiontestParseVersion 0
    testHashCodetestHashCode 0
    testEqualstestEquals 0
    testGetVersionPartstestGetVersionParts 0
    testIteratortestIterator 0

    DependencyVersionUtilTest

    - +
    testParseVersiontestParseVersion 0

    FilterTest

    - + - +
    testFilter_IterabletestFilter_Iterable 0
    testPassestestPasses 0

    ModelTest

    - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - + - + - + + + + + + + + +
    testGetLicensestestGetLicenses 0
    testSetGroupIdtestSetGroupId 0
    testSetParentArtifactIdtestSetParentArtifactId 0
    testSetVersiontestSetVersion 0
    testSetArtifactIdtestSetArtifactId 0
    testGetOrganizationtestGetOrganization 0
    testGetParentGroupIdtestGetParentGroupId 0
    testGetParentVersiontestGetParentVersion 0
    testSetDescriptiontestSetDescription 0
    testSetOrganizationtestSetOrganization 0
    testGetNametestGetName 0
    testGetParentArtifactIdtestGetParentArtifactId 0
    testGetGroupIdtestGetGroupId 0
    testGetVersiontestGetVersion 0
    testGetDescriptiontestGetDescription 0
    testInterpolateStringtestInterpolateString 0
    testProcessPropertiestestProcessProperties 0
    testSetParentGroupId0.001
    testSetParentVersion0
    testAddLicensetestSetParentGroupId 0
    testSetNametestSetParentVersion 0
    testGetArtifactIdtestAddLicense0
    testSetName0
    testGetArtifactId 0

    PomUtilsTest

    - +
    testReadPom_FiletestReadPom_File 0

    Failure Details

    @@ -2097,12 +2162,36 @@ function toggleDisplay(elementId) { + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dependency-check-core/taglist.html b/dependency-check-core/taglist.html index 8c9299a39..de6c53972 100644 --- a/dependency-check-core/taglist.html +++ b/dependency-check-core/taglist.html @@ -1,13 +1,13 @@ - + dependency-check-core – Tag List report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -97,7 +97,7 @@ Project Information - +
  • @@ -140,13 +140,6 @@ Surefire Report
  • -
  • - - - - Failsafe Report -
  • -
  • @@ -266,13 +259,13 @@
  • - + - + @@ -281,13 +274,13 @@ - + - + - + @@ -323,7 +316,7 @@ - + diff --git a/dependency-check-core/team-list.html b/dependency-check-core/team-list.html index 8213a9848..efec008d9 100644 --- a/dependency-check-core/team-list.html +++ b/dependency-check-core/team-list.html @@ -1,13 +1,13 @@ - + dependency-check-core – Project Team @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -146,7 +146,7 @@ - +
  • diff --git a/dependency-check-core/xref-test/allclasses-frame.html b/dependency-check-core/xref-test/allclasses-frame.html index 118666280..28344e306 100644 --- a/dependency-check-core/xref-test/allclasses-frame.html +++ b/dependency-check-core/xref-test/allclasses-frame.html @@ -12,9 +12,6 @@
    • - AbstractDatabaseTestCase -
    • -
    • AbstractFileTypeAnalyzerTest
    • @@ -28,6 +25,9 @@
    • ArchiveAnalyzerIntegrationTest +
    • +
    • + ArchiveAnalyzerTest
    • AssemblyAnalyzerTest @@ -36,7 +36,7 @@ AutoconfAnalyzerTest
    • - BaseDBTestCase + BaseDBTestCase
    • BaseTest @@ -61,6 +61,9 @@
    • ComposerLockParserTest +
    • +
    • + ConnectionFactoryTest
    • CpeUpdaterIntegrationTest @@ -175,6 +178,9 @@
    • ReportGeneratorIntegrationTest +
    • +
    • + RubyBundleAuditAnalyzerTest
    • RubyGemspecAnalyzerTest diff --git a/dependency-check-core/xref-test/index.html b/dependency-check-core/xref-test/index.html index a9688a502..16a7641a4 100644 --- a/dependency-check-core/xref-test/index.html +++ b/dependency-check-core/xref-test/index.html @@ -4,7 +4,7 @@ - Dependency-Check Core 1.3.1 Reference + Dependency-Check Core 1.3.2 Reference diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/BaseDBTestCase.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/BaseDBTestCase.html new file mode 100644 index 000000000..c4b87b578 --- /dev/null +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/BaseDBTestCase.html @@ -0,0 +1,136 @@ + + + +BaseDBTestCase xref + + + +
      +1   /*
      +2    * This file is part of dependency-check-core.
      +3    *
      +4    * Licensed under the Apache License, Version 2.0 (the "License");
      +5    * you may not use this file except in compliance with the License.
      +6    * You may obtain a copy of the License at
      +7    *
      +8    *     http://www.apache.org/licenses/LICENSE-2.0
      +9    *
      +10   * Unless required by applicable law or agreed to in writing, software
      +11   * distributed under the License is distributed on an "AS IS" BASIS,
      +12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      +13   * See the License for the specific language governing permissions and
      +14   * limitations under the License.
      +15   *
      +16   * Copyright (c) 2012 Jeremy Long. All Rights Reserved.
      +17   */
      +18  package org.owasp.dependencycheck;
      +19  
      +20  import java.io.BufferedInputStream;
      +21  import java.io.BufferedOutputStream;
      +22  import java.io.File;
      +23  import java.io.FileInputStream;
      +24  import java.io.FileOutputStream;
      +25  import java.util.zip.ZipEntry;
      +26  import java.util.zip.ZipInputStream;
      +27  import org.junit.Before;
      +28  import org.owasp.dependencycheck.BaseTest;
      +29  import org.owasp.dependencycheck.utils.Settings;
      +30  import org.slf4j.Logger;
      +31  import org.slf4j.LoggerFactory;
      +32  
      +33  /**
      +34   * An abstract database test case that is used to ensure the H2 DB exists prior to performing tests that utilize the data
      +35   * contained within.
      +36   *
      +37   * @author Jeremy Long
      +38   */
      +39  public abstract class BaseDBTestCase extends BaseTest {
      +40  
      +41      protected final static int BUFFER_SIZE = 2048;
      +42  
      +43      private final static Logger LOGGER = LoggerFactory.getLogger(BaseDBTestCase.class);
      +44  
      +45      @Before
      +46      public void setUp() throws Exception {
      +47          ensureDBExists();
      +48      }
      +49  
      +50      public static void ensureDBExists() throws Exception {
      +51  
      +52          java.io.File dataPath = Settings.getDataDirectory();
      +53          String fileName = Settings.getString(Settings.KEYS.DB_FILE_NAME);
      +54          LOGGER.trace("DB file name {}", fileName);
      +55          java.io.File dataFile = new File(dataPath, fileName);
      +56          LOGGER.trace("Ensuring {} exists", dataFile.toString());
      +57          if (!dataPath.exists() || !dataFile.exists()) {
      +58              LOGGER.trace("Extracting database to {}", dataPath.toString());
      +59              dataPath.mkdirs();
      +60              FileInputStream fis = null;
      +61              ZipInputStream zin = null;
      +62              try {
      +63                  File path = new File(BaseDBTestCase.class.getClassLoader().getResource("data.zip").getPath());
      +64                  fis = new FileInputStream(path);
      +65                  zin = new ZipInputStream(new BufferedInputStream(fis));
      +66                  ZipEntry entry;
      +67                  while ((entry = zin.getNextEntry()) != null) {
      +68                      if (entry.isDirectory()) {
      +69                          final File d = new File(dataPath, entry.getName());
      +70                          d.mkdir();
      +71                          continue;
      +72                      }
      +73                      FileOutputStream fos = null;
      +74                      BufferedOutputStream dest = null;
      +75                      try {
      +76                          File o = new File(dataPath, entry.getName());
      +77                          o.createNewFile();
      +78                          fos = new FileOutputStream(o, false);
      +79                          dest = new BufferedOutputStream(fos, BUFFER_SIZE);
      +80                          byte data[] = new byte[BUFFER_SIZE];
      +81                          int count;
      +82                          while ((count = zin.read(data, 0, BUFFER_SIZE)) != -1) {
      +83                              dest.write(data, 0, count);
      +84                          }
      +85                      } catch (Throwable ex) {
      +86                          LOGGER.error("", ex);
      +87                      } finally {
      +88                          try {
      +89                              if (dest != null) {
      +90                                  dest.flush();
      +91                                  dest.close();
      +92                              }
      +93                          } catch (Throwable ex) {
      +94                              LOGGER.trace("", ex);
      +95                          }
      +96                          try {
      +97                              if (fos != null) {
      +98                                  fos.close();
      +99                              }
      +100                         } catch (Throwable ex) {
      +101                             LOGGER.trace("", ex);
      +102                         }
      +103                     }
      +104                 }
      +105             } finally {
      +106                 try {
      +107                     if (zin != null) {
      +108                         zin.close();
      +109                     }
      +110                 } catch (Throwable ex) {
      +111                     LOGGER.trace("", ex);
      +112                 }
      +113                 try {
      +114                     if (fis != null) {
      +115                         fis.close();
      +116                     }
      +117                 } catch (Throwable ex) {
      +118                     LOGGER.trace("", ex);
      +119                 }
      +120             }
      +121         }
      +122     }
      +123 }
      +
      +
      + + + diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/EngineIntegrationTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/EngineIntegrationTest.html index 9c87c8e3d..7237388b5 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/EngineIntegrationTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/EngineIntegrationTest.html @@ -42,7 +42,7 @@ 34 35 @Before 36 public void setUp() throws Exception { -37 org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase.ensureDBExists(); +37 org.owasp.dependencycheck.BaseDBTestCase.ensureDBExists(); 38 } 39 40 @After diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzerTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzerTest.html index d5a3f7804..98347b1c9 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzerTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzerTest.html @@ -42,7 +42,7 @@ 34 */ 35 @Test 36 public void testNewHashSet() { -37 Set result = AbstractFileTypeAnalyzer.newHashSet("one", "two"); +37 Set<String> result = AbstractFileTypeAnalyzer.newHashSet("one", "two"); 38 assertEquals(2, result.size()); 39 assertTrue(result.contains("one")); 40 assertTrue(result.contains("two")); diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerIntegrationTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerIntegrationTest.html index 212f17b0a..cafeaa03e 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerIntegrationTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerIntegrationTest.html @@ -32,7 +32,7 @@ 24 import org.junit.Test; 25 import org.owasp.dependencycheck.BaseTest; 26 import org.owasp.dependencycheck.Engine; -27 import org.owasp.dependencycheck.data.cpe.AbstractDatabaseTestCase; +27 import org.owasp.dependencycheck.BaseDBTestCase; 28 import org.owasp.dependencycheck.dependency.Dependency; 29 import org.owasp.dependencycheck.utils.Settings; 30 @@ -40,7 +40,7 @@ 32 * 33 * @author Jeremy Long 34 */ -35 public class ArchiveAnalyzerIntegrationTest extends AbstractDatabaseTestCase { +35 public class ArchiveAnalyzerIntegrationTest extends BaseDBTestCase { 36 37 /** 38 * Test of getSupportedExtensions method, of class ArchiveAnalyzer. diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerTest.html new file mode 100644 index 000000000..0a64ea030 --- /dev/null +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerTest.html @@ -0,0 +1,93 @@ + + + +ArchiveAnalyzerTest xref + + + +
      +1   /*
      +2    * Copyright 2015 OWASP.
      +3    *
      +4    * Licensed under the Apache License, Version 2.0 (the "License");
      +5    * you may not use this file except in compliance with the License.
      +6    * You may obtain a copy of the License at
      +7    *
      +8    *      http://www.apache.org/licenses/LICENSE-2.0
      +9    *
      +10   * Unless required by applicable law or agreed to in writing, software
      +11   * distributed under the License is distributed on an "AS IS" BASIS,
      +12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      +13   * See the License for the specific language governing permissions and
      +14   * limitations under the License.
      +15   */
      +16  package org.owasp.dependencycheck.analyzer;
      +17  
      +18  import java.io.File;
      +19  import java.io.FileFilter;
      +20  import java.lang.reflect.InvocationTargetException;
      +21  import java.lang.reflect.Method;
      +22  import java.util.logging.Level;
      +23  import java.util.logging.Logger;
      +24  import org.junit.After;
      +25  import org.junit.AfterClass;
      +26  import org.junit.Before;
      +27  import org.junit.BeforeClass;
      +28  import org.junit.Test;
      +29  import static org.junit.Assert.*;
      +30  import static org.junit.Assume.assumeFalse;
      +31  import static org.junit.Assume.assumeNotNull;
      +32  import org.owasp.dependencycheck.BaseTest;
      +33  import org.owasp.dependencycheck.Engine;
      +34  import org.owasp.dependencycheck.dependency.Dependency;
      +35  import org.owasp.dependencycheck.utils.Settings;
      +36  
      +37  /**
      +38   *
      +39   * @author jeremy
      +40   */
      +41  public class ArchiveAnalyzerTest extends BaseTest {
      +42  
      +43      @Before
      +44      public void setUp() {
      +45          Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, "z2, z3");
      +46      }
      +47  
      +48      /**
      +49       * Test of analyzeFileType method, of class ArchiveAnalyzer.
      +50       */
      +51      @Test
      +52      public void testZippableExtensions() throws Exception {
      +53          assumeFalse(isPreviouslyLoaded("org.owasp.dependencycheck.analyzer.ArchiveAnalyzer"));
      +54          ArchiveAnalyzer instance = new ArchiveAnalyzer();
      +55          assertTrue(instance.getFileFilter().accept(new File("c:/test.zip")));
      +56          assertTrue(instance.getFileFilter().accept(new File("c:/test.z2")));
      +57          assertTrue(instance.getFileFilter().accept(new File("c:/test.z3")));
      +58          assertFalse(instance.getFileFilter().accept(new File("c:/test.z4")));
      +59      }
      +60  
      +61      private boolean isPreviouslyLoaded(String className) {
      +62          try {
      +63              Method m = ClassLoader.class.getDeclaredMethod("findLoadedClass", new Class[]{String.class});
      +64              m.setAccessible(true);
      +65              Object t = m.invoke(Thread.currentThread().getContextClassLoader(), className);
      +66              return t != null;
      +67          } catch (NoSuchMethodException ex) {
      +68              Logger.getLogger(ArchiveAnalyzerTest.class.getName()).log(Level.SEVERE, null, ex);
      +69          } catch (SecurityException ex) {
      +70              Logger.getLogger(ArchiveAnalyzerTest.class.getName()).log(Level.SEVERE, null, ex);
      +71          } catch (IllegalAccessException ex) {
      +72              Logger.getLogger(ArchiveAnalyzerTest.class.getName()).log(Level.SEVERE, null, ex);
      +73          } catch (IllegalArgumentException ex) {
      +74              Logger.getLogger(ArchiveAnalyzerTest.class.getName()).log(Level.SEVERE, null, ex);
      +75          } catch (InvocationTargetException ex) {
      +76              Logger.getLogger(ArchiveAnalyzerTest.class.getName()).log(Level.SEVERE, null, ex);
      +77          }
      +78          return false;
      +79      }
      +80  }
      +
      +
      + + + diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/CMakeAnalyzerTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/CMakeAnalyzerTest.html index 504ad0a83..612b29136 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/CMakeAnalyzerTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/CMakeAnalyzerTest.html @@ -41,14 +41,14 @@ 33 import static org.hamcrest.CoreMatchers.equalTo; 34 import static org.hamcrest.CoreMatchers.is; 35 import static org.junit.Assert.*; -36 import org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase; +36 import org.owasp.dependencycheck.BaseDBTestCase; 37 38 /** 39 * Unit tests for CmakeAnalyzer. 40 * 41 * @author Dale Visser <dvisser@ida.org> 42 */ -43 public class CMakeAnalyzerTest extends BaseDBTestCase { +43 public class CMakeAnalyzerTest extends BaseDBTestCase { 44 45 /** 46 * The package analyzer to test. diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/CPEAnalyzerIntegrationTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/CPEAnalyzerIntegrationTest.html index bf929759c..23f20b6e4 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/CPEAnalyzerIntegrationTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/CPEAnalyzerIntegrationTest.html @@ -27,7 +27,7 @@ 19 20 import java.io.File; 21 import java.io.IOException; -22 import java.util.HashSet; +22 import java.util.Collections; 23 import java.util.List; 24 import java.util.Set; 25 import org.apache.lucene.index.CorruptIndexException; @@ -36,7 +36,7 @@ 28 import static org.junit.Assert.assertTrue; 29 import org.junit.Test; 30 import org.owasp.dependencycheck.BaseTest; -31 import org.owasp.dependencycheck.data.cpe.AbstractDatabaseTestCase; +31 import org.owasp.dependencycheck.BaseDBTestCase; 32 import org.owasp.dependencycheck.data.cpe.IndexEntry; 33 import org.owasp.dependencycheck.dependency.Confidence; 34 import org.owasp.dependencycheck.dependency.Dependency; @@ -46,7 +46,7 @@ 38 * 39 * @author Jeremy Long 40 */ -41 public class CPEAnalyzerIntegrationTest extends AbstractDatabaseTestCase { +41 public class CPEAnalyzerIntegrationTest extends BaseDBTestCase { 42 43 /** 44 * Tests of buildSearch of class CPEAnalyzer. @@ -57,215 +57,211 @@ 49 */ 50 @Test 51 public void testBuildSearch() throws IOException, CorruptIndexException, ParseException { -52 Set<String> productWeightings = new HashSet<String>(1); -53 productWeightings.add("struts2"); -54 -55 Set<String> vendorWeightings = new HashSet<String>(1); -56 vendorWeightings.add("apache"); -57 -58 String vendor = "apache software foundation"; -59 String product = "struts 2 core"; -60 String version = "2.1.2"; -61 CPEAnalyzer instance = new CPEAnalyzer(); -62 -63 String queryText = instance.buildSearch(vendor, product, null, null); -64 String expResult = " product:( struts 2 core ) AND vendor:( apache software foundation ) "; -65 Assert.assertTrue(expResult.equals(queryText)); -66 -67 queryText = instance.buildSearch(vendor, product, null, productWeightings); -68 expResult = " product:( struts^5 struts2^5 2 core ) AND vendor:( apache software foundation ) "; -69 Assert.assertTrue(expResult.equals(queryText)); -70 -71 queryText = instance.buildSearch(vendor, product, vendorWeightings, null); -72 expResult = " product:( struts 2 core ) AND vendor:( apache^5 software foundation ) "; -73 Assert.assertTrue(expResult.equals(queryText)); -74 -75 queryText = instance.buildSearch(vendor, product, vendorWeightings, productWeightings); -76 expResult = " product:( struts^5 struts2^5 2 core ) AND vendor:( apache^5 software foundation ) "; -77 Assert.assertTrue(expResult.equals(queryText)); -78 } -79 -80 /** -81 * Test of determineCPE method, of class CPEAnalyzer. -82 * -83 * @throws Exception is thrown when an exception occurs -84 */ -85 @Test -86 public void testDetermineCPE_full() throws Exception { -87 CPEAnalyzer instance = new CPEAnalyzer(); -88 instance.open(); -89 FileNameAnalyzer fnAnalyzer = new FileNameAnalyzer(); -90 JarAnalyzer jarAnalyzer = new JarAnalyzer(); -91 HintAnalyzer hAnalyzer = new HintAnalyzer(); -92 FalsePositiveAnalyzer fp = new FalsePositiveAnalyzer(); -93 -94 try { -95 //callDetermineCPE_full("struts2-core-2.3.16.3.jar", "cpe:/a:apache:struts:2.3.16.3", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -96 callDetermineCPE_full("hazelcast-2.5.jar", null, instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -97 callDetermineCPE_full("spring-context-support-2.5.5.jar", "cpe:/a:springsource:spring_framework:2.5.5", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -98 callDetermineCPE_full("spring-core-3.0.0.RELEASE.jar", "cpe:/a:vmware:springsource_spring_framework:3.0.0", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -99 callDetermineCPE_full("org.mortbay.jetty.jar", "cpe:/a:mortbay_jetty:jetty:4.2.27", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -100 callDetermineCPE_full("jaxb-xercesImpl-1.5.jar", null, instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -101 callDetermineCPE_full("ehcache-core-2.2.0.jar", null, instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -102 } finally { -103 instance.close(); -104 } -105 } -106 -107 /** -108 * Test of determineCPE method, of class CPEAnalyzer. -109 * -110 * @throws Exception is thrown when an exception occurs -111 */ -112 public void callDetermineCPE_full(String depName, String expResult, CPEAnalyzer instance, FileNameAnalyzer fnAnalyzer, JarAnalyzer jarAnalyzer, HintAnalyzer hAnalyzer, FalsePositiveAnalyzer fp) throws Exception { -113 -114 //File file = new File(this.getClass().getClassLoader().getResource(depName).getPath()); -115 File file = BaseTest.getResourceAsFile(this, depName); +52 Set<String> productWeightings = Collections.singleton("struts2"); +53 +54 Set<String> vendorWeightings = Collections.singleton("apache"); +55 +56 String vendor = "apache software foundation"; +57 String product = "struts 2 core"; +58 String version = "2.1.2"; +59 CPEAnalyzer instance = new CPEAnalyzer(); +60 +61 String queryText = instance.buildSearch(vendor, product, null, null); +62 String expResult = " product:( struts 2 core ) AND vendor:( apache software foundation ) "; +63 Assert.assertTrue(expResult.equals(queryText)); +64 +65 queryText = instance.buildSearch(vendor, product, null, productWeightings); +66 expResult = " product:( struts^5 struts2^5 2 core ) AND vendor:( apache software foundation ) "; +67 Assert.assertTrue(expResult.equals(queryText)); +68 +69 queryText = instance.buildSearch(vendor, product, vendorWeightings, null); +70 expResult = " product:( struts 2 core ) AND vendor:( apache^5 software foundation ) "; +71 Assert.assertTrue(expResult.equals(queryText)); +72 +73 queryText = instance.buildSearch(vendor, product, vendorWeightings, productWeightings); +74 expResult = " product:( struts^5 struts2^5 2 core ) AND vendor:( apache^5 software foundation ) "; +75 Assert.assertTrue(expResult.equals(queryText)); +76 } +77 +78 /** +79 * Test of determineCPE method, of class CPEAnalyzer. +80 * +81 * @throws Exception is thrown when an exception occurs +82 */ +83 @Test +84 public void testDetermineCPE_full() throws Exception { +85 CPEAnalyzer instance = new CPEAnalyzer(); +86 instance.open(); +87 FileNameAnalyzer fnAnalyzer = new FileNameAnalyzer(); +88 JarAnalyzer jarAnalyzer = new JarAnalyzer(); +89 HintAnalyzer hAnalyzer = new HintAnalyzer(); +90 FalsePositiveAnalyzer fp = new FalsePositiveAnalyzer(); +91 +92 try { +93 //callDetermineCPE_full("struts2-core-2.3.16.3.jar", "cpe:/a:apache:struts:2.3.16.3", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +94 callDetermineCPE_full("hazelcast-2.5.jar", null, instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +95 callDetermineCPE_full("spring-context-support-2.5.5.jar", "cpe:/a:springsource:spring_framework:2.5.5", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +96 callDetermineCPE_full("spring-core-3.0.0.RELEASE.jar", "cpe:/a:vmware:springsource_spring_framework:3.0.0", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +97 callDetermineCPE_full("org.mortbay.jetty.jar", "cpe:/a:mortbay_jetty:jetty:4.2.27", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +98 callDetermineCPE_full("jaxb-xercesImpl-1.5.jar", null, instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +99 callDetermineCPE_full("ehcache-core-2.2.0.jar", null, instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +100 } finally { +101 instance.close(); +102 } +103 } +104 +105 /** +106 * Test of determineCPE method, of class CPEAnalyzer. +107 * +108 * @throws Exception is thrown when an exception occurs +109 */ +110 public void callDetermineCPE_full(String depName, String expResult, CPEAnalyzer instance, FileNameAnalyzer fnAnalyzer, JarAnalyzer jarAnalyzer, HintAnalyzer hAnalyzer, FalsePositiveAnalyzer fp) throws Exception { +111 +112 //File file = new File(this.getClass().getClassLoader().getResource(depName).getPath()); +113 File file = BaseTest.getResourceAsFile(this, depName); +114 +115 Dependency dep = new Dependency(file); 116 -117 Dependency dep = new Dependency(file); -118 -119 fnAnalyzer.analyze(dep, null); -120 jarAnalyzer.analyze(dep, null); -121 hAnalyzer.analyze(dep, null); -122 instance.analyze(dep, null); -123 fp.analyze(dep, null); -124 -125 if (expResult != null) { -126 Identifier expIdentifier = new Identifier("cpe", expResult, expResult); -127 Assert.assertTrue("Incorrect match: { dep:'" + dep.getFileName() + "' }", dep.getIdentifiers().contains(expIdentifier)); -128 } else { -129 for (Identifier i : dep.getIdentifiers()) { -130 Assert.assertFalse(String.format("%s - found a CPE identifier when should have been none (found '%s')", dep.getFileName(), i.getValue()), "cpe".equals(i.getType())); -131 } -132 } -133 } -134 -135 /** -136 * Test of determineCPE method, of class CPEAnalyzer. -137 * -138 * @throws Exception is thrown when an exception occurs -139 */ -140 @Test -141 public void testDetermineCPE() throws Exception { -142 //File file = new File(this.getClass().getClassLoader().getResource("struts2-core-2.1.2.jar").getPath()); -143 File file = BaseTest.getResourceAsFile(this, "struts2-core-2.1.2.jar"); -144 //File file = new File(this.getClass().getClassLoader().getResource("axis2-adb-1.4.1.jar").getPath()); -145 Dependency struts = new Dependency(file); -146 -147 FileNameAnalyzer fnAnalyzer = new FileNameAnalyzer(); -148 fnAnalyzer.analyze(struts, null); -149 -150 HintAnalyzer hintAnalyzer = new HintAnalyzer(); -151 JarAnalyzer jarAnalyzer = new JarAnalyzer(); -152 jarAnalyzer.accept(new File("test.jar"));//trick analyzer into "thinking it is active" -153 -154 jarAnalyzer.analyze(struts, null); -155 hintAnalyzer.analyze(struts, null); -156 //File fileCommonValidator = new File(this.getClass().getClassLoader().getResource("commons-validator-1.4.0.jar").getPath()); -157 File fileCommonValidator = BaseTest.getResourceAsFile(this, "commons-validator-1.4.0.jar"); -158 Dependency commonValidator = new Dependency(fileCommonValidator); -159 jarAnalyzer.analyze(commonValidator, null); -160 hintAnalyzer.analyze(commonValidator, null); -161 -162 //File fileSpring = new File(this.getClass().getClassLoader().getResource("spring-core-2.5.5.jar").getPath()); -163 File fileSpring = BaseTest.getResourceAsFile(this, "spring-core-2.5.5.jar"); -164 Dependency spring = new Dependency(fileSpring); -165 jarAnalyzer.analyze(spring, null); -166 hintAnalyzer.analyze(spring, null); -167 -168 //File fileSpring3 = new File(this.getClass().getClassLoader().getResource("spring-core-3.0.0.RELEASE.jar").getPath()); -169 File fileSpring3 = BaseTest.getResourceAsFile(this, "spring-core-3.0.0.RELEASE.jar"); -170 Dependency spring3 = new Dependency(fileSpring3); -171 jarAnalyzer.analyze(spring3, null); -172 hintAnalyzer.analyze(spring3, null); -173 -174 CPEAnalyzer instance = new CPEAnalyzer(); -175 instance.open(); -176 instance.determineCPE(commonValidator); -177 instance.determineCPE(struts); -178 instance.determineCPE(spring); -179 instance.determineCPE(spring3); -180 instance.close(); -181 -182 String expResult = "cpe:/a:apache:struts:2.1.2"; -183 Identifier expIdentifier = new Identifier("cpe", expResult, expResult); -184 String expResultSpring = "cpe:/a:springsource:spring_framework:2.5.5"; -185 String expResultSpring3 = "cpe:/a:vmware:springsource_spring_framework:3.0.0"; -186 -187 for (Identifier i : commonValidator.getIdentifiers()) { -188 Assert.assertFalse("Apache Common Validator - found a CPE identifier?", "cpe".equals(i.getType())); -189 } -190 -191 Assert.assertTrue("Incorrect match size - struts", struts.getIdentifiers().size() >= 1); -192 Assert.assertTrue("Incorrect match - struts", struts.getIdentifiers().contains(expIdentifier)); -193 Assert.assertTrue("Incorrect match size - spring3 - " + spring3.getIdentifiers().size(), spring3.getIdentifiers().size() >= 1); -194 -195 //the following two only work if the HintAnalyzer is used. -196 //Assert.assertTrue("Incorrect match size - spring", spring.getIdentifiers().size() == 1); -197 //Assert.assertTrue("Incorrect match - spring", spring.getIdentifiers().get(0).getValue().equals(expResultSpring)); -198 jarAnalyzer.close(); -199 } -200 -201 /** -202 * Test of determineIdentifiers method, of class CPEAnalyzer. -203 * -204 * @throws Exception is thrown when an exception occurs -205 */ -206 @Test -207 public void testDetermineIdentifiers() throws Exception { -208 Dependency openssl = new Dependency(); -209 openssl.getVendorEvidence().addEvidence("test", "vendor", "openssl", Confidence.HIGHEST); -210 openssl.getProductEvidence().addEvidence("test", "product", "openssl", Confidence.HIGHEST); -211 openssl.getVersionEvidence().addEvidence("test", "version", "1.0.1c", Confidence.HIGHEST); -212 -213 CPEAnalyzer instance = new CPEAnalyzer(); -214 instance.open(); -215 instance.determineIdentifiers(openssl, "openssl", "openssl", Confidence.HIGHEST); -216 instance.close(); -217 -218 String expResult = "cpe:/a:openssl:openssl:1.0.1c"; -219 Identifier expIdentifier = new Identifier("cpe", expResult, expResult); +117 fnAnalyzer.analyze(dep, null); +118 jarAnalyzer.analyze(dep, null); +119 hAnalyzer.analyze(dep, null); +120 instance.analyze(dep, null); +121 fp.analyze(dep, null); +122 +123 if (expResult != null) { +124 Identifier expIdentifier = new Identifier("cpe", expResult, expResult); +125 Assert.assertTrue("Incorrect match: { dep:'" + dep.getFileName() + "' }", dep.getIdentifiers().contains(expIdentifier)); +126 } else { +127 for (Identifier i : dep.getIdentifiers()) { +128 Assert.assertFalse(String.format("%s - found a CPE identifier when should have been none (found '%s')", dep.getFileName(), i.getValue()), "cpe".equals(i.getType())); +129 } +130 } +131 } +132 +133 /** +134 * Test of determineCPE method, of class CPEAnalyzer. +135 * +136 * @throws Exception is thrown when an exception occurs +137 */ +138 @Test +139 public void testDetermineCPE() throws Exception { +140 //File file = new File(this.getClass().getClassLoader().getResource("struts2-core-2.1.2.jar").getPath()); +141 File file = BaseTest.getResourceAsFile(this, "struts2-core-2.1.2.jar"); +142 //File file = new File(this.getClass().getClassLoader().getResource("axis2-adb-1.4.1.jar").getPath()); +143 Dependency struts = new Dependency(file); +144 +145 FileNameAnalyzer fnAnalyzer = new FileNameAnalyzer(); +146 fnAnalyzer.analyze(struts, null); +147 +148 HintAnalyzer hintAnalyzer = new HintAnalyzer(); +149 JarAnalyzer jarAnalyzer = new JarAnalyzer(); +150 jarAnalyzer.accept(new File("test.jar"));//trick analyzer into "thinking it is active" +151 +152 jarAnalyzer.analyze(struts, null); +153 hintAnalyzer.analyze(struts, null); +154 //File fileCommonValidator = new File(this.getClass().getClassLoader().getResource("commons-validator-1.4.0.jar").getPath()); +155 File fileCommonValidator = BaseTest.getResourceAsFile(this, "commons-validator-1.4.0.jar"); +156 Dependency commonValidator = new Dependency(fileCommonValidator); +157 jarAnalyzer.analyze(commonValidator, null); +158 hintAnalyzer.analyze(commonValidator, null); +159 +160 //File fileSpring = new File(this.getClass().getClassLoader().getResource("spring-core-2.5.5.jar").getPath()); +161 File fileSpring = BaseTest.getResourceAsFile(this, "spring-core-2.5.5.jar"); +162 Dependency spring = new Dependency(fileSpring); +163 jarAnalyzer.analyze(spring, null); +164 hintAnalyzer.analyze(spring, null); +165 +166 //File fileSpring3 = new File(this.getClass().getClassLoader().getResource("spring-core-3.0.0.RELEASE.jar").getPath()); +167 File fileSpring3 = BaseTest.getResourceAsFile(this, "spring-core-3.0.0.RELEASE.jar"); +168 Dependency spring3 = new Dependency(fileSpring3); +169 jarAnalyzer.analyze(spring3, null); +170 hintAnalyzer.analyze(spring3, null); +171 +172 CPEAnalyzer instance = new CPEAnalyzer(); +173 instance.open(); +174 instance.determineCPE(commonValidator); +175 instance.determineCPE(struts); +176 instance.determineCPE(spring); +177 instance.determineCPE(spring3); +178 instance.close(); +179 +180 String expResult = "cpe:/a:apache:struts:2.1.2"; +181 Identifier expIdentifier = new Identifier("cpe", expResult, expResult); +182 String expResultSpring = "cpe:/a:springsource:spring_framework:2.5.5"; +183 String expResultSpring3 = "cpe:/a:vmware:springsource_spring_framework:3.0.0"; +184 +185 for (Identifier i : commonValidator.getIdentifiers()) { +186 Assert.assertFalse("Apache Common Validator - found a CPE identifier?", "cpe".equals(i.getType())); +187 } +188 +189 Assert.assertTrue("Incorrect match size - struts", struts.getIdentifiers().size() >= 1); +190 Assert.assertTrue("Incorrect match - struts", struts.getIdentifiers().contains(expIdentifier)); +191 Assert.assertTrue("Incorrect match size - spring3 - " + spring3.getIdentifiers().size(), spring3.getIdentifiers().size() >= 1); +192 +193 //the following two only work if the HintAnalyzer is used. +194 //Assert.assertTrue("Incorrect match size - spring", spring.getIdentifiers().size() == 1); +195 //Assert.assertTrue("Incorrect match - spring", spring.getIdentifiers().get(0).getValue().equals(expResultSpring)); +196 jarAnalyzer.close(); +197 } +198 +199 /** +200 * Test of determineIdentifiers method, of class CPEAnalyzer. +201 * +202 * @throws Exception is thrown when an exception occurs +203 */ +204 @Test +205 public void testDetermineIdentifiers() throws Exception { +206 Dependency openssl = new Dependency(); +207 openssl.getVendorEvidence().addEvidence("test", "vendor", "openssl", Confidence.HIGHEST); +208 openssl.getProductEvidence().addEvidence("test", "product", "openssl", Confidence.HIGHEST); +209 openssl.getVersionEvidence().addEvidence("test", "version", "1.0.1c", Confidence.HIGHEST); +210 +211 CPEAnalyzer instance = new CPEAnalyzer(); +212 instance.open(); +213 instance.determineIdentifiers(openssl, "openssl", "openssl", Confidence.HIGHEST); +214 instance.close(); +215 +216 String expResult = "cpe:/a:openssl:openssl:1.0.1c"; +217 Identifier expIdentifier = new Identifier("cpe", expResult, expResult); +218 +219 assertTrue(openssl.getIdentifiers().contains(expIdentifier)); 220 -221 assertTrue(openssl.getIdentifiers().contains(expIdentifier)); +221 } 222 -223 } -224 -225 /** -226 * Test of searchCPE method, of class CPEAnalyzer. -227 * -228 * @throws Exception is thrown when an exception occurs -229 */ -230 @Test -231 public void testSearchCPE() throws Exception { -232 String vendor = "apache software foundation"; -233 String product = "struts 2 core"; -234 String version = "2.1.2"; -235 String expVendor = "apache"; -236 String expProduct = "struts"; -237 -238 CPEAnalyzer instance = new CPEAnalyzer(); -239 instance.open(); +223 /** +224 * Test of searchCPE method, of class CPEAnalyzer. +225 * +226 * @throws Exception is thrown when an exception occurs +227 */ +228 @Test +229 public void testSearchCPE() throws Exception { +230 String vendor = "apache software foundation"; +231 String product = "struts 2 core"; +232 String version = "2.1.2"; +233 String expVendor = "apache"; +234 String expProduct = "struts"; +235 +236 CPEAnalyzer instance = new CPEAnalyzer(); +237 instance.open(); +238 +239 Set<String> productWeightings = Collections.singleton("struts2"); 240 -241 Set<String> productWeightings = new HashSet<String>(1); -242 productWeightings.add("struts2"); -243 -244 Set<String> vendorWeightings = new HashSet<String>(1); -245 vendorWeightings.add("apache"); -246 -247 List<IndexEntry> result = instance.searchCPE(vendor, product, productWeightings, vendorWeightings); -248 instance.close(); -249 -250 boolean found = false; -251 for (IndexEntry entry : result) { -252 if (expVendor.equals(entry.getVendor()) && expProduct.equals(entry.getProduct())) { -253 found = true; -254 break; -255 } -256 } -257 assertTrue("apache:struts was not identified", found); -258 -259 } -260 } +241 Set<String> vendorWeightings = Collections.singleton("apache"); +242 +243 List<IndexEntry> result = instance.searchCPE(vendor, product, productWeightings, vendorWeightings); +244 instance.close(); +245 +246 boolean found = false; +247 for (IndexEntry entry : result) { +248 if (expVendor.equals(entry.getVendor()) && expProduct.equals(entry.getProduct())) { +249 found = true; +250 break; +251 } +252 } +253 assertTrue("apache:struts was not identified", found); +254 +255 } +256 }
      diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/ComposerLockAnalyzerTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/ComposerLockAnalyzerTest.html index 200d19a4b..9d70ec73e 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/ComposerLockAnalyzerTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/ComposerLockAnalyzerTest.html @@ -42,71 +42,72 @@ 34 import static org.junit.Assert.assertEquals; 35 import static org.junit.Assert.assertThat; 36 import static org.junit.Assert.assertTrue; -37 -38 /** -39 * Unit tests for NodePackageAnalyzer. -40 * -41 * @author Dale Visser <dvisser@ida.org> -42 */ -43 public class ComposerLockAnalyzerTest extends BaseTest { -44 -45 /** -46 * The analyzer to test. -47 */ -48 ComposerLockAnalyzer analyzer; -49 -50 /** -51 * Correctly setup the analyzer for testing. -52 * -53 * @throws Exception thrown if there is a problem -54 */ -55 @Before -56 public void setUp() throws Exception { -57 analyzer = new ComposerLockAnalyzer(); -58 analyzer.setFilesMatched(true); -59 analyzer.initialize(); -60 } -61 -62 /** -63 * Cleanup the analyzer's temp files, etc. -64 * -65 * @throws Exception thrown if there is a problem -66 */ -67 @After -68 public void tearDown() throws Exception { -69 analyzer.close(); -70 analyzer = null; -71 } -72 -73 /** -74 * Test of getName method, of class ComposerLockAnalyzer. -75 */ -76 @Test -77 public void testGetName() { -78 assertEquals("Composer.lock analyzer", analyzer.getName()); -79 } -80 -81 /** -82 * Test of supportsExtension method, of class ComposerLockAnalyzer. -83 */ -84 @Test -85 public void testSupportsFiles() { -86 assertTrue(analyzer.accept(new File("composer.lock"))); -87 } -88 -89 /** -90 * Test of inspect method, of class PythonDistributionAnalyzer. -91 * -92 * @throws AnalysisException is thrown when an exception occurs. -93 */ -94 @Test -95 public void testAnalyzePackageJson() throws Exception { -96 final Engine engine = new Engine(); -97 final Dependency result = new Dependency(BaseTest.getResourceAsFile(this, -98 "composer.lock")); -99 analyzer.analyze(result, engine); -100 } -101 } +37 import org.owasp.dependencycheck.BaseDBTestCase; +38 +39 /** +40 * Unit tests for NodePackageAnalyzer. +41 * +42 * @author Dale Visser <dvisser@ida.org> +43 */ +44 public class ComposerLockAnalyzerTest extends BaseDBTestCase { +45 +46 /** +47 * The analyzer to test. +48 */ +49 ComposerLockAnalyzer analyzer; +50 +51 /** +52 * Correctly setup the analyzer for testing. +53 * +54 * @throws Exception thrown if there is a problem +55 */ +56 @Before +57 public void setUp() throws Exception { +58 analyzer = new ComposerLockAnalyzer(); +59 analyzer.setFilesMatched(true); +60 analyzer.initialize(); +61 } +62 +63 /** +64 * Cleanup the analyzer's temp files, etc. +65 * +66 * @throws Exception thrown if there is a problem +67 */ +68 @After +69 public void tearDown() throws Exception { +70 analyzer.close(); +71 analyzer = null; +72 } +73 +74 /** +75 * Test of getName method, of class ComposerLockAnalyzer. +76 */ +77 @Test +78 public void testGetName() { +79 assertEquals("Composer.lock analyzer", analyzer.getName()); +80 } +81 +82 /** +83 * Test of supportsExtension method, of class ComposerLockAnalyzer. +84 */ +85 @Test +86 public void testSupportsFiles() { +87 assertTrue(analyzer.accept(new File("composer.lock"))); +88 } +89 +90 /** +91 * Test of inspect method, of class PythonDistributionAnalyzer. +92 * +93 * @throws AnalysisException is thrown when an exception occurs. +94 */ +95 @Test +96 public void testAnalyzePackageJson() throws Exception { +97 final Engine engine = new Engine(); +98 final Dependency result = new Dependency(BaseTest.getResourceAsFile(this, +99 "composer.lock")); +100 analyzer.analyze(result, engine); +101 } +102 }
      diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzerIntegrationTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzerIntegrationTest.html index 3b03449d7..ac4257686 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzerIntegrationTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzerIntegrationTest.html @@ -26,13 +26,13 @@ 18 package org.owasp.dependencycheck.analyzer; 19 20 import org.junit.Test; -21 import org.owasp.dependencycheck.data.cpe.AbstractDatabaseTestCase; +21 import org.owasp.dependencycheck.BaseDBTestCase; 22 23 /** 24 * 25 * @author Jeremy Long 26 */ -27 public class DependencyBundlingAnalyzerIntegrationTest extends AbstractDatabaseTestCase { +27 public class DependencyBundlingAnalyzerIntegrationTest extends BaseDBTestCase { 28 29 /** 30 * Test of analyze method, of class DependencyBundlingAnalyzer. diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/HintAnalyzerTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/HintAnalyzerTest.html index ee655d18e..f9445a3aa 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/HintAnalyzerTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/HintAnalyzerTest.html @@ -32,96 +32,92 @@ 24 import org.junit.Test; 25 import org.owasp.dependencycheck.BaseTest; 26 import org.owasp.dependencycheck.Engine; -27 import org.owasp.dependencycheck.dependency.Confidence; -28 import org.owasp.dependencycheck.dependency.Dependency; -29 import org.owasp.dependencycheck.dependency.Evidence; -30 import org.owasp.dependencycheck.utils.Settings; -31 -32 /** -33 * -34 * @author Jeremy Long -35 */ -36 public class HintAnalyzerTest extends BaseTest { -37 -38 @Before -39 public void setUp() throws Exception { -40 org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase.ensureDBExists(); -41 } -42 -43 /** -44 * Test of getName method, of class HintAnalyzer. -45 */ -46 @Test -47 public void testGetName() { -48 HintAnalyzer instance = new HintAnalyzer(); -49 String expResult = "Hint Analyzer"; -50 String result = instance.getName(); -51 assertEquals(expResult, result); -52 } -53 -54 /** -55 * Test of getAnalysisPhase method, of class HintAnalyzer. -56 */ -57 @Test -58 public void testGetAnalysisPhase() { -59 HintAnalyzer instance = new HintAnalyzer(); -60 AnalysisPhase expResult = AnalysisPhase.PRE_IDENTIFIER_ANALYSIS; -61 AnalysisPhase result = instance.getAnalysisPhase(); -62 assertEquals(expResult, result); -63 } -64 -65 /** -66 * Test of analyze method, of class HintAnalyzer. -67 */ -68 @Test -69 public void testAnalyze() throws Exception { -70 HintAnalyzer instance = new HintAnalyzer(); -71 -72 //File guice = new File(this.getClass().getClassLoader().getResource("guice-3.0.jar").getPath()); -73 File guice = BaseTest.getResourceAsFile(this, "guice-3.0.jar"); -74 //Dependency guice = new Dependency(fileg); -75 //File spring = new File(this.getClass().getClassLoader().getResource("spring-core-3.0.0.RELEASE.jar").getPath()); -76 File spring = BaseTest.getResourceAsFile(this, "spring-core-3.0.0.RELEASE.jar"); -77 //Dependency spring = new Dependency(files); -78 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, false); -79 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, false); -80 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, false); -81 Engine engine = new Engine(); -82 -83 engine.scan(guice); -84 engine.scan(spring); -85 engine.analyzeDependencies(); -86 Dependency gdep = null; -87 Dependency sdep = null; -88 for (Dependency d : engine.getDependencies()) { -89 if (d.getActualFile().equals(guice)) { -90 gdep = d; -91 } else if (d.getActualFile().equals(spring)) { -92 sdep = d; -93 } -94 } -95 final Evidence springTest1 = new Evidence("hint analyzer", "product", "springsource_spring_framework", Confidence.HIGH); -96 final Evidence springTest2 = new Evidence("hint analyzer", "vendor", "SpringSource", Confidence.HIGH); -97 final Evidence springTest3 = new Evidence("hint analyzer", "vendor", "vmware", Confidence.HIGH); -98 final Evidence springTest4 = new Evidence("hint analyzer", "product", "springsource_spring_framework", Confidence.HIGH); -99 final Evidence springTest5 = new Evidence("hint analyzer", "vendor", "vmware", Confidence.HIGH); -100 -101 Set<Evidence> evidence = gdep.getEvidence().getEvidence(); -102 assertFalse(evidence.contains(springTest1)); -103 assertFalse(evidence.contains(springTest2)); -104 assertFalse(evidence.contains(springTest3)); -105 assertFalse(evidence.contains(springTest4)); -106 assertFalse(evidence.contains(springTest5)); -107 -108 evidence = sdep.getEvidence().getEvidence(); -109 assertTrue(evidence.contains(springTest1)); -110 assertTrue(evidence.contains(springTest2)); -111 assertTrue(evidence.contains(springTest3)); -112 //assertTrue(evidence.contains(springTest4)); -113 //assertTrue(evidence.contains(springTest5)); -114 } -115 -116 } +27 import org.owasp.dependencycheck.BaseDBTestCase; +28 import org.owasp.dependencycheck.dependency.Confidence; +29 import org.owasp.dependencycheck.dependency.Dependency; +30 import org.owasp.dependencycheck.dependency.Evidence; +31 import org.owasp.dependencycheck.utils.Settings; +32 +33 /** +34 * +35 * @author Jeremy Long +36 */ +37 public class HintAnalyzerTest extends BaseDBTestCase { +38 +39 /** +40 * Test of getName method, of class HintAnalyzer. +41 */ +42 @Test +43 public void testGetName() { +44 HintAnalyzer instance = new HintAnalyzer(); +45 String expResult = "Hint Analyzer"; +46 String result = instance.getName(); +47 assertEquals(expResult, result); +48 } +49 +50 /** +51 * Test of getAnalysisPhase method, of class HintAnalyzer. +52 */ +53 @Test +54 public void testGetAnalysisPhase() { +55 HintAnalyzer instance = new HintAnalyzer(); +56 AnalysisPhase expResult = AnalysisPhase.PRE_IDENTIFIER_ANALYSIS; +57 AnalysisPhase result = instance.getAnalysisPhase(); +58 assertEquals(expResult, result); +59 } +60 +61 /** +62 * Test of analyze method, of class HintAnalyzer. +63 */ +64 @Test +65 public void testAnalyze() throws Exception { +66 HintAnalyzer instance = new HintAnalyzer(); +67 +68 //File guice = new File(this.getClass().getClassLoader().getResource("guice-3.0.jar").getPath()); +69 File guice = BaseTest.getResourceAsFile(this, "guice-3.0.jar"); +70 //Dependency guice = new Dependency(fileg); +71 //File spring = new File(this.getClass().getClassLoader().getResource("spring-core-3.0.0.RELEASE.jar").getPath()); +72 File spring = BaseTest.getResourceAsFile(this, "spring-core-3.0.0.RELEASE.jar"); +73 //Dependency spring = new Dependency(files); +74 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, false); +75 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, false); +76 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, false); +77 Engine engine = new Engine(); +78 +79 engine.scan(guice); +80 engine.scan(spring); +81 engine.analyzeDependencies(); +82 Dependency gdep = null; +83 Dependency sdep = null; +84 for (Dependency d : engine.getDependencies()) { +85 if (d.getActualFile().equals(guice)) { +86 gdep = d; +87 } else if (d.getActualFile().equals(spring)) { +88 sdep = d; +89 } +90 } +91 final Evidence springTest1 = new Evidence("hint analyzer", "product", "springsource_spring_framework", Confidence.HIGH); +92 final Evidence springTest2 = new Evidence("hint analyzer", "vendor", "SpringSource", Confidence.HIGH); +93 final Evidence springTest3 = new Evidence("hint analyzer", "vendor", "vmware", Confidence.HIGH); +94 final Evidence springTest4 = new Evidence("hint analyzer", "product", "springsource_spring_framework", Confidence.HIGH); +95 final Evidence springTest5 = new Evidence("hint analyzer", "vendor", "vmware", Confidence.HIGH); +96 +97 Set<Evidence> evidence = gdep.getEvidence().getEvidence(); +98 assertFalse(evidence.contains(springTest1)); +99 assertFalse(evidence.contains(springTest2)); +100 assertFalse(evidence.contains(springTest3)); +101 assertFalse(evidence.contains(springTest4)); +102 assertFalse(evidence.contains(springTest5)); +103 +104 evidence = sdep.getEvidence().getEvidence(); +105 assertTrue(evidence.contains(springTest1)); +106 assertTrue(evidence.contains(springTest2)); +107 assertTrue(evidence.contains(springTest3)); +108 //assertTrue(evidence.contains(springTest4)); +109 //assertTrue(evidence.contains(springTest5)); +110 } +111 +112 }
      diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzerTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzerTest.html new file mode 100644 index 000000000..2dbbe0767 --- /dev/null +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzerTest.html @@ -0,0 +1,122 @@ + + + +RubyBundleAuditAnalyzerTest xref + + + +
      +1   /*
      +2    * This file is part of dependency-check-core.
      +3    *
      +4    * Licensed under the Apache License, Version 2.0 (the "License");
      +5    * you may not use this file except in compliance with the License.
      +6    * You may obtain a copy of the License at
      +7    *
      +8    *     http://www.apache.org/licenses/LICENSE-2.0
      +9    *
      +10   * Unless required by applicable law or agreed to in writing, software
      +11   * distributed under the License is distributed on an "AS IS" BASIS,
      +12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      +13   * See the License for the specific language governing permissions and
      +14   * limitations under the License.
      +15   *
      +16   * Copyright (c) 2015 Institute for Defense Analyses. All Rights Reserved.
      +17   */
      +18  package org.owasp.dependencycheck.analyzer;
      +19  
      +20  import org.junit.After;
      +21  import org.junit.Assume;
      +22  import org.junit.Before;
      +23  import org.junit.Test;
      +24  import org.owasp.dependencycheck.BaseTest;
      +25  import org.owasp.dependencycheck.Engine;
      +26  import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
      +27  import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
      +28  import org.owasp.dependencycheck.dependency.Dependency;
      +29  import org.slf4j.Logger;
      +30  import org.slf4j.LoggerFactory;
      +31  
      +32  import java.io.File;
      +33  
      +34  import static org.hamcrest.CoreMatchers.is;
      +35  import static org.hamcrest.CoreMatchers.not;
      +36  import static org.junit.Assert.assertThat;
      +37  
      +38  /**
      +39   * Unit tests for {@link RubyBundleAuditAnalyzer}.
      +40   *
      +41   * @author Dale Visser <dvisser@ida.org>
      +42   */
      +43  public class RubyBundleAuditAnalyzerTest extends BaseTest {
      +44  
      +45      private static final Logger LOGGER = LoggerFactory.getLogger(RubyBundleAuditAnalyzerTest.class);
      +46  
      +47      /**
      +48       * The analyzer to test.
      +49       */
      +50      RubyBundleAuditAnalyzer analyzer;
      +51  
      +52      /**
      +53       * Correctly setup the analyzer for testing.
      +54       *
      +55       * @throws Exception thrown if there is a problem
      +56       */
      +57      @Before
      +58      public void setUp() throws Exception {
      +59          try {
      +60              analyzer = new RubyBundleAuditAnalyzer();
      +61              analyzer.setFilesMatched(true);
      +62              analyzer.initialize();
      +63          } catch (Exception e) {
      +64              //LOGGER.warn("Exception setting up RubyBundleAuditAnalyzer. Tests will be incomplete", e);
      +65              Assume.assumeNoException("Exception setting up RubyBundleAuditAnalyzer; bundle audit may not be installed. Tests will be incomplete", e);
      +66          }
      +67      }
      +68  
      +69      /**
      +70       * Cleanup the analyzer's temp files, etc.
      +71       *
      +72       * @throws Exception thrown if there is a problem
      +73       */
      +74      @After
      +75      public void tearDown() throws Exception {
      +76          analyzer.close();
      +77          analyzer = null;
      +78      }
      +79  
      +80      /**
      +81       * Test Ruby Gemspec name.
      +82       */
      +83      @Test
      +84      public void testGetName() {
      +85          assertThat(analyzer.getName(), is("Ruby Bundle Audit Analyzer"));
      +86      }
      +87  
      +88      /**
      +89       * Test Ruby Bundler Audit file support.
      +90       */
      +91      @Test
      +92      public void testSupportsFiles() {
      +93          assertThat(analyzer.accept(new File("Gemfile.lock")), is(true));
      +94      }
      +95  
      +96      /**
      +97       * Test Ruby BundlerAudit analysis.
      +98       *
      +99       * @throws AnalysisException is thrown when an exception occurs.
      +100      */
      +101     @Test
      +102     public void testAnalysis() throws AnalysisException, DatabaseException {
      +103         final Dependency result = new Dependency(BaseTest.getResourceAsFile(this,
      +104                 "ruby/vulnerable/Gemfile.lock"));
      +105         final Engine engine = new Engine();
      +106         analyzer.analyze(result, engine);
      +107         assertThat(engine.getDependencies().size(), is(not(0)));
      +108     }
      +109 }
      +
      +
      + + + diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzerTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzerTest.html index 43b76a407..6aba6f081 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzerTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzerTest.html @@ -74,7 +74,7 @@ 66 } 67 68 /** -69 * Test of getName method, of class PythonDistributionAnalyzer. +69 * Test Ruby Gemspec name. 70 */ 71 @Test 72 public void testGetName() { @@ -82,7 +82,7 @@ 74 } 75 76 /** -77 * Test of supportsExtension method, of class PythonDistributionAnalyzer. +77 * Test Ruby Gemspec file support. 78 */ 79 @Test 80 public void testSupportsFiles() { @@ -91,14 +91,14 @@ 83 } 84 85 /** -86 * Test of inspect method, of class PythonDistributionAnalyzer. +86 * Test Ruby Gemspec analysis. 87 * 88 * @throws AnalysisException is thrown when an exception occurs. 89 */ 90 @Test 91 public void testAnalyzePackageJson() throws AnalysisException { 92 final Dependency result = new Dependency(BaseTest.getResourceAsFile(this, -93 "ruby/gems/specifications/rest-client-1.7.2.gemspec")); +93 "ruby/vulnerable/gems/specifications/rest-client-1.7.2.gemspec")); 94 analyzer.analyze(result, null); 95 final String vendorString = result.getVendorEvidence().toString(); 96 assertThat(vendorString, containsString("REST Client Team")); diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/VulnerabilitySuppressionAnalyzerIntegrationTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/VulnerabilitySuppressionAnalyzerIntegrationTest.html index e1ca8c8db..bb723d413 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/VulnerabilitySuppressionAnalyzerIntegrationTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/VulnerabilitySuppressionAnalyzerIntegrationTest.html @@ -29,9 +29,9 @@ 21 import static org.junit.Assert.assertEquals; 22 import static org.junit.Assert.assertTrue; 23 import org.junit.Test; -24 import org.owasp.dependencycheck.BaseTest; -25 import org.owasp.dependencycheck.Engine; -26 import org.owasp.dependencycheck.data.cpe.AbstractDatabaseTestCase; +24 import org.owasp.dependencycheck.BaseDBTestCase; +25 import org.owasp.dependencycheck.BaseTest; +26 import org.owasp.dependencycheck.Engine; 27 import org.owasp.dependencycheck.dependency.Dependency; 28 import org.owasp.dependencycheck.utils.Settings; 29 @@ -40,7 +40,7 @@ 32 * 33 * @author Jeremy Long 34 */ -35 public class VulnerabilitySuppressionAnalyzerIntegrationTest extends AbstractDatabaseTestCase { +35 public class VulnerabilitySuppressionAnalyzerIntegrationTest extends BaseDBTestCase { 36 37 /** 38 * Test of getName method, of class VulnerabilitySuppressionAnalyzer. diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/package-frame.html index 52955a2fb..c5c593f3b 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.analyzer + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.analyzer @@ -29,6 +29,9 @@
    • ArchiveAnalyzerIntegrationTest +
    • +
    • + ArchiveAnalyzerTest
    • AssemblyAnalyzerTest @@ -77,6 +80,9 @@
    • PythonPackageAnalyzerTest +
    • +
    • + RubyBundleAuditAnalyzerTest
    • RubyGemspecAnalyzerTest diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/package-summary.html index 7a11f61ff..fd5febd3a 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/analyzer/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.analyzer + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.analyzer @@ -59,6 +59,11 @@
  • + + + + + + - - - diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cwe/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cwe/package-frame.html index dcd76c33f..c2892b507 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cwe/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cwe/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.cwe + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.cwe diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cwe/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cwe/package-summary.html index 14ed2ff33..829988fe3 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cwe/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cwe/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.cwe + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.cwe diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/lucene/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/lucene/package-frame.html index a09ea38cf..74db4f97c 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/lucene/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/lucene/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.lucene + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.lucene diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/lucene/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/lucene/package-summary.html index 6bc5b2c7e..16ca759b6 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/lucene/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/lucene/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.lucene + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.lucene diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nexus/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nexus/package-frame.html index f76f82fae..cb73f724f 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nexus/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nexus/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.nexus + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.nexus diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nexus/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nexus/package-summary.html index 00f848881..15bbae204 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nexus/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nexus/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.nexus + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.nexus diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nuget/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nuget/package-frame.html index f2b02f8a7..e069c5430 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nuget/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nuget/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.nuget + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.nuget diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nuget/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nuget/package-summary.html index 814999581..504ff2470 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nuget/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nuget/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.nuget + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.nuget diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/ConnectionFactoryTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/ConnectionFactoryTest.html new file mode 100644 index 000000000..5ace3ffd4 --- /dev/null +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/ConnectionFactoryTest.html @@ -0,0 +1,60 @@ + + + +ConnectionFactoryTest xref + + + +
    +1   /*
    +2    * Copyright 2015 OWASP.
    +3    *
    +4    * Licensed under the Apache License, Version 2.0 (the "License");
    +5    * you may not use this file except in compliance with the License.
    +6    * You may obtain a copy of the License at
    +7    *
    +8    *      http://www.apache.org/licenses/LICENSE-2.0
    +9    *
    +10   * Unless required by applicable law or agreed to in writing, software
    +11   * distributed under the License is distributed on an "AS IS" BASIS,
    +12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +13   * See the License for the specific language governing permissions and
    +14   * limitations under the License.
    +15   */
    +16  package org.owasp.dependencycheck.data.nvdcve;
    +17  
    +18  import java.sql.Connection;
    +19  import java.sql.SQLException;
    +20  import org.junit.After;
    +21  import org.junit.AfterClass;
    +22  import org.junit.Before;
    +23  import org.junit.BeforeClass;
    +24  import org.junit.Test;
    +25  import static org.junit.Assert.*;
    +26  import org.owasp.dependencycheck.BaseDBTestCase;
    +27  
    +28  /**
    +29   *
    +30   * @author jeremy
    +31   */
    +32  public class ConnectionFactoryTest extends BaseDBTestCase {
    +33  
    +34      /**
    +35       * Test of initialize method, of class ConnectionFactory.
    +36       *
    +37       * @throws org.owasp.dependencycheck.data.nvdcve.DatabaseException
    +38       */
    +39      @Test
    +40      public void testInitialize() throws DatabaseException, SQLException {
    +41          ConnectionFactory.initialize();
    +42          Connection result = ConnectionFactory.getConnection();
    +43          assertNotNull(result);
    +44          result.close();
    +45          ConnectionFactory.cleanup();
    +46      }
    +47  }
    +
    +
    + + + diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBIntegrationTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBIntegrationTest.html index 86cd991e1..7804fabb9 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBIntegrationTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBIntegrationTest.html @@ -25,168 +25,169 @@ 17 */18package org.owasp.dependencycheck.data.nvdcve; 19 -20import java.util.HashMap; -21import java.util.List; -22import java.util.Map; -23import java.util.Map.Entry; -24import java.util.Set; -25import org.junit.Assert; -26importstatic org.junit.Assert.assertTrue; -27import org.junit.Test; -28import org.owasp.dependencycheck.dependency.Vulnerability; -29import org.owasp.dependencycheck.dependency.VulnerableSoftware; -30import org.owasp.dependencycheck.utils.DependencyVersion; -31 -32/** -33 * -34 * @author Jeremy Long -35 */ -36publicclassCveDBIntegrationTestextendsBaseDBTestCase { -37 -38/** -39 * Pretty useless tests of open, commit, and close methods, of class CveDB. -40 */ -41 @Test -42publicvoid testOpen() throws Exception { -43 CveDB instance = null; -44try { -45 instance = new CveDB(); -46 instance.open(); -47 instance.commit(); -48 } finally { -49if (instance != null) { -50 instance.close(); -51 } -52 } -53 } -54 -55/** -56 * Test of getCPEs method, of class CveDB. -57 */ -58 @Test -59publicvoid testGetCPEs() throws Exception { -60 CveDB instance = null; -61try { -62 instance = new CveDB(); -63 String vendor = "apache"; -64 String product = "struts"; -65 instance.open(); -66 Set<VulnerableSoftware> result = instance.getCPEs(vendor, product); -67 assertTrue(result.size() > 5); -68 } finally { -69if (instance != null) { -70 instance.close(); -71 } -72 } -73 } -74 -75/** -76 * Test of getVulnerabilities method, of class CveDB. -77 */ -78 @Test -79publicvoid testGetVulnerabilities() throws Exception { -80 String cpeStr = "cpe:/a:apache:struts:2.1.2"; -81 CveDB instance = null; -82 List<Vulnerability> results; -83try { -84 instance = new CveDB(); -85 instance.open(); -86 results = instance.getVulnerabilities(cpeStr); -87 assertTrue(results.size() > 5); -88 cpeStr = "cpe:/a:jruby:jruby:1.6.3"; -89 results = instance.getVulnerabilities(cpeStr); -90 assertTrue(results.size() > 1); -91 -92boolean found = false; -93 String expected = "CVE-2011-4838"; -94for (Vulnerability v : results) { -95if (expected.equals(v.getName())) { -96 found = true; -97break; -98 } -99 } -100 assertTrue("Expected " + expected + ", but was not identified", found); -101 -102 found = false; -103 expected = "CVE-2012-5370"; -104for (Vulnerability v : results) { -105if (expected.equals(v.getName())) { -106 found = true; -107break; -108 } -109 } -110 assertTrue("Expected " + expected + ", but was not identified", found); -111 -112 } finally { -113if (instance != null) { -114 instance.close(); -115 } -116 } -117 } -118 -119/** -120 * Test of getMatchingSoftware method, of class CveDB. -121 */ -122 @Test -123publicvoid testGetMatchingSoftware() throws Exception { -124 CveDB instance = null; -125 Map<String, Boolean> versions = new HashMap<String, Boolean>(); -126 DependencyVersion identifiedVersion = new DependencyVersion("1.0.1o"); -127 versions.put("cpe:/a:openssl:openssl:1.0.1e", Boolean.FALSE); -128try { -129 instance = new CveDB(); -130 Entry<String, Boolean> results = instance.getMatchingSoftware(versions, "openssl", "openssl", identifiedVersion); -131 Assert.assertNull(results); -132 versions.put("cpe:/a:openssl:openssl:1.0.1p", Boolean.FALSE); -133 results = instance.getMatchingSoftware(versions, "openssl", "openssl", identifiedVersion); -134 Assert.assertNull(results); -135 -136 versions.put("cpe:/a:openssl:openssl:1.0.1q", Boolean.TRUE); -137 results = instance.getMatchingSoftware(versions, "openssl", "openssl", identifiedVersion); -138 Assert.assertNotNull(results); -139 Assert.assertEquals("cpe:/a:openssl:openssl:1.0.1q", results.getKey()); -140 -141 versions.clear(); -142 -143 versions.put("cpe:/a:springsource:spring_framework:3.2.5", Boolean.FALSE); -144 versions.put("cpe:/a:springsource:spring_framework:3.2.6", Boolean.FALSE); -145 versions.put("cpe:/a:springsource:spring_framework:3.2.7", Boolean.TRUE); -146 -147 versions.put("cpe:/a:springsource:spring_framework:4.0.1", Boolean.TRUE); -148 versions.put("cpe:/a:springsource:spring_framework:4.0.0:m1", Boolean.FALSE); -149 versions.put("cpe:/a:springsource:spring_framework:4.0.0:m2", Boolean.FALSE); -150 versions.put("cpe:/a:springsource:spring_framework:4.0.0:rc1", Boolean.FALSE); -151 -152 identifiedVersion = new DependencyVersion("3.2.2"); -153 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); -154 Assert.assertEquals("cpe:/a:springsource:spring_framework:3.2.7", results.getKey()); -155 Assert.assertTrue(results.getValue()); -156 identifiedVersion = new DependencyVersion("3.2.12"); -157 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); -158 Assert.assertNull(results); -159 -160 identifiedVersion = new DependencyVersion("4.0.0"); -161 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); -162 Assert.assertEquals("cpe:/a:springsource:spring_framework:4.0.1", results.getKey()); -163 Assert.assertTrue(results.getValue()); -164 identifiedVersion = new DependencyVersion("4.1.0"); -165 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); -166 Assert.assertNull(results); -167 -168 versions.clear(); -169 -170 versions.put("cpe:/a:jruby:jruby:-", Boolean.FALSE); -171 identifiedVersion = new DependencyVersion("1.6.3"); -172 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); -173 Assert.assertNotNull(results); -174 } finally { -175if (instance != null) { -176 instance.close(); -177 } -178 } -179 } -180 -181 } +20import org.owasp.dependencycheck.BaseDBTestCase; +21import java.util.HashMap; +22import java.util.List; +23import java.util.Map; +24import java.util.Map.Entry; +25import java.util.Set; +26import org.junit.Assert; +27importstatic org.junit.Assert.assertTrue; +28import org.junit.Test; +29import org.owasp.dependencycheck.dependency.Vulnerability; +30import org.owasp.dependencycheck.dependency.VulnerableSoftware; +31import org.owasp.dependencycheck.utils.DependencyVersion; +32 +33/** +34 * +35 * @author Jeremy Long +36 */ +37publicclassCveDBIntegrationTestextendsBaseDBTestCase { +38 +39/** +40 * Pretty useless tests of open, commit, and close methods, of class CveDB. +41 */ +42 @Test +43publicvoid testOpen() throws Exception { +44 CveDB instance = null; +45try { +46 instance = new CveDB(); +47 instance.open(); +48 instance.commit(); +49 } finally { +50if (instance != null) { +51 instance.close(); +52 } +53 } +54 } +55 +56/** +57 * Test of getCPEs method, of class CveDB. +58 */ +59 @Test +60publicvoid testGetCPEs() throws Exception { +61 CveDB instance = null; +62try { +63 instance = new CveDB(); +64 String vendor = "apache"; +65 String product = "struts"; +66 instance.open(); +67 Set<VulnerableSoftware> result = instance.getCPEs(vendor, product); +68 assertTrue(result.size() > 5); +69 } finally { +70if (instance != null) { +71 instance.close(); +72 } +73 } +74 } +75 +76/** +77 * Test of getVulnerabilities method, of class CveDB. +78 */ +79 @Test +80publicvoid testGetVulnerabilities() throws Exception { +81 String cpeStr = "cpe:/a:apache:struts:2.1.2"; +82 CveDB instance = null; +83 List<Vulnerability> results; +84try { +85 instance = new CveDB(); +86 instance.open(); +87 results = instance.getVulnerabilities(cpeStr); +88 assertTrue(results.size() > 5); +89 cpeStr = "cpe:/a:jruby:jruby:1.6.3"; +90 results = instance.getVulnerabilities(cpeStr); +91 assertTrue(results.size() > 1); +92 +93boolean found = false; +94 String expected = "CVE-2011-4838"; +95for (Vulnerability v : results) { +96if (expected.equals(v.getName())) { +97 found = true; +98break; +99 } +100 } +101 assertTrue("Expected " + expected + ", but was not identified", found); +102 +103 found = false; +104 expected = "CVE-2012-5370"; +105for (Vulnerability v : results) { +106if (expected.equals(v.getName())) { +107 found = true; +108break; +109 } +110 } +111 assertTrue("Expected " + expected + ", but was not identified", found); +112 +113 } finally { +114if (instance != null) { +115 instance.close(); +116 } +117 } +118 } +119 +120/** +121 * Test of getMatchingSoftware method, of class CveDB. +122 */ +123 @Test +124publicvoid testGetMatchingSoftware() throws Exception { +125 CveDB instance = null; +126 Map<String, Boolean> versions = new HashMap<String, Boolean>(); +127 DependencyVersion identifiedVersion = new DependencyVersion("1.0.1o"); +128 versions.put("cpe:/a:openssl:openssl:1.0.1e", Boolean.FALSE); +129try { +130 instance = new CveDB(); +131 Entry<String, Boolean> results = instance.getMatchingSoftware(versions, "openssl", "openssl", identifiedVersion); +132 Assert.assertNull(results); +133 versions.put("cpe:/a:openssl:openssl:1.0.1p", Boolean.FALSE); +134 results = instance.getMatchingSoftware(versions, "openssl", "openssl", identifiedVersion); +135 Assert.assertNull(results); +136 +137 versions.put("cpe:/a:openssl:openssl:1.0.1q", Boolean.TRUE); +138 results = instance.getMatchingSoftware(versions, "openssl", "openssl", identifiedVersion); +139 Assert.assertNotNull(results); +140 Assert.assertEquals("cpe:/a:openssl:openssl:1.0.1q", results.getKey()); +141 +142 versions.clear(); +143 +144 versions.put("cpe:/a:springsource:spring_framework:3.2.5", Boolean.FALSE); +145 versions.put("cpe:/a:springsource:spring_framework:3.2.6", Boolean.FALSE); +146 versions.put("cpe:/a:springsource:spring_framework:3.2.7", Boolean.TRUE); +147 +148 versions.put("cpe:/a:springsource:spring_framework:4.0.1", Boolean.TRUE); +149 versions.put("cpe:/a:springsource:spring_framework:4.0.0:m1", Boolean.FALSE); +150 versions.put("cpe:/a:springsource:spring_framework:4.0.0:m2", Boolean.FALSE); +151 versions.put("cpe:/a:springsource:spring_framework:4.0.0:rc1", Boolean.FALSE); +152 +153 identifiedVersion = new DependencyVersion("3.2.2"); +154 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); +155 Assert.assertEquals("cpe:/a:springsource:spring_framework:3.2.7", results.getKey()); +156 Assert.assertTrue(results.getValue()); +157 identifiedVersion = new DependencyVersion("3.2.12"); +158 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); +159 Assert.assertNull(results); +160 +161 identifiedVersion = new DependencyVersion("4.0.0"); +162 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); +163 Assert.assertEquals("cpe:/a:springsource:spring_framework:4.0.1", results.getKey()); +164 Assert.assertTrue(results.getValue()); +165 identifiedVersion = new DependencyVersion("4.1.0"); +166 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); +167 Assert.assertNull(results); +168 +169 versions.clear(); +170 +171 versions.put("cpe:/a:jruby:jruby:-", Boolean.FALSE); +172 identifiedVersion = new DependencyVersion("1.6.3"); +173 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); +174 Assert.assertNotNull(results); +175 } finally { +176if (instance != null) { +177 instance.close(); +178 } +179 } +180 } +181 +182 }
    diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBMySQLTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBMySQLTest.html index eb7d87933..9202e32af 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBMySQLTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBMySQLTest.html @@ -33,84 +33,88 @@ 25import org.junit.Before; 26import org.junit.BeforeClass; 27import org.junit.Test; -28import org.owasp.dependencycheck.dependency.VulnerableSoftware; -29 -30/** -31 * -32 * @author Jeremy Long -33 */ -34publicclassCveDBMySQLTest { -35 -36 @BeforeClass -37publicstaticvoid setUpClass() { -38 } -39 -40 @AfterClass -41publicstaticvoid tearDownClass() { -42 } -43 -44 @Before -45publicvoid setUp() throws Exception { +28import org.owasp.dependencycheck.dependency.Vulnerability; +29import org.owasp.dependencycheck.dependency.VulnerableSoftware; +30import org.owasp.dependencycheck.utils.Settings; +31 +32/** +33 * +34 * @author Jeremy Long +35 */ +36publicclassCveDBMySQLTest { +37 +38 @BeforeClass +39publicstaticvoid setUpClass() { +40 Settings.initialize(); +41 } +42 +43 @AfterClass +44publicstaticvoid tearDownClass() { +45 Settings.cleanup(); 46 } 47 -48 @After -49publicvoid tearDown() throws Exception { +48 @Before +49publicvoid setUp() throws Exception { 50 } 51 -52/** -53 * Pretty useless tests of open, commit, and close methods, of class CveDB. -54 */ -55 @Test -56publicvoid testOpen() throws DatabaseException { -57try { -58 CveDB instance = new CveDB(); -59 instance.open(); -60 instance.close(); -61 } catch (DatabaseException ex) { -62 System.out.println("Unable to connect to the My SQL database; verify that the db server is running and that the schema has been generated"); -63throw ex; -64 } -65 } -66 -67/** -68 * Test of getCPEs method, of class CveDB. -69 */ -70 @Test -71publicvoid testGetCPEs() throws Exception { -72 CveDB instance = new CveDB(); -73try { -74 String vendor = "apache"; -75 String product = "struts"; -76 instance.open(); -77 Set<VulnerableSoftware> result = instance.getCPEs(vendor, product); -78 assertTrue("Has data been loaded into the MySQL DB? if not consider using the CLI to populate it", result.size() > 5); -79 } catch (Exception ex) { -80 System.out.println("Unable to access the My SQL database; verify that the db server is running and that the schema has been generated"); -81throw ex; -82 } finally { -83 instance.close(); -84 } -85 } -86 -87/** -88 * Test of getVulnerabilities method, of class CveDB. -89 */ -90 @Test -91publicvoid testGetVulnerabilities() throws Exception { -92 String cpeStr = "cpe:/a:apache:struts:2.1.2"; -93 CveDB instance = new CveDB(); -94try { -95 instance.open(); -96 List result = instance.getVulnerabilities(cpeStr); -97 assertTrue(result.size() > 5); -98 } catch (Exception ex) { -99 System.out.println("Unable to access the My SQL database; verify that the db server is running and that the schema has been generated"); -100throw ex; -101 } finally { -102 instance.close(); -103 } -104 } -105 } +52 @After +53publicvoid tearDown() throws Exception { +54 } +55 +56/** +57 * Pretty useless tests of open, commit, and close methods, of class CveDB. +58 */ +59 @Test +60publicvoid testOpen() throws DatabaseException { +61try { +62 CveDB instance = new CveDB(); +63 instance.open(); +64 instance.close(); +65 } catch (DatabaseException ex) { +66 System.out.println("Unable to connect to the My SQL database; verify that the db server is running and that the schema has been generated"); +67throw ex; +68 } +69 } +70 +71/** +72 * Test of getCPEs method, of class CveDB. +73 */ +74 @Test +75publicvoid testGetCPEs() throws Exception { +76 CveDB instance = new CveDB(); +77try { +78 String vendor = "apache"; +79 String product = "struts"; +80 instance.open(); +81 Set<VulnerableSoftware> result = instance.getCPEs(vendor, product); +82 assertTrue("Has data been loaded into the MySQL DB? if not consider using the CLI to populate it", result.size() > 5); +83 } catch (Exception ex) { +84 System.out.println("Unable to access the My SQL database; verify that the db server is running and that the schema has been generated"); +85throw ex; +86 } finally { +87 instance.close(); +88 } +89 } +90 +91/** +92 * Test of getVulnerabilities method, of class CveDB. +93 */ +94 @Test +95publicvoid testGetVulnerabilities() throws Exception { +96 String cpeStr = "cpe:/a:apache:struts:2.1.2"; +97 CveDB instance = new CveDB(); +98try { +99 instance.open(); +100 List<Vulnerability> result = instance.getVulnerabilities(cpeStr); +101 assertTrue(result.size() > 5); +102 } catch (Exception ex) { +103 System.out.println("Unable to access the My SQL database; verify that the db server is running and that the schema has been generated"); +104throw ex; +105 } finally { +106 instance.close(); +107 } +108 } +109 }
    diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/DatabasePropertiesIntegrationTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/DatabasePropertiesIntegrationTest.html index 2588517aa..73ed3e2fe 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/DatabasePropertiesIntegrationTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/DatabasePropertiesIntegrationTest.html @@ -25,132 +25,133 @@ 17 */18package org.owasp.dependencycheck.data.nvdcve; 19 -20import java.util.Properties; -21importstatic org.junit.Assert.assertEquals; -22importstatic org.junit.Assert.assertTrue; -23import org.junit.Test; -24import org.owasp.dependencycheck.data.update.nvd.NvdCveInfo; -25 -26/** -27 * -28 * @author Jeremy Long -29 */ -30publicclassDatabasePropertiesIntegrationTestextendsBaseDBTestCase { -31 -32/** -33 * Test of isEmpty method, of class DatabaseProperties. -34 */ -35 @Test -36publicvoid testIsEmpty() throws Exception { -37 CveDB cveDB = null; -38try { -39 cveDB = new CveDB(); -40 cveDB.open(); -41 DatabaseProperties instance = cveDB.getDatabaseProperties(); -42boolean expResult = false; -43boolean result = instance.isEmpty(); -44//no exception means the call worked... whether or not it is empty depends on if the db is new -45//assertEquals(expResult, result); -46 } finally { -47if (cveDB != null) { -48 cveDB.close(); -49 } -50 } -51 } -52 -53/** -54 * Test of save method, of class DatabaseProperties. -55 */ -56 @Test -57publicvoid testSave() throws Exception { -58 NvdCveInfo updatedValue = new NvdCveInfo(); -59 String key = "test"; -60long expected = 1337; -61 updatedValue.setId(key); -62 updatedValue.setTimestamp(expected); -63 CveDB cveDB = null; -64try { -65 cveDB = new CveDB(); -66 cveDB.open(); -67 DatabaseProperties instance = cveDB.getDatabaseProperties(); -68 instance.save(updatedValue); -69//reload the properties -70 cveDB.close(); -71 cveDB = new CveDB(); -72 cveDB.open(); -73 instance = cveDB.getDatabaseProperties(); -74long results = Long.parseLong(instance.getProperty("NVD CVE " + key)); -75 assertEquals(expected, results); -76 } finally { -77if (cveDB != null) { -78 cveDB.close(); -79 } -80 } -81 } -82 -83/** -84 * Test of getProperty method, of class DatabaseProperties. -85 */ -86 @Test -87publicvoid testGetProperty_String_String() throws Exception { -88 String key = "doesn't exist"; -89 String defaultValue = "default"; -90 CveDB cveDB = null; -91try { -92 cveDB = new CveDB(); -93 cveDB.open(); -94 DatabaseProperties instance = cveDB.getDatabaseProperties(); -95 String expResult = "default"; -96 String result = instance.getProperty(key, defaultValue); -97 assertEquals(expResult, result); -98 } finally { -99if (cveDB != null) { -100 cveDB.close(); -101 } -102 } -103 } -104 -105/** -106 * Test of getProperty method, of class DatabaseProperties. -107 */ -108 @Test -109publicvoid testGetProperty_String() throws DatabaseException { -110 String key = "version"; -111 CveDB cveDB = null; -112try { -113 cveDB = new CveDB(); -114 cveDB.open(); -115 DatabaseProperties instance = cveDB.getDatabaseProperties(); -116 String result = instance.getProperty(key); -117double version = Double.parseDouble(result); -118 assertTrue(version >= 2.8); -119 assertTrue(version <= 10); -120 } finally { -121if (cveDB != null) { -122 cveDB.close(); -123 } -124 } -125 } -126 -127/** -128 * Test of getProperties method, of class DatabaseProperties. -129 */ -130 @Test -131publicvoid testGetProperties() throws DatabaseException { -132 CveDB cveDB = null; -133try { -134 cveDB = new CveDB(); -135 cveDB.open(); -136 DatabaseProperties instance = cveDB.getDatabaseProperties(); -137 Properties result = instance.getProperties(); -138 assertTrue(result.size() > 0); -139 } finally { -140if (cveDB != null) { -141 cveDB.close(); -142 } -143 } -144 } -145 } +20import org.owasp.dependencycheck.BaseDBTestCase; +21import java.util.Properties; +22importstatic org.junit.Assert.assertEquals; +23importstatic org.junit.Assert.assertTrue; +24import org.junit.Test; +25import org.owasp.dependencycheck.data.update.nvd.NvdCveInfo; +26 +27/** +28 * +29 * @author Jeremy Long +30 */ +31publicclassDatabasePropertiesIntegrationTestextendsBaseDBTestCase { +32 +33/** +34 * Test of isEmpty method, of class DatabaseProperties. +35 */ +36 @Test +37publicvoid testIsEmpty() throws Exception { +38 CveDB cveDB = null; +39try { +40 cveDB = new CveDB(); +41 cveDB.open(); +42 DatabaseProperties instance = cveDB.getDatabaseProperties(); +43boolean expResult = false; +44boolean result = instance.isEmpty(); +45//no exception means the call worked... whether or not it is empty depends on if the db is new +46//assertEquals(expResult, result); +47 } finally { +48if (cveDB != null) { +49 cveDB.close(); +50 } +51 } +52 } +53 +54/** +55 * Test of save method, of class DatabaseProperties. +56 */ +57 @Test +58publicvoid testSave() throws Exception { +59 NvdCveInfo updatedValue = new NvdCveInfo(); +60 String key = "test"; +61long expected = 1337; +62 updatedValue.setId(key); +63 updatedValue.setTimestamp(expected); +64 CveDB cveDB = null; +65try { +66 cveDB = new CveDB(); +67 cveDB.open(); +68 DatabaseProperties instance = cveDB.getDatabaseProperties(); +69 instance.save(updatedValue); +70//reload the properties +71 cveDB.close(); +72 cveDB = new CveDB(); +73 cveDB.open(); +74 instance = cveDB.getDatabaseProperties(); +75long results = Long.parseLong(instance.getProperty("NVD CVE " + key)); +76 assertEquals(expected, results); +77 } finally { +78if (cveDB != null) { +79 cveDB.close(); +80 } +81 } +82 } +83 +84/** +85 * Test of getProperty method, of class DatabaseProperties. +86 */ +87 @Test +88publicvoid testGetProperty_String_String() throws Exception { +89 String key = "doesn't exist"; +90 String defaultValue = "default"; +91 CveDB cveDB = null; +92try { +93 cveDB = new CveDB(); +94 cveDB.open(); +95 DatabaseProperties instance = cveDB.getDatabaseProperties(); +96 String expResult = "default"; +97 String result = instance.getProperty(key, defaultValue); +98 assertEquals(expResult, result); +99 } finally { +100if (cveDB != null) { +101 cveDB.close(); +102 } +103 } +104 } +105 +106/** +107 * Test of getProperty method, of class DatabaseProperties. +108 */ +109 @Test +110publicvoid testGetProperty_String() throws DatabaseException { +111 String key = "version"; +112 CveDB cveDB = null; +113try { +114 cveDB = new CveDB(); +115 cveDB.open(); +116 DatabaseProperties instance = cveDB.getDatabaseProperties(); +117 String result = instance.getProperty(key); +118double version = Double.parseDouble(result); +119 assertTrue(version >= 2.8); +120 assertTrue(version <= 10); +121 } finally { +122if (cveDB != null) { +123 cveDB.close(); +124 } +125 } +126 } +127 +128/** +129 * Test of getProperties method, of class DatabaseProperties. +130 */ +131 @Test +132publicvoid testGetProperties() throws DatabaseException { +133 CveDB cveDB = null; +134try { +135 cveDB = new CveDB(); +136 cveDB.open(); +137 DatabaseProperties instance = cveDB.getDatabaseProperties(); +138 Properties result = instance.getProperties(); +139 assertTrue(result.size() > 0); +140 } finally { +141if (cveDB != null) { +142 cveDB.close(); +143 } +144 } +145 } +146 }
    diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/package-frame.html index 9b7c40910..3fa77e1cf 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.nvdcve + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.nvdcve @@ -16,7 +16,7 @@
    • - BaseDBTestCase + ConnectionFactoryTest
    • CveDBIntegrationTest diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/package-summary.html index 197d8a6c4..b384a348d 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/nvdcve/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.nvdcve + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.nvdcve @@ -37,7 +37,7 @@
    diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/BaseUpdaterTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/BaseUpdaterTest.html index dc4183a46..71d0ed8a5 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/BaseUpdaterTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/BaseUpdaterTest.html @@ -26,7 +26,7 @@ 18package org.owasp.dependencycheck.data.update; 1920import org.junit.Test; -21import org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase; +21import org.owasp.dependencycheck.BaseDBTestCase; 22import org.owasp.dependencycheck.data.nvdcve.CveDB; 23import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties; 24import org.owasp.dependencycheck.data.update.exception.UpdateException; @@ -38,7 +38,7 @@ 30 *31 * @author Jeremy Long32 */ -33publicclassBaseUpdaterTestextendsBaseDBTestCase { +33publicclassBaseUpdaterTestextendsBaseDBTestCase { 3435/**36 * Test of getCveDB method, of class BaseUpdater. diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/nvd/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/nvd/package-frame.html index fee06151f..af17f8d5c 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/nvd/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/nvd/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.update.nvd + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.update.nvd diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/nvd/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/nvd/package-summary.html index c2d2d9ce6..492ba53cb 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/nvd/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/nvd/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.update.nvd + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.update.nvd diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/package-frame.html index e3d49fe80..3c9c7d3bb 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.update + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.update diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/package-summary.html index d0aa57ffb..3cb66616c 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/update/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.update + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.update diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/dependency/DependencyTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/dependency/DependencyTest.html index f29864b61..7ff2c9153 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/dependency/DependencyTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/dependency/DependencyTest.html @@ -193,133 +193,132 @@ 185 @Test 186publicvoid testGetIdentifiers() { 187 Dependency instance = new Dependency(); -188 List expResult = null; -189 Set<Identifier> result = instance.getIdentifiers(); -190 -191 assertTrue(true); //this is just a getter setter pair. -192 } -193 -194/** -195 * Test of setIdentifiers method, of class Dependency. -196 */ -197 @Test -198publicvoid testSetIdentifiers() { -199 Set<Identifier> identifiers = null; -200 Dependency instance = new Dependency(); -201 instance.setIdentifiers(identifiers); -202 assertTrue(true); //this is just a getter setter pair. -203 } -204 -205/** -206 * Test of addIdentifier method, of class Dependency. -207 */ -208 @Test -209publicvoid testAddIdentifier() { -210 String type = "cpe"; -211 String value = "cpe:/a:apache:struts:2.1.2"; -212 String url = "http://somewhere"; -213 Identifier expResult = new Identifier(type, value, url); -214 -215 Dependency instance = new Dependency(); -216 instance.addIdentifier(type, value, url); -217 assertEquals(1, instance.getIdentifiers().size()); -218 assertTrue("Identifier doesn't contain expected result.", instance.getIdentifiers().contains(expResult)); -219 } -220 -221/** -222 * Test of getEvidence method, of class Dependency. -223 */ -224 @Test -225publicvoid testGetEvidence() { -226 Dependency instance = new Dependency(); -227 EvidenceCollection expResult = null; -228 EvidenceCollection result = instance.getEvidence(); -229 assertTrue(true); //this is just a getter setter pair. -230 } -231 -232/** -233 * Test of getEvidenceUsed method, of class Dependency. -234 */ -235 @Test -236publicvoid testGetEvidenceUsed() { -237 Dependency instance = new Dependency(); -238 String expResult = "used"; -239 -240 instance.getProductEvidence().addEvidence("used", "used", "used", Confidence.HIGH); -241 instance.getProductEvidence().addEvidence("not", "not", "not", Confidence.MEDIUM); -242for (Evidence e : instance.getProductEvidence().iterator(Confidence.HIGH)) { -243 String use = e.getValue(); -244 } -245 -246 EvidenceCollection result = instance.getEvidenceUsed(); -247 -248 assertEquals(1, result.size()); -249 assertTrue(result.containsUsedString(expResult)); -250 } -251 -252/** -253 * Test of getVendorEvidence method, of class Dependency. -254 */ -255 @Test -256publicvoid testGetVendorEvidence() { -257 Dependency instance = new Dependency(); -258 EvidenceCollection expResult = null; -259 EvidenceCollection result = instance.getVendorEvidence(); -260 assertTrue(true); //this is just a getter setter pair. -261 } -262 -263/** -264 * Test of getProductEvidence method, of class Dependency. -265 */ -266 @Test -267publicvoid testGetProductEvidence() { -268 Dependency instance = new Dependency(); -269 EvidenceCollection expResult = null; -270 EvidenceCollection result = instance.getProductEvidence(); -271 assertTrue(true); //this is just a getter setter pair. -272 } -273 -274/** -275 * Test of getVersionEvidence method, of class Dependency. -276 */ -277 @Test -278publicvoid testGetVersionEvidence() { -279 Dependency instance = new Dependency(); -280 EvidenceCollection expResult = null; -281 EvidenceCollection result = instance.getVersionEvidence(); -282 assertTrue(true); //this is just a getter setter pair. -283 } -284 -285/** -286 * Test of addAsEvidence method, of class Dependency. -287 */ -288 @Test -289publicvoid testAddAsEvidence() { -290 Dependency instance = new Dependency(); -291 MavenArtifact mavenArtifact = new MavenArtifact("group", "artifact", "version", "url"); -292 instance.addAsEvidence("pom", mavenArtifact, Confidence.HIGH); -293 assertTrue(instance.getEvidence().contains(Confidence.HIGH)); -294 assertFalse(instance.getEvidence().getEvidence("pom", "groupid").isEmpty()); -295 assertFalse(instance.getEvidence().getEvidence("pom", "artifactid").isEmpty()); -296 assertFalse(instance.getEvidence().getEvidence("pom", "version").isEmpty()); -297 assertFalse(instance.getIdentifiers().isEmpty()); -298 } -299 -300/** -301 * Test of addAsEvidence method, of class Dependency. -302 */ -303 @Test -304publicvoid testAddAsEvidenceWithEmptyArtefact() { -305 Dependency instance = new Dependency(); -306 MavenArtifact mavenArtifact = new MavenArtifact(null, null, null, null); -307 instance.addAsEvidence("pom", mavenArtifact, Confidence.HIGH); -308 assertFalse(instance.getEvidence().contains(Confidence.HIGH)); -309 assertTrue(instance.getEvidence().getEvidence("pom", "groupid").isEmpty()); -310 assertTrue(instance.getEvidence().getEvidence("pom", "artifactid").isEmpty()); -311 assertTrue(instance.getEvidence().getEvidence("pom", "version").isEmpty()); -312 assertTrue(instance.getIdentifiers().isEmpty()); -313 } -314 } +188 Set<Identifier> result = instance.getIdentifiers(); +189 +190 assertTrue(true); //this is just a getter setter pair. +191 } +192 +193/** +194 * Test of setIdentifiers method, of class Dependency. +195 */ +196 @Test +197publicvoid testSetIdentifiers() { +198 Set<Identifier> identifiers = null; +199 Dependency instance = new Dependency(); +200 instance.setIdentifiers(identifiers); +201 assertTrue(true); //this is just a getter setter pair. +202 } +203 +204/** +205 * Test of addIdentifier method, of class Dependency. +206 */ +207 @Test +208publicvoid testAddIdentifier() { +209 String type = "cpe"; +210 String value = "cpe:/a:apache:struts:2.1.2"; +211 String url = "http://somewhere"; +212 Identifier expResult = new Identifier(type, value, url); +213 +214 Dependency instance = new Dependency(); +215 instance.addIdentifier(type, value, url); +216 assertEquals(1, instance.getIdentifiers().size()); +217 assertTrue("Identifier doesn't contain expected result.", instance.getIdentifiers().contains(expResult)); +218 } +219 +220/** +221 * Test of getEvidence method, of class Dependency. +222 */ +223 @Test +224publicvoid testGetEvidence() { +225 Dependency instance = new Dependency(); +226 EvidenceCollection expResult = null; +227 EvidenceCollection result = instance.getEvidence(); +228 assertTrue(true); //this is just a getter setter pair. +229 } +230 +231/** +232 * Test of getEvidenceUsed method, of class Dependency. +233 */ +234 @Test +235publicvoid testGetEvidenceUsed() { +236 Dependency instance = new Dependency(); +237 String expResult = "used"; +238 +239 instance.getProductEvidence().addEvidence("used", "used", "used", Confidence.HIGH); +240 instance.getProductEvidence().addEvidence("not", "not", "not", Confidence.MEDIUM); +241for (Evidence e : instance.getProductEvidence().iterator(Confidence.HIGH)) { +242 String use = e.getValue(); +243 } +244 +245 EvidenceCollection result = instance.getEvidenceUsed(); +246 +247 assertEquals(1, result.size()); +248 assertTrue(result.containsUsedString(expResult)); +249 } +250 +251/** +252 * Test of getVendorEvidence method, of class Dependency. +253 */ +254 @Test +255publicvoid testGetVendorEvidence() { +256 Dependency instance = new Dependency(); +257 EvidenceCollection expResult = null; +258 EvidenceCollection result = instance.getVendorEvidence(); +259 assertTrue(true); //this is just a getter setter pair. +260 } +261 +262/** +263 * Test of getProductEvidence method, of class Dependency. +264 */ +265 @Test +266publicvoid testGetProductEvidence() { +267 Dependency instance = new Dependency(); +268 EvidenceCollection expResult = null; +269 EvidenceCollection result = instance.getProductEvidence(); +270 assertTrue(true); //this is just a getter setter pair. +271 } +272 +273/** +274 * Test of getVersionEvidence method, of class Dependency. +275 */ +276 @Test +277publicvoid testGetVersionEvidence() { +278 Dependency instance = new Dependency(); +279 EvidenceCollection expResult = null; +280 EvidenceCollection result = instance.getVersionEvidence(); +281 assertTrue(true); //this is just a getter setter pair. +282 } +283 +284/** +285 * Test of addAsEvidence method, of class Dependency. +286 */ +287 @Test +288publicvoid testAddAsEvidence() { +289 Dependency instance = new Dependency(); +290 MavenArtifact mavenArtifact = new MavenArtifact("group", "artifact", "version", "url"); +291 instance.addAsEvidence("pom", mavenArtifact, Confidence.HIGH); +292 assertTrue(instance.getEvidence().contains(Confidence.HIGH)); +293 assertFalse(instance.getEvidence().getEvidence("pom", "groupid").isEmpty()); +294 assertFalse(instance.getEvidence().getEvidence("pom", "artifactid").isEmpty()); +295 assertFalse(instance.getEvidence().getEvidence("pom", "version").isEmpty()); +296 assertFalse(instance.getIdentifiers().isEmpty()); +297 } +298 +299/** +300 * Test of addAsEvidence method, of class Dependency. +301 */ +302 @Test +303publicvoid testAddAsEvidenceWithEmptyArtefact() { +304 Dependency instance = new Dependency(); +305 MavenArtifact mavenArtifact = new MavenArtifact(null, null, null, null); +306 instance.addAsEvidence("pom", mavenArtifact, Confidence.HIGH); +307 assertFalse(instance.getEvidence().contains(Confidence.HIGH)); +308 assertTrue(instance.getEvidence().getEvidence("pom", "groupid").isEmpty()); +309 assertTrue(instance.getEvidence().getEvidence("pom", "artifactid").isEmpty()); +310 assertTrue(instance.getEvidence().getEvidence("pom", "version").isEmpty()); +311 assertTrue(instance.getIdentifiers().isEmpty()); +312 } +313 }
    diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/dependency/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/dependency/package-frame.html index 16f19aa27..6fff43573 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/dependency/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/dependency/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.dependency + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.dependency diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/dependency/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/dependency/package-summary.html index d51b4d833..9ef4344c4 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/dependency/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/dependency/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.dependency + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.dependency diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/package-frame.html index 03fc34f71..b2557e9cb 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck @@ -16,6 +16,9 @@
    • + BaseDBTestCase +
    • +
    • BaseTest
    • diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/package-summary.html index 1b88397b6..d7cf2ac31 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck @@ -36,6 +36,11 @@
    + + + diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/reporting/ReportGeneratorIntegrationTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/reporting/ReportGeneratorIntegrationTest.html index bcbdf2277..a3736cdf0 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/reporting/ReportGeneratorIntegrationTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/reporting/ReportGeneratorIntegrationTest.html @@ -48,7 +48,7 @@ 4041 @Before 42publicvoid setUp() throws Exception { -43 org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase.ensureDBExists(); +43 org.owasp.dependencycheck.BaseDBTestCase.ensureDBExists(); 44 } 4546/** diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/reporting/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/reporting/package-frame.html index ae2733607..971a278d3 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/reporting/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/reporting/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.reporting + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.reporting diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/reporting/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/reporting/package-summary.html index ab6ce8f23..28f1a9ae6 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/reporting/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/reporting/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.reporting + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.reporting diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/SuppressionParserTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/SuppressionParserTest.html index 09add0ea4..febbdf203 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/SuppressionParserTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/SuppressionParserTest.html @@ -69,7 +69,7 @@ 61//File file = new File(this.getClass().getClassLoader().getResource("suppressions.xml").getPath());62 File file = BaseTest.getResourceAsFile(this, "suppressions.xml"); 63 SuppressionParser instance = new SuppressionParser(); -64 List result = instance.parseSuppressionRules(file); +64 List<SuppressionRule> result = instance.parseSuppressionRules(file); 65 assertTrue(result.size() > 3); 66 } 67 } diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/SuppressionRuleTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/SuppressionRuleTest.html index 8ba5311e9..72db0c9b2 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/SuppressionRuleTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/SuppressionRuleTest.html @@ -315,220 +315,199 @@ 307 } 308309/** -310 * Test of countCharacter method, of class SuppressionRule. +310 * Test of identifierMatches method, of class SuppressionRule.311 */312 @Test -313publicvoid testCountCharacter() { -314 String str = "cpe:/a:microsoft:.net_framework:4.5"; -315char c = ':'; -316 SuppressionRule instance = new SuppressionRule(); -317int expResult = 4; -318int result = instance.countCharacter(str, c); -319 assertEquals(expResult, result); -320 str = "::"; -321 expResult = 2; -322 result = instance.countCharacter(str, c); -323 assertEquals(expResult, result); -324 str = "these are not the characters you are looking for"; -325 expResult = 0; -326 result = instance.countCharacter(str, c); +313publicvoid testCpeMatches() { +314 Identifier identifier = new Identifier("cpe", "cpe:/a:microsoft:.net_framework:4.5", "some url not needed for this test"); +315 +316 PropertyType cpe = new PropertyType(); +317 cpe.setValue("cpe:/a:microsoft:.net_framework:4.5"); +318 +319 SuppressionRule instance = new SuppressionRule(); +320boolean expResult = true; +321boolean result = instance.identifierMatches("cpe", cpe, identifier); +322 assertEquals(expResult, result); +323 +324 cpe.setValue("cpe:/a:microsoft:.net_framework:4.0"); +325 expResult = false; +326 result = instance.identifierMatches("cpe", cpe, identifier); 327 assertEquals(expResult, result); -328 } -329 -330/** -331 * Test of identifierMatches method, of class SuppressionRule. -332 */ -333 @Test -334publicvoid testCpeMatches() { -335 Identifier identifier = new Identifier("cpe", "cpe:/a:microsoft:.net_framework:4.5", "some url not needed for this test"); -336 -337 PropertyType cpe = new PropertyType(); -338 cpe.setValue("cpe:/a:microsoft:.net_framework:4.5"); -339 -340 SuppressionRule instance = new SuppressionRule(); -341boolean expResult = true; -342boolean result = instance.identifierMatches("cpe", cpe, identifier); -343 assertEquals(expResult, result); -344 -345 cpe.setValue("cpe:/a:microsoft:.net_framework:4.0"); -346 expResult = false; -347 result = instance.identifierMatches("cpe", cpe, identifier); -348 assertEquals(expResult, result); -349 -350 cpe.setValue("CPE:/a:microsoft:.net_framework:4.5"); -351 cpe.setCaseSensitive(true); -352 expResult = false; -353 result = instance.identifierMatches("cpe", cpe, identifier); -354 assertEquals(expResult, result); -355 -356 cpe.setValue("cpe:/a:microsoft:.net_framework"); -357 cpe.setCaseSensitive(false); -358 expResult = true; -359 result = instance.identifierMatches("cpe", cpe, identifier); -360 assertEquals(expResult, result); -361 -362 cpe.setValue("cpe:/a:microsoft:.*"); -363 cpe.setRegex(true); -364 expResult = true; -365 result = instance.identifierMatches("cpe", cpe, identifier); -366 assertEquals(expResult, result); -367 -368 cpe.setValue("CPE:/a:microsoft:.*"); -369 cpe.setRegex(true); -370 cpe.setCaseSensitive(true); -371 expResult = false; -372 result = instance.identifierMatches("cpe", cpe, identifier); -373 assertEquals(expResult, result); -374 -375 cpe.setValue("cpe:/a:apache:.*"); -376 cpe.setRegex(true); -377 cpe.setCaseSensitive(false); -378 expResult = false; -379 result = instance.identifierMatches("cpe", cpe, identifier); -380 assertEquals(expResult, result); -381 -382 identifier = new Identifier("maven", "org.springframework:spring-core:2.5.5", "https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.springframework&a=spring-core&v=2.5.5&e=jar"); -383 cpe.setValue("org.springframework:spring-core:2.5.5"); -384 cpe.setRegex(false); -385 cpe.setCaseSensitive(false); -386 expResult = true; -387 result = instance.identifierMatches("maven", cpe, identifier); -388 assertEquals(expResult, result); -389 -390 cpe.setValue("org\\.springframework\\.security:spring.*"); -391 cpe.setRegex(true); -392 cpe.setCaseSensitive(false); -393 expResult = false; -394 result = instance.identifierMatches("maven", cpe, identifier); -395 assertEquals(expResult, result); -396 } -397 -398/** -399 * Test of process method, of class SuppressionRule. -400 */ -401 @Test -402publicvoid testProcess() { -403//File struts = new File(this.getClass().getClassLoader().getResource("struts2-core-2.1.2.jar").getPath()); -404 File struts = BaseTest.getResourceAsFile(this, "struts2-core-2.1.2.jar"); -405 Dependency dependency = new Dependency(struts); -406 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:4.5", "some url not needed for this test"); -407 String sha1 = dependency.getSha1sum(); -408 dependency.setSha1sum("384FAA82E193D4E4B0546059CA09572654BC3970"); -409 Vulnerability v = createVulnerability(); -410 dependency.addVulnerability(v); -411 -412//cwe -413 SuppressionRule instance = new SuppressionRule(); -414 instance.setSha1(sha1); -415 instance.addCwe("287"); -416 instance.process(dependency); -417 assertEquals(1, dependency.getVulnerabilities().size()); -418 dependency.setSha1sum(sha1); -419 instance.process(dependency); -420 assertTrue(dependency.getVulnerabilities().isEmpty()); -421 assertEquals(1, dependency.getSuppressedVulnerabilities().size()); -422 -423//cvss -424 dependency.addVulnerability(v); +328 +329 cpe.setValue("CPE:/a:microsoft:.net_framework:4.5"); +330 cpe.setCaseSensitive(true); +331 expResult = false; +332 result = instance.identifierMatches("cpe", cpe, identifier); +333 assertEquals(expResult, result); +334 +335 cpe.setValue("cpe:/a:microsoft:.net_framework"); +336 cpe.setCaseSensitive(false); +337 expResult = true; +338 result = instance.identifierMatches("cpe", cpe, identifier); +339 assertEquals(expResult, result); +340 +341 cpe.setValue("cpe:/a:microsoft:.*"); +342 cpe.setRegex(true); +343 expResult = true; +344 result = instance.identifierMatches("cpe", cpe, identifier); +345 assertEquals(expResult, result); +346 +347 cpe.setValue("CPE:/a:microsoft:.*"); +348 cpe.setRegex(true); +349 cpe.setCaseSensitive(true); +350 expResult = false; +351 result = instance.identifierMatches("cpe", cpe, identifier); +352 assertEquals(expResult, result); +353 +354 cpe.setValue("cpe:/a:apache:.*"); +355 cpe.setRegex(true); +356 cpe.setCaseSensitive(false); +357 expResult = false; +358 result = instance.identifierMatches("cpe", cpe, identifier); +359 assertEquals(expResult, result); +360 +361 identifier = new Identifier("maven", "org.springframework:spring-core:2.5.5", "https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.springframework&a=spring-core&v=2.5.5&e=jar"); +362 cpe.setValue("org.springframework:spring-core:2.5.5"); +363 cpe.setRegex(false); +364 cpe.setCaseSensitive(false); +365 expResult = true; +366 result = instance.identifierMatches("maven", cpe, identifier); +367 assertEquals(expResult, result); +368 +369 cpe.setValue("org\\.springframework\\.security:spring.*"); +370 cpe.setRegex(true); +371 cpe.setCaseSensitive(false); +372 expResult = false; +373 result = instance.identifierMatches("maven", cpe, identifier); +374 assertEquals(expResult, result); +375 } +376 +377/** +378 * Test of process method, of class SuppressionRule. +379 */ +380 @Test +381publicvoid testProcess() { +382//File struts = new File(this.getClass().getClassLoader().getResource("struts2-core-2.1.2.jar").getPath()); +383 File struts = BaseTest.getResourceAsFile(this, "struts2-core-2.1.2.jar"); +384 Dependency dependency = new Dependency(struts); +385 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:4.5", "some url not needed for this test"); +386 String sha1 = dependency.getSha1sum(); +387 dependency.setSha1sum("384FAA82E193D4E4B0546059CA09572654BC3970"); +388 Vulnerability v = createVulnerability(); +389 dependency.addVulnerability(v); +390 +391//cwe +392 SuppressionRule instance = new SuppressionRule(); +393 instance.setSha1(sha1); +394 instance.addCwe("287"); +395 instance.process(dependency); +396 assertEquals(1, dependency.getVulnerabilities().size()); +397 dependency.setSha1sum(sha1); +398 instance.process(dependency); +399 assertTrue(dependency.getVulnerabilities().isEmpty()); +400 assertEquals(1, dependency.getSuppressedVulnerabilities().size()); +401 +402//cvss +403 dependency.addVulnerability(v); +404 instance = new SuppressionRule(); +405 instance.addCvssBelow(5f); +406 instance.process(dependency); +407 assertEquals(1, dependency.getVulnerabilities().size()); +408 instance.addCvssBelow(8f); +409 instance.process(dependency); +410 assertTrue(dependency.getVulnerabilities().isEmpty()); +411 assertEquals(1, dependency.getSuppressedVulnerabilities().size()); +412 +413//cve +414 dependency.addVulnerability(v); +415 instance = new SuppressionRule(); +416 instance.addCve("CVE-2012-1337"); +417 instance.process(dependency); +418 assertEquals(1, dependency.getVulnerabilities().size()); +419 instance.addCve("CVE-2013-1337"); +420 instance.process(dependency); +421 assertTrue(dependency.getVulnerabilities().isEmpty()); +422 assertEquals(1, dependency.getSuppressedVulnerabilities().size()); +423 +424//cpe425 instance = new SuppressionRule(); -426 instance.addCvssBelow(5f); -427 instance.process(dependency); -428 assertEquals(1, dependency.getVulnerabilities().size()); -429 instance.addCvssBelow(8f); -430 instance.process(dependency); -431 assertTrue(dependency.getVulnerabilities().isEmpty()); -432 assertEquals(1, dependency.getSuppressedVulnerabilities().size()); -433 -434//cve -435 dependency.addVulnerability(v); -436 instance = new SuppressionRule(); -437 instance.addCve("CVE-2012-1337"); +426 PropertyType pt = new PropertyType(); +427 pt.setValue("cpe:/a:microsoft:.net_framework:4.0"); +428 instance.addCpe(pt); +429 instance.process(dependency); +430 assertTrue(dependency.getIdentifiers().size() == 1); +431 pt = new PropertyType(); +432 pt.setValue("cpe:/a:microsoft:.net_framework:4.5"); +433 instance.addCpe(pt); +434 pt = new PropertyType(); +435 pt.setValue(".*"); +436 pt.setRegex(true); +437 instance.setFilePath(pt); 438 instance.process(dependency); -439 assertEquals(1, dependency.getVulnerabilities().size()); -440 instance.addCve("CVE-2013-1337"); -441 instance.process(dependency); -442 assertTrue(dependency.getVulnerabilities().isEmpty()); -443 assertEquals(1, dependency.getSuppressedVulnerabilities().size()); -444 -445//cpe -446 instance = new SuppressionRule(); -447 PropertyType pt = new PropertyType(); -448 pt.setValue("cpe:/a:microsoft:.net_framework:4.0"); -449 instance.addCpe(pt); -450 instance.process(dependency); -451 assertTrue(dependency.getIdentifiers().size() == 1); -452 pt = new PropertyType(); -453 pt.setValue("cpe:/a:microsoft:.net_framework:4.5"); -454 instance.addCpe(pt); -455 pt = new PropertyType(); -456 pt.setValue(".*"); -457 pt.setRegex(true); -458 instance.setFilePath(pt); -459 instance.process(dependency); -460 assertTrue(dependency.getIdentifiers().isEmpty()); -461 assertEquals(1, dependency.getSuppressedIdentifiers().size()); -462 -463 instance = new SuppressionRule(); -464 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:4.0", "some url not needed for this test"); -465 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:4.5", "some url not needed for this test"); -466 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:5.0", "some url not needed for this test"); -467 pt = new PropertyType(); -468 pt.setValue("cpe:/a:microsoft:.net_framework"); -469 instance.addCpe(pt); -470 instance.setBase(true); -471 assertEquals(3, dependency.getIdentifiers().size()); -472 assertEquals(1, dependency.getSuppressedIdentifiers().size()); -473 instance.process(dependency); -474 assertTrue(dependency.getIdentifiers().isEmpty()); -475 assertEquals(1, dependency.getSuppressedIdentifiers().size()); -476 } -477 -478/** -479 * Test of process method, of class SuppressionRule. -480 */ -481 @Test -482publicvoid testProcessGAV() { -483//File spring = new File(this.getClass().getClassLoader().getResource("spring-security-web-3.0.0.RELEASE.jar").getPath()); -484 File spring = BaseTest.getResourceAsFile(this, "spring-security-web-3.0.0.RELEASE.jar"); -485 Dependency dependency = new Dependency(spring); -486 dependency.addIdentifier("cpe", "cpe:/a:vmware:springsource_spring_framework:3.0.0", "some url not needed for this test"); -487 dependency.addIdentifier("cpe", "cpe:/a:springsource:spring_framework:3.0.0", "some url not needed for this test"); -488 dependency.addIdentifier("cpe", "cpe:/a:mod_security:mod_security:3.0.0", "some url not needed for this test"); -489 dependency.addIdentifier("cpe", "cpe:/a:vmware:springsource_spring_security:3.0.0", "some url not needed for this test"); -490 dependency.addIdentifier("maven", "org.springframework.security:spring-security-web:3.0.0.RELEASE", "some url not needed for this test"); -491 -492//cpe -493 SuppressionRule instance = new SuppressionRule(); -494 PropertyType pt = new PropertyType(); -495 -496 pt.setValue("org\\.springframework\\.security:spring.*"); -497 pt.setRegex(true); -498 pt.setCaseSensitive(false); -499 instance.setGav(pt); -500 -501 pt = new PropertyType(); -502 pt.setValue("cpe:/a:mod_security:mod_security"); -503 instance.addCpe(pt); -504 pt = new PropertyType(); -505 pt.setValue("cpe:/a:springsource:spring_framework"); -506 instance.addCpe(pt); -507 pt = new PropertyType(); -508 pt.setValue("cpe:/a:vmware:springsource_spring_framework"); -509 instance.addCpe(pt); -510 -511 instance.process(dependency); -512 assertEquals(2, dependency.getIdentifiers().size()); -513 -514 } -515 -516private Vulnerability createVulnerability() { -517 Vulnerability v = new Vulnerability(); -518 v.setCwe("CWE-287 Improper Authentication"); -519 v.setName("CVE-2013-1337"); -520 v.setCvssScore(7.5f); -521return v; -522 } -523 } +439 assertTrue(dependency.getIdentifiers().isEmpty()); +440 assertEquals(1, dependency.getSuppressedIdentifiers().size()); +441 +442 instance = new SuppressionRule(); +443 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:4.0", "some url not needed for this test"); +444 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:4.5", "some url not needed for this test"); +445 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:5.0", "some url not needed for this test"); +446 pt = new PropertyType(); +447 pt.setValue("cpe:/a:microsoft:.net_framework"); +448 instance.addCpe(pt); +449 instance.setBase(true); +450 assertEquals(3, dependency.getIdentifiers().size()); +451 assertEquals(1, dependency.getSuppressedIdentifiers().size()); +452 instance.process(dependency); +453 assertTrue(dependency.getIdentifiers().isEmpty()); +454 assertEquals(1, dependency.getSuppressedIdentifiers().size()); +455 } +456 +457/** +458 * Test of process method, of class SuppressionRule. +459 */ +460 @Test +461publicvoid testProcessGAV() { +462//File spring = new File(this.getClass().getClassLoader().getResource("spring-security-web-3.0.0.RELEASE.jar").getPath()); +463 File spring = BaseTest.getResourceAsFile(this, "spring-security-web-3.0.0.RELEASE.jar"); +464 Dependency dependency = new Dependency(spring); +465 dependency.addIdentifier("cpe", "cpe:/a:vmware:springsource_spring_framework:3.0.0", "some url not needed for this test"); +466 dependency.addIdentifier("cpe", "cpe:/a:springsource:spring_framework:3.0.0", "some url not needed for this test"); +467 dependency.addIdentifier("cpe", "cpe:/a:mod_security:mod_security:3.0.0", "some url not needed for this test"); +468 dependency.addIdentifier("cpe", "cpe:/a:vmware:springsource_spring_security:3.0.0", "some url not needed for this test"); +469 dependency.addIdentifier("maven", "org.springframework.security:spring-security-web:3.0.0.RELEASE", "some url not needed for this test"); +470 +471//cpe +472 SuppressionRule instance = new SuppressionRule(); +473 PropertyType pt = new PropertyType(); +474 +475 pt.setValue("org\\.springframework\\.security:spring.*"); +476 pt.setRegex(true); +477 pt.setCaseSensitive(false); +478 instance.setGav(pt); +479 +480 pt = new PropertyType(); +481 pt.setValue("cpe:/a:mod_security:mod_security"); +482 instance.addCpe(pt); +483 pt = new PropertyType(); +484 pt.setValue("cpe:/a:springsource:spring_framework"); +485 instance.addCpe(pt); +486 pt = new PropertyType(); +487 pt.setValue("cpe:/a:vmware:springsource_spring_framework"); +488 instance.addCpe(pt); +489 +490 instance.process(dependency); +491 assertEquals(2, dependency.getIdentifiers().size()); +492 +493 } +494 +495private Vulnerability createVulnerability() { +496 Vulnerability v = new Vulnerability(); +497 v.setCwe("CWE-287 Improper Authentication"); +498 v.setName("CVE-2013-1337"); +499 v.setCvssScore(7.5f); +500return v; +501 } +502 }
    diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/package-frame.html index afa4b9875..6648c3f75 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.suppression + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.suppression diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/package-summary.html index 538f937a8..db3e67b79 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/suppression/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.suppression + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.suppression diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/utils/DependencyVersionTest.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/utils/DependencyVersionTest.html index 65e29e39b..36aa46080 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/utils/DependencyVersionTest.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/utils/DependencyVersionTest.html @@ -69,11 +69,11 @@ 61 @Test 62publicvoid testIterator() { 63 DependencyVersion instance = new DependencyVersion("1.2.3"); -64 Iterator result = instance.iterator(); +64 Iterator<String> result = instance.iterator(); 65 assertTrue(result.hasNext()); 66int count = 1; 67while (result.hasNext()) { -68 String v = (String) result.next(); +68 String v = result.next(); 69 assertTrue(String.valueOf(count++).equals(v)); 70 } 71 } diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/utils/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/utils/package-frame.html index 3a11669f1..8c41b0466 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/utils/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/utils/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.utils + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.utils diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/utils/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/utils/package-summary.html index 86e324532..f8f426332 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/utils/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/utils/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.utils + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.utils diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/xml/pom/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/xml/pom/package-frame.html index c7c9ccd3d..aa371b59f 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/xml/pom/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/xml/pom/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.xml.pom + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.xml.pom diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/xml/pom/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/xml/pom/package-summary.html index 34a0a4267..c44dde0b1 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/xml/pom/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/xml/pom/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.xml.pom + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.xml.pom diff --git a/dependency-check-core/xref-test/overview-frame.html b/dependency-check-core/xref-test/overview-frame.html index 8706d120f..c0bad6238 100644 --- a/dependency-check-core/xref-test/overview-frame.html +++ b/dependency-check-core/xref-test/overview-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference + Dependency-Check Core 1.3.2 Reference diff --git a/dependency-check-core/xref-test/overview-summary.html b/dependency-check-core/xref-test/overview-summary.html index 68729816c..bec2a7c3c 100644 --- a/dependency-check-core/xref-test/overview-summary.html +++ b/dependency-check-core/xref-test/overview-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference + Dependency-Check Core 1.3.2 Reference @@ -24,7 +24,7 @@ -

    Dependency-Check Core 1.3.1 Reference

    +

    Dependency-Check Core 1.3.2 Reference

    testZippableExtensions
    skipped: skipped
    testWithSettingMono
    skipped: skipped
    testGetName
    skipped: skipped
    testAnalysis
    skipped: skipped
    testSupportsFiles
    skipped: skipped
    testNullSha1
    Line
    - can we get more evidence from the parent? EAR contains module name, etc. analyze the dependency (i.e. extract files) if it is a supported type.232
    235
    org.owasp.dependencycheck.analyzer.CMakeAnalyzer Line
    - refactor so we do not assign to the parameter (checkstyle)192
    209
    org.owasp.dependencycheck.analyzer.CPEAnalyzer Line
    180
    - does this nullify some of the fuzzy matching that happens in the lucene search? for instance CPE some-component and in the evidence we have SomeComponent.410
    417
    - likely need to change the split... not sure if this will work for CPE with special chars428
    435
    the following isn't quite right is it? need to think about this guessing game a bit more.532
    539
    org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzerTest Line
    Line
    convert this to use DatabaseProperties343
    341
    org.owasp.dependencycheck.data.update.CpeUpdater Line
    ArchiveAnalyzerIntegrationTest
    + ArchiveAnalyzerTest +
    @@ -139,6 +144,11 @@ PythonPackageAnalyzerTest
    + RubyBundleAuditAnalyzerTest +
    diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/central/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/central/package-frame.html index 3d9f18666..ac893797d 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/central/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/central/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.central + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.central diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/central/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/central/package-summary.html index 11b99c44c..e55e8ccdd 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/central/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/central/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.central + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.central diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/composer/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/composer/package-frame.html index 0f9b8da14..f6fdfa96d 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/composer/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/composer/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.composer + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.composer diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/composer/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/composer/package-summary.html index 19d39f5a0..4d7119248 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/composer/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/composer/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.composer + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.composer diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cpe/package-frame.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cpe/package-frame.html index f54254c31..8d6c34f44 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cpe/package-frame.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cpe/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.cpe + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.cpe @@ -16,9 +16,6 @@ diff --git a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cpe/package-summary.html b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cpe/package-summary.html index 59d86cea8..f143f0a72 100644 --- a/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cpe/package-summary.html +++ b/dependency-check-core/xref-test/org/owasp/dependencycheck/data/cpe/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.cpe + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.cpe @@ -36,11 +36,6 @@
    - AbstractDatabaseTestCase -
    IndexEntryTest
    - BaseDBTestCase + ConnectionFactoryTest
    + BaseDBTestCase +
    BaseTest
    diff --git a/dependency-check-core/xref/allclasses-frame.html b/dependency-check-core/xref/allclasses-frame.html index c23b7e045..47331c821 100644 --- a/dependency-check-core/xref/allclasses-frame.html +++ b/dependency-check-core/xref/allclasses-frame.html @@ -253,9 +253,6 @@
  • NodePackageAnalyzer -
  • -
  • - NonClosingStream
  • NugetPackage @@ -304,6 +301,9 @@
  • ProcessTask +
  • +
  • + PropertyLookup
  • PropertyType @@ -319,6 +319,9 @@
  • ReportGenerator +
  • +
  • + RubyBundleAuditAnalyzer
  • RubyGemspecAnalyzer diff --git a/dependency-check-core/xref/index.html b/dependency-check-core/xref/index.html index a9688a502..16a7641a4 100644 --- a/dependency-check-core/xref/index.html +++ b/dependency-check-core/xref/index.html @@ -4,7 +4,7 @@ - Dependency-Check Core 1.3.1 Reference + Dependency-Check Core 1.3.2 Reference diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/Engine.html b/dependency-check-core/xref/org/owasp/dependencycheck/Engine.html index 5afcee9c2..aa3777ac1 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/Engine.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/Engine.html @@ -46,144 +46,144 @@ 38 import java.io.File; 39 import java.io.FileFilter; 40 import java.util.ArrayList; -41 import java.util.EnumMap; -42 import java.util.HashSet; -43 import java.util.Iterator; -44 import java.util.List; -45 import java.util.Map; -46 import java.util.Set; -47 -48 /** -49 * Scans files, directories, etc. for Dependencies. Analyzers are loaded and used to process the files found by the scan, if a -50 * file is encountered and an Analyzer is associated with the file type then the file is turned into a dependency. -51 * -52 * @author Jeremy Long -53 */ -54 public class Engine implements FileFilter { -55 -56 /** -57 * The list of dependencies. -58 */ -59 private List<Dependency> dependencies = new ArrayList<Dependency>(); -60 /** -61 * A Map of analyzers grouped by Analysis phase. -62 */ -63 private Map<AnalysisPhase, List<Analyzer>> analyzers = new EnumMap<AnalysisPhase, List<Analyzer>>(AnalysisPhase.class); -64 -65 /** -66 * A Map of analyzers grouped by Analysis phase. -67 */ -68 private Set<FileTypeAnalyzer> fileTypeAnalyzers = new HashSet<FileTypeAnalyzer>(); -69 -70 /** -71 * The ClassLoader to use when dynamically loading Analyzer and Update services. -72 */ -73 private ClassLoader serviceClassLoader = Thread.currentThread().getContextClassLoader(); -74 /** -75 * The Logger for use throughout the class. -76 */ -77 private static final Logger LOGGER = LoggerFactory.getLogger(Engine.class); -78 -79 /** -80 * Creates a new Engine. -81 * -82 * @throws DatabaseException thrown if there is an error connecting to the database -83 */ -84 public Engine() throws DatabaseException { -85 initializeEngine(); -86 } -87 -88 /** -89 * Creates a new Engine. -90 * -91 * @param serviceClassLoader a reference the class loader being used -92 * @throws DatabaseException thrown if there is an error connecting to the database -93 */ -94 public Engine(ClassLoader serviceClassLoader) throws DatabaseException { -95 this.serviceClassLoader = serviceClassLoader; -96 initializeEngine(); -97 } -98 -99 /** -100 * Creates a new Engine using the specified classloader to dynamically load Analyzer and Update services. -101 * -102 * @throws DatabaseException thrown if there is an error connecting to the database -103 */ -104 protected final void initializeEngine() throws DatabaseException { -105 ConnectionFactory.initialize(); -106 loadAnalyzers(); -107 } -108 -109 /** -110 * Properly cleans up resources allocated during analysis. -111 */ -112 public void cleanup() { -113 ConnectionFactory.cleanup(); -114 } -115 -116 /** -117 * Loads the analyzers specified in the configuration file (or system properties). -118 */ -119 private void loadAnalyzers() { -120 if (!analyzers.isEmpty()) { -121 return; -122 } -123 for (AnalysisPhase phase : AnalysisPhase.values()) { -124 analyzers.put(phase, new ArrayList<Analyzer>()); -125 } -126 -127 final AnalyzerService service = new AnalyzerService(serviceClassLoader); -128 final Iterator<Analyzer> iterator = service.getAnalyzers(); -129 while (iterator.hasNext()) { -130 final Analyzer a = iterator.next(); -131 analyzers.get(a.getAnalysisPhase()).add(a); -132 if (a instanceof FileTypeAnalyzer) { -133 this.fileTypeAnalyzers.add((FileTypeAnalyzer) a); -134 } -135 } -136 } -137 -138 /** -139 * Get the List of the analyzers for a specific phase of analysis. -140 * -141 * @param phase the phase to get the configured analyzers. -142 * @return the analyzers loaded -143 */ -144 public List<Analyzer> getAnalyzers(AnalysisPhase phase) { -145 return analyzers.get(phase); -146 } -147 -148 /** -149 * Get the dependencies identified. -150 * -151 * @return the dependencies identified -152 */ -153 public List<Dependency> getDependencies() { -154 return dependencies; -155 } -156 -157 /** -158 * Sets the dependencies. -159 * -160 * @param dependencies the dependencies -161 */ -162 public void setDependencies(List<Dependency> dependencies) { -163 this.dependencies = dependencies; -164 } -165 -166 /** -167 * Scans an array of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies -168 * identified are added to the dependency collection. -169 * -170 * @param paths an array of paths to files or directories to be analyzed -171 * @return the list of dependencies scanned -172 * @since v0.3.2.5 -173 */ -174 public List<Dependency> scan(String[] paths) { -175 final List<Dependency> deps = new ArrayList<Dependency>(); -176 for (String path : paths) { -177 final File file = new File(path); -178 final List<Dependency> d = scan(file); +41 import java.util.Collection; +42 import java.util.EnumMap; +43 import java.util.HashSet; +44 import java.util.Iterator; +45 import java.util.List; +46 import java.util.Map; +47 import java.util.Set; +48 +49 /** +50 * Scans files, directories, etc. for Dependencies. Analyzers are loaded and used to process the files found by the scan, if a +51 * file is encountered and an Analyzer is associated with the file type then the file is turned into a dependency. +52 * +53 * @author Jeremy Long +54 */ +55 public class Engine implements FileFilter { +56 +57 /** +58 * The list of dependencies. +59 */ +60 private List<Dependency> dependencies = new ArrayList<Dependency>(); +61 /** +62 * A Map of analyzers grouped by Analysis phase. +63 */ +64 private Map<AnalysisPhase, List<Analyzer>> analyzers = new EnumMap<AnalysisPhase, List<Analyzer>>(AnalysisPhase.class); +65 +66 /** +67 * A Map of analyzers grouped by Analysis phase. +68 */ +69 private Set<FileTypeAnalyzer> fileTypeAnalyzers = new HashSet<FileTypeAnalyzer>(); +70 +71 /** +72 * The ClassLoader to use when dynamically loading Analyzer and Update services. +73 */ +74 private ClassLoader serviceClassLoader = Thread.currentThread().getContextClassLoader(); +75 /** +76 * The Logger for use throughout the class. +77 */ +78 private static final Logger LOGGER = LoggerFactory.getLogger(Engine.class); +79 +80 /** +81 * Creates a new Engine. +82 * +83 * @throws DatabaseException thrown if there is an error connecting to the database +84 */ +85 public Engine() throws DatabaseException { +86 initializeEngine(); +87 } +88 +89 /** +90 * Creates a new Engine. +91 * +92 * @param serviceClassLoader a reference the class loader being used +93 * @throws DatabaseException thrown if there is an error connecting to the database +94 */ +95 public Engine(ClassLoader serviceClassLoader) throws DatabaseException { +96 this.serviceClassLoader = serviceClassLoader; +97 initializeEngine(); +98 } +99 +100 /** +101 * Creates a new Engine using the specified classloader to dynamically load Analyzer and Update services. +102 * +103 * @throws DatabaseException thrown if there is an error connecting to the database +104 */ +105 protected final void initializeEngine() throws DatabaseException { +106 ConnectionFactory.initialize(); +107 loadAnalyzers(); +108 } +109 +110 /** +111 * Properly cleans up resources allocated during analysis. +112 */ +113 public void cleanup() { +114 ConnectionFactory.cleanup(); +115 } +116 +117 /** +118 * Loads the analyzers specified in the configuration file (or system properties). +119 */ +120 private void loadAnalyzers() { +121 if (!analyzers.isEmpty()) { +122 return; +123 } +124 for (AnalysisPhase phase : AnalysisPhase.values()) { +125 analyzers.put(phase, new ArrayList<Analyzer>()); +126 } +127 +128 final AnalyzerService service = new AnalyzerService(serviceClassLoader); +129 final Iterator<Analyzer> iterator = service.getAnalyzers(); +130 while (iterator.hasNext()) { +131 final Analyzer a = iterator.next(); +132 analyzers.get(a.getAnalysisPhase()).add(a); +133 if (a instanceof FileTypeAnalyzer) { +134 this.fileTypeAnalyzers.add((FileTypeAnalyzer) a); +135 } +136 } +137 } +138 +139 /** +140 * Get the List of the analyzers for a specific phase of analysis. +141 * +142 * @param phase the phase to get the configured analyzers. +143 * @return the analyzers loaded +144 */ +145 public List<Analyzer> getAnalyzers(AnalysisPhase phase) { +146 return analyzers.get(phase); +147 } +148 +149 /** +150 * Get the dependencies identified. +151 * +152 * @return the dependencies identified +153 */ +154 public List<Dependency> getDependencies() { +155 return dependencies; +156 } +157 +158 /** +159 * Sets the dependencies. +160 * +161 * @param dependencies the dependencies +162 */ +163 public void setDependencies(List<Dependency> dependencies) { +164 this.dependencies = dependencies; +165 } +166 +167 /** +168 * Scans an array of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies +169 * identified are added to the dependency collection. +170 * +171 * @param paths an array of paths to files or directories to be analyzed +172 * @return the list of dependencies scanned +173 * @since v0.3.2.5 +174 */ +175 public List<Dependency> scan(String[] paths) { +176 final List<Dependency> deps = new ArrayList<Dependency>(); +177 for (String path : paths) { +178 final List<Dependency> d = scan(path); 179 if (d != null) { 180 deps.addAll(d); 181 } @@ -223,14 +223,14 @@ 215 } 216 217 /** -218 * Scans a list of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies +218 * Scans a collection of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies 219 * identified are added to the dependency collection. 220 * 221 * @param files a set of paths to files or directories to be analyzed 222 * @return the list of dependencies scanned 223 * @since v0.3.2.5 224 */ -225 public List<Dependency> scan(Set<File> files) { +225 public List<Dependency> scan(Collection<File> files) { 226 final List<Dependency> deps = new ArrayList<Dependency>(); 227 for (File file : files) { 228 final List<Dependency> d = scan(file); @@ -242,294 +242,275 @@ 234 } 235 236 /** -237 * Scans a list of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies -238 * identified are added to the dependency collection. +237 * Scans a given file or directory. If a directory is specified, it will be scanned recursively. Any dependencies identified +238 * are added to the dependency collection. 239 * -240 * @param files a set of paths to files or directories to be analyzed +240 * @param file the path to a file or directory to be analyzed 241 * @return the list of dependencies scanned -242 * @since v0.3.2.5 +242 * @since v0.3.2.4 243 */ -244 public List<Dependency> scan(List<File> files) { -245 final List<Dependency> deps = new ArrayList<Dependency>(); -246 for (File file : files) { -247 final List<Dependency> d = scan(file); -248 if (d != null) { -249 deps.addAll(d); -250 } -251 } -252 return deps; -253 } -254 -255 /** -256 * Scans a given file or directory. If a directory is specified, it will be scanned recursively. Any dependencies identified -257 * are added to the dependency collection. -258 * -259 * @param file the path to a file or directory to be analyzed -260 * @return the list of dependencies scanned -261 * @since v0.3.2.4 -262 */ -263 public List<Dependency> scan(File file) { -264 if (file.exists()) { -265 if (file.isDirectory()) { -266 return scanDirectory(file); -267 } else { -268 final Dependency d = scanFile(file); -269 if (d != null) { -270 final List<Dependency> deps = new ArrayList<Dependency>(); -271 deps.add(d); -272 return deps; -273 } -274 } -275 } -276 return null; -277 } -278 -279 /** -280 * Recursively scans files and directories. Any dependencies identified are added to the dependency collection. -281 * -282 * @param dir the directory to scan -283 * @return the list of Dependency objects scanned -284 */ -285 protected List<Dependency> scanDirectory(File dir) { -286 final File[] files = dir.listFiles(); -287 final List<Dependency> deps = new ArrayList<Dependency>(); -288 if (files != null) { -289 for (File f : files) { -290 if (f.isDirectory()) { -291 final List<Dependency> d = scanDirectory(f); -292 if (d != null) { -293 deps.addAll(d); -294 } -295 } else { -296 final Dependency d = scanFile(f); -297 deps.add(d); -298 } -299 } +244 public List<Dependency> scan(File file) { +245 if (file.exists()) { +246 if (file.isDirectory()) { +247 return scanDirectory(file); +248 } else { +249 final Dependency d = scanFile(file); +250 if (d != null) { +251 final List<Dependency> deps = new ArrayList<Dependency>(); +252 deps.add(d); +253 return deps; +254 } +255 } +256 } +257 return null; +258 } +259 +260 /** +261 * Recursively scans files and directories. Any dependencies identified are added to the dependency collection. +262 * +263 * @param dir the directory to scan +264 * @return the list of Dependency objects scanned +265 */ +266 protected List<Dependency> scanDirectory(File dir) { +267 final File[] files = dir.listFiles(); +268 final List<Dependency> deps = new ArrayList<Dependency>(); +269 if (files != null) { +270 for (File f : files) { +271 if (f.isDirectory()) { +272 final List<Dependency> d = scanDirectory(f); +273 if (d != null) { +274 deps.addAll(d); +275 } +276 } else { +277 final Dependency d = scanFile(f); +278 deps.add(d); +279 } +280 } +281 } +282 return deps; +283 } +284 +285 /** +286 * Scans a specified file. If a dependency is identified it is added to the dependency collection. +287 * +288 * @param file The file to scan +289 * @return the scanned dependency +290 */ +291 protected Dependency scanFile(File file) { +292 Dependency dependency = null; +293 if (file.isFile()) { +294 if (accept(file)) { +295 dependency = new Dependency(file); +296 dependencies.add(dependency); +297 } +298 } else { +299 LOGGER.debug("Path passed to scanFile(File) is not a file: {}. Skipping the file.", file); 300 } -301 return deps; +301 return dependency; 302 } 303 304 /** -305 * Scans a specified file. If a dependency is identified it is added to the dependency collection. -306 * -307 * @param file The file to scan -308 * @return the scanned dependency +305 * Runs the analyzers against all of the dependencies. Since the mutable dependencies list is exposed via +306 * {@link #getDependencies()}, this method iterates over a copy of the dependencies list. Thus, the potential for +307 * {@link java.util.ConcurrentModificationException}s is avoided, and analyzers may safely add or remove entries from the +308 * dependencies list. 309 */ -310 protected Dependency scanFile(File file) { -311 Dependency dependency = null; -312 if (file.isFile()) { -313 if (accept(file)) { -314 dependency = new Dependency(file); -315 dependencies.add(dependency); -316 } -317 } else { -318 LOGGER.debug("Path passed to scanFile(File) is not a file: {}. Skipping the file.", file); +310 public void analyzeDependencies() { +311 boolean autoUpdate = true; +312 try { +313 autoUpdate = Settings.getBoolean(Settings.KEYS.AUTO_UPDATE); +314 } catch (InvalidSettingException ex) { +315 LOGGER.debug("Invalid setting for auto-update; using true."); +316 } +317 if (autoUpdate) { +318 doUpdates(); 319 } -320 return dependency; -321 } -322 -323 /** -324 * Runs the analyzers against all of the dependencies. Since the mutable dependencies list is exposed via -325 * {@link #getDependencies()}, this method iterates over a copy of the dependencies list. Thus, the potential for -326 * {@link java.util.ConcurrentModificationException}s is avoided, and analyzers may safely add or remove entries from the -327 * dependencies list. -328 */ -329 public void analyzeDependencies() { -330 boolean autoUpdate = true; -331 try { -332 autoUpdate = Settings.getBoolean(Settings.KEYS.AUTO_UPDATE); -333 } catch (InvalidSettingException ex) { -334 LOGGER.debug("Invalid setting for auto-update; using true."); -335 } -336 if (autoUpdate) { -337 doUpdates(); -338 } -339 -340 //need to ensure that data exists -341 try { -342 ensureDataExists(); -343 } catch (NoDataException ex) { -344 LOGGER.error("{}\n\nUnable to continue dependency-check analysis.", ex.getMessage()); -345 LOGGER.debug("", ex); -346 return; -347 } catch (DatabaseException ex) { -348 LOGGER.error("{}\n\nUnable to continue dependency-check analysis.", ex.getMessage()); -349 LOGGER.debug("", ex); -350 return; -351 -352 } -353 -354 LOGGER.debug("\n----------------------------------------------------\nBEGIN ANALYSIS\n----------------------------------------------------"); -355 LOGGER.info("Analysis Starting"); -356 final long analysisStart = System.currentTimeMillis(); -357 -358 // analysis phases -359 for (AnalysisPhase phase : AnalysisPhase.values()) { -360 final List<Analyzer> analyzerList = analyzers.get(phase); -361 -362 for (Analyzer a : analyzerList) { -363 a = initializeAnalyzer(a); -364 -365 /* need to create a copy of the collection because some of the -366 * analyzers may modify it. This prevents ConcurrentModificationExceptions. -367 * This is okay for adds/deletes because it happens per analyzer. -368 */ -369 LOGGER.debug("Begin Analyzer '{}'", a.getName()); -370 final Set<Dependency> dependencySet = new HashSet<Dependency>(dependencies); -371 for (Dependency d : dependencySet) { -372 boolean shouldAnalyze = true; -373 if (a instanceof FileTypeAnalyzer) { -374 final FileTypeAnalyzer fAnalyzer = (FileTypeAnalyzer) a; -375 shouldAnalyze = fAnalyzer.accept(d.getActualFile()); -376 } -377 if (shouldAnalyze) { -378 LOGGER.debug("Begin Analysis of '{}'", d.getActualFilePath()); -379 try { -380 a.analyze(d, this); -381 } catch (AnalysisException ex) { -382 LOGGER.warn("An error occurred while analyzing '{}'.", d.getActualFilePath()); -383 LOGGER.debug("", ex); -384 } catch (Throwable ex) { -385 //final AnalysisException ax = new AnalysisException(axMsg, ex); -386 LOGGER.warn("An unexpected error occurred during analysis of '{}'", d.getActualFilePath()); -387 LOGGER.debug("", ex); -388 } -389 } -390 } -391 } -392 } -393 for (AnalysisPhase phase : AnalysisPhase.values()) { -394 final List<Analyzer> analyzerList = analyzers.get(phase); -395 -396 for (Analyzer a : analyzerList) { -397 closeAnalyzer(a); -398 } -399 } -400 -401 LOGGER.debug("\n----------------------------------------------------\nEND ANALYSIS\n----------------------------------------------------"); -402 LOGGER.info("Analysis Complete ({} ms)", System.currentTimeMillis() - analysisStart); -403 } -404 -405 /** -406 * Initializes the given analyzer. -407 * -408 * @param analyzer the analyzer to initialize -409 * @return the initialized analyzer -410 */ -411 protected Analyzer initializeAnalyzer(Analyzer analyzer) { -412 try { -413 LOGGER.debug("Initializing {}", analyzer.getName()); -414 analyzer.initialize(); -415 } catch (Throwable ex) { -416 LOGGER.error("Exception occurred initializing {}.", analyzer.getName()); -417 LOGGER.debug("", ex); -418 try { -419 analyzer.close(); -420 } catch (Throwable ex1) { -421 LOGGER.trace("", ex1); -422 } -423 } -424 return analyzer; -425 } -426 -427 /** -428 * Closes the given analyzer. -429 * -430 * @param analyzer the analyzer to close -431 */ -432 protected void closeAnalyzer(Analyzer analyzer) { -433 LOGGER.debug("Closing Analyzer '{}'", analyzer.getName()); -434 try { -435 analyzer.close(); -436 } catch (Throwable ex) { -437 LOGGER.trace("", ex); -438 } -439 } -440 -441 /** -442 * Cycles through the cached web data sources and calls update on all of them. -443 */ -444 public void doUpdates() { -445 LOGGER.info("Checking for updates"); -446 final long updateStart = System.currentTimeMillis(); -447 final UpdateService service = new UpdateService(serviceClassLoader); -448 final Iterator<CachedWebDataSource> iterator = service.getDataSources(); -449 while (iterator.hasNext()) { -450 final CachedWebDataSource source = iterator.next(); -451 try { -452 source.update(); -453 } catch (UpdateException ex) { -454 LOGGER.warn( -455 "Unable to update Cached Web DataSource, using local data instead. Results may not include recent vulnerabilities."); -456 LOGGER.debug("Unable to update details for {}", source.getClass().getName(), ex); -457 } -458 } -459 LOGGER.info("Check for updates complete ({} ms)", System.currentTimeMillis() - updateStart); -460 } -461 -462 /** -463 * Returns a full list of all of the analyzers. This is useful for reporting which analyzers where used. -464 * -465 * @return a list of Analyzers -466 */ -467 public List<Analyzer> getAnalyzers() { -468 final List<Analyzer> ret = new ArrayList<Analyzer>(); -469 for (AnalysisPhase phase : AnalysisPhase.values()) { -470 final List<Analyzer> analyzerList = analyzers.get(phase); -471 ret.addAll(analyzerList); -472 } -473 return ret; -474 } -475 -476 /** -477 * Checks all analyzers to see if an extension is supported. -478 * -479 * @param file a file extension -480 * @return true or false depending on whether or not the file extension is supported +320 +321 //need to ensure that data exists +322 try { +323 ensureDataExists(); +324 } catch (NoDataException ex) { +325 LOGGER.error("{}\n\nUnable to continue dependency-check analysis.", ex.getMessage()); +326 LOGGER.debug("", ex); +327 return; +328 } catch (DatabaseException ex) { +329 LOGGER.error("{}\n\nUnable to continue dependency-check analysis.", ex.getMessage()); +330 LOGGER.debug("", ex); +331 return; +332 +333 } +334 +335 LOGGER.debug("\n----------------------------------------------------\nBEGIN ANALYSIS\n----------------------------------------------------"); +336 LOGGER.info("Analysis Starting"); +337 final long analysisStart = System.currentTimeMillis(); +338 +339 // analysis phases +340 for (AnalysisPhase phase : AnalysisPhase.values()) { +341 final List<Analyzer> analyzerList = analyzers.get(phase); +342 +343 for (Analyzer a : analyzerList) { +344 a = initializeAnalyzer(a); +345 +346 /* need to create a copy of the collection because some of the +347 * analyzers may modify it. This prevents ConcurrentModificationExceptions. +348 * This is okay for adds/deletes because it happens per analyzer. +349 */ +350 LOGGER.debug("Begin Analyzer '{}'", a.getName()); +351 final Set<Dependency> dependencySet = new HashSet<Dependency>(dependencies); +352 for (Dependency d : dependencySet) { +353 boolean shouldAnalyze = true; +354 if (a instanceof FileTypeAnalyzer) { +355 final FileTypeAnalyzer fAnalyzer = (FileTypeAnalyzer) a; +356 shouldAnalyze = fAnalyzer.accept(d.getActualFile()); +357 } +358 if (shouldAnalyze) { +359 LOGGER.debug("Begin Analysis of '{}'", d.getActualFilePath()); +360 try { +361 a.analyze(d, this); +362 } catch (AnalysisException ex) { +363 LOGGER.warn("An error occurred while analyzing '{}'.", d.getActualFilePath()); +364 LOGGER.debug("", ex); +365 } catch (Throwable ex) { +366 //final AnalysisException ax = new AnalysisException(axMsg, ex); +367 LOGGER.warn("An unexpected error occurred during analysis of '{}'", d.getActualFilePath()); +368 LOGGER.debug("", ex); +369 } +370 } +371 } +372 } +373 } +374 for (AnalysisPhase phase : AnalysisPhase.values()) { +375 final List<Analyzer> analyzerList = analyzers.get(phase); +376 +377 for (Analyzer a : analyzerList) { +378 closeAnalyzer(a); +379 } +380 } +381 +382 LOGGER.debug("\n----------------------------------------------------\nEND ANALYSIS\n----------------------------------------------------"); +383 LOGGER.info("Analysis Complete ({} ms)", System.currentTimeMillis() - analysisStart); +384 } +385 +386 /** +387 * Initializes the given analyzer. +388 * +389 * @param analyzer the analyzer to initialize +390 * @return the initialized analyzer +391 */ +392 protected Analyzer initializeAnalyzer(Analyzer analyzer) { +393 try { +394 LOGGER.debug("Initializing {}", analyzer.getName()); +395 analyzer.initialize(); +396 } catch (Throwable ex) { +397 LOGGER.error("Exception occurred initializing {}.", analyzer.getName()); +398 LOGGER.debug("", ex); +399 try { +400 analyzer.close(); +401 } catch (Throwable ex1) { +402 LOGGER.trace("", ex1); +403 } +404 } +405 return analyzer; +406 } +407 +408 /** +409 * Closes the given analyzer. +410 * +411 * @param analyzer the analyzer to close +412 */ +413 protected void closeAnalyzer(Analyzer analyzer) { +414 LOGGER.debug("Closing Analyzer '{}'", analyzer.getName()); +415 try { +416 analyzer.close(); +417 } catch (Throwable ex) { +418 LOGGER.trace("", ex); +419 } +420 } +421 +422 /** +423 * Cycles through the cached web data sources and calls update on all of them. +424 */ +425 public void doUpdates() { +426 LOGGER.info("Checking for updates"); +427 final long updateStart = System.currentTimeMillis(); +428 final UpdateService service = new UpdateService(serviceClassLoader); +429 final Iterator<CachedWebDataSource> iterator = service.getDataSources(); +430 while (iterator.hasNext()) { +431 final CachedWebDataSource source = iterator.next(); +432 try { +433 source.update(); +434 } catch (UpdateException ex) { +435 LOGGER.warn( +436 "Unable to update Cached Web DataSource, using local data instead. Results may not include recent vulnerabilities."); +437 LOGGER.debug("Unable to update details for {}", source.getClass().getName(), ex); +438 } +439 } +440 LOGGER.info("Check for updates complete ({} ms)", System.currentTimeMillis() - updateStart); +441 } +442 +443 /** +444 * Returns a full list of all of the analyzers. This is useful for reporting which analyzers where used. +445 * +446 * @return a list of Analyzers +447 */ +448 public List<Analyzer> getAnalyzers() { +449 final List<Analyzer> ret = new ArrayList<Analyzer>(); +450 for (AnalysisPhase phase : AnalysisPhase.values()) { +451 final List<Analyzer> analyzerList = analyzers.get(phase); +452 ret.addAll(analyzerList); +453 } +454 return ret; +455 } +456 +457 /** +458 * Checks all analyzers to see if an extension is supported. +459 * +460 * @param file a file extension +461 * @return true or false depending on whether or not the file extension is supported +462 */ +463 @Override +464 public boolean accept(File file) { +465 if (file == null) { +466 return false; +467 } +468 boolean scan = false; +469 for (FileTypeAnalyzer a : this.fileTypeAnalyzers) { +470 /* note, we can't break early on this loop as the analyzers need to know if +471 they have files to work on prior to initialization */ +472 scan |= a.accept(file); +473 } +474 return scan; +475 } +476 +477 /** +478 * Returns the set of file type analyzers. +479 * +480 * @return the set of file type analyzers 481 */ -482 @Override -483 public boolean accept(File file) { -484 if (file == null) { -485 return false; -486 } -487 boolean scan = false; -488 for (FileTypeAnalyzer a : this.fileTypeAnalyzers) { -489 /* note, we can't break early on this loop as the analyzers need to know if -490 they have files to work on prior to initialization */ -491 scan |= a.accept(file); -492 } -493 return scan; -494 } -495 -496 /** -497 * Returns the set of file type analyzers. -498 * -499 * @return the set of file type analyzers -500 */ -501 public Set<FileTypeAnalyzer> getFileTypeAnalyzers() { -502 return this.fileTypeAnalyzers; -503 } -504 -505 /** -506 * Checks the CPE Index to ensure documents exists. If none exist a NoDataException is thrown. -507 * -508 * @throws NoDataException thrown if no data exists in the CPE Index -509 * @throws DatabaseException thrown if there is an exception opening the database -510 */ -511 private void ensureDataExists() throws NoDataException, DatabaseException { -512 final CveDB cve = new CveDB(); -513 try { -514 cve.open(); -515 if (!cve.dataExists()) { -516 throw new NoDataException("No documents exist"); -517 } -518 } catch (DatabaseException ex) { -519 throw new NoDataException(ex.getMessage(), ex); -520 } finally { -521 cve.close(); -522 } -523 } -524 } +482 public Set<FileTypeAnalyzer> getFileTypeAnalyzers() { +483 return this.fileTypeAnalyzers; +484 } +485 +486 /** +487 * Checks the CPE Index to ensure documents exists. If none exist a NoDataException is thrown. +488 * +489 * @throws NoDataException thrown if no data exists in the CPE Index +490 * @throws DatabaseException thrown if there is an exception opening the database +491 */ +492 private void ensureDataExists() throws NoDataException, DatabaseException { +493 final CveDB cve = new CveDB(); +494 try { +495 cve.open(); +496 if (!cve.dataExists()) { +497 throw new NoDataException("No documents exist"); +498 } +499 } catch (DatabaseException ex) { +500 throw new NoDataException(ex.getMessage(), ex); +501 } finally { +502 cve.close(); +503 } +504 } +505 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.html b/dependency-check-core/xref/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.html index 940b0f3e2..71686ab6b 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.html @@ -848,231 +848,191 @@ 840 */ 841 private Engine executeDependencyCheck() throws DatabaseException { 842 populateSettings(); -843 Engine engine = null; -844 engine = new Engine(); -845 engine.setDependencies(this.dependencies); -846 engine.analyzeDependencies(); -847 return engine; -848 } -849 -850 /** -851 * Generates the reports for a given dependency-check engine. -852 * -853 * @param engine a dependency-check engine -854 * @param outDirectory the directory to write the reports to -855 */ -856 private void generateExternalReports(Engine engine, File outDirectory) { -857 DatabaseProperties prop = null; -858 CveDB cve = null; -859 try { -860 cve = new CveDB(); -861 cve.open(); -862 prop = cve.getDatabaseProperties(); -863 } catch (DatabaseException ex) { -864 LOGGER.debug("Unable to retrieve DB Properties", ex); -865 } finally { -866 if (cve != null) { -867 cve.close(); -868 } -869 } -870 final ReportGenerator r = new ReportGenerator(this.applicationName, engine.getDependencies(), engine.getAnalyzers(), prop); -871 try { -872 r.generateReports(outDirectory.getCanonicalPath(), this.reportFormat.name()); -873 } catch (IOException ex) { -874 LOGGER.error( -875 "Unexpected exception occurred during analysis; please see the verbose error log for more details."); -876 LOGGER.debug("", ex); -877 } catch (Throwable ex) { -878 LOGGER.error( -879 "Unexpected exception occurred during analysis; please see the verbose error log for more details."); -880 LOGGER.debug("", ex); -881 } -882 } -883 -884 /** -885 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties -886 * required to change the proxy server, port, and connection timeout. -887 */ -888 private void populateSettings() { -889 Settings.initialize(); -890 if (dataDirectory != null) { -891 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory); -892 } else { -893 final File jarPath = new File(DependencyCheckScanAgent.class.getProtectionDomain().getCodeSource().getLocation().getPath()); -894 final File base = jarPath.getParentFile(); -895 final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY); -896 final File dataDir = new File(base, sub); -897 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); -898 } -899 -900 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); -901 -902 if (proxyServer != null && !proxyServer.isEmpty()) { -903 Settings.setString(Settings.KEYS.PROXY_SERVER, proxyServer); -904 } -905 if (proxyPort != null && !proxyPort.isEmpty()) { -906 Settings.setString(Settings.KEYS.PROXY_PORT, proxyPort); -907 } -908 if (proxyUsername != null && !proxyUsername.isEmpty()) { -909 Settings.setString(Settings.KEYS.PROXY_USERNAME, proxyUsername); -910 } -911 if (proxyPassword != null && !proxyPassword.isEmpty()) { -912 Settings.setString(Settings.KEYS.PROXY_PASSWORD, proxyPassword); -913 } -914 if (connectionTimeout != null && !connectionTimeout.isEmpty()) { -915 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); -916 } -917 if (suppressionFile != null && !suppressionFile.isEmpty()) { -918 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); -919 } -920 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); -921 if (centralUrl != null && !centralUrl.isEmpty()) { -922 Settings.setString(Settings.KEYS.ANALYZER_CENTRAL_URL, centralUrl); -923 } -924 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); -925 if (nexusUrl != null && !nexusUrl.isEmpty()) { -926 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); -927 } -928 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy); -929 if (databaseDriverName != null && !databaseDriverName.isEmpty()) { -930 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); -931 } -932 if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) { -933 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); -934 } -935 if (connectionString != null && !connectionString.isEmpty()) { -936 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString); -937 } -938 if (databaseUser != null && !databaseUser.isEmpty()) { -939 Settings.setString(Settings.KEYS.DB_USER, databaseUser); -940 } -941 if (databasePassword != null && !databasePassword.isEmpty()) { -942 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword); -943 } -944 if (zipExtensions != null && !zipExtensions.isEmpty()) { -945 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); -946 } -947 if (cveUrl12Modified != null && !cveUrl12Modified.isEmpty()) { -948 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); -949 } -950 if (cveUrl20Modified != null && !cveUrl20Modified.isEmpty()) { -951 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); +843 final Engine engine = new Engine(); +844 engine.setDependencies(this.dependencies); +845 engine.analyzeDependencies(); +846 return engine; +847 } +848 +849 /** +850 * Generates the reports for a given dependency-check engine. +851 * +852 * @param engine a dependency-check engine +853 * @param outDirectory the directory to write the reports to +854 */ +855 private void generateExternalReports(Engine engine, File outDirectory) { +856 DatabaseProperties prop = null; +857 CveDB cve = null; +858 try { +859 cve = new CveDB(); +860 cve.open(); +861 prop = cve.getDatabaseProperties(); +862 } catch (DatabaseException ex) { +863 LOGGER.debug("Unable to retrieve DB Properties", ex); +864 } finally { +865 if (cve != null) { +866 cve.close(); +867 } +868 } +869 final ReportGenerator r = new ReportGenerator(this.applicationName, engine.getDependencies(), engine.getAnalyzers(), prop); +870 try { +871 r.generateReports(outDirectory.getCanonicalPath(), this.reportFormat.name()); +872 } catch (IOException ex) { +873 LOGGER.error( +874 "Unexpected exception occurred during analysis; please see the verbose error log for more details."); +875 LOGGER.debug("", ex); +876 } catch (Throwable ex) { +877 LOGGER.error( +878 "Unexpected exception occurred during analysis; please see the verbose error log for more details."); +879 LOGGER.debug("", ex); +880 } +881 } +882 +883 /** +884 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties +885 * required to change the proxy server, port, and connection timeout. +886 */ +887 private void populateSettings() { +888 Settings.initialize(); +889 if (dataDirectory != null) { +890 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory); +891 } else { +892 final File jarPath = new File(DependencyCheckScanAgent.class.getProtectionDomain().getCodeSource().getLocation().getPath()); +893 final File base = jarPath.getParentFile(); +894 final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY); +895 final File dataDir = new File(base, sub); +896 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); +897 } +898 +899 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); +900 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_SERVER, proxyServer); +901 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PORT, proxyPort); +902 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_USERNAME, proxyUsername); +903 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PASSWORD, proxyPassword); +904 Settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); +905 Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); +906 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); +907 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_CENTRAL_URL, centralUrl); +908 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); +909 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); +910 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy); +911 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); +912 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); +913 Settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString); +914 Settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser); +915 Settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword); +916 Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); +917 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); +918 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); +919 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); +920 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); +921 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); +922 } +923 +924 /** +925 * Executes the dependency-check and generates the report. +926 * +927 * @return a reference to the engine used to perform the scan. +928 * @throws org.owasp.dependencycheck.exception.ScanAgentException thrown if there is an exception executing the scan. +929 */ +930 public Engine execute() throws ScanAgentException { +931 Engine engine = null; +932 try { +933 engine = executeDependencyCheck(); +934 if (this.generateReport) { +935 generateExternalReports(engine, new File(this.reportOutputDirectory)); +936 } +937 if (this.showSummary) { +938 showSummary(engine.getDependencies()); +939 } +940 if (this.failBuildOnCVSS <= 10) { +941 checkForFailure(engine.getDependencies()); +942 } +943 } catch (DatabaseException ex) { +944 LOGGER.error( +945 "Unable to connect to the dependency-check database; analysis has stopped"); +946 LOGGER.debug("", ex); +947 } finally { +948 Settings.cleanup(true); +949 if (engine != null) { +950 engine.cleanup(); +951 } 952 } -953 if (cveUrl12Base != null && !cveUrl12Base.isEmpty()) { -954 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); -955 } -956 if (cveUrl20Base != null && !cveUrl20Base.isEmpty()) { -957 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); -958 } -959 if (pathToMono != null && !pathToMono.isEmpty()) { -960 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); -961 } -962 } -963 -964 /** -965 * Executes the dependency-check and generates the report. -966 * -967 * @return a reference to the engine used to perform the scan. -968 * @throws org.owasp.dependencycheck.exception.ScanAgentException thrown if there is an exception executing the scan. -969 */ -970 public Engine execute() throws ScanAgentException { -971 Engine engine = null; -972 try { -973 engine = executeDependencyCheck(); -974 if (this.generateReport) { -975 generateExternalReports(engine, new File(this.reportOutputDirectory)); -976 } -977 if (this.showSummary) { -978 showSummary(engine.getDependencies()); -979 } -980 if (this.failBuildOnCVSS <= 10) { -981 checkForFailure(engine.getDependencies()); -982 } -983 } catch (DatabaseException ex) { -984 LOGGER.error( -985 "Unable to connect to the dependency-check database; analysis has stopped"); -986 LOGGER.debug("", ex); -987 } finally { -988 Settings.cleanup(true); -989 if (engine != null) { -990 engine.cleanup(); -991 } -992 } -993 return engine; -994 } -995 -996 /** -997 * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the -998 * configuration. -999 * -1000 * @param dependencies the list of dependency objects -1001 * @throws org.owasp.dependencycheck.exception.ScanAgentException thrown if there is an exception executing the scan. -1002 */ -1003 private void checkForFailure(List<Dependency> dependencies) throws ScanAgentException { -1004 final StringBuilder ids = new StringBuilder(); -1005 for (Dependency d : dependencies) { -1006 boolean addName = true; -1007 for (Vulnerability v : d.getVulnerabilities()) { -1008 if (v.getCvssScore() >= failBuildOnCVSS) { -1009 if (addName) { -1010 addName = false; -1011 ids.append(NEW_LINE).append(d.getFileName()).append(": "); -1012 ids.append(v.getName()); -1013 } else { -1014 ids.append(", ").append(v.getName()); -1015 } +953 return engine; +954 } +955 +956 /** +957 * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the +958 * configuration. +959 * +960 * @param dependencies the list of dependency objects +961 * @throws org.owasp.dependencycheck.exception.ScanAgentException thrown if there is an exception executing the scan. +962 */ +963 private void checkForFailure(List<Dependency> dependencies) throws ScanAgentException { +964 final StringBuilder ids = new StringBuilder(); +965 for (Dependency d : dependencies) { +966 boolean addName = true; +967 for (Vulnerability v : d.getVulnerabilities()) { +968 if (v.getCvssScore() >= failBuildOnCVSS) { +969 if (addName) { +970 addName = false; +971 ids.append(NEW_LINE).append(d.getFileName()).append(": "); +972 ids.append(v.getName()); +973 } else { +974 ids.append(", ").append(v.getName()); +975 } +976 } +977 } +978 } +979 if (ids.length() > 0) { +980 final String msg = String.format("%n%nDependency-Check Failure:%n" +981 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" +982 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); +983 +984 throw new ScanAgentException(msg); +985 } +986 } +987 +988 /** +989 * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. +990 * +991 * @param dependencies a list of dependency objects +992 */ +993 private void showSummary(List<Dependency> dependencies) { +994 final StringBuilder summary = new StringBuilder(); +995 for (Dependency d : dependencies) { +996 boolean firstEntry = true; +997 final StringBuilder ids = new StringBuilder(); +998 for (Vulnerability v : d.getVulnerabilities()) { +999 if (firstEntry) { +1000 firstEntry = false; +1001 } else { +1002 ids.append(", "); +1003 } +1004 ids.append(v.getName()); +1005 } +1006 if (ids.length() > 0) { +1007 summary.append(d.getFileName()).append(" ("); +1008 firstEntry = true; +1009 for (Identifier id : d.getIdentifiers()) { +1010 if (firstEntry) { +1011 firstEntry = false; +1012 } else { +1013 summary.append(", "); +1014 } +1015 summary.append(id.getValue()); 1016 } -1017 } -1018 } -1019 if (ids.length() > 0) { -1020 final String msg = String.format("%n%nDependency-Check Failure:%n" -1021 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" -1022 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); -1023 -1024 throw new ScanAgentException(msg); -1025 } -1026 } -1027 -1028 /** -1029 * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. -1030 * -1031 * @param dependencies a list of dependency objects -1032 */ -1033 private void showSummary(List<Dependency> dependencies) { -1034 final StringBuilder summary = new StringBuilder(); -1035 for (Dependency d : dependencies) { -1036 boolean firstEntry = true; -1037 final StringBuilder ids = new StringBuilder(); -1038 for (Vulnerability v : d.getVulnerabilities()) { -1039 if (firstEntry) { -1040 firstEntry = false; -1041 } else { -1042 ids.append(", "); -1043 } -1044 ids.append(v.getName()); -1045 } -1046 if (ids.length() > 0) { -1047 summary.append(d.getFileName()).append(" ("); -1048 firstEntry = true; -1049 for (Identifier id : d.getIdentifiers()) { -1050 if (firstEntry) { -1051 firstEntry = false; -1052 } else { -1053 summary.append(", "); -1054 } -1055 summary.append(id.getValue()); -1056 } -1057 summary.append(") : ").append(ids).append(NEW_LINE); -1058 } -1059 } -1060 if (summary.length() > 0) { -1061 LOGGER.warn("\n\nOne or more dependencies were identified with known vulnerabilities:\n\n{}\n\n" -1062 + "See the dependency-check report for more details.\n\n", -1063 summary.toString()); -1064 } -1065 } -1066 -1067 } +1017 summary.append(") : ").append(ids).append(NEW_LINE); +1018 } +1019 } +1020 if (summary.length() > 0) { +1021 LOGGER.warn("\n\nOne or more dependencies were identified with known vulnerabilities:\n\n{}\n\n" +1022 + "See the dependency-check report for more details.\n\n", +1023 summary.toString()); +1024 } +1025 } +1026 +1027 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/agent/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/agent/package-frame.html index 3b026ec93..f38fbc01e 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/agent/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/agent/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.agent + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.agent diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/agent/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/agent/package-summary.html index 83eb14727..2266c8d24 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/agent/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/agent/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.agent + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.agent diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzer.html index 9630ee9ef..c1d3fe9ab 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzer.html @@ -222,7 +222,7 @@ 214 * @return a Set of strings. 215 */ 216 protected static Set<String> newHashSet(String... strings) { -217 final Set<String> set = new HashSet<String>(); +217 final Set<String> set = new HashSet<String>(strings.length); 218 Collections.addAll(set, strings); 219 return set; 220 } diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/AnalysisPhase.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/AnalysisPhase.html index b42341bbb..467d58eaa 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/AnalysisPhase.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/AnalysisPhase.html @@ -37,38 +37,42 @@ 29 */ 30 INITIAL, 31 /** -32 * Information collection phase. +32 * Pre information collection phase 33 */ -34 INFORMATION_COLLECTION, +34 PRE_INFORMATION_COLLECTION, 35 /** -36 * Pre identifier analysis phase. +36 * Information collection phase. 37 */ -38 PRE_IDENTIFIER_ANALYSIS, +38 INFORMATION_COLLECTION, 39 /** -40 * Identifier analysis phase. +40 * Pre identifier analysis phase. 41 */ -42 IDENTIFIER_ANALYSIS, +42 PRE_IDENTIFIER_ANALYSIS, 43 /** -44 * Post identifier analysis phase. +44 * Identifier analysis phase. 45 */ -46 POST_IDENTIFIER_ANALYSIS, +46 IDENTIFIER_ANALYSIS, 47 /** -48 * Pre finding analysis phase. +48 * Post identifier analysis phase. 49 */ -50 PRE_FINDING_ANALYSIS, +50 POST_IDENTIFIER_ANALYSIS, 51 /** -52 * Finding analysis phase. +52 * Pre finding analysis phase. 53 */ -54 FINDING_ANALYSIS, +54 PRE_FINDING_ANALYSIS, 55 /** -56 * Post analysis phase. +56 * Finding analysis phase. 57 */ -58 POST_FINDING_ANALYSIS, +58 FINDING_ANALYSIS, 59 /** -60 * The final analysis phase. +60 * Post analysis phase. 61 */ -62 FINAL -63 } +62 POST_FINDING_ANALYSIS, +63 /** +64 * The final analysis phase. +65 */ +66 FINAL +67 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.html index 94bf4b6ed..17c9d8c0b 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.html @@ -122,8 +122,8 @@ 114 static { 115 final String additionalZipExt = Settings.getString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS); 116 if (additionalZipExt != null) { -117 final Set<String> ext = new HashSet<String>(Collections.singletonList(additionalZipExt)); -118 ZIPPABLES.addAll(ext); +117 final String[] ext = additionalZipExt.split("\\s*,\\s*"); +118 Collections.addAll(ZIPPABLES, ext); 119 } 120 EXTENSIONS.addAll(ZIPPABLES); 121 } @@ -203,320 +203,321 @@ 195 if (tempFileLocation != null && tempFileLocation.exists()) { 196 LOGGER.debug("Attempting to delete temporary files"); 197 final boolean success = FileUtils.delete(tempFileLocation); -198 if (!success && tempFileLocation.exists() && tempFileLocation.list().length > 0) { -199 LOGGER.warn("Failed to delete some temporary files, see the log for more details"); -200 } -201 } -202 } -203 -204 /** -205 * Analyzes a given dependency. If the dependency is an archive, such as a WAR or EAR, the contents are extracted, scanned, -206 * and added to the list of dependencies within the engine. -207 * -208 * @param dependency the dependency to analyze -209 * @param engine the engine scanning -210 * @throws AnalysisException thrown if there is an analysis exception -211 */ -212 @Override -213 public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { -214 final File f = new File(dependency.getActualFilePath()); -215 final File tmpDir = getNextTempDirectory(); -216 extractFiles(f, tmpDir, engine); -217 -218 //make a copy -219 final Set<Dependency> dependencySet = findMoreDependencies(engine, tmpDir); -220 if (!dependencySet.isEmpty()) { -221 for (Dependency d : dependencySet) { -222 //fix the dependency's display name and path -223 final String displayPath = String.format("%s%s", -224 dependency.getFilePath(), -225 d.getActualFilePath().substring(tmpDir.getAbsolutePath().length())); -226 final String displayName = String.format("%s: %s", -227 dependency.getFileName(), -228 d.getFileName()); -229 d.setFilePath(displayPath); -230 d.setFileName(displayName); -231 -232 //TODO - can we get more evidence from the parent? EAR contains module name, etc. -233 //analyze the dependency (i.e. extract files) if it is a supported type. -234 if (this.accept(d.getActualFile()) && scanDepth < MAX_SCAN_DEPTH) { -235 scanDepth += 1; -236 analyze(d, engine); -237 scanDepth -= 1; -238 } -239 } -240 } -241 if (REMOVE_FROM_ANALYSIS.accept(dependency.getActualFile())) { -242 addDisguisedJarsToDependencies(dependency, engine); -243 engine.getDependencies().remove(dependency); -244 } -245 Collections.sort(engine.getDependencies()); -246 } -247 -248 /** -249 * If a zip file was identified as a possible JAR, this method will add the zip to the list of dependencies. -250 * -251 * @param dependency the zip file -252 * @param engine the engine -253 * @throws AnalysisException thrown if there is an issue -254 */ -255 private void addDisguisedJarsToDependencies(Dependency dependency, Engine engine) throws AnalysisException { -256 if (ZIP_FILTER.accept(dependency.getActualFile()) && isZipFileActuallyJarFile(dependency)) { -257 final File tdir = getNextTempDirectory(); -258 final String fileName = dependency.getFileName(); -259 -260 LOGGER.info("The zip file '{}' appears to be a JAR file, making a copy and analyzing it as a JAR.", fileName); -261 -262 final File tmpLoc = new File(tdir, fileName.substring(0, fileName.length() - 3) + "jar"); -263 try { -264 org.apache.commons.io.FileUtils.copyFile(tdir, tmpLoc); -265 final Set<Dependency> dependencySet = findMoreDependencies(engine, tmpLoc); -266 if (!dependencySet.isEmpty()) { -267 if (dependencySet.size() != 1) { -268 LOGGER.info("Deep copy of ZIP to JAR file resulted in more than one dependency?"); -269 } -270 for (Dependency d : dependencySet) { -271 //fix the dependency's display name and path -272 d.setFilePath(dependency.getFilePath()); -273 d.setDisplayFileName(dependency.getFileName()); -274 } -275 } -276 } catch (IOException ex) { -277 LOGGER.debug("Unable to perform deep copy on '{}'", dependency.getActualFile().getPath(), ex); -278 } -279 } -280 } -281 /** -282 * An empty dependency set. -283 */ -284 private static final Set<Dependency> EMPTY_DEPENDENCY_SET = Collections.emptySet(); -285 -286 /** -287 * Scan the given file/folder, and return any new dependencies found. -288 * -289 * @param engine used to scan -290 * @param file target of scanning -291 * @return any dependencies that weren't known to the engine before -292 */ -293 private static Set<Dependency> findMoreDependencies(Engine engine, File file) { -294 final List<Dependency> before = new ArrayList<Dependency>(engine.getDependencies()); -295 engine.scan(file); -296 final List<Dependency> after = engine.getDependencies(); -297 final boolean sizeChanged = before.size() != after.size(); -298 final Set<Dependency> newDependencies; -299 if (sizeChanged) { -300 //get the new dependencies -301 newDependencies = new HashSet<Dependency>(after); -302 newDependencies.removeAll(before); -303 } else { -304 newDependencies = EMPTY_DEPENDENCY_SET; -305 } -306 return newDependencies; -307 } -308 -309 /** -310 * Retrieves the next temporary directory to extract an archive too. -311 * -312 * @return a directory -313 * @throws AnalysisException thrown if unable to create temporary directory -314 */ -315 private File getNextTempDirectory() throws AnalysisException { -316 dirCount += 1; -317 final File directory = new File(tempFileLocation, String.valueOf(dirCount)); -318 //getting an exception for some directories not being able to be created; might be because the directory already exists? -319 if (directory.exists()) { -320 return getNextTempDirectory(); -321 } -322 if (!directory.mkdirs()) { -323 final String msg = String.format("Unable to create temp directory '%s'.", directory.getAbsolutePath()); -324 throw new AnalysisException(msg); -325 } -326 return directory; -327 } -328 -329 /** -330 * Extracts the contents of an archive into the specified directory. -331 * -332 * @param archive an archive file such as a WAR or EAR -333 * @param destination a directory to extract the contents to -334 * @param engine the scanning engine -335 * @throws AnalysisException thrown if the archive is not found -336 */ -337 private void extractFiles(File archive, File destination, Engine engine) throws AnalysisException { -338 if (archive != null && destination != null) { -339 FileInputStream fis; -340 try { -341 fis = new FileInputStream(archive); -342 } catch (FileNotFoundException ex) { -343 LOGGER.debug("", ex); -344 throw new AnalysisException("Archive file was not found.", ex); -345 } -346 final String archiveExt = FileUtils.getFileExtension(archive.getName()).toLowerCase(); -347 try { -348 if (ZIPPABLES.contains(archiveExt)) { -349 extractArchive(new ZipArchiveInputStream(new BufferedInputStream(fis)), destination, engine); -350 } else if ("tar".equals(archiveExt)) { -351 extractArchive(new TarArchiveInputStream(new BufferedInputStream(fis)), destination, engine); -352 } else if ("gz".equals(archiveExt) || "tgz".equals(archiveExt)) { -353 final String uncompressedName = GzipUtils.getUncompressedFilename(archive.getName()); -354 final File f = new File(destination, uncompressedName); -355 if (engine.accept(f)) { -356 decompressFile(new GzipCompressorInputStream(new BufferedInputStream(fis)), f); -357 } -358 } else if ("bz2".equals(archiveExt) || "tbz2".equals(archiveExt)) { -359 final String uncompressedName = BZip2Utils.getUncompressedFilename(archive.getName()); -360 final File f = new File(destination, uncompressedName); -361 if (engine.accept(f)) { -362 decompressFile(new BZip2CompressorInputStream(new BufferedInputStream(fis)), f); -363 } -364 } -365 } catch (ArchiveExtractionException ex) { -366 LOGGER.warn("Exception extracting archive '{}'.", archive.getName()); -367 LOGGER.debug("", ex); -368 } catch (IOException ex) { -369 LOGGER.warn("Exception reading archive '{}'.", archive.getName()); +198 if (!success && tempFileLocation.exists()) { +199 final String[] l = tempFileLocation.list(); +200 if (l != null && l.length > 0) { +201 LOGGER.warn("Failed to delete some temporary files, see the log for more details"); +202 } +203 } +204 } +205 } +206 +207 /** +208 * Analyzes a given dependency. If the dependency is an archive, such as a WAR or EAR, the contents are extracted, scanned, +209 * and added to the list of dependencies within the engine. +210 * +211 * @param dependency the dependency to analyze +212 * @param engine the engine scanning +213 * @throws AnalysisException thrown if there is an analysis exception +214 */ +215 @Override +216 public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { +217 final File f = new File(dependency.getActualFilePath()); +218 final File tmpDir = getNextTempDirectory(); +219 extractFiles(f, tmpDir, engine); +220 +221 //make a copy +222 final Set<Dependency> dependencySet = findMoreDependencies(engine, tmpDir); +223 if (!dependencySet.isEmpty()) { +224 for (Dependency d : dependencySet) { +225 //fix the dependency's display name and path +226 final String displayPath = String.format("%s%s", +227 dependency.getFilePath(), +228 d.getActualFilePath().substring(tmpDir.getAbsolutePath().length())); +229 final String displayName = String.format("%s: %s", +230 dependency.getFileName(), +231 d.getFileName()); +232 d.setFilePath(displayPath); +233 d.setFileName(displayName); +234 +235 //TODO - can we get more evidence from the parent? EAR contains module name, etc. +236 //analyze the dependency (i.e. extract files) if it is a supported type. +237 if (this.accept(d.getActualFile()) && scanDepth < MAX_SCAN_DEPTH) { +238 scanDepth += 1; +239 analyze(d, engine); +240 scanDepth -= 1; +241 } +242 } +243 } +244 if (REMOVE_FROM_ANALYSIS.accept(dependency.getActualFile())) { +245 addDisguisedJarsToDependencies(dependency, engine); +246 engine.getDependencies().remove(dependency); +247 } +248 Collections.sort(engine.getDependencies()); +249 } +250 +251 /** +252 * If a zip file was identified as a possible JAR, this method will add the zip to the list of dependencies. +253 * +254 * @param dependency the zip file +255 * @param engine the engine +256 * @throws AnalysisException thrown if there is an issue +257 */ +258 private void addDisguisedJarsToDependencies(Dependency dependency, Engine engine) throws AnalysisException { +259 if (ZIP_FILTER.accept(dependency.getActualFile()) && isZipFileActuallyJarFile(dependency)) { +260 final File tdir = getNextTempDirectory(); +261 final String fileName = dependency.getFileName(); +262 +263 LOGGER.info("The zip file '{}' appears to be a JAR file, making a copy and analyzing it as a JAR.", fileName); +264 +265 final File tmpLoc = new File(tdir, fileName.substring(0, fileName.length() - 3) + "jar"); +266 try { +267 org.apache.commons.io.FileUtils.copyFile(tdir, tmpLoc); +268 final Set<Dependency> dependencySet = findMoreDependencies(engine, tmpLoc); +269 if (!dependencySet.isEmpty()) { +270 if (dependencySet.size() != 1) { +271 LOGGER.info("Deep copy of ZIP to JAR file resulted in more than one dependency?"); +272 } +273 for (Dependency d : dependencySet) { +274 //fix the dependency's display name and path +275 d.setFilePath(dependency.getFilePath()); +276 d.setDisplayFileName(dependency.getFileName()); +277 } +278 } +279 } catch (IOException ex) { +280 LOGGER.debug("Unable to perform deep copy on '{}'", dependency.getActualFile().getPath(), ex); +281 } +282 } +283 } +284 /** +285 * An empty dependency set. +286 */ +287 private static final Set<Dependency> EMPTY_DEPENDENCY_SET = Collections.emptySet(); +288 +289 /** +290 * Scan the given file/folder, and return any new dependencies found. +291 * +292 * @param engine used to scan +293 * @param file target of scanning +294 * @return any dependencies that weren't known to the engine before +295 */ +296 private static Set<Dependency> findMoreDependencies(Engine engine, File file) { +297 final List<Dependency> before = new ArrayList<Dependency>(engine.getDependencies()); +298 engine.scan(file); +299 final List<Dependency> after = engine.getDependencies(); +300 final boolean sizeChanged = before.size() != after.size(); +301 final Set<Dependency> newDependencies; +302 if (sizeChanged) { +303 //get the new dependencies +304 newDependencies = new HashSet<Dependency>(after); +305 newDependencies.removeAll(before); +306 } else { +307 newDependencies = EMPTY_DEPENDENCY_SET; +308 } +309 return newDependencies; +310 } +311 +312 /** +313 * Retrieves the next temporary directory to extract an archive too. +314 * +315 * @return a directory +316 * @throws AnalysisException thrown if unable to create temporary directory +317 */ +318 private File getNextTempDirectory() throws AnalysisException { +319 dirCount += 1; +320 final File directory = new File(tempFileLocation, String.valueOf(dirCount)); +321 //getting an exception for some directories not being able to be created; might be because the directory already exists? +322 if (directory.exists()) { +323 return getNextTempDirectory(); +324 } +325 if (!directory.mkdirs()) { +326 final String msg = String.format("Unable to create temp directory '%s'.", directory.getAbsolutePath()); +327 throw new AnalysisException(msg); +328 } +329 return directory; +330 } +331 +332 /** +333 * Extracts the contents of an archive into the specified directory. +334 * +335 * @param archive an archive file such as a WAR or EAR +336 * @param destination a directory to extract the contents to +337 * @param engine the scanning engine +338 * @throws AnalysisException thrown if the archive is not found +339 */ +340 private void extractFiles(File archive, File destination, Engine engine) throws AnalysisException { +341 if (archive != null && destination != null) { +342 FileInputStream fis; +343 try { +344 fis = new FileInputStream(archive); +345 } catch (FileNotFoundException ex) { +346 LOGGER.debug("", ex); +347 throw new AnalysisException("Archive file was not found.", ex); +348 } +349 final String archiveExt = FileUtils.getFileExtension(archive.getName()).toLowerCase(); +350 try { +351 if (ZIPPABLES.contains(archiveExt)) { +352 extractArchive(new ZipArchiveInputStream(new BufferedInputStream(fis)), destination, engine); +353 } else if ("tar".equals(archiveExt)) { +354 extractArchive(new TarArchiveInputStream(new BufferedInputStream(fis)), destination, engine); +355 } else if ("gz".equals(archiveExt) || "tgz".equals(archiveExt)) { +356 final String uncompressedName = GzipUtils.getUncompressedFilename(archive.getName()); +357 final File f = new File(destination, uncompressedName); +358 if (engine.accept(f)) { +359 decompressFile(new GzipCompressorInputStream(new BufferedInputStream(fis)), f); +360 } +361 } else if ("bz2".equals(archiveExt) || "tbz2".equals(archiveExt)) { +362 final String uncompressedName = BZip2Utils.getUncompressedFilename(archive.getName()); +363 final File f = new File(destination, uncompressedName); +364 if (engine.accept(f)) { +365 decompressFile(new BZip2CompressorInputStream(new BufferedInputStream(fis)), f); +366 } +367 } +368 } catch (ArchiveExtractionException ex) { +369 LOGGER.warn("Exception extracting archive '{}'.", archive.getName()); 370 LOGGER.debug("", ex); -371 } finally { -372 close(fis); -373 } -374 } -375 } -376 -377 /** -378 * Extracts files from an archive. -379 * -380 * @param input the archive to extract files from -381 * @param destination the location to write the files too -382 * @param engine the dependency-check engine -383 * @throws ArchiveExtractionException thrown if there is an exception extracting files from the archive -384 */ -385 private void extractArchive(ArchiveInputStream input, File destination, Engine engine) throws ArchiveExtractionException { -386 ArchiveEntry entry; -387 try { -388 while ((entry = input.getNextEntry()) != null) { -389 final File file = new File(destination, entry.getName()); -390 if (entry.isDirectory()) { -391 if (!file.exists() && !file.mkdirs()) { -392 final String msg = String.format("Unable to create directory '%s'.", file.getAbsolutePath()); -393 throw new AnalysisException(msg); -394 } -395 } else if (engine.accept(file)) { -396 extractAcceptedFile(input, file); -397 } -398 } -399 } catch (Throwable ex) { -400 throw new ArchiveExtractionException(ex); -401 } finally { -402 close(input); -403 } -404 } -405 -406 /** -407 * Extracts a file from an archive. -408 * -409 * @param input the archives input stream -410 * @param file the file to extract -411 * @throws AnalysisException thrown if there is an error -412 */ -413 private static void extractAcceptedFile(ArchiveInputStream input, File file) throws AnalysisException { -414 LOGGER.debug("Extracting '{}'", file.getPath()); -415 FileOutputStream fos = null; -416 try { -417 final File parent = file.getParentFile(); -418 if (!parent.isDirectory()) { -419 if (!parent.mkdirs()) { -420 final String msg = String.format("Unable to build directory '%s'.", parent.getAbsolutePath()); -421 throw new AnalysisException(msg); -422 } -423 } -424 fos = new FileOutputStream(file); -425 IOUtils.copy(input, fos); -426 } catch (FileNotFoundException ex) { -427 LOGGER.debug("", ex); -428 final String msg = String.format("Unable to find file '%s'.", file.getName()); -429 throw new AnalysisException(msg, ex); -430 } catch (IOException ex) { -431 LOGGER.debug("", ex); -432 final String msg = String.format("IO Exception while parsing file '%s'.", file.getName()); -433 throw new AnalysisException(msg, ex); -434 } finally { -435 close(fos); -436 } -437 } -438 -439 /** -440 * Decompresses a file. -441 * -442 * @param inputStream the compressed file -443 * @param outputFile the location to write the decompressed file -444 * @throws ArchiveExtractionException thrown if there is an exception decompressing the file -445 */ -446 private void decompressFile(CompressorInputStream inputStream, File outputFile) throws ArchiveExtractionException { -447 LOGGER.debug("Decompressing '{}'", outputFile.getPath()); -448 FileOutputStream out = null; -449 try { -450 out = new FileOutputStream(outputFile); -451 IOUtils.copy(inputStream, out); -452 } catch (FileNotFoundException ex) { -453 LOGGER.debug("", ex); -454 throw new ArchiveExtractionException(ex); -455 } catch (IOException ex) { -456 LOGGER.debug("", ex); -457 throw new ArchiveExtractionException(ex); -458 } finally { -459 close(out); -460 } -461 } -462 -463 /** -464 * Close the given {@link Closeable} instance, ignoring nulls, and logging any thrown {@link IOException}. -465 * -466 * @param closeable to be closed -467 */ -468 private static void close(Closeable closeable) { -469 if (null != closeable) { -470 try { -471 closeable.close(); -472 } catch (IOException ex) { -473 LOGGER.trace("", ex); -474 } -475 } -476 } -477 -478 /** -479 * Attempts to determine if a zip file is actually a JAR file. -480 * -481 * @param dependency the dependency to check -482 * @return true if the dependency appears to be a JAR file; otherwise false -483 */ -484 private boolean isZipFileActuallyJarFile(Dependency dependency) { -485 boolean isJar = false; -486 ZipFile zip = null; -487 try { -488 zip = new ZipFile(dependency.getActualFilePath()); -489 if (zip.getEntry("META-INF/MANIFEST.MF") != null -490 || zip.getEntry("META-INF/maven") != null) { -491 final Enumeration<ZipArchiveEntry> entries = zip.getEntries(); -492 while (entries.hasMoreElements()) { -493 final ZipArchiveEntry entry = entries.nextElement(); -494 if (!entry.isDirectory()) { -495 final String name = entry.getName().toLowerCase(); -496 if (name.endsWith(".class")) { -497 isJar = true; -498 break; -499 } -500 } -501 } -502 } -503 } catch (IOException ex) { -504 LOGGER.debug("Unable to unzip zip file '{}'", dependency.getFilePath(), ex); -505 } finally { -506 ZipFile.closeQuietly(zip); -507 } -508 -509 return isJar; -510 } -511 } +371 } catch (IOException ex) { +372 LOGGER.warn("Exception reading archive '{}'.", archive.getName()); +373 LOGGER.debug("", ex); +374 } finally { +375 close(fis); +376 } +377 } +378 } +379 +380 /** +381 * Extracts files from an archive. +382 * +383 * @param input the archive to extract files from +384 * @param destination the location to write the files too +385 * @param engine the dependency-check engine +386 * @throws ArchiveExtractionException thrown if there is an exception extracting files from the archive +387 */ +388 private void extractArchive(ArchiveInputStream input, File destination, Engine engine) throws ArchiveExtractionException { +389 ArchiveEntry entry; +390 try { +391 while ((entry = input.getNextEntry()) != null) { +392 final File file = new File(destination, entry.getName()); +393 if (entry.isDirectory()) { +394 if (!file.exists() && !file.mkdirs()) { +395 final String msg = String.format("Unable to create directory '%s'.", file.getAbsolutePath()); +396 throw new AnalysisException(msg); +397 } +398 } else if (engine.accept(file)) { +399 extractAcceptedFile(input, file); +400 } +401 } +402 } catch (Throwable ex) { +403 throw new ArchiveExtractionException(ex); +404 } finally { +405 close(input); +406 } +407 } +408 +409 /** +410 * Extracts a file from an archive. +411 * +412 * @param input the archives input stream +413 * @param file the file to extract +414 * @throws AnalysisException thrown if there is an error +415 */ +416 private static void extractAcceptedFile(ArchiveInputStream input, File file) throws AnalysisException { +417 LOGGER.debug("Extracting '{}'", file.getPath()); +418 FileOutputStream fos = null; +419 try { +420 final File parent = file.getParentFile(); +421 if (!parent.isDirectory() && !parent.mkdirs()) { +422 final String msg = String.format("Unable to build directory '%s'.", parent.getAbsolutePath()); +423 throw new AnalysisException(msg); +424 } +425 fos = new FileOutputStream(file); +426 IOUtils.copy(input, fos); +427 } catch (FileNotFoundException ex) { +428 LOGGER.debug("", ex); +429 final String msg = String.format("Unable to find file '%s'.", file.getName()); +430 throw new AnalysisException(msg, ex); +431 } catch (IOException ex) { +432 LOGGER.debug("", ex); +433 final String msg = String.format("IO Exception while parsing file '%s'.", file.getName()); +434 throw new AnalysisException(msg, ex); +435 } finally { +436 close(fos); +437 } +438 } +439 +440 /** +441 * Decompresses a file. +442 * +443 * @param inputStream the compressed file +444 * @param outputFile the location to write the decompressed file +445 * @throws ArchiveExtractionException thrown if there is an exception decompressing the file +446 */ +447 private void decompressFile(CompressorInputStream inputStream, File outputFile) throws ArchiveExtractionException { +448 LOGGER.debug("Decompressing '{}'", outputFile.getPath()); +449 FileOutputStream out = null; +450 try { +451 out = new FileOutputStream(outputFile); +452 IOUtils.copy(inputStream, out); +453 } catch (FileNotFoundException ex) { +454 LOGGER.debug("", ex); +455 throw new ArchiveExtractionException(ex); +456 } catch (IOException ex) { +457 LOGGER.debug("", ex); +458 throw new ArchiveExtractionException(ex); +459 } finally { +460 close(out); +461 } +462 } +463 +464 /** +465 * Close the given {@link Closeable} instance, ignoring nulls, and logging any thrown {@link IOException}. +466 * +467 * @param closeable to be closed +468 */ +469 private static void close(Closeable closeable) { +470 if (null != closeable) { +471 try { +472 closeable.close(); +473 } catch (IOException ex) { +474 LOGGER.trace("", ex); +475 } +476 } +477 } +478 +479 /** +480 * Attempts to determine if a zip file is actually a JAR file. +481 * +482 * @param dependency the dependency to check +483 * @return true if the dependency appears to be a JAR file; otherwise false +484 */ +485 private boolean isZipFileActuallyJarFile(Dependency dependency) { +486 boolean isJar = false; +487 ZipFile zip = null; +488 try { +489 zip = new ZipFile(dependency.getActualFilePath()); +490 if (zip.getEntry("META-INF/MANIFEST.MF") != null +491 || zip.getEntry("META-INF/maven") != null) { +492 final Enumeration<ZipArchiveEntry> entries = zip.getEntries(); +493 while (entries.hasMoreElements()) { +494 final ZipArchiveEntry entry = entries.nextElement(); +495 if (!entry.isDirectory()) { +496 final String name = entry.getName().toLowerCase(); +497 if (name.endsWith(".class")) { +498 isJar = true; +499 break; +500 } +501 } +502 } +503 } +504 } catch (IOException ex) { +505 LOGGER.debug("Unable to unzip zip file '{}'", dependency.getFilePath(), ex); +506 } finally { +507 ZipFile.closeQuietly(zip); +508 } +509 +510 return isJar; +511 } +512 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.html index de7540863..7806b1b25 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.html @@ -25,13 +25,13 @@ 17 */ 18 package org.owasp.dependencycheck.analyzer; 19 -20 import java.io.BufferedReader; -21 import java.io.File; -22 import java.io.FileFilter; -23 import java.io.FileOutputStream; -24 import java.io.IOException; -25 import java.io.InputStream; -26 import java.io.InputStreamReader; +20 import java.io.File; +21 import java.io.FileFilter; +22 import java.io.FileOutputStream; +23 import java.io.IOException; +24 import java.io.InputStream; +25 import org.apache.commons.io.IOUtils; +26 import org.apache.commons.io.output.NullOutputStream; 27 import org.owasp.dependencycheck.Engine; 28 import org.owasp.dependencycheck.analyzer.exception.AnalysisException; 29 import org.owasp.dependencycheck.dependency.Confidence; @@ -123,224 +123,198 @@ 115 final List<String> args = buildArgumentList(); 116 args.add(dependency.getActualFilePath()); 117 final ProcessBuilder pb = new ProcessBuilder(args); -118 BufferedReader rdr = null; -119 Document doc = null; -120 try { -121 final Process proc = pb.start(); -122 // Try evacuating the error stream -123 rdr = new BufferedReader(new InputStreamReader(proc.getErrorStream(), "UTF-8")); -124 String line = null; -125 // CHECKSTYLE:OFF -126 while (rdr.ready() && (line = rdr.readLine()) != null) { -127 LOGGER.warn("Error from GrokAssembly: {}", line); +118 Document doc = null; +119 try { +120 final Process proc = pb.start(); +121 +122 doc = builder.parse(proc.getInputStream()); +123 +124 // Try evacuating the error stream +125 final String errorStream = IOUtils.toString(proc.getErrorStream(), "UTF-8"); +126 if (null != errorStream && !errorStream.isEmpty()) { +127 LOGGER.warn("Error from GrokAssembly: {}", errorStream); 128 } -129 // CHECKSTYLE:ON +129 130 int rc = 0; -131 doc = builder.parse(proc.getInputStream()); -132 -133 try { -134 rc = proc.waitFor(); -135 } catch (InterruptedException ie) { -136 return; -137 } -138 if (rc == 3) { -139 LOGGER.debug("{} is not a .NET assembly or executable and as such cannot be analyzed by dependency-check", -140 dependency.getActualFilePath()); -141 return; -142 } else if (rc != 0) { -143 LOGGER.warn("Return code {} from GrokAssembly", rc); -144 } +131 try { +132 rc = proc.waitFor(); +133 } catch (InterruptedException ie) { +134 return; +135 } +136 if (rc == 3) { +137 LOGGER.debug("{} is not a .NET assembly or executable and as such cannot be analyzed by dependency-check", +138 dependency.getActualFilePath()); +139 return; +140 } else if (rc != 0) { +141 LOGGER.warn("Return code {} from GrokAssembly", rc); +142 } +143 +144 final XPath xpath = XPathFactory.newInstance().newXPath(); 145 -146 final XPath xpath = XPathFactory.newInstance().newXPath(); -147 -148 // First, see if there was an error -149 final String error = xpath.evaluate("/assembly/error", doc); -150 if (error != null && !error.isEmpty()) { -151 throw new AnalysisException(error); -152 } -153 -154 final String version = xpath.evaluate("/assembly/version", doc); -155 if (version != null) { -156 dependency.getVersionEvidence().addEvidence(new Evidence("grokassembly", "version", -157 version, Confidence.HIGHEST)); -158 } -159 -160 final String vendor = xpath.evaluate("/assembly/company", doc); -161 if (vendor != null) { -162 dependency.getVendorEvidence().addEvidence(new Evidence("grokassembly", "vendor", -163 vendor, Confidence.HIGH)); -164 } -165 -166 final String product = xpath.evaluate("/assembly/product", doc); -167 if (product != null) { -168 dependency.getProductEvidence().addEvidence(new Evidence("grokassembly", "product", -169 product, Confidence.HIGH)); -170 } -171 -172 } catch (IOException ioe) { -173 throw new AnalysisException(ioe); -174 } catch (SAXException saxe) { -175 throw new AnalysisException("Couldn't parse GrokAssembly result", saxe); -176 } catch (XPathExpressionException xpe) { -177 // This shouldn't happen -178 throw new AnalysisException(xpe); -179 } finally { -180 if (rdr != null) { -181 try { -182 rdr.close(); -183 } catch (IOException ex) { -184 LOGGER.debug("ignore", ex); -185 } -186 } -187 } -188 } -189 -190 /** -191 * Initialize the analyzer. In this case, extract GrokAssembly.exe to a temporary location. -192 * -193 * @throws Exception if anything goes wrong -194 */ -195 @Override -196 public void initializeFileTypeAnalyzer() throws Exception { -197 final File tempFile = File.createTempFile("GKA", ".exe", Settings.getTempDirectory()); -198 FileOutputStream fos = null; -199 InputStream is = null; -200 try { -201 fos = new FileOutputStream(tempFile); -202 is = AssemblyAnalyzer.class.getClassLoader().getResourceAsStream("GrokAssembly.exe"); -203 final byte[] buff = new byte[4096]; -204 int bread = -1; -205 while ((bread = is.read(buff)) >= 0) { -206 fos.write(buff, 0, bread); -207 } -208 grokAssemblyExe = tempFile; -209 // Set the temp file to get deleted when we're done -210 grokAssemblyExe.deleteOnExit(); -211 LOGGER.debug("Extracted GrokAssembly.exe to {}", grokAssemblyExe.getPath()); -212 } catch (IOException ioe) { -213 this.setEnabled(false); -214 LOGGER.warn("Could not extract GrokAssembly.exe: {}", ioe.getMessage()); -215 throw new AnalysisException("Could not extract GrokAssembly.exe", ioe); -216 } finally { -217 if (fos != null) { -218 try { -219 fos.close(); -220 } catch (Throwable e) { -221 LOGGER.debug("Error closing output stream"); -222 } -223 } -224 if (is != null) { -225 try { -226 is.close(); -227 } catch (Throwable e) { -228 LOGGER.debug("Error closing input stream"); -229 } -230 } -231 } -232 -233 // Now, need to see if GrokAssembly actually runs from this location. -234 final List<String> args = buildArgumentList(); -235 BufferedReader rdr = null; -236 try { -237 final ProcessBuilder pb = new ProcessBuilder(args); -238 final Process p = pb.start(); -239 // Try evacuating the error stream -240 rdr = new BufferedReader(new InputStreamReader(p.getErrorStream(), "UTF-8")); -241 // CHECKSTYLE:OFF -242 while (rdr.ready() && rdr.readLine() != null) { -243 // We expect this to complain -244 } -245 // CHECKSTYLE:ON -246 final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(p.getInputStream()); -247 final XPath xpath = XPathFactory.newInstance().newXPath(); -248 final String error = xpath.evaluate("/assembly/error", doc); -249 if (p.waitFor() != 1 || error == null || error.isEmpty()) { -250 LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer, please see the log for more details."); -251 LOGGER.debug("GrokAssembly.exe is not working properly"); -252 grokAssemblyExe = null; -253 this.setEnabled(false); -254 throw new AnalysisException("Could not execute .NET AssemblyAnalyzer"); -255 } -256 } catch (Throwable e) { -257 if (e instanceof AnalysisException) { -258 throw (AnalysisException) e; -259 } else { -260 LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer;\n" -261 + "this can be ignored unless you are scanning .NET DLLs. Please see the log for more details."); -262 LOGGER.debug("Could not execute GrokAssembly {}", e.getMessage()); -263 this.setEnabled(false); -264 throw new AnalysisException("An error occured with the .NET AssemblyAnalyzer", e); -265 } -266 } finally { -267 if (rdr != null) { -268 try { -269 rdr.close(); -270 } catch (IOException ex) { -271 LOGGER.trace("ignore", ex); -272 } -273 } -274 } -275 builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); -276 } -277 -278 /** -279 * Removes resources used from the local file system. -280 * -281 * @throws Exception thrown if there is a problem closing the analyzer -282 */ -283 @Override -284 public void close() throws Exception { -285 super.close(); -286 try { -287 if (grokAssemblyExe != null && !grokAssemblyExe.delete()) { -288 grokAssemblyExe.deleteOnExit(); -289 } -290 } catch (SecurityException se) { -291 LOGGER.debug("Can't delete temporary GrokAssembly.exe"); -292 } -293 } -294 -295 /** -296 * The File Filter used to filter supported extensions. -297 */ -298 private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions( -299 SUPPORTED_EXTENSIONS).build(); -300 -301 @Override -302 protected FileFilter getFileFilter() { -303 return FILTER; -304 } -305 -306 /** -307 * Gets this analyzer's name. -308 * -309 * @return the analyzer name -310 */ -311 @Override -312 public String getName() { -313 return ANALYZER_NAME; -314 } -315 -316 /** -317 * Returns the phase this analyzer runs under. -318 * -319 * @return the phase this runs under -320 */ -321 @Override -322 public AnalysisPhase getAnalysisPhase() { -323 return ANALYSIS_PHASE; -324 } -325 -326 /** -327 * Returns the key used in the properties file to reference the analyzer's enabled property. -328 * -329 * @return the analyzer's enabled property setting key -330 */ -331 @Override -332 protected String getAnalyzerEnabledSettingKey() { -333 return Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED; -334 } -335 } +146 // First, see if there was an error +147 final String error = xpath.evaluate("/assembly/error", doc); +148 if (error != null && !error.isEmpty()) { +149 throw new AnalysisException(error); +150 } +151 +152 final String version = xpath.evaluate("/assembly/version", doc); +153 if (version != null) { +154 dependency.getVersionEvidence().addEvidence(new Evidence("grokassembly", "version", +155 version, Confidence.HIGHEST)); +156 } +157 +158 final String vendor = xpath.evaluate("/assembly/company", doc); +159 if (vendor != null) { +160 dependency.getVendorEvidence().addEvidence(new Evidence("grokassembly", "vendor", +161 vendor, Confidence.HIGH)); +162 } +163 +164 final String product = xpath.evaluate("/assembly/product", doc); +165 if (product != null) { +166 dependency.getProductEvidence().addEvidence(new Evidence("grokassembly", "product", +167 product, Confidence.HIGH)); +168 } +169 +170 } catch (IOException ioe) { +171 throw new AnalysisException(ioe); +172 } catch (SAXException saxe) { +173 throw new AnalysisException("Couldn't parse GrokAssembly result", saxe); +174 } catch (XPathExpressionException xpe) { +175 // This shouldn't happen +176 throw new AnalysisException(xpe); +177 } +178 } +179 +180 /** +181 * Initialize the analyzer. In this case, extract GrokAssembly.exe to a temporary location. +182 * +183 * @throws Exception if anything goes wrong +184 */ +185 @Override +186 public void initializeFileTypeAnalyzer() throws Exception { +187 final File tempFile = File.createTempFile("GKA", ".exe", Settings.getTempDirectory()); +188 FileOutputStream fos = null; +189 InputStream is = null; +190 try { +191 fos = new FileOutputStream(tempFile); +192 is = AssemblyAnalyzer.class.getClassLoader().getResourceAsStream("GrokAssembly.exe"); +193 IOUtils.copy(is, fos); +194 +195 grokAssemblyExe = tempFile; +196 // Set the temp file to get deleted when we're done +197 grokAssemblyExe.deleteOnExit(); +198 LOGGER.debug("Extracted GrokAssembly.exe to {}", grokAssemblyExe.getPath()); +199 } catch (IOException ioe) { +200 this.setEnabled(false); +201 LOGGER.warn("Could not extract GrokAssembly.exe: {}", ioe.getMessage()); +202 throw new AnalysisException("Could not extract GrokAssembly.exe", ioe); +203 } finally { +204 if (fos != null) { +205 try { +206 fos.close(); +207 } catch (Throwable e) { +208 LOGGER.debug("Error closing output stream"); +209 } +210 } +211 if (is != null) { +212 try { +213 is.close(); +214 } catch (Throwable e) { +215 LOGGER.debug("Error closing input stream"); +216 } +217 } +218 } +219 +220 // Now, need to see if GrokAssembly actually runs from this location. +221 final List<String> args = buildArgumentList(); +222 try { +223 final ProcessBuilder pb = new ProcessBuilder(args); +224 final Process p = pb.start(); +225 // Try evacuating the error stream +226 IOUtils.copy(p.getErrorStream(), NullOutputStream.NULL_OUTPUT_STREAM); +227 +228 final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(p.getInputStream()); +229 final XPath xpath = XPathFactory.newInstance().newXPath(); +230 final String error = xpath.evaluate("/assembly/error", doc); +231 if (p.waitFor() != 1 || error == null || error.isEmpty()) { +232 LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer, please see the log for more details."); +233 LOGGER.debug("GrokAssembly.exe is not working properly"); +234 grokAssemblyExe = null; +235 this.setEnabled(false); +236 throw new AnalysisException("Could not execute .NET AssemblyAnalyzer"); +237 } +238 } catch (Throwable e) { +239 if (e instanceof AnalysisException) { +240 throw (AnalysisException) e; +241 } else { +242 LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer;\n" +243 + "this can be ignored unless you are scanning .NET DLLs. Please see the log for more details."); +244 LOGGER.debug("Could not execute GrokAssembly {}", e.getMessage()); +245 this.setEnabled(false); +246 throw new AnalysisException("An error occured with the .NET AssemblyAnalyzer", e); +247 } +248 } +249 builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); +250 } +251 +252 /** +253 * Removes resources used from the local file system. +254 * +255 * @throws Exception thrown if there is a problem closing the analyzer +256 */ +257 @Override +258 public void close() throws Exception { +259 super.close(); +260 try { +261 if (grokAssemblyExe != null && !grokAssemblyExe.delete()) { +262 grokAssemblyExe.deleteOnExit(); +263 } +264 } catch (SecurityException se) { +265 LOGGER.debug("Can't delete temporary GrokAssembly.exe"); +266 } +267 } +268 +269 /** +270 * The File Filter used to filter supported extensions. +271 */ +272 private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions( +273 SUPPORTED_EXTENSIONS).build(); +274 +275 @Override +276 protected FileFilter getFileFilter() { +277 return FILTER; +278 } +279 +280 /** +281 * Gets this analyzer's name. +282 * +283 * @return the analyzer name +284 */ +285 @Override +286 public String getName() { +287 return ANALYZER_NAME; +288 } +289 +290 /** +291 * Returns the phase this analyzer runs under. +292 * +293 * @return the phase this runs under +294 */ +295 @Override +296 public AnalysisPhase getAnalysisPhase() { +297 return ANALYSIS_PHASE; +298 } +299 +300 /** +301 * Returns the key used in the properties file to reference the analyzer's enabled property. +302 * +303 * @return the analyzer's enabled property setting key +304 */ +305 @Override +306 protected String getAnalyzerEnabledSettingKey() { +307 return Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED; +308 } +309 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.html index 879698ad8..8b3632ace 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.html @@ -70,157 +70,174 @@ 62 private static final int REGEX_OPTIONS = Pattern.DOTALL 63 | Pattern.CASE_INSENSITIVE | Pattern.MULTILINE; 64 -65 private static final Pattern PROJECT = Pattern.compile( -66 "^ *project *\\([ \\n]*(\\w+)[ \\n]*.*?\\)", REGEX_OPTIONS); -67 -68 // Group 1: Product -69 // Group 2: Version -70 private static final Pattern SET_VERSION = Pattern -71 .compile( -72 "^ *set\\s*\\(\\s*(\\w+)_version\\s+\"?(\\d+(?:\\.\\d+)+)[\\s\"]?\\)", -73 REGEX_OPTIONS); -74 -75 /** -76 * Detects files that can be analyzed. +65 /** +66 * Regex to extract the product information. +67 */ +68 private static final Pattern PROJECT = Pattern.compile( +69 "^ *project *\\([ \\n]*(\\w+)[ \\n]*.*?\\)", REGEX_OPTIONS); +70 +71 /** +72 * Regex to extract product and version information. +73 * +74 * Group 1: Product +75 * +76 * Group 2: Version 77 */ -78 private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions(".cmake") -79 .addFilenames("CMakeLists.txt").build(); -80 -81 /** -82 * A reference to SHA1 message digest. -83 */ -84 private static MessageDigest sha1 = null; -85 -86 static { -87 try { -88 sha1 = MessageDigest.getInstance("SHA1"); -89 } catch (NoSuchAlgorithmException e) { -90 LOGGER.error(e.getMessage()); -91 } -92 } +78 private static final Pattern SET_VERSION = Pattern +79 .compile( +80 "^ *set\\s*\\(\\s*(\\w+)_version\\s+\"?(\\d+(?:\\.\\d+)+)[\\s\"]?\\)", +81 REGEX_OPTIONS); +82 +83 /** +84 * Detects files that can be analyzed. +85 */ +86 private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions(".cmake") +87 .addFilenames("CMakeLists.txt").build(); +88 +89 /** +90 * A reference to SHA1 message digest. +91 */ +92 private static MessageDigest sha1 = null; 93 -94 /** -95 * Returns the name of the CMake analyzer. -96 * -97 * @return the name of the analyzer -98 * -99 */ -100 @Override -101 public String getName() { -102 return "CMake Analyzer"; -103 } -104 -105 /** -106 * Tell that we are used for information collection. -107 * -108 * @return INFORMATION_COLLECTION -109 */ -110 @Override -111 public AnalysisPhase getAnalysisPhase() { -112 return AnalysisPhase.INFORMATION_COLLECTION; -113 } -114 -115 /** -116 * Returns the set of supported file extensions. -117 * -118 * @return the set of supported file extensions -119 */ -120 @Override -121 protected FileFilter getFileFilter() { -122 return FILTER; -123 } -124 -125 /** -126 * No-op initializer implementation. -127 * -128 * @throws Exception never thrown -129 */ -130 @Override -131 protected void initializeFileTypeAnalyzer() throws Exception { -132 // Nothing to do here. -133 } -134 -135 /** -136 * Analyzes python packages and adds evidence to the dependency. -137 * -138 * @param dependency the dependency being analyzed -139 * @param engine the engine being used to perform the scan -140 * @throws AnalysisException thrown if there is an unrecoverable error analyzing the dependency -141 */ -142 @Override -143 protected void analyzeFileType(Dependency dependency, Engine engine) -144 throws AnalysisException { -145 final File file = dependency.getActualFile(); -146 final String parentName = file.getParentFile().getName(); -147 final String name = file.getName(); -148 dependency.setDisplayFileName(String.format("%s%c%s", parentName, File.separatorChar, name)); -149 String contents; -150 try { -151 contents = FileUtils.readFileToString(file).trim(); -152 } catch (IOException e) { -153 throw new AnalysisException( -154 "Problem occurred while reading dependency file.", e); -155 } -156 -157 if (StringUtils.isNotBlank(contents)) { -158 final Matcher m = PROJECT.matcher(contents); -159 int count = 0; -160 while (m.find()) { -161 count++; -162 LOGGER.debug(String.format( -163 "Found project command match with %d groups: %s", -164 m.groupCount(), m.group(0))); -165 final String group = m.group(1); -166 LOGGER.debug("Group 1: " + group); -167 dependency.getProductEvidence().addEvidence(name, "Project", -168 group, Confidence.HIGH); -169 } -170 LOGGER.debug("Found {} matches.", count); -171 analyzeSetVersionCommand(dependency, engine, contents); -172 } -173 } -174 -175 private void analyzeSetVersionCommand(Dependency dependency, Engine engine, String contents) { -176 final Dependency orig = dependency; -177 final Matcher m = SET_VERSION.matcher(contents); -178 int count = 0; -179 while (m.find()) { -180 count++; -181 LOGGER.debug("Found project command match with {} groups: {}", -182 m.groupCount(), m.group(0)); -183 String product = m.group(1); -184 final String version = m.group(2); -185 LOGGER.debug("Group 1: " + product); -186 LOGGER.debug("Group 2: " + version); -187 final String aliasPrefix = "ALIASOF_"; -188 if (product.startsWith(aliasPrefix)) { -189 product = product.replaceFirst(aliasPrefix, ""); -190 } -191 if (count > 1) { -192 //TODO - refactor so we do not assign to the parameter (checkstyle) -193 dependency = new Dependency(orig.getActualFile()); -194 dependency.setDisplayFileName(String.format("%s:%s", orig.getDisplayFileName(), product)); -195 final String filePath = String.format("%s:%s", orig.getFilePath(), product); -196 dependency.setFilePath(filePath); -197 -198 // prevents coalescing into the dependency provided by engine -199 dependency.setSha1sum(Checksum.getHex(sha1.digest(filePath.getBytes()))); -200 engine.getDependencies().add(dependency); -201 } -202 final String source = dependency.getDisplayFileName(); -203 dependency.getProductEvidence().addEvidence(source, "Product", -204 product, Confidence.MEDIUM); -205 dependency.getVersionEvidence().addEvidence(source, "Version", -206 version, Confidence.MEDIUM); -207 } -208 LOGGER.debug(String.format("Found %d matches.", count)); -209 } -210 -211 @Override -212 protected String getAnalyzerEnabledSettingKey() { -213 return Settings.KEYS.ANALYZER_CMAKE_ENABLED; -214 } -215 } +94 static { +95 try { +96 sha1 = MessageDigest.getInstance("SHA1"); +97 } catch (NoSuchAlgorithmException e) { +98 LOGGER.error(e.getMessage()); +99 } +100 } +101 +102 /** +103 * Returns the name of the CMake analyzer. +104 * +105 * @return the name of the analyzer +106 * +107 */ +108 @Override +109 public String getName() { +110 return "CMake Analyzer"; +111 } +112 +113 /** +114 * Tell that we are used for information collection. +115 * +116 * @return INFORMATION_COLLECTION +117 */ +118 @Override +119 public AnalysisPhase getAnalysisPhase() { +120 return AnalysisPhase.INFORMATION_COLLECTION; +121 } +122 +123 /** +124 * Returns the set of supported file extensions. +125 * +126 * @return the set of supported file extensions +127 */ +128 @Override +129 protected FileFilter getFileFilter() { +130 return FILTER; +131 } +132 +133 /** +134 * No-op initializer implementation. +135 * +136 * @throws Exception never thrown +137 */ +138 @Override +139 protected void initializeFileTypeAnalyzer() throws Exception { +140 // Nothing to do here. +141 } +142 +143 /** +144 * Analyzes python packages and adds evidence to the dependency. +145 * +146 * @param dependency the dependency being analyzed +147 * @param engine the engine being used to perform the scan +148 * @throws AnalysisException thrown if there is an unrecoverable error analyzing the dependency +149 */ +150 @Override +151 protected void analyzeFileType(Dependency dependency, Engine engine) +152 throws AnalysisException { +153 final File file = dependency.getActualFile(); +154 final String parentName = file.getParentFile().getName(); +155 final String name = file.getName(); +156 dependency.setDisplayFileName(String.format("%s%c%s", parentName, File.separatorChar, name)); +157 String contents; +158 try { +159 contents = FileUtils.readFileToString(file).trim(); +160 } catch (IOException e) { +161 throw new AnalysisException( +162 "Problem occurred while reading dependency file.", e); +163 } +164 +165 if (StringUtils.isNotBlank(contents)) { +166 final Matcher m = PROJECT.matcher(contents); +167 int count = 0; +168 while (m.find()) { +169 count++; +170 LOGGER.debug(String.format( +171 "Found project command match with %d groups: %s", +172 m.groupCount(), m.group(0))); +173 final String group = m.group(1); +174 LOGGER.debug("Group 1: " + group); +175 dependency.getProductEvidence().addEvidence(name, "Project", +176 group, Confidence.HIGH); +177 } +178 LOGGER.debug("Found {} matches.", count); +179 analyzeSetVersionCommand(dependency, engine, contents); +180 } +181 } +182 +183 /** +184 * Extracts the version information from the contents. If more then one version is found additional dependencies are added to +185 * the dependency list. +186 * +187 * @param dependency the dependency being analyzed +188 * @param engine the dependency-check engine +189 * @param contents the version information +190 */ +191 private void analyzeSetVersionCommand(Dependency dependency, Engine engine, String contents) { +192 Dependency currentDep = dependency; +193 +194 final Matcher m = SET_VERSION.matcher(contents); +195 int count = 0; +196 while (m.find()) { +197 count++; +198 LOGGER.debug("Found project command match with {} groups: {}", +199 m.groupCount(), m.group(0)); +200 String product = m.group(1); +201 final String version = m.group(2); +202 LOGGER.debug("Group 1: " + product); +203 LOGGER.debug("Group 2: " + version); +204 final String aliasPrefix = "ALIASOF_"; +205 if (product.startsWith(aliasPrefix)) { +206 product = product.replaceFirst(aliasPrefix, ""); +207 } +208 if (count > 1) { +209 //TODO - refactor so we do not assign to the parameter (checkstyle) +210 currentDep = new Dependency(dependency.getActualFile()); +211 currentDep.setDisplayFileName(String.format("%s:%s", dependency.getDisplayFileName(), product)); +212 final String filePath = String.format("%s:%s", dependency.getFilePath(), product); +213 currentDep.setFilePath(filePath); +214 +215 // prevents coalescing into the dependency provided by engine +216 currentDep.setSha1sum(Checksum.getHex(sha1.digest(filePath.getBytes()))); +217 engine.getDependencies().add(currentDep); +218 } +219 final String source = currentDep.getDisplayFileName(); +220 currentDep.getProductEvidence().addEvidence(source, "Product", +221 product, Confidence.MEDIUM); +222 currentDep.getVersionEvidence().addEvidence(source, "Version", +223 version, Confidence.MEDIUM); +224 } +225 LOGGER.debug(String.format("Found %d matches.", count)); +226 } +227 +228 @Override +229 protected String getAnalyzerEnabledSettingKey() { +230 return Settings.KEYS.ANALYZER_CMAKE_ENABLED; +231 } +232 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/CPEAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/CPEAnalyzer.html index f2de7ed0f..a248eb73b 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/CPEAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/CPEAnalyzer.html @@ -343,7 +343,7 @@ 335 * @return if the append was successful. 336 */ 337 private boolean appendWeightedSearch(StringBuilder sb, String field, String searchText, Set<String> weightedText) { -338 sb.append(" ").append(field).append(":( "); +338 sb.append(' ').append(field).append(":( "); 339 340 final String cleanText = cleanseText(searchText); 341 @@ -357,419 +357,426 @@ 349 final StringTokenizer tokens = new StringTokenizer(cleanText); 350 while (tokens.hasMoreElements()) { 351 final String word = tokens.nextToken(); -352 String temp = null; +352 StringBuilder temp = null; 353 for (String weighted : weightedText) { 354 final String weightedStr = cleanseText(weighted); 355 if (equalsIgnoreCaseAndNonAlpha(word, weightedStr)) { -356 temp = LuceneUtils.escapeLuceneQuery(word) + WEIGHTING_BOOST; -357 if (!word.equalsIgnoreCase(weightedStr)) { -358 temp += " " + LuceneUtils.escapeLuceneQuery(weightedStr) + WEIGHTING_BOOST; -359 } -360 } -361 } -362 if (temp == null) { -363 temp = LuceneUtils.escapeLuceneQuery(word); -364 } -365 sb.append(" ").append(temp); -366 } -367 } -368 sb.append(" ) "); -369 return true; -370 } -371 -372 /** -373 * Removes characters from the input text that are not used within the CPE index. -374 * -375 * @param text is the text to remove the characters from. -376 * @return the text having removed some characters. -377 */ -378 private String cleanseText(String text) { -379 return text.replaceAll(CLEANSE_CHARACTER_RX, " "); -380 } -381 -382 /** -383 * Compares two strings after lower casing them and removing the non-alpha characters. -384 * -385 * @param l string one to compare. -386 * @param r string two to compare. -387 * @return whether or not the two strings are similar. -388 */ -389 private boolean equalsIgnoreCaseAndNonAlpha(String l, String r) { -390 if (l == null || r == null) { -391 return false; -392 } -393 -394 final String left = l.replaceAll(CLEANSE_NONALPHA_RX, ""); -395 final String right = r.replaceAll(CLEANSE_NONALPHA_RX, ""); -396 return left.equalsIgnoreCase(right); -397 } -398 -399 /** -400 * Ensures that the CPE Identified matches the dependency. This validates that the product, vendor, and version information -401 * for the CPE are contained within the dependencies evidence. -402 * -403 * @param entry a CPE entry. -404 * @param dependency the dependency that the CPE entries could be for. -405 * @return whether or not the entry is valid. -406 */ -407 private boolean verifyEntry(final IndexEntry entry, final Dependency dependency) { -408 boolean isValid = false; -409 -410 //TODO - does this nullify some of the fuzzy matching that happens in the lucene search? -411 // for instance CPE some-component and in the evidence we have SomeComponent. -412 if (collectionContainsString(dependency.getProductEvidence(), entry.getProduct()) -413 && collectionContainsString(dependency.getVendorEvidence(), entry.getVendor())) { -414 //&& collectionContainsVersion(dependency.getVersionEvidence(), entry.getVersion()) -415 isValid = true; -416 } -417 return isValid; -418 } -419 -420 /** -421 * Used to determine if the EvidenceCollection contains a specific string. -422 * -423 * @param ec an EvidenceCollection -424 * @param text the text to search for -425 * @return whether or not the EvidenceCollection contains the string -426 */ -427 private boolean collectionContainsString(EvidenceCollection ec, String text) { -428 //TODO - likely need to change the split... not sure if this will work for CPE with special chars -429 if (text == null) { -430 return false; -431 } -432 final String[] words = text.split("[\\s_-]"); -433 final List<String> list = new ArrayList<String>(); -434 String tempWord = null; -435 for (String word : words) { -436 /* -437 single letter words should be concatenated with the next word. -438 so { "m", "core", "sample" } -> { "mcore", "sample" } -439 */ -440 if (tempWord != null) { -441 list.add(tempWord + word); -442 tempWord = null; -443 } else if (word.length() <= 2) { -444 tempWord = word; -445 } else { -446 list.add(word); -447 } -448 } -449 if (tempWord != null) { -450 if (!list.isEmpty()) { -451 final String tmp = list.get(list.size() - 1) + tempWord; -452 list.add(tmp); -453 } else { -454 list.add(tempWord); -455 } -456 } -457 if (list.isEmpty()) { -458 return false; -459 } -460 boolean contains = true; -461 for (String word : list) { -462 contains &= ec.containsUsedString(word); +356 temp = new StringBuilder(word.length() + 2); +357 LuceneUtils.appendEscapedLuceneQuery(temp, word); +358 temp.append(WEIGHTING_BOOST); +359 if (!word.equalsIgnoreCase(weightedStr)) { +360 temp.append(' '); +361 LuceneUtils.appendEscapedLuceneQuery(temp, weightedStr); +362 temp.append(WEIGHTING_BOOST); +363 } +364 break; +365 } +366 } +367 sb.append(' '); +368 if (temp == null) { +369 LuceneUtils.appendEscapedLuceneQuery(sb, word); +370 } else { +371 sb.append(temp); +372 } +373 } +374 } +375 sb.append(" ) "); +376 return true; +377 } +378 +379 /** +380 * Removes characters from the input text that are not used within the CPE index. +381 * +382 * @param text is the text to remove the characters from. +383 * @return the text having removed some characters. +384 */ +385 private String cleanseText(String text) { +386 return text.replaceAll(CLEANSE_CHARACTER_RX, " "); +387 } +388 +389 /** +390 * Compares two strings after lower casing them and removing the non-alpha characters. +391 * +392 * @param l string one to compare. +393 * @param r string two to compare. +394 * @return whether or not the two strings are similar. +395 */ +396 private boolean equalsIgnoreCaseAndNonAlpha(String l, String r) { +397 if (l == null || r == null) { +398 return false; +399 } +400 +401 final String left = l.replaceAll(CLEANSE_NONALPHA_RX, ""); +402 final String right = r.replaceAll(CLEANSE_NONALPHA_RX, ""); +403 return left.equalsIgnoreCase(right); +404 } +405 +406 /** +407 * Ensures that the CPE Identified matches the dependency. This validates that the product, vendor, and version information +408 * for the CPE are contained within the dependencies evidence. +409 * +410 * @param entry a CPE entry. +411 * @param dependency the dependency that the CPE entries could be for. +412 * @return whether or not the entry is valid. +413 */ +414 private boolean verifyEntry(final IndexEntry entry, final Dependency dependency) { +415 boolean isValid = false; +416 +417 //TODO - does this nullify some of the fuzzy matching that happens in the lucene search? +418 // for instance CPE some-component and in the evidence we have SomeComponent. +419 if (collectionContainsString(dependency.getProductEvidence(), entry.getProduct()) +420 && collectionContainsString(dependency.getVendorEvidence(), entry.getVendor())) { +421 //&& collectionContainsVersion(dependency.getVersionEvidence(), entry.getVersion()) +422 isValid = true; +423 } +424 return isValid; +425 } +426 +427 /** +428 * Used to determine if the EvidenceCollection contains a specific string. +429 * +430 * @param ec an EvidenceCollection +431 * @param text the text to search for +432 * @return whether or not the EvidenceCollection contains the string +433 */ +434 private boolean collectionContainsString(EvidenceCollection ec, String text) { +435 //TODO - likely need to change the split... not sure if this will work for CPE with special chars +436 if (text == null) { +437 return false; +438 } +439 final String[] words = text.split("[\\s_-]"); +440 final List<String> list = new ArrayList<String>(); +441 String tempWord = null; +442 for (String word : words) { +443 /* +444 single letter words should be concatenated with the next word. +445 so { "m", "core", "sample" } -> { "mcore", "sample" } +446 */ +447 if (tempWord != null) { +448 list.add(tempWord + word); +449 tempWord = null; +450 } else if (word.length() <= 2) { +451 tempWord = word; +452 } else { +453 list.add(word); +454 } +455 } +456 if (tempWord != null) { +457 if (!list.isEmpty()) { +458 final String tmp = list.get(list.size() - 1) + tempWord; +459 list.add(tmp); +460 } else { +461 list.add(tempWord); +462 } 463 } -464 return contains; -465 } -466 -467 /** -468 * Analyzes a dependency and attempts to determine if there are any CPE identifiers for this dependency. -469 * -470 * @param dependency The Dependency to analyze. -471 * @param engine The analysis engine -472 * @throws AnalysisException is thrown if there is an issue analyzing the dependency. -473 */ -474 @Override -475 public void analyze(Dependency dependency, Engine engine) throws AnalysisException { -476 try { -477 determineCPE(dependency); -478 } catch (CorruptIndexException ex) { -479 throw new AnalysisException("CPE Index is corrupt.", ex); -480 } catch (IOException ex) { -481 throw new AnalysisException("Failure opening the CPE Index.", ex); -482 } catch (ParseException ex) { -483 throw new AnalysisException("Unable to parse the generated Lucene query for this dependency.", ex); -484 } -485 } -486 -487 /** -488 * Retrieves a list of CPE values from the CveDB based on the vendor and product passed in. The list is then validated to find -489 * only CPEs that are valid for the given dependency. It is possible that the CPE identified is a best effort "guess" based on -490 * the vendor, product, and version information. -491 * -492 * @param dependency the Dependency being analyzed -493 * @param vendor the vendor for the CPE being analyzed -494 * @param product the product for the CPE being analyzed -495 * @param currentConfidence the current confidence being used during analysis -496 * @return <code>true</code> if an identifier was added to the dependency; otherwise <code>false</code> -497 * @throws UnsupportedEncodingException is thrown if UTF-8 is not supported -498 */ -499 protected boolean determineIdentifiers(Dependency dependency, String vendor, String product, -500 Confidence currentConfidence) throws UnsupportedEncodingException { -501 final Set<VulnerableSoftware> cpes = cve.getCPEs(vendor, product); -502 DependencyVersion bestGuess = new DependencyVersion("-"); -503 Confidence bestGuessConf = null; -504 boolean hasBroadMatch = false; -505 final List<IdentifierMatch> collected = new ArrayList<IdentifierMatch>(); -506 for (Confidence conf : Confidence.values()) { -507 // if (conf.compareTo(currentConfidence) > 0) { -508 // break; -509 // } -510 for (Evidence evidence : dependency.getVersionEvidence().iterator(conf)) { -511 final DependencyVersion evVer = DependencyVersionUtil.parseVersion(evidence.getValue()); -512 if (evVer == null) { -513 continue; -514 } -515 for (VulnerableSoftware vs : cpes) { -516 DependencyVersion dbVer; -517 if (vs.getUpdate() != null && !vs.getUpdate().isEmpty()) { -518 dbVer = DependencyVersionUtil.parseVersion(vs.getVersion() + "." + vs.getUpdate()); -519 } else { -520 dbVer = DependencyVersionUtil.parseVersion(vs.getVersion()); -521 } -522 if (dbVer == null) { //special case, no version specified - everything is vulnerable -523 hasBroadMatch = true; -524 final String url = String.format(NVD_SEARCH_URL, URLEncoder.encode(vs.getName(), "UTF-8")); -525 final IdentifierMatch match = new IdentifierMatch("cpe", vs.getName(), url, IdentifierConfidence.BROAD_MATCH, conf); -526 collected.add(match); -527 } else if (evVer.equals(dbVer)) { //yeah! exact match -528 final String url = String.format(NVD_SEARCH_URL, URLEncoder.encode(vs.getName(), "UTF-8")); -529 final IdentifierMatch match = new IdentifierMatch("cpe", vs.getName(), url, IdentifierConfidence.EXACT_MATCH, conf); -530 collected.add(match); -531 } else { -532 //TODO the following isn't quite right is it? need to think about this guessing game a bit more. -533 if (evVer.getVersionParts().size() <= dbVer.getVersionParts().size() -534 && evVer.matchesAtLeastThreeLevels(dbVer)) { -535 if (bestGuessConf == null || bestGuessConf.compareTo(conf) > 0) { -536 if (bestGuess.getVersionParts().size() < dbVer.getVersionParts().size()) { -537 bestGuess = dbVer; -538 bestGuessConf = conf; -539 } -540 } -541 } -542 } -543 } -544 if (bestGuessConf == null || bestGuessConf.compareTo(conf) > 0) { -545 if (bestGuess.getVersionParts().size() < evVer.getVersionParts().size()) { -546 bestGuess = evVer; -547 bestGuessConf = conf; -548 } -549 } -550 } -551 } -552 final String cpeName = String.format("cpe:/a:%s:%s:%s", vendor, product, bestGuess.toString()); -553 String url = null; -554 if (hasBroadMatch) { //if we have a broad match we can add the URL to the best guess. -555 final String cpeUrlName = String.format("cpe:/a:%s:%s", vendor, product); -556 url = String.format(NVD_SEARCH_URL, URLEncoder.encode(cpeUrlName, "UTF-8")); -557 } -558 if (bestGuessConf == null) { -559 bestGuessConf = Confidence.LOW; -560 } -561 final IdentifierMatch match = new IdentifierMatch("cpe", cpeName, url, IdentifierConfidence.BEST_GUESS, bestGuessConf); -562 collected.add(match); -563 -564 Collections.sort(collected); -565 final IdentifierConfidence bestIdentifierQuality = collected.get(0).getConfidence(); -566 final Confidence bestEvidenceQuality = collected.get(0).getEvidenceConfidence(); -567 boolean identifierAdded = false; -568 for (IdentifierMatch m : collected) { -569 if (bestIdentifierQuality.equals(m.getConfidence()) -570 && bestEvidenceQuality.equals(m.getEvidenceConfidence())) { -571 final Identifier i = m.getIdentifier(); -572 if (bestIdentifierQuality == IdentifierConfidence.BEST_GUESS) { -573 i.setConfidence(Confidence.LOW); -574 } else { -575 i.setConfidence(bestEvidenceQuality); -576 } -577 dependency.addIdentifier(i); -578 identifierAdded = true; -579 } -580 } -581 return identifierAdded; -582 } -583 -584 /** -585 * The confidence whether the identifier is an exact match, or a best guess. -586 */ -587 private enum IdentifierConfidence { -588 -589 /** -590 * An exact match for the CPE. -591 */ -592 EXACT_MATCH, -593 /** -594 * A best guess for the CPE. -595 */ -596 BEST_GUESS, -597 /** -598 * The entire vendor/product group must be added (without a guess at version) because there is a CVE with a VS that only -599 * specifies vendor/product. -600 */ -601 BROAD_MATCH -602 } -603 -604 /** -605 * A simple object to hold an identifier and carry information about the confidence in the identifier. -606 */ -607 private static class IdentifierMatch implements Comparable<IdentifierMatch> { -608 -609 /** -610 * Constructs an IdentifierMatch. -611 * -612 * @param type the type of identifier (such as CPE) -613 * @param value the value of the identifier -614 * @param url the URL of the identifier -615 * @param identifierConfidence the confidence in the identifier: best guess or exact match -616 * @param evidenceConfidence the confidence of the evidence used to find the identifier -617 */ -618 IdentifierMatch(String type, String value, String url, IdentifierConfidence identifierConfidence, Confidence evidenceConfidence) { -619 this.identifier = new Identifier(type, value, url); -620 this.confidence = identifierConfidence; -621 this.evidenceConfidence = evidenceConfidence; -622 } -623 //<editor-fold defaultstate="collapsed" desc="Property implementations: evidenceConfidence, confidence, identifier"> -624 /** -625 * The confidence in the evidence used to identify this match. -626 */ -627 private Confidence evidenceConfidence; -628 -629 /** -630 * Get the value of evidenceConfidence -631 * -632 * @return the value of evidenceConfidence +464 if (list.isEmpty()) { +465 return false; +466 } +467 boolean contains = true; +468 for (String word : list) { +469 contains &= ec.containsUsedString(word); +470 } +471 return contains; +472 } +473 +474 /** +475 * Analyzes a dependency and attempts to determine if there are any CPE identifiers for this dependency. +476 * +477 * @param dependency The Dependency to analyze. +478 * @param engine The analysis engine +479 * @throws AnalysisException is thrown if there is an issue analyzing the dependency. +480 */ +481 @Override +482 public void analyze(Dependency dependency, Engine engine) throws AnalysisException { +483 try { +484 determineCPE(dependency); +485 } catch (CorruptIndexException ex) { +486 throw new AnalysisException("CPE Index is corrupt.", ex); +487 } catch (IOException ex) { +488 throw new AnalysisException("Failure opening the CPE Index.", ex); +489 } catch (ParseException ex) { +490 throw new AnalysisException("Unable to parse the generated Lucene query for this dependency.", ex); +491 } +492 } +493 +494 /** +495 * Retrieves a list of CPE values from the CveDB based on the vendor and product passed in. The list is then validated to find +496 * only CPEs that are valid for the given dependency. It is possible that the CPE identified is a best effort "guess" based on +497 * the vendor, product, and version information. +498 * +499 * @param dependency the Dependency being analyzed +500 * @param vendor the vendor for the CPE being analyzed +501 * @param product the product for the CPE being analyzed +502 * @param currentConfidence the current confidence being used during analysis +503 * @return <code>true</code> if an identifier was added to the dependency; otherwise <code>false</code> +504 * @throws UnsupportedEncodingException is thrown if UTF-8 is not supported +505 */ +506 protected boolean determineIdentifiers(Dependency dependency, String vendor, String product, +507 Confidence currentConfidence) throws UnsupportedEncodingException { +508 final Set<VulnerableSoftware> cpes = cve.getCPEs(vendor, product); +509 DependencyVersion bestGuess = new DependencyVersion("-"); +510 Confidence bestGuessConf = null; +511 boolean hasBroadMatch = false; +512 final List<IdentifierMatch> collected = new ArrayList<IdentifierMatch>(); +513 for (Confidence conf : Confidence.values()) { +514 // if (conf.compareTo(currentConfidence) > 0) { +515 // break; +516 // } +517 for (Evidence evidence : dependency.getVersionEvidence().iterator(conf)) { +518 final DependencyVersion evVer = DependencyVersionUtil.parseVersion(evidence.getValue()); +519 if (evVer == null) { +520 continue; +521 } +522 for (VulnerableSoftware vs : cpes) { +523 DependencyVersion dbVer; +524 if (vs.getUpdate() != null && !vs.getUpdate().isEmpty()) { +525 dbVer = DependencyVersionUtil.parseVersion(vs.getVersion() + '.' + vs.getUpdate()); +526 } else { +527 dbVer = DependencyVersionUtil.parseVersion(vs.getVersion()); +528 } +529 if (dbVer == null) { //special case, no version specified - everything is vulnerable +530 hasBroadMatch = true; +531 final String url = String.format(NVD_SEARCH_URL, URLEncoder.encode(vs.getName(), "UTF-8")); +532 final IdentifierMatch match = new IdentifierMatch("cpe", vs.getName(), url, IdentifierConfidence.BROAD_MATCH, conf); +533 collected.add(match); +534 } else if (evVer.equals(dbVer)) { //yeah! exact match +535 final String url = String.format(NVD_SEARCH_URL, URLEncoder.encode(vs.getName(), "UTF-8")); +536 final IdentifierMatch match = new IdentifierMatch("cpe", vs.getName(), url, IdentifierConfidence.EXACT_MATCH, conf); +537 collected.add(match); +538 } else { +539 //TODO the following isn't quite right is it? need to think about this guessing game a bit more. +540 if (evVer.getVersionParts().size() <= dbVer.getVersionParts().size() +541 && evVer.matchesAtLeastThreeLevels(dbVer)) { +542 if (bestGuessConf == null || bestGuessConf.compareTo(conf) > 0) { +543 if (bestGuess.getVersionParts().size() < dbVer.getVersionParts().size()) { +544 bestGuess = dbVer; +545 bestGuessConf = conf; +546 } +547 } +548 } +549 } +550 } +551 if (bestGuessConf == null || bestGuessConf.compareTo(conf) > 0) { +552 if (bestGuess.getVersionParts().size() < evVer.getVersionParts().size()) { +553 bestGuess = evVer; +554 bestGuessConf = conf; +555 } +556 } +557 } +558 } +559 final String cpeName = String.format("cpe:/a:%s:%s:%s", vendor, product, bestGuess.toString()); +560 String url = null; +561 if (hasBroadMatch) { //if we have a broad match we can add the URL to the best guess. +562 final String cpeUrlName = String.format("cpe:/a:%s:%s", vendor, product); +563 url = String.format(NVD_SEARCH_URL, URLEncoder.encode(cpeUrlName, "UTF-8")); +564 } +565 if (bestGuessConf == null) { +566 bestGuessConf = Confidence.LOW; +567 } +568 final IdentifierMatch match = new IdentifierMatch("cpe", cpeName, url, IdentifierConfidence.BEST_GUESS, bestGuessConf); +569 collected.add(match); +570 +571 Collections.sort(collected); +572 final IdentifierConfidence bestIdentifierQuality = collected.get(0).getConfidence(); +573 final Confidence bestEvidenceQuality = collected.get(0).getEvidenceConfidence(); +574 boolean identifierAdded = false; +575 for (IdentifierMatch m : collected) { +576 if (bestIdentifierQuality.equals(m.getConfidence()) +577 && bestEvidenceQuality.equals(m.getEvidenceConfidence())) { +578 final Identifier i = m.getIdentifier(); +579 if (bestIdentifierQuality == IdentifierConfidence.BEST_GUESS) { +580 i.setConfidence(Confidence.LOW); +581 } else { +582 i.setConfidence(bestEvidenceQuality); +583 } +584 dependency.addIdentifier(i); +585 identifierAdded = true; +586 } +587 } +588 return identifierAdded; +589 } +590 +591 /** +592 * The confidence whether the identifier is an exact match, or a best guess. +593 */ +594 private enum IdentifierConfidence { +595 +596 /** +597 * An exact match for the CPE. +598 */ +599 EXACT_MATCH, +600 /** +601 * A best guess for the CPE. +602 */ +603 BEST_GUESS, +604 /** +605 * The entire vendor/product group must be added (without a guess at version) because there is a CVE with a VS that only +606 * specifies vendor/product. +607 */ +608 BROAD_MATCH +609 } +610 +611 /** +612 * A simple object to hold an identifier and carry information about the confidence in the identifier. +613 */ +614 private static class IdentifierMatch implements Comparable<IdentifierMatch> { +615 +616 /** +617 * Constructs an IdentifierMatch. +618 * +619 * @param type the type of identifier (such as CPE) +620 * @param value the value of the identifier +621 * @param url the URL of the identifier +622 * @param identifierConfidence the confidence in the identifier: best guess or exact match +623 * @param evidenceConfidence the confidence of the evidence used to find the identifier +624 */ +625 IdentifierMatch(String type, String value, String url, IdentifierConfidence identifierConfidence, Confidence evidenceConfidence) { +626 this.identifier = new Identifier(type, value, url); +627 this.confidence = identifierConfidence; +628 this.evidenceConfidence = evidenceConfidence; +629 } +630 //<editor-fold defaultstate="collapsed" desc="Property implementations: evidenceConfidence, confidence, identifier"> +631 /** +632 * The confidence in the evidence used to identify this match. 633 */ -634 public Confidence getEvidenceConfidence() { -635 return evidenceConfidence; -636 } -637 -638 /** -639 * Set the value of evidenceConfidence -640 * -641 * @param evidenceConfidence new value of evidenceConfidence -642 */ -643 public void setEvidenceConfidence(Confidence evidenceConfidence) { -644 this.evidenceConfidence = evidenceConfidence; -645 } -646 /** -647 * The confidence whether this is an exact match, or a best guess. -648 */ -649 private IdentifierConfidence confidence; -650 -651 /** -652 * Get the value of confidence. -653 * -654 * @return the value of confidence +634 private Confidence evidenceConfidence; +635 +636 /** +637 * Get the value of evidenceConfidence +638 * +639 * @return the value of evidenceConfidence +640 */ +641 public Confidence getEvidenceConfidence() { +642 return evidenceConfidence; +643 } +644 +645 /** +646 * Set the value of evidenceConfidence +647 * +648 * @param evidenceConfidence new value of evidenceConfidence +649 */ +650 public void setEvidenceConfidence(Confidence evidenceConfidence) { +651 this.evidenceConfidence = evidenceConfidence; +652 } +653 /** +654 * The confidence whether this is an exact match, or a best guess. 655 */ -656 public IdentifierConfidence getConfidence() { -657 return confidence; -658 } -659 -660 /** -661 * Set the value of confidence. -662 * -663 * @param confidence new value of confidence -664 */ -665 public void setConfidence(IdentifierConfidence confidence) { -666 this.confidence = confidence; -667 } -668 /** -669 * The CPE identifier. -670 */ -671 private Identifier identifier; -672 -673 /** -674 * Get the value of identifier. -675 * -676 * @return the value of identifier +656 private IdentifierConfidence confidence; +657 +658 /** +659 * Get the value of confidence. +660 * +661 * @return the value of confidence +662 */ +663 public IdentifierConfidence getConfidence() { +664 return confidence; +665 } +666 +667 /** +668 * Set the value of confidence. +669 * +670 * @param confidence new value of confidence +671 */ +672 public void setConfidence(IdentifierConfidence confidence) { +673 this.confidence = confidence; +674 } +675 /** +676 * The CPE identifier. 677 */ -678 public Identifier getIdentifier() { -679 return identifier; -680 } -681 -682 /** -683 * Set the value of identifier. -684 * -685 * @param identifier new value of identifier -686 */ -687 public void setIdentifier(Identifier identifier) { -688 this.identifier = identifier; -689 } -690 //</editor-fold> -691 //<editor-fold defaultstate="collapsed" desc="Standard implementations of toString, hashCode, and equals"> -692 -693 /** -694 * Standard toString() implementation. -695 * -696 * @return the string representation of the object -697 */ -698 @Override -699 public String toString() { -700 return "IdentifierMatch{" + "evidenceConfidence=" + evidenceConfidence -701 + ", confidence=" + confidence + ", identifier=" + identifier + '}'; -702 } -703 -704 /** -705 * Standard hashCode() implementation. -706 * -707 * @return the hashCode -708 */ -709 @Override -710 public int hashCode() { -711 int hash = 5; -712 hash = 97 * hash + (this.evidenceConfidence != null ? this.evidenceConfidence.hashCode() : 0); -713 hash = 97 * hash + (this.confidence != null ? this.confidence.hashCode() : 0); -714 hash = 97 * hash + (this.identifier != null ? this.identifier.hashCode() : 0); -715 return hash; -716 } -717 -718 /** -719 * Standard equals implementation. -720 * -721 * @param obj the object to compare -722 * @return true if the objects are equal, otherwise false -723 */ -724 @Override -725 public boolean equals(Object obj) { -726 if (obj == null) { -727 return false; -728 } -729 if (getClass() != obj.getClass()) { -730 return false; -731 } -732 final IdentifierMatch other = (IdentifierMatch) obj; -733 if (this.evidenceConfidence != other.evidenceConfidence) { +678 private Identifier identifier; +679 +680 /** +681 * Get the value of identifier. +682 * +683 * @return the value of identifier +684 */ +685 public Identifier getIdentifier() { +686 return identifier; +687 } +688 +689 /** +690 * Set the value of identifier. +691 * +692 * @param identifier new value of identifier +693 */ +694 public void setIdentifier(Identifier identifier) { +695 this.identifier = identifier; +696 } +697 //</editor-fold> +698 //<editor-fold defaultstate="collapsed" desc="Standard implementations of toString, hashCode, and equals"> +699 +700 /** +701 * Standard toString() implementation. +702 * +703 * @return the string representation of the object +704 */ +705 @Override +706 public String toString() { +707 return "IdentifierMatch{" + "evidenceConfidence=" + evidenceConfidence +708 + ", confidence=" + confidence + ", identifier=" + identifier + '}'; +709 } +710 +711 /** +712 * Standard hashCode() implementation. +713 * +714 * @return the hashCode +715 */ +716 @Override +717 public int hashCode() { +718 int hash = 5; +719 hash = 97 * hash + (this.evidenceConfidence != null ? this.evidenceConfidence.hashCode() : 0); +720 hash = 97 * hash + (this.confidence != null ? this.confidence.hashCode() : 0); +721 hash = 97 * hash + (this.identifier != null ? this.identifier.hashCode() : 0); +722 return hash; +723 } +724 +725 /** +726 * Standard equals implementation. +727 * +728 * @param obj the object to compare +729 * @return true if the objects are equal, otherwise false +730 */ +731 @Override +732 public boolean equals(Object obj) { +733 if (obj == null) { 734 return false; 735 } -736 if (this.confidence != other.confidence) { +736 if (getClass() != obj.getClass()) { 737 return false; 738 } -739 if (this.identifier != other.identifier && (this.identifier == null || !this.identifier.equals(other.identifier))) { -740 return false; -741 } -742 return true; -743 } -744 //</editor-fold> -745 -746 /** -747 * Standard implementation of compareTo that compares identifier confidence, evidence confidence, and then the identifier. -748 * -749 * @param o the IdentifierMatch to compare to -750 * @return the natural ordering of IdentifierMatch -751 */ -752 @Override -753 public int compareTo(IdentifierMatch o) { -754 int conf = this.confidence.compareTo(o.confidence); -755 if (conf == 0) { -756 conf = this.evidenceConfidence.compareTo(o.evidenceConfidence); -757 if (conf == 0) { -758 conf = identifier.compareTo(o.identifier); -759 } -760 } -761 return conf; -762 } -763 } -764 } +739 final IdentifierMatch other = (IdentifierMatch) obj; +740 if (this.evidenceConfidence != other.evidenceConfidence) { +741 return false; +742 } +743 if (this.confidence != other.confidence) { +744 return false; +745 } +746 if (this.identifier != other.identifier && (this.identifier == null || !this.identifier.equals(other.identifier))) { +747 return false; +748 } +749 return true; +750 } +751 //</editor-fold> +752 +753 /** +754 * Standard implementation of compareTo that compares identifier confidence, evidence confidence, and then the identifier. +755 * +756 * @param o the IdentifierMatch to compare to +757 * @return the natural ordering of IdentifierMatch +758 */ +759 @Override +760 public int compareTo(IdentifierMatch o) { +761 int conf = this.confidence.compareTo(o.confidence); +762 if (conf == 0) { +763 conf = this.evidenceConfidence.compareTo(o.evidenceConfidence); +764 if (conf == 0) { +765 conf = identifier.compareTo(o.identifier); +766 } +767 } +768 return conf; +769 } +770 } +771 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/CentralAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/CentralAnalyzer.html index d61ea95c5..1e64ac384 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/CentralAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/CentralAnalyzer.html @@ -200,7 +200,7 @@ 192 final List<MavenArtifact> mas = searcher.searchSha1(dependency.getSha1sum()); 193 final Confidence confidence = mas.size() > 1 ? Confidence.HIGH : Confidence.HIGHEST; 194 for (MavenArtifact ma : mas) { -195 LOGGER.debug("Central analyzer found artifact ({}) for dependency ({})", ma.toString(), dependency.getFileName()); +195 LOGGER.debug("Central analyzer found artifact ({}) for dependency ({})", ma, dependency.getFileName()); 196 dependency.addAsEvidence("central", ma, confidence); 197 boolean pomAnalyzed = false; 198 for (Evidence e : dependency.getVendorEvidence()) { diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.html index 510a8935b..d7da91769 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.html @@ -221,221 +221,219 @@ 213 //version check 214 final DependencyVersion version1 = DependencyVersionUtil.parseVersion(fileName1); 215 final DependencyVersion version2 = DependencyVersionUtil.parseVersion(fileName2); -216 if (version1 != null && version2 != null) { -217 if (!version1.equals(version2)) { -218 return false; -219 } -220 } -221 -222 //filename check -223 final Matcher match1 = STARTING_TEXT_PATTERN.matcher(fileName1); -224 final Matcher match2 = STARTING_TEXT_PATTERN.matcher(fileName2); -225 if (match1.find() && match2.find()) { -226 return match1.group().equals(match2.group()); -227 } -228 -229 return false; -230 } -231 -232 /** -233 * Returns true if the CPE identifiers in the two supplied dependencies are equal. -234 * -235 * @param dependency1 a dependency2 to compare -236 * @param dependency2 a dependency2 to compare -237 * @return true if the identifiers in the two supplied dependencies are equal -238 */ -239 private boolean cpeIdentifiersMatch(Dependency dependency1, Dependency dependency2) { -240 if (dependency1 == null || dependency1.getIdentifiers() == null -241 || dependency2 == null || dependency2.getIdentifiers() == null) { -242 return false; -243 } -244 boolean matches = false; -245 int cpeCount1 = 0; -246 int cpeCount2 = 0; -247 for (Identifier i : dependency1.getIdentifiers()) { -248 if ("cpe".equals(i.getType())) { -249 cpeCount1 += 1; -250 } -251 } -252 for (Identifier i : dependency2.getIdentifiers()) { -253 if ("cpe".equals(i.getType())) { -254 cpeCount2 += 1; -255 } -256 } -257 if (cpeCount1 > 0 && cpeCount1 == cpeCount2) { -258 for (Identifier i : dependency1.getIdentifiers()) { -259 if ("cpe".equals(i.getType())) { -260 matches |= dependency2.getIdentifiers().contains(i); -261 if (!matches) { -262 break; -263 } -264 } -265 } -266 } -267 LOGGER.debug("IdentifiersMatch={} ({}, {})", matches, dependency1.getFileName(), dependency2.getFileName()); -268 return matches; -269 } -270 -271 /** -272 * Determines if the two dependencies have the same base path. -273 * -274 * @param dependency1 a Dependency object -275 * @param dependency2 a Dependency object -276 * @return true if the base paths of the dependencies are identical -277 */ -278 private boolean hasSameBasePath(Dependency dependency1, Dependency dependency2) { -279 if (dependency1 == null || dependency2 == null) { -280 return false; -281 } -282 final File lFile = new File(dependency1.getFilePath()); -283 String left = lFile.getParent(); -284 final File rFile = new File(dependency2.getFilePath()); -285 String right = rFile.getParent(); -286 if (left == null) { -287 return right == null; -288 } -289 if (left.equalsIgnoreCase(right)) { -290 return true; -291 } -292 if (left.matches(".*[/\\\\]repository[/\\\\].*") && right.matches(".*[/\\\\]repository[/\\\\].*")) { -293 left = getBaseRepoPath(left); -294 right = getBaseRepoPath(right); -295 } -296 if (left.equalsIgnoreCase(right)) { -297 return true; -298 } -299 //new code -300 for (Dependency child : dependency2.getRelatedDependencies()) { -301 if (hasSameBasePath(dependency1, child)) { -302 return true; -303 } -304 } -305 return false; -306 } -307 -308 /** -309 * This is likely a very broken attempt at determining if the 'left' dependency is the 'core' library in comparison to the -310 * 'right' library. -311 * -312 * @param left the dependency to test -313 * @param right the dependency to test against -314 * @return a boolean indicating whether or not the left dependency should be considered the "core" version. -315 */ -316 boolean isCore(Dependency left, Dependency right) { -317 final String leftName = left.getFileName().toLowerCase(); -318 final String rightName = right.getFileName().toLowerCase(); -319 -320 final boolean returnVal; -321 if (!rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") && leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") -322 || rightName.contains("core") && !leftName.contains("core") -323 || rightName.contains("kernel") && !leftName.contains("kernel")) { -324 returnVal = false; -325 } else if (rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") && !leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") -326 || !rightName.contains("core") && leftName.contains("core") -327 || !rightName.contains("kernel") && leftName.contains("kernel")) { -328 returnVal = true; -329 // } else if (leftName.matches(".*struts2\\-core.*") && rightName.matches(".*xwork\\-core.*")) { -330 // returnVal = true; -331 // } else if (rightName.matches(".*struts2\\-core.*") && leftName.matches(".*xwork\\-core.*")) { -332 // returnVal = false; -333 } else { -334 /* -335 * considered splitting the names up and comparing the components, -336 * but decided that the file name length should be sufficient as the -337 * "core" component, if this follows a normal naming protocol should -338 * be shorter: -339 * axis2-saaj-1.4.1.jar -340 * axis2-1.4.1.jar <----- -341 * axis2-kernel-1.4.1.jar -342 */ -343 returnVal = leftName.length() <= rightName.length(); -344 } -345 LOGGER.debug("IsCore={} ({}, {})", returnVal, left.getFileName(), right.getFileName()); -346 return returnVal; -347 } -348 -349 /** -350 * Compares the SHA1 hashes of two dependencies to determine if they are equal. -351 * -352 * @param dependency1 a dependency object to compare -353 * @param dependency2 a dependency object to compare -354 * @return true if the sha1 hashes of the two dependencies match; otherwise false -355 */ -356 private boolean hashesMatch(Dependency dependency1, Dependency dependency2) { -357 if (dependency1 == null || dependency2 == null || dependency1.getSha1sum() == null || dependency2.getSha1sum() == null) { -358 return false; -359 } -360 return dependency1.getSha1sum().equals(dependency2.getSha1sum()); -361 } -362 -363 /** -364 * Determines if the jar is shaded and the created pom.xml identified the same CPE as the jar - if so, the pom.xml dependency -365 * should be removed. -366 * -367 * @param dependency a dependency to check -368 * @param nextDependency another dependency to check -369 * @return true if on of the dependencies is a pom.xml and the identifiers between the two collections match; otherwise false -370 */ -371 private boolean isShadedJar(Dependency dependency, Dependency nextDependency) { -372 final String mainName = dependency.getFileName().toLowerCase(); -373 final String nextName = nextDependency.getFileName().toLowerCase(); -374 if (mainName.endsWith(".jar") && nextName.endsWith("pom.xml")) { -375 return dependency.getIdentifiers().containsAll(nextDependency.getIdentifiers()); -376 } else if (nextName.endsWith(".jar") && mainName.endsWith("pom.xml")) { -377 return nextDependency.getIdentifiers().containsAll(dependency.getIdentifiers()); -378 } -379 return false; -380 } -381 -382 /** -383 * Determines which path is shortest; if path lengths are equal then we use compareTo of the string method to determine if the -384 * first path is smaller. -385 * -386 * @param left the first path to compare -387 * @param right the second path to compare -388 * @return <code>true</code> if the leftPath is the shortest; otherwise <code>false</code> -389 */ -390 protected boolean firstPathIsShortest(String left, String right) { -391 final String leftPath = left.replace('\\', '/'); -392 final String rightPath = right.replace('\\', '/'); -393 -394 final int leftCount = countChar(leftPath, '/'); -395 final int rightCount = countChar(rightPath, '/'); -396 if (leftCount == rightCount) { -397 return leftPath.compareTo(rightPath) <= 0; -398 } else { -399 return leftCount < rightCount; -400 } -401 } -402 -403 /** -404 * Counts the number of times the character is present in the string. -405 * -406 * @param string the string to count the characters in -407 * @param c the character to count -408 * @return the number of times the character is present in the string -409 */ -410 private int countChar(String string, char c) { -411 int count = 0; -412 final int max = string.length(); -413 for (int i = 0; i < max; i++) { -414 if (c == string.charAt(i)) { -415 count++; -416 } -417 } -418 return count; -419 } -420 -421 /** -422 * Checks if the given file path is contained within a war or ear file. -423 * -424 * @param filePath the file path to check -425 * @return true if the path contains '.war\' or '.ear\'. -426 */ -427 private boolean containedInWar(String filePath) { -428 return filePath == null ? false : filePath.matches(".*\\.(ear|war)[\\\\/].*"); -429 } -430 } +216 if (version1 != null && version2 != null && !version1.equals(version2)) { +217 return false; +218 } +219 +220 //filename check +221 final Matcher match1 = STARTING_TEXT_PATTERN.matcher(fileName1); +222 final Matcher match2 = STARTING_TEXT_PATTERN.matcher(fileName2); +223 if (match1.find() && match2.find()) { +224 return match1.group().equals(match2.group()); +225 } +226 +227 return false; +228 } +229 +230 /** +231 * Returns true if the CPE identifiers in the two supplied dependencies are equal. +232 * +233 * @param dependency1 a dependency2 to compare +234 * @param dependency2 a dependency2 to compare +235 * @return true if the identifiers in the two supplied dependencies are equal +236 */ +237 private boolean cpeIdentifiersMatch(Dependency dependency1, Dependency dependency2) { +238 if (dependency1 == null || dependency1.getIdentifiers() == null +239 || dependency2 == null || dependency2.getIdentifiers() == null) { +240 return false; +241 } +242 boolean matches = false; +243 int cpeCount1 = 0; +244 int cpeCount2 = 0; +245 for (Identifier i : dependency1.getIdentifiers()) { +246 if ("cpe".equals(i.getType())) { +247 cpeCount1 += 1; +248 } +249 } +250 for (Identifier i : dependency2.getIdentifiers()) { +251 if ("cpe".equals(i.getType())) { +252 cpeCount2 += 1; +253 } +254 } +255 if (cpeCount1 > 0 && cpeCount1 == cpeCount2) { +256 for (Identifier i : dependency1.getIdentifiers()) { +257 if ("cpe".equals(i.getType())) { +258 matches |= dependency2.getIdentifiers().contains(i); +259 if (!matches) { +260 break; +261 } +262 } +263 } +264 } +265 LOGGER.debug("IdentifiersMatch={} ({}, {})", matches, dependency1.getFileName(), dependency2.getFileName()); +266 return matches; +267 } +268 +269 /** +270 * Determines if the two dependencies have the same base path. +271 * +272 * @param dependency1 a Dependency object +273 * @param dependency2 a Dependency object +274 * @return true if the base paths of the dependencies are identical +275 */ +276 private boolean hasSameBasePath(Dependency dependency1, Dependency dependency2) { +277 if (dependency1 == null || dependency2 == null) { +278 return false; +279 } +280 final File lFile = new File(dependency1.getFilePath()); +281 String left = lFile.getParent(); +282 final File rFile = new File(dependency2.getFilePath()); +283 String right = rFile.getParent(); +284 if (left == null) { +285 return right == null; +286 } +287 if (left.equalsIgnoreCase(right)) { +288 return true; +289 } +290 if (left.matches(".*[/\\\\]repository[/\\\\].*") && right.matches(".*[/\\\\]repository[/\\\\].*")) { +291 left = getBaseRepoPath(left); +292 right = getBaseRepoPath(right); +293 } +294 if (left.equalsIgnoreCase(right)) { +295 return true; +296 } +297 //new code +298 for (Dependency child : dependency2.getRelatedDependencies()) { +299 if (hasSameBasePath(dependency1, child)) { +300 return true; +301 } +302 } +303 return false; +304 } +305 +306 /** +307 * This is likely a very broken attempt at determining if the 'left' dependency is the 'core' library in comparison to the +308 * 'right' library. +309 * +310 * @param left the dependency to test +311 * @param right the dependency to test against +312 * @return a boolean indicating whether or not the left dependency should be considered the "core" version. +313 */ +314 boolean isCore(Dependency left, Dependency right) { +315 final String leftName = left.getFileName().toLowerCase(); +316 final String rightName = right.getFileName().toLowerCase(); +317 +318 final boolean returnVal; +319 if (!rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") && leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") +320 || rightName.contains("core") && !leftName.contains("core") +321 || rightName.contains("kernel") && !leftName.contains("kernel")) { +322 returnVal = false; +323 } else if (rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") && !leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") +324 || !rightName.contains("core") && leftName.contains("core") +325 || !rightName.contains("kernel") && leftName.contains("kernel")) { +326 returnVal = true; +327 // } else if (leftName.matches(".*struts2\\-core.*") && rightName.matches(".*xwork\\-core.*")) { +328 // returnVal = true; +329 // } else if (rightName.matches(".*struts2\\-core.*") && leftName.matches(".*xwork\\-core.*")) { +330 // returnVal = false; +331 } else { +332 /* +333 * considered splitting the names up and comparing the components, +334 * but decided that the file name length should be sufficient as the +335 * "core" component, if this follows a normal naming protocol should +336 * be shorter: +337 * axis2-saaj-1.4.1.jar +338 * axis2-1.4.1.jar <----- +339 * axis2-kernel-1.4.1.jar +340 */ +341 returnVal = leftName.length() <= rightName.length(); +342 } +343 LOGGER.debug("IsCore={} ({}, {})", returnVal, left.getFileName(), right.getFileName()); +344 return returnVal; +345 } +346 +347 /** +348 * Compares the SHA1 hashes of two dependencies to determine if they are equal. +349 * +350 * @param dependency1 a dependency object to compare +351 * @param dependency2 a dependency object to compare +352 * @return true if the sha1 hashes of the two dependencies match; otherwise false +353 */ +354 private boolean hashesMatch(Dependency dependency1, Dependency dependency2) { +355 if (dependency1 == null || dependency2 == null || dependency1.getSha1sum() == null || dependency2.getSha1sum() == null) { +356 return false; +357 } +358 return dependency1.getSha1sum().equals(dependency2.getSha1sum()); +359 } +360 +361 /** +362 * Determines if the jar is shaded and the created pom.xml identified the same CPE as the jar - if so, the pom.xml dependency +363 * should be removed. +364 * +365 * @param dependency a dependency to check +366 * @param nextDependency another dependency to check +367 * @return true if on of the dependencies is a pom.xml and the identifiers between the two collections match; otherwise false +368 */ +369 private boolean isShadedJar(Dependency dependency, Dependency nextDependency) { +370 final String mainName = dependency.getFileName().toLowerCase(); +371 final String nextName = nextDependency.getFileName().toLowerCase(); +372 if (mainName.endsWith(".jar") && nextName.endsWith("pom.xml")) { +373 return dependency.getIdentifiers().containsAll(nextDependency.getIdentifiers()); +374 } else if (nextName.endsWith(".jar") && mainName.endsWith("pom.xml")) { +375 return nextDependency.getIdentifiers().containsAll(dependency.getIdentifiers()); +376 } +377 return false; +378 } +379 +380 /** +381 * Determines which path is shortest; if path lengths are equal then we use compareTo of the string method to determine if the +382 * first path is smaller. +383 * +384 * @param left the first path to compare +385 * @param right the second path to compare +386 * @return <code>true</code> if the leftPath is the shortest; otherwise <code>false</code> +387 */ +388 protected boolean firstPathIsShortest(String left, String right) { +389 final String leftPath = left.replace('\\', '/'); +390 final String rightPath = right.replace('\\', '/'); +391 +392 final int leftCount = countChar(leftPath, '/'); +393 final int rightCount = countChar(rightPath, '/'); +394 if (leftCount == rightCount) { +395 return leftPath.compareTo(rightPath) <= 0; +396 } else { +397 return leftCount < rightCount; +398 } +399 } +400 +401 /** +402 * Counts the number of times the character is present in the string. +403 * +404 * @param string the string to count the characters in +405 * @param c the character to count +406 * @return the number of times the character is present in the string +407 */ +408 private int countChar(String string, char c) { +409 int count = 0; +410 final int max = string.length(); +411 for (int i = 0; i < max; i++) { +412 if (c == string.charAt(i)) { +413 count++; +414 } +415 } +416 return count; +417 } +418 +419 /** +420 * Checks if the given file path is contained within a war or ear file. +421 * +422 * @param filePath the file path to check +423 * @return true if the path contains '.war\' or '.ear\'. +424 */ +425 private boolean containedInWar(String filePath) { +426 return filePath == null ? false : filePath.matches(".*\\.(ear|war)[\\\\/].*"); +427 } +428 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.html index e4b842ee7..87e0d107e 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.html @@ -121,7 +121,7 @@ 113 for (Identifier i : dependency.getIdentifiers()) { 114 if ("maven".contains(i.getType())) { 115 if (i.getValue() != null && i.getValue().startsWith("org.springframework.")) { -116 final int endPoint = i.getValue().indexOf(":", 19); +116 final int endPoint = i.getValue().indexOf(':', 19); 117 if (endPoint >= 0) { 118 mustContain = i.getValue().substring(19, endPoint).toLowerCase(); 119 break; @@ -480,8 +480,8 @@ 472 */ 473 private String trimCpeToVendor(String value) { 474 //cpe:/a:jruby:jruby:1.0.8 -475 final int pos1 = value.indexOf(":", 7); //right of vendor -476 final int pos2 = value.indexOf(":", pos1 + 1); //right of product +475 final int pos1 = value.indexOf(':', 7); //right of vendor +476 final int pos2 = value.indexOf(':', pos1 + 1); //right of product 477 if (pos2 < 0) { 478 return value; 479 } else { diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/FileNameAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/FileNameAnalyzer.html index 03187253c..e658990ac 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/FileNameAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/FileNameAnalyzer.html @@ -26,103 +26,98 @@ 18 package org.owasp.dependencycheck.analyzer; 19 20 import java.io.File; -21 import org.owasp.dependencycheck.Engine; -22 import org.owasp.dependencycheck.analyzer.exception.AnalysisException; -23 import org.owasp.dependencycheck.dependency.Confidence; -24 import org.owasp.dependencycheck.dependency.Dependency; -25 import org.owasp.dependencycheck.utils.DependencyVersion; -26 import org.owasp.dependencycheck.utils.DependencyVersionUtil; -27 -28 /** -29 * -30 * Takes a dependency and analyzes the filename and determines the hashes. -31 * -32 * @author Jeremy Long -33 */ -34 public class FileNameAnalyzer extends AbstractAnalyzer implements Analyzer { -35 -36 //<editor-fold defaultstate="collapsed" desc="All standard implementation details of Analyzer"> -37 /** -38 * The name of the analyzer. -39 */ -40 private static final String ANALYZER_NAME = "File Name Analyzer"; -41 /** -42 * The phase that this analyzer is intended to run in. -43 */ -44 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION; -45 -46 /** -47 * Returns the name of the analyzer. -48 * -49 * @return the name of the analyzer. -50 */ -51 @Override -52 public String getName() { -53 return ANALYZER_NAME; -54 } -55 -56 /** -57 * Returns the phase that the analyzer is intended to run in. -58 * -59 * @return the phase that the analyzer is intended to run in. -60 */ -61 @Override -62 public AnalysisPhase getAnalysisPhase() { -63 return ANALYSIS_PHASE; -64 } -65 //</editor-fold> -66 -67 /** -68 * Collects information about the file name. -69 * -70 * @param dependency the dependency to analyze. -71 * @param engine the engine that is scanning the dependencies -72 * @throws AnalysisException is thrown if there is an error reading the JAR file. -73 */ -74 @Override -75 public void analyze(Dependency dependency, Engine engine) throws AnalysisException { -76 -77 //strip any path information that may get added by ArchiveAnalyzer, etc. -78 final File f = dependency.getActualFile(); -79 String fileName = f.getName(); -80 -81 //remove file extension -82 final int pos = fileName.lastIndexOf("."); -83 if (pos > 0) { -84 fileName = fileName.substring(0, pos); -85 } -86 -87 //add version evidence -88 final DependencyVersion version = DependencyVersionUtil.parseVersion(fileName); -89 if (version != null) { -90 // If the version number is just a number like 2 or 23, reduce the confidence -91 // a shade. This should hopefully correct for cases like log4j.jar or -92 // struts2-core.jar -93 if (version.getVersionParts() == null || version.getVersionParts().size() < 2) { -94 dependency.getVersionEvidence().addEvidence("file", "name", -95 version.toString(), Confidence.MEDIUM); -96 } else { -97 dependency.getVersionEvidence().addEvidence("file", "name", -98 version.toString(), Confidence.HIGHEST); -99 } -100 dependency.getVersionEvidence().addEvidence("file", "name", -101 fileName, Confidence.MEDIUM); -102 } -103 -104 //add as vendor and product evidence -105 if (fileName.contains("-")) { +21 import org.apache.commons.io.FilenameUtils; +22 import org.owasp.dependencycheck.Engine; +23 import org.owasp.dependencycheck.analyzer.exception.AnalysisException; +24 import org.owasp.dependencycheck.dependency.Confidence; +25 import org.owasp.dependencycheck.dependency.Dependency; +26 import org.owasp.dependencycheck.utils.DependencyVersion; +27 import org.owasp.dependencycheck.utils.DependencyVersionUtil; +28 +29 /** +30 * +31 * Takes a dependency and analyzes the filename and determines the hashes. +32 * +33 * @author Jeremy Long +34 */ +35 public class FileNameAnalyzer extends AbstractAnalyzer implements Analyzer { +36 +37 //<editor-fold defaultstate="collapsed" desc="All standard implementation details of Analyzer"> +38 /** +39 * The name of the analyzer. +40 */ +41 private static final String ANALYZER_NAME = "File Name Analyzer"; +42 /** +43 * The phase that this analyzer is intended to run in. +44 */ +45 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION; +46 +47 /** +48 * Returns the name of the analyzer. +49 * +50 * @return the name of the analyzer. +51 */ +52 @Override +53 public String getName() { +54 return ANALYZER_NAME; +55 } +56 +57 /** +58 * Returns the phase that the analyzer is intended to run in. +59 * +60 * @return the phase that the analyzer is intended to run in. +61 */ +62 @Override +63 public AnalysisPhase getAnalysisPhase() { +64 return ANALYSIS_PHASE; +65 } +66 //</editor-fold> +67 +68 /** +69 * Collects information about the file name. +70 * +71 * @param dependency the dependency to analyze. +72 * @param engine the engine that is scanning the dependencies +73 * @throws AnalysisException is thrown if there is an error reading the JAR file. +74 */ +75 @Override +76 public void analyze(Dependency dependency, Engine engine) throws AnalysisException { +77 +78 //strip any path information that may get added by ArchiveAnalyzer, etc. +79 final File f = dependency.getActualFile(); +80 final String fileName = FilenameUtils.removeExtension(f.getName()); +81 +82 //add version evidence +83 final DependencyVersion version = DependencyVersionUtil.parseVersion(fileName); +84 if (version != null) { +85 // If the version number is just a number like 2 or 23, reduce the confidence +86 // a shade. This should hopefully correct for cases like log4j.jar or +87 // struts2-core.jar +88 if (version.getVersionParts() == null || version.getVersionParts().size() < 2) { +89 dependency.getVersionEvidence().addEvidence("file", "name", +90 version.toString(), Confidence.MEDIUM); +91 } else { +92 dependency.getVersionEvidence().addEvidence("file", "name", +93 version.toString(), Confidence.HIGHEST); +94 } +95 dependency.getVersionEvidence().addEvidence("file", "name", +96 fileName, Confidence.MEDIUM); +97 } +98 +99 //add as vendor and product evidence +100 if (fileName.contains("-")) { +101 dependency.getProductEvidence().addEvidence("file", "name", +102 fileName, Confidence.HIGHEST); +103 dependency.getVendorEvidence().addEvidence("file", "name", +104 fileName, Confidence.HIGHEST); +105 } else { 106 dependency.getProductEvidence().addEvidence("file", "name", -107 fileName, Confidence.HIGHEST); +107 fileName, Confidence.HIGH); 108 dependency.getVendorEvidence().addEvidence("file", "name", -109 fileName, Confidence.HIGHEST); -110 } else { -111 dependency.getProductEvidence().addEvidence("file", "name", -112 fileName, Confidence.HIGH); -113 dependency.getVendorEvidence().addEvidence("file", "name", -114 fileName, Confidence.HIGH); -115 } -116 } -117 } +109 fileName, Confidence.HIGH); +110 } +111 } +112 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/JarAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/JarAnalyzer.html index 0892bcde7..b5b20b9cb 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/JarAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/JarAnalyzer.html @@ -50,235 +50,235 @@ 42 import java.util.regex.Pattern; 43 import java.util.zip.ZipEntry; 44 import org.apache.commons.compress.utils.IOUtils; -45 import org.jsoup.Jsoup; -46 import org.owasp.dependencycheck.Engine; -47 import org.owasp.dependencycheck.analyzer.exception.AnalysisException; -48 import org.owasp.dependencycheck.dependency.Confidence; -49 import org.owasp.dependencycheck.dependency.Dependency; -50 import org.owasp.dependencycheck.dependency.EvidenceCollection; -51 import org.owasp.dependencycheck.utils.FileFilterBuilder; -52 import org.owasp.dependencycheck.xml.pom.License; -53 import org.owasp.dependencycheck.xml.pom.PomUtils; -54 import org.owasp.dependencycheck.xml.pom.Model; -55 import org.owasp.dependencycheck.utils.FileUtils; -56 import org.owasp.dependencycheck.utils.Settings; -57 import org.slf4j.Logger; -58 import org.slf4j.LoggerFactory; -59 -60 /** -61 * Used to load a JAR file and collect information that can be used to determine the associated CPE. -62 * -63 * @author Jeremy Long -64 */ -65 public class JarAnalyzer extends AbstractFileTypeAnalyzer { -66 -67 //<editor-fold defaultstate="collapsed" desc="Constants and Member Variables"> -68 /** -69 * The logger. -70 */ -71 private static final Logger LOGGER = LoggerFactory.getLogger(JarAnalyzer.class); -72 /** -73 * The count of directories created during analysis. This is used for creating temporary directories. -74 */ -75 private static int dirCount = 0; -76 /** -77 * The system independent newline character. -78 */ -79 private static final String NEWLINE = System.getProperty("line.separator"); -80 /** -81 * A list of values in the manifest to ignore as they only result in false positives. -82 */ -83 private static final Set<String> IGNORE_VALUES = newHashSet( -84 "Sun Java System Application Server"); -85 /** -86 * A list of elements in the manifest to ignore. -87 */ -88 private static final Set<String> IGNORE_KEYS = newHashSet( -89 "built-by", -90 "created-by", -91 "builtby", -92 "createdby", -93 "build-jdk", -94 "buildjdk", -95 "ant-version", -96 "antversion", -97 "dynamicimportpackage", -98 "dynamicimport-package", -99 "dynamic-importpackage", -100 "dynamic-import-package", -101 "import-package", -102 "ignore-package", -103 "export-package", -104 "importpackage", -105 "ignorepackage", -106 "exportpackage", -107 "sealed", -108 "manifest-version", -109 "archiver-version", -110 "manifestversion", -111 "archiverversion", -112 "classpath", -113 "class-path", -114 "tool", -115 "bundle-manifestversion", -116 "bundlemanifestversion", -117 "bundle-vendor", -118 "include-resource", -119 "embed-dependency", -120 "ipojo-components", -121 "ipojo-extension", -122 "eclipse-sourcereferences"); -123 /** -124 * Deprecated Jar manifest attribute, that is, nonetheless, useful for analysis. -125 */ -126 @SuppressWarnings("deprecation") -127 private static final String IMPLEMENTATION_VENDOR_ID = Attributes.Name.IMPLEMENTATION_VENDOR_ID -128 .toString(); -129 /** -130 * item in some manifest, should be considered medium confidence. -131 */ -132 private static final String BUNDLE_VERSION = "Bundle-Version"; //: 2.1.2 -133 /** -134 * item in some manifest, should be considered medium confidence. -135 */ -136 private static final String BUNDLE_DESCRIPTION = "Bundle-Description"; //: Apache Struts 2 -137 /** -138 * item in some manifest, should be considered medium confidence. -139 */ -140 private static final String BUNDLE_NAME = "Bundle-Name"; //: Struts 2 Core -141 /** -142 * A pattern to detect HTML within text. -143 */ -144 private static final Pattern HTML_DETECTION_PATTERN = Pattern.compile("\\<[a-z]+.*/?\\>", Pattern.CASE_INSENSITIVE); -145 -146 //</editor-fold> -147 /** -148 * Constructs a new JarAnalyzer. -149 */ -150 public JarAnalyzer() { -151 } -152 -153 //<editor-fold defaultstate="collapsed" desc="All standard implmentation details of Analyzer"> -154 /** -155 * The name of the analyzer. -156 */ -157 private static final String ANALYZER_NAME = "Jar Analyzer"; -158 /** -159 * The phase that this analyzer is intended to run in. -160 */ -161 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION; -162 /** -163 * The set of file extensions supported by this analyzer. -164 */ -165 private static final String[] EXTENSIONS = {"jar", "war"}; -166 -167 /** -168 * The file filter used to determine which files this analyzer supports. -169 */ -170 private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions(EXTENSIONS).build(); -171 -172 /** -173 * Returns the FileFilter. -174 * -175 * @return the FileFilter -176 */ -177 @Override -178 protected FileFilter getFileFilter() { -179 return FILTER; -180 } -181 -182 /** -183 * Returns the name of the analyzer. -184 * -185 * @return the name of the analyzer. -186 */ -187 @Override -188 public String getName() { -189 return ANALYZER_NAME; -190 } -191 -192 /** -193 * Returns the phase that the analyzer is intended to run in. -194 * -195 * @return the phase that the analyzer is intended to run in. -196 */ -197 @Override -198 public AnalysisPhase getAnalysisPhase() { -199 return ANALYSIS_PHASE; -200 } -201 //</editor-fold> -202 -203 /** -204 * Returns the key used in the properties file to reference the analyzer's enabled property. -205 * -206 * @return the analyzer's enabled property setting key -207 */ -208 @Override -209 protected String getAnalyzerEnabledSettingKey() { -210 return Settings.KEYS.ANALYZER_JAR_ENABLED; -211 } -212 -213 /** -214 * Loads a specified JAR file and collects information from the manifest and checksums to identify the correct CPE -215 * information. -216 * -217 * @param dependency the dependency to analyze. -218 * @param engine the engine that is scanning the dependencies -219 * @throws AnalysisException is thrown if there is an error reading the JAR file. -220 */ -221 @Override -222 public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { -223 try { -224 final List<ClassNameInformation> classNames = collectClassNames(dependency); -225 final String fileName = dependency.getFileName().toLowerCase(); -226 if (classNames.isEmpty() -227 && (fileName.endsWith("-sources.jar") -228 || fileName.endsWith("-javadoc.jar") -229 || fileName.endsWith("-src.jar") -230 || fileName.endsWith("-doc.jar"))) { -231 engine.getDependencies().remove(dependency); -232 } -233 final boolean hasManifest = parseManifest(dependency, classNames); -234 final boolean hasPOM = analyzePOM(dependency, classNames, engine); -235 final boolean addPackagesAsEvidence = !(hasManifest && hasPOM); -236 analyzePackageNames(classNames, dependency, addPackagesAsEvidence); -237 } catch (IOException ex) { -238 throw new AnalysisException("Exception occurred reading the JAR file.", ex); -239 } -240 } -241 -242 /** -243 * Attempts to find a pom.xml within the JAR file. If found it extracts information and adds it to the evidence. This will -244 * attempt to interpolate the strings contained within the pom.properties if one exists. -245 * -246 * @param dependency the dependency being analyzed -247 * @param classes a collection of class name information -248 * @param engine the analysis engine, used to add additional dependencies -249 * @throws AnalysisException is thrown if there is an exception parsing the pom -250 * @return whether or not evidence was added to the dependency -251 */ -252 protected boolean analyzePOM(Dependency dependency, List<ClassNameInformation> classes, Engine engine) throws AnalysisException { -253 boolean foundSomething = false; -254 final JarFile jar; -255 try { -256 jar = new JarFile(dependency.getActualFilePath()); -257 } catch (IOException ex) { -258 LOGGER.warn("Unable to read JarFile '{}'.", dependency.getActualFilePath()); -259 LOGGER.trace("", ex); -260 return false; -261 } -262 List<String> pomEntries; -263 try { -264 pomEntries = retrievePomListing(jar); -265 } catch (IOException ex) { -266 LOGGER.warn("Unable to read Jar file entries in '{}'.", dependency.getActualFilePath()); -267 LOGGER.trace("", ex); -268 return false; -269 } -270 File externalPom = null; -271 if (pomEntries.isEmpty()) { -272 String pomPath = dependency.getActualFilePath(); -273 pomPath = pomPath.substring(0, pomPath.lastIndexOf('.')) + ".pom"; +45 import org.apache.commons.io.FilenameUtils; +46 import org.jsoup.Jsoup; +47 import org.owasp.dependencycheck.Engine; +48 import org.owasp.dependencycheck.analyzer.exception.AnalysisException; +49 import org.owasp.dependencycheck.dependency.Confidence; +50 import org.owasp.dependencycheck.dependency.Dependency; +51 import org.owasp.dependencycheck.dependency.EvidenceCollection; +52 import org.owasp.dependencycheck.utils.FileFilterBuilder; +53 import org.owasp.dependencycheck.xml.pom.License; +54 import org.owasp.dependencycheck.xml.pom.PomUtils; +55 import org.owasp.dependencycheck.xml.pom.Model; +56 import org.owasp.dependencycheck.utils.FileUtils; +57 import org.owasp.dependencycheck.utils.Settings; +58 import org.slf4j.Logger; +59 import org.slf4j.LoggerFactory; +60 +61 /** +62 * Used to load a JAR file and collect information that can be used to determine the associated CPE. +63 * +64 * @author Jeremy Long +65 */ +66 public class JarAnalyzer extends AbstractFileTypeAnalyzer { +67 +68 //<editor-fold defaultstate="collapsed" desc="Constants and Member Variables"> +69 /** +70 * The logger. +71 */ +72 private static final Logger LOGGER = LoggerFactory.getLogger(JarAnalyzer.class); +73 /** +74 * The count of directories created during analysis. This is used for creating temporary directories. +75 */ +76 private static int dirCount = 0; +77 /** +78 * The system independent newline character. +79 */ +80 private static final String NEWLINE = System.getProperty("line.separator"); +81 /** +82 * A list of values in the manifest to ignore as they only result in false positives. +83 */ +84 private static final Set<String> IGNORE_VALUES = newHashSet( +85 "Sun Java System Application Server"); +86 /** +87 * A list of elements in the manifest to ignore. +88 */ +89 private static final Set<String> IGNORE_KEYS = newHashSet( +90 "built-by", +91 "created-by", +92 "builtby", +93 "createdby", +94 "build-jdk", +95 "buildjdk", +96 "ant-version", +97 "antversion", +98 "dynamicimportpackage", +99 "dynamicimport-package", +100 "dynamic-importpackage", +101 "dynamic-import-package", +102 "import-package", +103 "ignore-package", +104 "export-package", +105 "importpackage", +106 "ignorepackage", +107 "exportpackage", +108 "sealed", +109 "manifest-version", +110 "archiver-version", +111 "manifestversion", +112 "archiverversion", +113 "classpath", +114 "class-path", +115 "tool", +116 "bundle-manifestversion", +117 "bundlemanifestversion", +118 "bundle-vendor", +119 "include-resource", +120 "embed-dependency", +121 "ipojo-components", +122 "ipojo-extension", +123 "eclipse-sourcereferences"); +124 /** +125 * Deprecated Jar manifest attribute, that is, nonetheless, useful for analysis. +126 */ +127 @SuppressWarnings("deprecation") +128 private static final String IMPLEMENTATION_VENDOR_ID = Attributes.Name.IMPLEMENTATION_VENDOR_ID +129 .toString(); +130 /** +131 * item in some manifest, should be considered medium confidence. +132 */ +133 private static final String BUNDLE_VERSION = "Bundle-Version"; //: 2.1.2 +134 /** +135 * item in some manifest, should be considered medium confidence. +136 */ +137 private static final String BUNDLE_DESCRIPTION = "Bundle-Description"; //: Apache Struts 2 +138 /** +139 * item in some manifest, should be considered medium confidence. +140 */ +141 private static final String BUNDLE_NAME = "Bundle-Name"; //: Struts 2 Core +142 /** +143 * A pattern to detect HTML within text. +144 */ +145 private static final Pattern HTML_DETECTION_PATTERN = Pattern.compile("\\<[a-z]+.*/?\\>", Pattern.CASE_INSENSITIVE); +146 +147 //</editor-fold> +148 /** +149 * Constructs a new JarAnalyzer. +150 */ +151 public JarAnalyzer() { +152 } +153 +154 //<editor-fold defaultstate="collapsed" desc="All standard implmentation details of Analyzer"> +155 /** +156 * The name of the analyzer. +157 */ +158 private static final String ANALYZER_NAME = "Jar Analyzer"; +159 /** +160 * The phase that this analyzer is intended to run in. +161 */ +162 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION; +163 /** +164 * The set of file extensions supported by this analyzer. +165 */ +166 private static final String[] EXTENSIONS = {"jar", "war"}; +167 +168 /** +169 * The file filter used to determine which files this analyzer supports. +170 */ +171 private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions(EXTENSIONS).build(); +172 +173 /** +174 * Returns the FileFilter. +175 * +176 * @return the FileFilter +177 */ +178 @Override +179 protected FileFilter getFileFilter() { +180 return FILTER; +181 } +182 +183 /** +184 * Returns the name of the analyzer. +185 * +186 * @return the name of the analyzer. +187 */ +188 @Override +189 public String getName() { +190 return ANALYZER_NAME; +191 } +192 +193 /** +194 * Returns the phase that the analyzer is intended to run in. +195 * +196 * @return the phase that the analyzer is intended to run in. +197 */ +198 @Override +199 public AnalysisPhase getAnalysisPhase() { +200 return ANALYSIS_PHASE; +201 } +202 //</editor-fold> +203 +204 /** +205 * Returns the key used in the properties file to reference the analyzer's enabled property. +206 * +207 * @return the analyzer's enabled property setting key +208 */ +209 @Override +210 protected String getAnalyzerEnabledSettingKey() { +211 return Settings.KEYS.ANALYZER_JAR_ENABLED; +212 } +213 +214 /** +215 * Loads a specified JAR file and collects information from the manifest and checksums to identify the correct CPE +216 * information. +217 * +218 * @param dependency the dependency to analyze. +219 * @param engine the engine that is scanning the dependencies +220 * @throws AnalysisException is thrown if there is an error reading the JAR file. +221 */ +222 @Override +223 public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { +224 try { +225 final List<ClassNameInformation> classNames = collectClassNames(dependency); +226 final String fileName = dependency.getFileName().toLowerCase(); +227 if (classNames.isEmpty() +228 && (fileName.endsWith("-sources.jar") +229 || fileName.endsWith("-javadoc.jar") +230 || fileName.endsWith("-src.jar") +231 || fileName.endsWith("-doc.jar"))) { +232 engine.getDependencies().remove(dependency); +233 } +234 final boolean hasManifest = parseManifest(dependency, classNames); +235 final boolean hasPOM = analyzePOM(dependency, classNames, engine); +236 final boolean addPackagesAsEvidence = !(hasManifest && hasPOM); +237 analyzePackageNames(classNames, dependency, addPackagesAsEvidence); +238 } catch (IOException ex) { +239 throw new AnalysisException("Exception occurred reading the JAR file.", ex); +240 } +241 } +242 +243 /** +244 * Attempts to find a pom.xml within the JAR file. If found it extracts information and adds it to the evidence. This will +245 * attempt to interpolate the strings contained within the pom.properties if one exists. +246 * +247 * @param dependency the dependency being analyzed +248 * @param classes a collection of class name information +249 * @param engine the analysis engine, used to add additional dependencies +250 * @throws AnalysisException is thrown if there is an exception parsing the pom +251 * @return whether or not evidence was added to the dependency +252 */ +253 protected boolean analyzePOM(Dependency dependency, List<ClassNameInformation> classes, Engine engine) throws AnalysisException { +254 boolean foundSomething = false; +255 final JarFile jar; +256 try { +257 jar = new JarFile(dependency.getActualFilePath()); +258 } catch (IOException ex) { +259 LOGGER.warn("Unable to read JarFile '{}'.", dependency.getActualFilePath()); +260 LOGGER.trace("", ex); +261 return false; +262 } +263 List<String> pomEntries; +264 try { +265 pomEntries = retrievePomListing(jar); +266 } catch (IOException ex) { +267 LOGGER.warn("Unable to read Jar file entries in '{}'.", dependency.getActualFilePath()); +268 LOGGER.trace("", ex); +269 return false; +270 } +271 File externalPom = null; +272 if (pomEntries.isEmpty()) { +273 final String pomPath = FilenameUtils.removeExtension(dependency.getActualFilePath()) + ".pom"; 274 externalPom = new File(pomPath); 275 if (externalPom.isFile()) { 276 pomEntries.add(pomPath); diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/NexusAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/NexusAnalyzer.html index a0fc78551..a6ea64452 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/NexusAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/NexusAnalyzer.html @@ -112,7 +112,7 @@ 104 */ 105 boolean retval = false; 106 try { -107 if ((!DEFAULT_URL.equals(Settings.getString(Settings.KEYS.ANALYZER_NEXUS_URL))) +107 if (!DEFAULT_URL.equals(Settings.getString(Settings.KEYS.ANALYZER_NEXUS_URL)) 108 && Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED)) { 109 LOGGER.info("Enabling Nexus analyzer"); 110 retval = true; diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/NuspecAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/NuspecAnalyzer.html index b6fa073e9..9895b94ac 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/NuspecAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/NuspecAnalyzer.html @@ -134,7 +134,7 @@ 126 */ 127 @Override 128 public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { -129 LOGGER.debug("Checking Nuspec file {}", dependency.toString()); +129 LOGGER.debug("Checking Nuspec file {}", dependency); 130 try { 131 final NuspecParser parser = new XPathNuspecParser(); 132 NugetPackage np = null; diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.html index 09057ff7d..c77fa103b 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.html @@ -81,7 +81,7 @@ 73 * @return true or false. 74 */ 75 public boolean isOpen() { -76 return (cveDB != null); +76 return cveDB != null; 77 } 78 79 /** diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/PythonPackageAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/PythonPackageAnalyzer.html index ed63e358c..a583fbba3 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/PythonPackageAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/PythonPackageAnalyzer.html @@ -172,7 +172,7 @@ 164 * Analyzes python packages and adds evidence to the dependency. 165 * 166 * @param dependency the dependency being analyzed -167 * @param engine the engine being used to perform the scan +167 * @param engine the engine being used to perform the scan 168 * @throws AnalysisException thrown if there is an unrecoverable error analyzing the dependency 169 */ 170 @Override @@ -183,142 +183,145 @@ 175 final String parentName = parent.getName(); 176 boolean found = false; 177 if (INIT_PY_FILTER.accept(file)) { -178 for (final File sourceFile : parent.listFiles(PY_FILTER)) { -179 found |= analyzeFileContents(dependency, sourceFile); -180 } -181 } -182 if (found) { -183 dependency.setDisplayFileName(parentName + "/__init__.py"); -184 dependency.getProductEvidence().addEvidence(file.getName(), -185 "PackageName", parentName, Confidence.MEDIUM); -186 } else { -187 // copy, alter and set in case some other thread is iterating over -188 final List<Dependency> dependencies = new ArrayList<Dependency>( -189 engine.getDependencies()); -190 dependencies.remove(dependency); -191 engine.setDependencies(dependencies); -192 } -193 } -194 -195 /** -196 * This should gather information from leading docstrings, file comments, and assignments to __version__, __title__, -197 * __summary__, __uri__, __url__, __home*page__, __author__, and their all caps equivalents. -198 * -199 * @param dependency the dependency being analyzed -200 * @param file the file name to analyze -201 * @return whether evidence was found -202 * @throws AnalysisException thrown if there is an unrecoverable error -203 */ -204 private boolean analyzeFileContents(Dependency dependency, File file) -205 throws AnalysisException { -206 String contents; -207 try { -208 contents = FileUtils.readFileToString(file).trim(); -209 } catch (IOException e) { -210 throw new AnalysisException( -211 "Problem occurred while reading dependency file.", e); -212 } -213 boolean found = false; -214 if (!contents.isEmpty()) { -215 final String source = file.getName(); -216 found = gatherEvidence(VERSION_PATTERN, contents, source, -217 dependency.getVersionEvidence(), "SourceVersion", -218 Confidence.MEDIUM); -219 found |= addSummaryInfo(dependency, SUMMARY_PATTERN, 4, contents, -220 source, "summary"); -221 if (INIT_PY_FILTER.accept(file)) { -222 found |= addSummaryInfo(dependency, MODULE_DOCSTRING, 2, -223 contents, source, "docstring"); -224 } -225 found |= gatherEvidence(TITLE_PATTERN, contents, source, -226 dependency.getProductEvidence(), "SourceTitle", -227 Confidence.LOW); -228 final EvidenceCollection vendorEvidence = dependency -229 .getVendorEvidence(); -230 found |= gatherEvidence(AUTHOR_PATTERN, contents, source, -231 vendorEvidence, "SourceAuthor", Confidence.MEDIUM); -232 found |= gatherHomePageEvidence(URI_PATTERN, vendorEvidence, -233 source, "URL", contents); -234 found |= gatherHomePageEvidence(HOMEPAGE_PATTERN, -235 vendorEvidence, source, "HomePage", contents); -236 } -237 return found; -238 } -239 -240 /** -241 * Adds summary information to the dependency -242 * -243 * @param dependency the dependency being analyzed -244 * @param pattern the pattern used to perform analysis -245 * @param group the group from the pattern that indicates the data to use -246 * @param contents the data being analyzed -247 * @param source the source name to use when recording the evidence -248 * @param key the key name to use when recording the evidence -249 * @return true if evidence was collected; otherwise false -250 */ -251 private boolean addSummaryInfo(Dependency dependency, Pattern pattern, -252 int group, String contents, String source, String key) { -253 final Matcher matcher = pattern.matcher(contents); -254 final boolean found = matcher.find(); -255 if (found) { -256 JarAnalyzer.addDescription(dependency, matcher.group(group), -257 source, key); -258 } -259 return found; -260 } -261 -262 /** -263 * Collects evidence from the home page URL. -264 * -265 * @param pattern the pattern to match -266 * @param evidence the evidence collection to add the evidence to -267 * @param source the source of the evidence -268 * @param name the name of the evidence -269 * @param contents the home page URL -270 * @return true if evidence was collected; otherwise false -271 */ -272 private boolean gatherHomePageEvidence(Pattern pattern, -273 EvidenceCollection evidence, String source, String name, -274 String contents) { -275 final Matcher matcher = pattern.matcher(contents); -276 boolean found = false; -277 if (matcher.find()) { -278 final String url = matcher.group(4); -279 if (UrlStringUtils.isUrl(url)) { -280 found = true; -281 evidence.addEvidence(source, name, url, Confidence.MEDIUM); -282 } -283 } -284 return found; -285 } -286 -287 /** -288 * Gather evidence from a Python source file using the given string assignment regex pattern. -289 * -290 * @param pattern to scan contents with -291 * @param contents of Python source file -292 * @param source for storing evidence -293 * @param evidence to store evidence in -294 * @param name of evidence -295 * @param confidence in evidence -296 * @return whether evidence was found -297 */ -298 private boolean gatherEvidence(Pattern pattern, String contents, -299 String source, EvidenceCollection evidence, String name, -300 Confidence confidence) { -301 final Matcher matcher = pattern.matcher(contents); -302 final boolean found = matcher.find(); -303 if (found) { -304 evidence.addEvidence(source, name, matcher.group(4), confidence); -305 } -306 return found; -307 } -308 -309 @Override -310 protected String getAnalyzerEnabledSettingKey() { -311 return Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED; -312 } -313 } +178 final File[] fileList = parent.listFiles(PY_FILTER); +179 if (fileList != null) { +180 for (final File sourceFile : fileList) { +181 found |= analyzeFileContents(dependency, sourceFile); +182 } +183 } +184 } +185 if (found) { +186 dependency.setDisplayFileName(parentName + "/__init__.py"); +187 dependency.getProductEvidence().addEvidence(file.getName(), +188 "PackageName", parentName, Confidence.MEDIUM); +189 } else { +190 // copy, alter and set in case some other thread is iterating over +191 final List<Dependency> dependencies = new ArrayList<Dependency>( +192 engine.getDependencies()); +193 dependencies.remove(dependency); +194 engine.setDependencies(dependencies); +195 } +196 } +197 +198 /** +199 * This should gather information from leading docstrings, file comments, and assignments to __version__, __title__, +200 * __summary__, __uri__, __url__, __home*page__, __author__, and their all caps equivalents. +201 * +202 * @param dependency the dependency being analyzed +203 * @param file the file name to analyze +204 * @return whether evidence was found +205 * @throws AnalysisException thrown if there is an unrecoverable error +206 */ +207 private boolean analyzeFileContents(Dependency dependency, File file) +208 throws AnalysisException { +209 String contents; +210 try { +211 contents = FileUtils.readFileToString(file).trim(); +212 } catch (IOException e) { +213 throw new AnalysisException( +214 "Problem occurred while reading dependency file.", e); +215 } +216 boolean found = false; +217 if (!contents.isEmpty()) { +218 final String source = file.getName(); +219 found = gatherEvidence(VERSION_PATTERN, contents, source, +220 dependency.getVersionEvidence(), "SourceVersion", +221 Confidence.MEDIUM); +222 found |= addSummaryInfo(dependency, SUMMARY_PATTERN, 4, contents, +223 source, "summary"); +224 if (INIT_PY_FILTER.accept(file)) { +225 found |= addSummaryInfo(dependency, MODULE_DOCSTRING, 2, +226 contents, source, "docstring"); +227 } +228 found |= gatherEvidence(TITLE_PATTERN, contents, source, +229 dependency.getProductEvidence(), "SourceTitle", +230 Confidence.LOW); +231 final EvidenceCollection vendorEvidence = dependency +232 .getVendorEvidence(); +233 found |= gatherEvidence(AUTHOR_PATTERN, contents, source, +234 vendorEvidence, "SourceAuthor", Confidence.MEDIUM); +235 found |= gatherHomePageEvidence(URI_PATTERN, vendorEvidence, +236 source, "URL", contents); +237 found |= gatherHomePageEvidence(HOMEPAGE_PATTERN, +238 vendorEvidence, source, "HomePage", contents); +239 } +240 return found; +241 } +242 +243 /** +244 * Adds summary information to the dependency +245 * +246 * @param dependency the dependency being analyzed +247 * @param pattern the pattern used to perform analysis +248 * @param group the group from the pattern that indicates the data to use +249 * @param contents the data being analyzed +250 * @param source the source name to use when recording the evidence +251 * @param key the key name to use when recording the evidence +252 * @return true if evidence was collected; otherwise false +253 */ +254 private boolean addSummaryInfo(Dependency dependency, Pattern pattern, +255 int group, String contents, String source, String key) { +256 final Matcher matcher = pattern.matcher(contents); +257 final boolean found = matcher.find(); +258 if (found) { +259 JarAnalyzer.addDescription(dependency, matcher.group(group), +260 source, key); +261 } +262 return found; +263 } +264 +265 /** +266 * Collects evidence from the home page URL. +267 * +268 * @param pattern the pattern to match +269 * @param evidence the evidence collection to add the evidence to +270 * @param source the source of the evidence +271 * @param name the name of the evidence +272 * @param contents the home page URL +273 * @return true if evidence was collected; otherwise false +274 */ +275 private boolean gatherHomePageEvidence(Pattern pattern, +276 EvidenceCollection evidence, String source, String name, +277 String contents) { +278 final Matcher matcher = pattern.matcher(contents); +279 boolean found = false; +280 if (matcher.find()) { +281 final String url = matcher.group(4); +282 if (UrlStringUtils.isUrl(url)) { +283 found = true; +284 evidence.addEvidence(source, name, url, Confidence.MEDIUM); +285 } +286 } +287 return found; +288 } +289 +290 /** +291 * Gather evidence from a Python source file using the given string assignment regex pattern. +292 * +293 * @param pattern to scan contents with +294 * @param contents of Python source file +295 * @param source for storing evidence +296 * @param evidence to store evidence in +297 * @param name of evidence +298 * @param confidence in evidence +299 * @return whether evidence was found +300 */ +301 private boolean gatherEvidence(Pattern pattern, String contents, +302 String source, EvidenceCollection evidence, String name, +303 Confidence confidence) { +304 final Matcher matcher = pattern.matcher(contents); +305 final boolean found = matcher.find(); +306 if (found) { +307 evidence.addEvidence(source, name, matcher.group(4), confidence); +308 } +309 return found; +310 } +311 +312 @Override +313 protected String getAnalyzerEnabledSettingKey() { +314 return Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED; +315 } +316 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.html new file mode 100644 index 000000000..059ec01a2 --- /dev/null +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.html @@ -0,0 +1,339 @@ + + + +RubyBundleAuditAnalyzer xref + + + +
    +1   /*
    +2    * This file is part of dependency-check-core.
    +3    *
    +4    * Licensed under the Apache License, Version 2.0 (the "License");
    +5    * you may not use this file except in compliance with the License.
    +6    * You may obtain a copy of the License at
    +7    *
    +8    *     http://www.apache.org/licenses/LICENSE-2.0
    +9    *
    +10   * Unless required by applicable law or agreed to in writing, software
    +11   * distributed under the License is distributed on an "AS IS" BASIS,
    +12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +13   * See the License for the specific language governing permissions and
    +14   * limitations under the License.
    +15   *
    +16   * Copyright (c) 2015 Institute for Defense Analyses. All Rights Reserved.
    +17   */
    +18  package org.owasp.dependencycheck.analyzer;
    +19  
    +20  import org.apache.commons.io.FileUtils;
    +21  import org.owasp.dependencycheck.Engine;
    +22  import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
    +23  import org.owasp.dependencycheck.dependency.Confidence;
    +24  import org.owasp.dependencycheck.dependency.Dependency;
    +25  import org.owasp.dependencycheck.dependency.Reference;
    +26  import org.owasp.dependencycheck.dependency.Vulnerability;
    +27  import org.owasp.dependencycheck.utils.FileFilterBuilder;
    +28  import org.owasp.dependencycheck.utils.Settings;
    +29  import org.slf4j.Logger;
    +30  import org.slf4j.LoggerFactory;
    +31  
    +32  import java.io.*;
    +33  import java.util.*;
    +34  
    +35  /**
    +36   * Used to analyze Ruby Bundler Gemspec.lock files utilizing the 3rd party bundle-audit tool.
    +37   *
    +38   * @author Dale Visser <dvisser@ida.org>
    +39   */
    +40  public class RubyBundleAuditAnalyzer extends AbstractFileTypeAnalyzer {
    +41  
    +42      private static final Logger LOGGER = LoggerFactory.getLogger(RubyBundleAuditAnalyzer.class);
    +43  
    +44      /**
    +45       * The name of the analyzer.
    +46       */
    +47      private static final String ANALYZER_NAME = "Ruby Bundle Audit Analyzer";
    +48  
    +49      /**
    +50       * The phase that this analyzer is intended to run in.
    +51       */
    +52      private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.PRE_INFORMATION_COLLECTION;
    +53  
    +54      private static final FileFilter FILTER =
    +55              FileFilterBuilder.newInstance().addFilenames("Gemfile.lock").build();
    +56      public static final String NAME = "Name: ";
    +57      public static final String VERSION = "Version: ";
    +58      public static final String ADVISORY = "Advisory: ";
    +59      public static final String CRITICALITY = "Criticality: ";
    +60  
    +61      /**
    +62       * @return a filter that accepts files named Gemfile.lock
    +63       */
    +64      @Override
    +65      protected FileFilter getFileFilter() {
    +66          return FILTER;
    +67      }
    +68  
    +69      /**
    +70       * Launch bundle-audit.
    +71       *
    +72       * @return a handle to the process
    +73       */
    +74      private Process launchBundleAudit(File folder) throws AnalysisException {
    +75          if (!folder.isDirectory()) {
    +76              throw new AnalysisException(String.format("%s should have been a directory.", folder.getAbsolutePath()));
    +77          }
    +78          final List<String> args = new ArrayList<String>();
    +79          final String bundleAuditPath = Settings.getString(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_PATH);
    +80          args.add(null == bundleAuditPath ? "bundle-audit" : bundleAuditPath);
    +81          args.add("check");
    +82          args.add("--verbose");
    +83          final ProcessBuilder builder = new ProcessBuilder(args);
    +84          builder.directory(folder);
    +85          try {
    +86              return builder.start();
    +87          } catch (IOException ioe) {
    +88              throw new AnalysisException("bundle-audit failure", ioe);
    +89          }
    +90      }
    +91  
    +92      /**
    +93       * Initialize the analyzer. In this case, extract GrokAssembly.exe to a temporary location.
    +94       *
    +95       * @throws Exception if anything goes wrong
    +96       */
    +97      @Override
    +98      public void initializeFileTypeAnalyzer() throws Exception {
    +99          // Now, need to see if bundle-audit actually runs from this location.
    +100         Process process = launchBundleAudit(Settings.getTempDirectory());
    +101         int exitValue = process.waitFor();
    +102         if (0 == exitValue) {
    +103             LOGGER.warn("Unexpected exit code from bundle-audit process. Disabling {}: {}", ANALYZER_NAME, exitValue);
    +104             setEnabled(false);
    +105             throw new AnalysisException("Unexpected exit code from bundle-audit process.");
    +106         } else {
    +107             BufferedReader reader = null;
    +108             try {
    +109                 reader = new BufferedReader(new InputStreamReader(process.getErrorStream(), "UTF-8"));
    +110                 if (!reader.ready()) {
    +111                     LOGGER.warn("Bundle-audit error stream unexpectedly not ready. Disabling " + ANALYZER_NAME);
    +112                     setEnabled(false);
    +113                     throw new AnalysisException("Bundle-audit error stream unexpectedly not ready.");
    +114                 } else {
    +115                     final String line = reader.readLine();
    +116                     if (!line.contains("Errno::ENOENT")) {
    +117                         LOGGER.warn("Unexpected bundle-audit output. Disabling {}: {}", ANALYZER_NAME, line);
    +118                         setEnabled(false);
    +119                         throw new AnalysisException("Unexpected bundle-audit output.");
    +120                     }
    +121                 }
    +122             } finally {
    +123                 if (null != reader) {
    +124                     reader.close();
    +125                 }
    +126             }
    +127         }
    +128         if (isEnabled()) {
    +129             LOGGER.info(ANALYZER_NAME + " is enabled. It is necessary to manually run \"bundle-audit update\" " +
    +130                     "occasionally to keep its database up to date.");
    +131         }
    +132     }
    +133 
    +134     /**
    +135      * Returns the name of the analyzer.
    +136      *
    +137      * @return the name of the analyzer.
    +138      */
    +139     @Override
    +140     public String getName() {
    +141         return ANALYZER_NAME;
    +142     }
    +143 
    +144     /**
    +145      * Returns the phase that the analyzer is intended to run in.
    +146      *
    +147      * @return the phase that the analyzer is intended to run in.
    +148      */
    +149     @Override
    +150     public AnalysisPhase getAnalysisPhase() {
    +151         return ANALYSIS_PHASE;
    +152     }
    +153 
    +154     /**
    +155      * Returns the key used in the properties file to reference the analyzer's enabled property.
    +156      *
    +157      * @return the analyzer's enabled property setting key
    +158      */
    +159     @Override
    +160     protected String getAnalyzerEnabledSettingKey() {
    +161         return Settings.KEYS.ANALYZER_BUNDLE_AUDIT_ENABLED;
    +162     }
    +163 
    +164     /**
    +165      * If {@link #analyzeFileType(Dependency, Engine)} is called, then we have successfully initialized, and it will
    +166      * be necessary to disable {@link RubyGemspecAnalyzer}.
    +167      */
    +168     private boolean needToDisableGemspecAnalyzer = true;
    +169 
    +170     @Override
    +171     protected void analyzeFileType(Dependency dependency, Engine engine)
    +172             throws AnalysisException {
    +173         if (needToDisableGemspecAnalyzer) {
    +174             boolean failed = true;
    +175             final String className = RubyGemspecAnalyzer.class.getName();
    +176             for (FileTypeAnalyzer analyzer : engine.getFileTypeAnalyzers()) {
    +177                 if (analyzer instanceof RubyGemspecAnalyzer) {
    +178                     ((RubyGemspecAnalyzer) analyzer).setEnabled(false);
    +179                     LOGGER.info("Disabled " + className + " to avoid noisy duplicate results.");
    +180                     failed = false;
    +181                 }
    +182             }
    +183             if (failed) {
    +184                 LOGGER.warn("Did not find" + className + '.');
    +185             }
    +186             needToDisableGemspecAnalyzer = false;
    +187         }
    +188         final File parentFile = dependency.getActualFile().getParentFile();
    +189         final Process process = launchBundleAudit(parentFile);
    +190         try {
    +191             process.waitFor();
    +192         } catch (InterruptedException ie) {
    +193             throw new AnalysisException("bundle-audit process interrupted", ie);
    +194         }
    +195         BufferedReader rdr = null;
    +196         try {
    +197             rdr = new BufferedReader(new InputStreamReader(process.getInputStream(), "UTF-8"));
    +198             processBundlerAuditOutput(dependency, engine, rdr);
    +199         } catch (IOException ioe) {
    +200             LOGGER.warn("bundle-audit failure", ioe);
    +201         } finally {
    +202             if (null != rdr) {
    +203                 try {
    +204                     rdr.close();
    +205                 } catch (IOException ioe) {
    +206                     LOGGER.warn("bundle-audit close failure", ioe);
    +207                 }
    +208             }
    +209         }
    +210 
    +211     }
    +212 
    +213     private void processBundlerAuditOutput(Dependency original, Engine engine, BufferedReader rdr) throws IOException {
    +214         final String parentName = original.getActualFile().getParentFile().getName();
    +215         final String fileName = original.getFileName();
    +216         Dependency dependency = null;
    +217         Vulnerability vulnerability = null;
    +218         String gem = null;
    +219         final Map<String, Dependency> map = new HashMap<String, Dependency>();
    +220         boolean appendToDescription = false;
    +221         while (rdr.ready()) {
    +222             final String nextLine = rdr.readLine();
    +223             if (null == nextLine) {
    +224                 break;
    +225             } else if (nextLine.startsWith(NAME)) {
    +226                 appendToDescription = false;
    +227                 gem = nextLine.substring(NAME.length());
    +228                 if (!map.containsKey(gem)) {
    +229                     map.put(gem, createDependencyForGem(engine, parentName, fileName, gem));
    +230                 }
    +231                 dependency = map.get(gem);
    +232                 LOGGER.debug(String.format("bundle-audit (%s): %s", parentName, nextLine));
    +233             } else if (nextLine.startsWith(VERSION)) {
    +234                 vulnerability = createVulnerability(parentName, dependency, vulnerability, gem, nextLine);
    +235             } else if (nextLine.startsWith(ADVISORY)) {
    +236                 setVulnerabilityName(parentName, dependency, vulnerability, nextLine);
    +237             } else if (nextLine.startsWith(CRITICALITY)) {
    +238                 addCriticalityToVulnerability(parentName, vulnerability, nextLine);
    +239             } else if (nextLine.startsWith("URL: ")) {
    +240                 addReferenceToVulnerability(parentName, vulnerability, nextLine);
    +241             } else if (nextLine.startsWith("Description:")) {
    +242                 appendToDescription = true;
    +243                 if (null != vulnerability) {
    +244                     vulnerability.setDescription("*** Vulnerability obtained from bundle-audit verbose report. Title link may not work. CPE below is guessed. CVSS score is estimated (-1.0 indicates unknown). See link below for full details. *** ");
    +245                 }
    +246             } else if (appendToDescription) {
    +247                 if (null != vulnerability) {
    +248                     vulnerability.setDescription(vulnerability.getDescription() + nextLine + "\n");
    +249                 }
    +250             }
    +251         }
    +252     }
    +253 
    +254     private void setVulnerabilityName(String parentName, Dependency dependency, Vulnerability vulnerability, String nextLine) {
    +255         final String advisory = nextLine.substring((ADVISORY.length()));
    +256         if (null != vulnerability) {
    +257             vulnerability.setName(advisory);
    +258         }
    +259         if (null != dependency) {
    +260             dependency.getVulnerabilities().add(vulnerability); // needed to wait for vulnerability name to avoid NPE
    +261         }
    +262         LOGGER.debug(String.format("bundle-audit (%s): %s", parentName, nextLine));
    +263     }
    +264 
    +265     private void addReferenceToVulnerability(String parentName, Vulnerability vulnerability, String nextLine) {
    +266         final String url = nextLine.substring(("URL: ").length());
    +267         if (null != vulnerability) {
    +268             Reference ref = new Reference();
    +269             ref.setName(vulnerability.getName());
    +270             ref.setSource("bundle-audit");
    +271             ref.setUrl(url);
    +272             vulnerability.getReferences().add(ref);
    +273         }
    +274         LOGGER.debug(String.format("bundle-audit (%s): %s", parentName, nextLine));
    +275     }
    +276 
    +277     private void addCriticalityToVulnerability(String parentName, Vulnerability vulnerability, String nextLine) {
    +278         if (null != vulnerability) {
    +279             final String criticality = nextLine.substring(CRITICALITY.length()).trim();
    +280             if ("High".equals(criticality)) {
    +281                 vulnerability.setCvssScore(8.5f);
    +282             } else if ("Medium".equals(criticality)) {
    +283                 vulnerability.setCvssScore(5.5f);
    +284             } else if ("Low".equals(criticality)) {
    +285                 vulnerability.setCvssScore(2.0f);
    +286             } else {
    +287                 vulnerability.setCvssScore(-1.0f);
    +288             }
    +289         }
    +290         LOGGER.debug(String.format("bundle-audit (%s): %s", parentName, nextLine));
    +291     }
    +292 
    +293     private Vulnerability createVulnerability(String parentName, Dependency dependency, Vulnerability vulnerability, String gem, String nextLine) {
    +294         if (null != dependency) {
    +295             final String version = nextLine.substring(VERSION.length());
    +296             dependency.getVersionEvidence().addEvidence(
    +297                     "bundler-audit",
    +298                     "Version",
    +299                     version,
    +300                     Confidence.HIGHEST);
    +301             vulnerability = new Vulnerability(); // don't add to dependency until we have name set later
    +302             vulnerability.setMatchedCPE(
    +303                     String.format("cpe:/a:%1$s_project:%1$s:%2$s::~~~ruby~~", gem, version),
    +304                     null);
    +305             vulnerability.setCvssAccessVector("-");
    +306             vulnerability.setCvssAccessComplexity("-");
    +307             vulnerability.setCvssAuthentication("-");
    +308             vulnerability.setCvssAvailabilityImpact("-");
    +309             vulnerability.setCvssConfidentialityImpact("-");
    +310             vulnerability.setCvssIntegrityImpact("-");
    +311         }
    +312         LOGGER.debug(String.format("bundle-audit (%s): %s", parentName, nextLine));
    +313         return vulnerability;
    +314     }
    +315 
    +316     private Dependency createDependencyForGem(Engine engine, String parentName, String fileName, String gem) throws IOException {
    +317         final File tempFile = File.createTempFile("Gemfile-" + gem, ".lock", Settings.getTempDirectory());
    +318         final String displayFileName = String.format("%s%c%s:%s", parentName, File.separatorChar, fileName, gem);
    +319         FileUtils.write(tempFile, displayFileName); // unique contents to avoid dependency bundling
    +320         final Dependency dependency = new Dependency(tempFile);
    +321         dependency.getProductEvidence().addEvidence("bundler-audit", "Name", gem, Confidence.HIGHEST);
    +322         dependency.setDisplayFileName(displayFileName);
    +323         engine.getDependencies().add(dependency);
    +324         return dependency;
    +325     }
    +326 }
    +
    +
    + + + diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzer.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzer.html index d167b5d5d..c5874acf8 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzer.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzer.html @@ -57,115 +57,116 @@ 49 */ 50 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION; 51 -52 private static final FileFilter FILTER = -53 FileFilterBuilder.newInstance().addExtensions("gemspec").addFilenames("Rakefile").build(); -54 -55 private static final String EMAIL = "email"; -56 private static final String GEMSPEC = "gemspec"; -57 -58 /** -59 * @return a filter that accepts files named Rakefile or matching the glob pattern, *.gemspec -60 */ -61 @Override -62 protected FileFilter getFileFilter() { -63 return FILTER; -64 } -65 -66 @Override -67 protected void initializeFileTypeAnalyzer() throws Exception { -68 // NO-OP -69 } -70 -71 /** -72 * Returns the name of the analyzer. -73 * -74 * @return the name of the analyzer. -75 */ -76 @Override -77 public String getName() { -78 return ANALYZER_NAME; -79 } -80 -81 /** -82 * Returns the phase that the analyzer is intended to run in. -83 * -84 * @return the phase that the analyzer is intended to run in. -85 */ -86 @Override -87 public AnalysisPhase getAnalysisPhase() { -88 return ANALYSIS_PHASE; -89 } -90 -91 /** -92 * Returns the key used in the properties file to reference the analyzer's enabled property. -93 * -94 * @return the analyzer's enabled property setting key -95 */ -96 @Override -97 protected String getAnalyzerEnabledSettingKey() { -98 return Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED; -99 } -100 -101 /** -102 * The capture group #1 is the block variable. -103 */ -104 private static final Pattern GEMSPEC_BLOCK_INIT = -105 Pattern.compile("Gem::Specification\\.new\\s+?do\\s+?\\|(.+?)\\|"); -106 -107 @Override -108 protected void analyzeFileType(Dependency dependency, Engine engine) -109 throws AnalysisException { -110 String contents; -111 try { -112 contents = FileUtils.readFileToString(dependency.getActualFile()); -113 } catch (IOException e) { -114 throw new AnalysisException( -115 "Problem occurred while reading dependency file.", e); -116 } -117 final Matcher matcher = GEMSPEC_BLOCK_INIT.matcher(contents); -118 if (matcher.find()) { -119 contents = contents.substring(matcher.end()); -120 final String blockVariable = matcher.group(1); -121 final EvidenceCollection vendor = dependency.getVendorEvidence(); -122 addStringEvidence(vendor, contents, blockVariable, "author", Confidence.HIGHEST); -123 addListEvidence(vendor, contents, blockVariable, "authors", Confidence.HIGHEST); -124 final String email = addStringEvidence(vendor, contents, blockVariable, EMAIL, Confidence.MEDIUM); -125 if (email.isEmpty()) { -126 addListEvidence(vendor, contents, blockVariable, EMAIL, Confidence.MEDIUM); -127 } -128 addStringEvidence(vendor, contents, blockVariable, "homepage", Confidence.MEDIUM); -129 final EvidenceCollection product = dependency.getProductEvidence(); -130 final String name = addStringEvidence(product, contents, blockVariable, "name", Confidence.HIGHEST); -131 if (!name.isEmpty()) { -132 vendor.addEvidence(GEMSPEC, "name_project", name + "_project", Confidence.LOW); -133 } -134 addStringEvidence(product, contents, blockVariable, "summary", Confidence.LOW); -135 addStringEvidence(dependency.getVersionEvidence(), contents, blockVariable, "version", Confidence.HIGHEST); -136 } -137 } -138 -139 private void addListEvidence(EvidenceCollection evidences, String contents, -140 String blockVariable, String field, Confidence confidence) { -141 final Matcher matcher = Pattern.compile( -142 String.format("\\s+?%s\\.%s\\s*?=\\s*?\\[(.*?)\\]", blockVariable, field)).matcher(contents); -143 if (matcher.find()) { -144 final String value = matcher.group(1).replaceAll("['\"]", " ").trim(); -145 evidences.addEvidence(GEMSPEC, field, value, confidence); -146 } -147 } -148 -149 private String addStringEvidence(EvidenceCollection evidences, String contents, -150 String blockVariable, String field, Confidence confidence) { -151 final Matcher matcher = Pattern.compile( -152 String.format("\\s+?%s\\.%s\\s*?=\\s*?(['\"])(.*?)\\1", blockVariable, field)).matcher(contents); -153 String value = ""; -154 if (matcher.find()) { -155 value = matcher.group(2); -156 evidences.addEvidence(GEMSPEC, field, value, confidence); -157 } -158 return value; -159 } -160 } +52 private static final String GEMSPEC = "gemspec"; +53 +54 private static final FileFilter FILTER = +55 FileFilterBuilder.newInstance().addExtensions(GEMSPEC).addFilenames("Rakefile").build(); +56 +57 private static final String EMAIL = "email"; +58 +59 /** +60 * @return a filter that accepts files named Rakefile or matching the glob pattern, *.gemspec +61 */ +62 @Override +63 protected FileFilter getFileFilter() { +64 return FILTER; +65 } +66 +67 @Override +68 protected void initializeFileTypeAnalyzer() throws Exception { +69 // NO-OP +70 } +71 +72 /** +73 * Returns the name of the analyzer. +74 * +75 * @return the name of the analyzer. +76 */ +77 @Override +78 public String getName() { +79 return ANALYZER_NAME; +80 } +81 +82 /** +83 * Returns the phase that the analyzer is intended to run in. +84 * +85 * @return the phase that the analyzer is intended to run in. +86 */ +87 @Override +88 public AnalysisPhase getAnalysisPhase() { +89 return ANALYSIS_PHASE; +90 } +91 +92 /** +93 * Returns the key used in the properties file to reference the analyzer's enabled property. +94 * +95 * @return the analyzer's enabled property setting key +96 */ +97 @Override +98 protected String getAnalyzerEnabledSettingKey() { +99 return Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED; +100 } +101 +102 /** +103 * The capture group #1 is the block variable. +104 */ +105 private static final Pattern GEMSPEC_BLOCK_INIT = +106 Pattern.compile("Gem::Specification\\.new\\s+?do\\s+?\\|(.+?)\\|"); +107 +108 @Override +109 protected void analyzeFileType(Dependency dependency, Engine engine) +110 throws AnalysisException { +111 String contents; +112 try { +113 contents = FileUtils.readFileToString(dependency.getActualFile()); +114 } catch (IOException e) { +115 throw new AnalysisException( +116 "Problem occurred while reading dependency file.", e); +117 } +118 final Matcher matcher = GEMSPEC_BLOCK_INIT.matcher(contents); +119 if (matcher.find()) { +120 contents = contents.substring(matcher.end()); +121 final String blockVariable = matcher.group(1); +122 final EvidenceCollection vendor = dependency.getVendorEvidence(); +123 addStringEvidence(vendor, contents, blockVariable, "author", Confidence.HIGHEST); +124 addListEvidence(vendor, contents, blockVariable, "authors", Confidence.HIGHEST); +125 final String email = addStringEvidence(vendor, contents, blockVariable, EMAIL, Confidence.MEDIUM); +126 if (email.isEmpty()) { +127 addListEvidence(vendor, contents, blockVariable, EMAIL, Confidence.MEDIUM); +128 } +129 addStringEvidence(vendor, contents, blockVariable, "homepage", Confidence.MEDIUM); +130 final EvidenceCollection product = dependency.getProductEvidence(); +131 final String name = addStringEvidence(product, contents, blockVariable, "name", Confidence.HIGHEST); +132 if (!name.isEmpty()) { +133 vendor.addEvidence(GEMSPEC, "name_project", name + "_project", Confidence.LOW); +134 } +135 addStringEvidence(product, contents, blockVariable, "summary", Confidence.LOW); +136 addStringEvidence(dependency.getVersionEvidence(), contents, blockVariable, "version", Confidence.HIGHEST); +137 } +138 } +139 +140 private void addListEvidence(EvidenceCollection evidences, String contents, +141 String blockVariable, String field, Confidence confidence) { +142 final Matcher matcher = Pattern.compile( +143 String.format("\\s+?%s\\.%s\\s*?=\\s*?\\[(.*?)\\]", blockVariable, field)).matcher(contents); +144 if (matcher.find()) { +145 final String value = matcher.group(1).replaceAll("['\"]", " ").trim(); +146 evidences.addEvidence(GEMSPEC, field, value, confidence); +147 } +148 } +149 +150 private String addStringEvidence(EvidenceCollection evidences, String contents, +151 String blockVariable, String field, Confidence confidence) { +152 final Matcher matcher = Pattern.compile( +153 String.format("\\s+?%s\\.%s\\s*?=\\s*?(['\"])(.*?)\\1", blockVariable, field)).matcher(contents); +154 String value = ""; +155 if (matcher.find()) { +156 value = matcher.group(2); +157 evidences.addEvidence(GEMSPEC, field, value, confidence); +158 } +159 return value; +160 } +161 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/exception/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/exception/package-frame.html index 172bdb727..5628f6315 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/exception/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/exception/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.analyzer.exception + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.analyzer.exception diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/exception/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/exception/package-summary.html index 190639f36..c2dcde610 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/exception/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/exception/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.analyzer.exception + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.analyzer.exception diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/package-frame.html index e7ed6a307..ae4496bba 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.analyzer + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.analyzer @@ -104,6 +104,9 @@
  • PythonPackageAnalyzer +
  • +
  • + RubyBundleAuditAnalyzer
  • RubyGemspecAnalyzer diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/package-summary.html index 58be1c395..9c9b77214 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/analyzer/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.analyzer + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.analyzer @@ -184,6 +184,11 @@
  • + + + - - - + + +
    PythonPackageAnalyzer
    + RubyBundleAuditAnalyzer +
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/central/CentralSearch.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/central/CentralSearch.html index d5d762529..95f926224 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/central/CentralSearch.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/central/CentralSearch.html @@ -98,7 +98,7 @@ 90 91 final URL url = new URL(rootURL + String.format("?q=1:\"%s\"&wt=xml", sha1)); 92 -93 LOGGER.debug("Searching Central url {}", url.toString()); +93 LOGGER.debug("Searching Central url {}", url); 94 95 // Determine if we need to use a proxy. The rules: 96 // 1) If the proxy is set, AND the setting is set to true, use the proxy diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/central/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/central/package-frame.html index ebb3527e6..ca0b7a1e1 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/central/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/central/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.central + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.central diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/central/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/central/package-summary.html index 6c1620fe2..be5b904fd 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/central/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/central/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.central + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.central diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/composer/ComposerException.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/composer/ComposerException.html index 087f8e3d4..4ecd7dd23 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/composer/ComposerException.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/composer/ComposerException.html @@ -33,31 +33,36 @@ 25 public class ComposerException extends RuntimeException { 26 27 /** -28 * Creates a ComposerException with default message. +28 * The serial version UID for serialization. 29 */ -30 public ComposerException() { -31 super(); -32 } -33 -34 /** -35 * Creates a ComposerException with the specified message. -36 * -37 * @param message the exception message -38 */ -39 public ComposerException(String message) { -40 super(message); -41 } -42 -43 /** -44 * Creates a Composer exception with the specified message and cause. -45 * -46 * @param message the message -47 * @param cause the underlying cause -48 */ -49 public ComposerException(String message, Throwable cause) { -50 super(message, cause); -51 } -52 } +30 private static final long serialVersionUID = 1L; +31 +32 /** +33 * Creates a ComposerException with default message. +34 */ +35 public ComposerException() { +36 super(); +37 } +38 +39 /** +40 * Creates a ComposerException with the specified message. +41 * +42 * @param message the exception message +43 */ +44 public ComposerException(String message) { +45 super(message); +46 } +47 +48 /** +49 * Creates a Composer exception with the specified message and cause. +50 * +51 * @param message the message +52 * @param cause the underlying cause +53 */ +54 public ComposerException(String message, Throwable cause) { +55 super(message, cause); +56 } +57 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/composer/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/composer/package-frame.html index 66039b0fd..d8f161bf6 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/composer/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/composer/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.composer + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.composer diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/composer/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/composer/package-summary.html index 3ef2ed0b4..20ff6fa52 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/composer/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/composer/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.composer + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.composer diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.html index 4ba9888f2..0ac991659 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.html @@ -157,185 +157,177 @@ 149 * 150 * @return the CPE Analyzer. 151 */ -152 @SuppressWarnings("unchecked") -153 private Analyzer createIndexingAnalyzer() { -154 final Map<String, Analyzer> fieldAnalyzers = new HashMap<String, Analyzer>(); -155 fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer()); -156 return new PerFieldAnalyzerWrapper(new FieldAnalyzer(LuceneUtils.CURRENT_VERSION), fieldAnalyzers); -157 } -158 -159 /** -160 * Creates an Analyzer for searching the CPE Index. -161 * -162 * @return the CPE Analyzer. -163 */ -164 @SuppressWarnings("unchecked") -165 private Analyzer createSearchingAnalyzer() { -166 final Map<String, Analyzer> fieldAnalyzers = new HashMap<String, Analyzer>(); -167 fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer()); -168 productSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION); -169 vendorSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION); -170 fieldAnalyzers.put(Fields.PRODUCT, productSearchFieldAnalyzer); -171 fieldAnalyzers.put(Fields.VENDOR, vendorSearchFieldAnalyzer); -172 -173 return new PerFieldAnalyzerWrapper(new FieldAnalyzer(LuceneUtils.CURRENT_VERSION), fieldAnalyzers); -174 } -175 -176 /** -177 * Saves a CPE IndexEntry into the Lucene index. -178 * -179 * @param vendor the vendor to index -180 * @param product the product to index -181 * @param indexWriter the index writer to write the entry into -182 * @throws CorruptIndexException is thrown if the index is corrupt -183 * @throws IOException is thrown if an IOException occurs -184 */ -185 public void saveEntry(String vendor, String product, IndexWriter indexWriter) throws CorruptIndexException, IOException { -186 final Document doc = new Document(); -187 final Field v = new TextField(Fields.VENDOR, vendor, Field.Store.YES); -188 final Field p = new TextField(Fields.PRODUCT, product, Field.Store.YES); -189 doc.add(v); -190 doc.add(p); -191 indexWriter.addDocument(doc); -192 } -193 -194 /** -195 * Closes the CPE Index. -196 */ -197 public void close() { -198 if (searchingAnalyzer != null) { -199 searchingAnalyzer.close(); -200 searchingAnalyzer = null; -201 } -202 if (indexReader != null) { -203 try { -204 indexReader.close(); -205 } catch (IOException ex) { -206 LOGGER.trace("", ex); -207 } -208 indexReader = null; -209 } -210 queryParser = null; -211 indexSearcher = null; -212 if (index != null) { -213 index.close(); -214 index = null; -215 } -216 openState = false; -217 } -218 -219 /** -220 * Builds the CPE Lucene Index based off of the data within the CveDB. -221 * -222 * @param cve the data base containing the CPE data -223 * @throws IndexException thrown if there is an issue creating the index -224 */ -225 private void buildIndex(CveDB cve) throws IndexException { -226 Analyzer analyzer = null; -227 IndexWriter indexWriter = null; -228 try { -229 analyzer = createIndexingAnalyzer(); -230 final IndexWriterConfig conf = new IndexWriterConfig(LuceneUtils.CURRENT_VERSION, analyzer); -231 indexWriter = new IndexWriter(index, conf); -232 try { -233 final Set<Pair<String, String>> data = cve.getVendorProductList(); -234 for (Pair<String, String> pair : data) { -235 saveEntry(pair.getLeft(), pair.getRight(), indexWriter); -236 } -237 } catch (DatabaseException ex) { -238 LOGGER.debug("", ex); -239 throw new IndexException("Error reading CPE data", ex); -240 } -241 } catch (CorruptIndexException ex) { -242 throw new IndexException("Unable to close an in-memory index", ex); -243 } catch (IOException ex) { -244 throw new IndexException("Unable to close an in-memory index", ex); -245 } finally { -246 if (indexWriter != null) { -247 try { -248 try { -249 indexWriter.commit(); -250 } finally { -251 indexWriter.close(true); -252 } -253 } catch (CorruptIndexException ex) { -254 throw new IndexException("Unable to close an in-memory index", ex); -255 } catch (IOException ex) { -256 throw new IndexException("Unable to close an in-memory index", ex); -257 } -258 if (analyzer != null) { -259 analyzer.close(); -260 } -261 } +152 private Analyzer createIndexingAnalyzer() { +153 final Map<String, Analyzer> fieldAnalyzers = new HashMap<String, Analyzer>(); +154 fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer()); +155 return new PerFieldAnalyzerWrapper(new FieldAnalyzer(LuceneUtils.CURRENT_VERSION), fieldAnalyzers); +156 } +157 +158 /** +159 * Creates an Analyzer for searching the CPE Index. +160 * +161 * @return the CPE Analyzer. +162 */ +163 private Analyzer createSearchingAnalyzer() { +164 final Map<String, Analyzer> fieldAnalyzers = new HashMap<String, Analyzer>(); +165 fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer()); +166 productSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION); +167 vendorSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION); +168 fieldAnalyzers.put(Fields.PRODUCT, productSearchFieldAnalyzer); +169 fieldAnalyzers.put(Fields.VENDOR, vendorSearchFieldAnalyzer); +170 +171 return new PerFieldAnalyzerWrapper(new FieldAnalyzer(LuceneUtils.CURRENT_VERSION), fieldAnalyzers); +172 } +173 +174 /** +175 * Closes the CPE Index. +176 */ +177 public void close() { +178 if (searchingAnalyzer != null) { +179 searchingAnalyzer.close(); +180 searchingAnalyzer = null; +181 } +182 if (indexReader != null) { +183 try { +184 indexReader.close(); +185 } catch (IOException ex) { +186 LOGGER.trace("", ex); +187 } +188 indexReader = null; +189 } +190 queryParser = null; +191 indexSearcher = null; +192 if (index != null) { +193 index.close(); +194 index = null; +195 } +196 openState = false; +197 } +198 +199 /** +200 * Builds the CPE Lucene Index based off of the data within the CveDB. +201 * +202 * @param cve the data base containing the CPE data +203 * @throws IndexException thrown if there is an issue creating the index +204 */ +205 private void buildIndex(CveDB cve) throws IndexException { +206 Analyzer analyzer = null; +207 IndexWriter indexWriter = null; +208 try { +209 analyzer = createIndexingAnalyzer(); +210 final IndexWriterConfig conf = new IndexWriterConfig(LuceneUtils.CURRENT_VERSION, analyzer); +211 indexWriter = new IndexWriter(index, conf); +212 try { +213 // Tip: reuse the Document and Fields for performance... +214 // See "Re-use Document and Field instances" from +215 // http://wiki.apache.org/lucene-java/ImproveIndexingSpeed +216 final Document doc = new Document(); +217 final Field v = new TextField(Fields.VENDOR, Fields.VENDOR, Field.Store.YES); +218 final Field p = new TextField(Fields.PRODUCT, Fields.PRODUCT, Field.Store.YES); +219 doc.add(v); +220 doc.add(p); +221 +222 final Set<Pair<String, String>> data = cve.getVendorProductList(); +223 for (Pair<String, String> pair : data) { +224 v.setStringValue(pair.getLeft()); +225 p.setStringValue(pair.getRight()); +226 indexWriter.addDocument(doc); +227 } +228 } catch (DatabaseException ex) { +229 LOGGER.debug("", ex); +230 throw new IndexException("Error reading CPE data", ex); +231 } +232 } catch (CorruptIndexException ex) { +233 throw new IndexException("Unable to close an in-memory index", ex); +234 } catch (IOException ex) { +235 throw new IndexException("Unable to close an in-memory index", ex); +236 } finally { +237 if (indexWriter != null) { +238 try { +239 try { +240 indexWriter.commit(); +241 } finally { +242 indexWriter.close(true); +243 } +244 } catch (CorruptIndexException ex) { +245 throw new IndexException("Unable to close an in-memory index", ex); +246 } catch (IOException ex) { +247 throw new IndexException("Unable to close an in-memory index", ex); +248 } +249 if (analyzer != null) { +250 analyzer.close(); +251 } +252 } +253 } +254 } +255 +256 /** +257 * Resets the searching analyzers +258 */ +259 private void resetSearchingAnalyzer() { +260 if (productSearchFieldAnalyzer != null) { +261 productSearchFieldAnalyzer.clear(); 262 } -263 } -264 -265 /** -266 * Resets the searching analyzers -267 */ -268 private void resetSearchingAnalyzer() { -269 if (productSearchFieldAnalyzer != null) { -270 productSearchFieldAnalyzer.clear(); -271 } -272 if (vendorSearchFieldAnalyzer != null) { -273 vendorSearchFieldAnalyzer.clear(); -274 } -275 } -276 -277 /** -278 * Searches the index using the given search string. -279 * -280 * @param searchString the query text -281 * @param maxQueryResults the maximum number of documents to return -282 * @return the TopDocs found by the search -283 * @throws ParseException thrown when the searchString is invalid -284 * @throws IOException is thrown if there is an issue with the underlying Index -285 */ -286 public TopDocs search(String searchString, int maxQueryResults) throws ParseException, IOException { -287 if (searchString == null || searchString.trim().isEmpty()) { -288 throw new ParseException("Query is null or empty"); -289 } -290 final Query query = queryParser.parse(searchString); -291 return indexSearcher.search(query, maxQueryResults); -292 } -293 -294 /** -295 * Searches the index using the given query. -296 * -297 * @param query the query used to search the index -298 * @param maxQueryResults the max number of results to return -299 * @return the TopDocs found be the query -300 * @throws CorruptIndexException thrown if the Index is corrupt -301 * @throws IOException thrown if there is an IOException -302 */ -303 public TopDocs search(Query query, int maxQueryResults) throws CorruptIndexException, IOException { -304 resetSearchingAnalyzer(); -305 return indexSearcher.search(query, maxQueryResults); -306 } -307 -308 /** -309 * Retrieves a document from the Index. -310 * -311 * @param documentId the id of the document to retrieve -312 * @return the Document -313 * @throws IOException thrown if there is an IOException -314 */ -315 public Document getDocument(int documentId) throws IOException { -316 return indexSearcher.doc(documentId); -317 } -318 -319 /** -320 * Returns the number of CPE entries stored in the index. -321 * -322 * @return the number of CPE entries stored in the index -323 */ -324 public int numDocs() { -325 if (indexReader == null) { -326 return -1; -327 } -328 return indexReader.numDocs(); -329 } -330 } +263 if (vendorSearchFieldAnalyzer != null) { +264 vendorSearchFieldAnalyzer.clear(); +265 } +266 } +267 +268 /** +269 * Searches the index using the given search string. +270 * +271 * @param searchString the query text +272 * @param maxQueryResults the maximum number of documents to return +273 * @return the TopDocs found by the search +274 * @throws ParseException thrown when the searchString is invalid +275 * @throws IOException is thrown if there is an issue with the underlying Index +276 */ +277 public TopDocs search(String searchString, int maxQueryResults) throws ParseException, IOException { +278 if (searchString == null || searchString.trim().isEmpty()) { +279 throw new ParseException("Query is null or empty"); +280 } +281 LOGGER.debug(searchString); +282 final Query query = queryParser.parse(searchString); +283 return search(query, maxQueryResults); +284 } +285 +286 /** +287 * Searches the index using the given query. +288 * +289 * @param query the query used to search the index +290 * @param maxQueryResults the max number of results to return +291 * @return the TopDocs found be the query +292 * @throws CorruptIndexException thrown if the Index is corrupt +293 * @throws IOException thrown if there is an IOException +294 */ +295 public TopDocs search(Query query, int maxQueryResults) throws CorruptIndexException, IOException { +296 resetSearchingAnalyzer(); +297 return indexSearcher.search(query, maxQueryResults); +298 } +299 +300 /** +301 * Retrieves a document from the Index. +302 * +303 * @param documentId the id of the document to retrieve +304 * @return the Document +305 * @throws IOException thrown if there is an IOException +306 */ +307 public Document getDocument(int documentId) throws IOException { +308 return indexSearcher.doc(documentId); +309 } +310 +311 /** +312 * Returns the number of CPE entries stored in the index. +313 * +314 * @return the number of CPE entries stored in the index +315 */ +316 public int numDocs() { +317 if (indexReader == null) { +318 return -1; +319 } +320 return indexReader.numDocs(); +321 } +322 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/IndexEntry.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/IndexEntry.html index daf3733bc..77af07139 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/IndexEntry.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/IndexEntry.html @@ -56,7 +56,7 @@ 48 */ 49 public String getDocumentId() { 50 if (documentId == null && vendor != null && product != null) { -51 documentId = vendor + ":" + product; +51 documentId = vendor + ':' + product; 52 } 53 return documentId; 54 } diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/package-frame.html index 8ad0c8b2e..a3f3dc3a7 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.cpe + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.cpe diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/package-summary.html index 4c6ecd2ff..4dbff5cec 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/cpe/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.cpe + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.cpe diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/cwe/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/cwe/package-frame.html index 5d8003d08..234f05cc3 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/cwe/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/cwe/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.cwe + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.cwe diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/cwe/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/cwe/package-summary.html index 8e552e2c7..81db238fb 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/cwe/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/cwe/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.cwe + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.cwe diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/lucene/LuceneUtils.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/lucene/LuceneUtils.html index 3961455fe..c0079b677 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/lucene/LuceneUtils.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/lucene/LuceneUtils.html @@ -85,31 +85,32 @@ 77 case '*': 78 case '?': 79 case ':': -80 case '\\': //it is supposed to fall through here -81 buf.append('\\'); -82 default: -83 buf.append(c); -84 break; -85 } -86 } -87 } -88 -89 /** -90 * Escapes the text passed in so that it is treated as data instead of control characters. -91 * -92 * @param text data to be escaped -93 * @return the escaped text. -94 */ -95 public static String escapeLuceneQuery(final CharSequence text) { -96 if (text == null) { -97 return null; -98 } -99 final int size = text.length() << 1; -100 final StringBuilder buf = new StringBuilder(size); -101 appendEscapedLuceneQuery(buf, text); -102 return buf.toString(); -103 } -104 } +80 case '/': +81 case '\\': //it is supposed to fall through here +82 buf.append('\\'); +83 default: +84 buf.append(c); +85 break; +86 } +87 } +88 } +89 +90 /** +91 * Escapes the text passed in so that it is treated as data instead of control characters. +92 * +93 * @param text data to be escaped +94 * @return the escaped text. +95 */ +96 public static String escapeLuceneQuery(final CharSequence text) { +97 if (text == null) { +98 return null; +99 } +100 final int size = text.length() << 1; +101 final StringBuilder buf = new StringBuilder(size); +102 appendEscapedLuceneQuery(buf, text); +103 return buf.toString(); +104 } +105 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/lucene/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/lucene/package-frame.html index a946a7687..b7c857f5c 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/lucene/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/lucene/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.lucene + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.lucene diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/lucene/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/lucene/package-summary.html index fa10e8008..322bd1423 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/lucene/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/lucene/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.lucene + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.lucene diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/MavenArtifact.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/MavenArtifact.html index f7785fb88..ae7153b9e 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/MavenArtifact.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/MavenArtifact.html @@ -102,13 +102,13 @@ 94 } 95 if (jarAvailable) { 96 //org/springframework/spring-core/3.2.0.RELEASE/spring-core-3.2.0.RELEASE.pom -97 this.artifactUrl = base + groupId.replace('.', '/') + "/" + artifactId + "/" -98 + version + "/" + artifactId + "-" + version + ".jar"; +97 this.artifactUrl = base + groupId.replace('.', '/') + '/' + artifactId + '/' +98 + version + '/' + artifactId + '-' + version + ".jar"; 99 } 100 if (pomAvailable) { 101 //org/springframework/spring-core/3.2.0.RELEASE/spring-core-3.2.0.RELEASE.pom -102 this.pomUrl = base + groupId.replace('.', '/') + "/" + artifactId + "/" -103 + version + "/" + artifactId + "-" + version + ".pom"; +102 this.pomUrl = base + groupId.replace('.', '/') + '/' + artifactId + '/' +103 + version + '/' + artifactId + '-' + version + ".pom"; 104 } 105 } 106 diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/NexusSearch.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/NexusSearch.html index e0cb9e61f..90af5b8ea 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/NexusSearch.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/NexusSearch.html @@ -71,7 +71,7 @@ 63 this.rootURL = rootURL; 64 try { 65 if (null != Settings.getString(Settings.KEYS.PROXY_SERVER) -66 && Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY)) { +66 && Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY)) { 67 useProxy = true; 68 LOGGER.debug("Using proxy"); 69 } else { diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/package-frame.html index 447aac03b..1e6d9a5a2 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.nexus + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.nexus diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/package-summary.html index eb60a38af..94292924c 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nexus/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.nexus + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.nexus diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nuget/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nuget/package-frame.html index 1b7b9e827..59ddacc7d 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nuget/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nuget/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.nuget + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.nuget diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nuget/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nuget/package-summary.html index aafaf076a..bcd4af93d 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nuget/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nuget/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.nuget + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.nuget diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.html index d61c01ae9..937de68c8 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.html @@ -25,350 +25,353 @@ 17 */ 18 package org.owasp.dependencycheck.data.nvdcve; 19 -20 import java.io.BufferedReader; -21 import java.io.File; -22 import java.io.IOException; -23 import java.io.InputStream; -24 import java.io.InputStreamReader; -25 import java.sql.CallableStatement; -26 import java.sql.Connection; -27 import java.sql.Driver; -28 import java.sql.DriverManager; -29 import java.sql.ResultSet; -30 import java.sql.SQLException; -31 import java.sql.Statement; -32 import org.owasp.dependencycheck.utils.DBUtils; -33 import org.owasp.dependencycheck.utils.Settings; -34 import org.slf4j.Logger; -35 import org.slf4j.LoggerFactory; -36 -37 /** -38 * Loads the configured database driver and returns the database connection. If the embedded H2 database is used obtaining a -39 * connection will ensure the database file exists and that the appropriate table structure has been created. -40 * -41 * @author Jeremy Long -42 */ -43 public final class ConnectionFactory { -44 -45 /** -46 * The Logger. -47 */ -48 private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionFactory.class); -49 /** -50 * The version of the current DB Schema. -51 */ -52 public static final String DB_SCHEMA_VERSION = Settings.getString(Settings.KEYS.DB_VERSION); -53 /** -54 * Resource location for SQL file used to create the database schema. -55 */ -56 public static final String DB_STRUCTURE_RESOURCE = "data/initialize.sql"; -57 /** -58 * Resource location for SQL file used to create the database schema. -59 */ -60 public static final String DB_STRUCTURE_UPDATE_RESOURCE = "data/upgrade_%s.sql"; -61 /** -62 * The database driver used to connect to the database. -63 */ -64 private static Driver driver = null; -65 /** -66 * The database connection string. -67 */ -68 private static String connectionString = null; -69 /** -70 * The username to connect to the database. -71 */ -72 private static String userName = null; -73 /** -74 * The password for the database. -75 */ -76 private static String password = null; -77 +20 import java.io.File; +21 import java.io.IOException; +22 import java.io.InputStream; +23 import java.sql.CallableStatement; +24 import java.sql.Connection; +25 import java.sql.Driver; +26 import java.sql.DriverManager; +27 import java.sql.ResultSet; +28 import java.sql.SQLException; +29 import java.sql.Statement; +30 import org.apache.commons.io.IOUtils; +31 import org.owasp.dependencycheck.utils.DBUtils; +32 import org.owasp.dependencycheck.utils.DependencyVersion; +33 import org.owasp.dependencycheck.utils.DependencyVersionUtil; +34 import org.owasp.dependencycheck.utils.Settings; +35 import org.slf4j.Logger; +36 import org.slf4j.LoggerFactory; +37 +38 /** +39 * Loads the configured database driver and returns the database connection. If the embedded H2 database is used obtaining a +40 * connection will ensure the database file exists and that the appropriate table structure has been created. +41 * +42 * @author Jeremy Long +43 */ +44 public final class ConnectionFactory { +45 +46 /** +47 * The Logger. +48 */ +49 private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionFactory.class); +50 /** +51 * The version of the current DB Schema. +52 */ +53 public static final String DB_SCHEMA_VERSION = Settings.getString(Settings.KEYS.DB_VERSION); +54 /** +55 * Resource location for SQL file used to create the database schema. +56 */ +57 public static final String DB_STRUCTURE_RESOURCE = "data/initialize.sql"; +58 /** +59 * Resource location for SQL file used to create the database schema. +60 */ +61 public static final String DB_STRUCTURE_UPDATE_RESOURCE = "data/upgrade_%s.sql"; +62 /** +63 * The URL that discusses upgrading non-H2 databases. +64 */ +65 public static final String UPGRADE_HELP_URL = "http://jeremylong.github.io/DependencyCheck/data/upgrade.html"; +66 /** +67 * The database driver used to connect to the database. +68 */ +69 private static Driver driver = null; +70 /** +71 * The database connection string. +72 */ +73 private static String connectionString = null; +74 /** +75 * The username to connect to the database. +76 */ +77 private static String userName = null; 78 /** -79 * Private constructor for this factory class; no instance is ever needed. +79 * The password for the database. 80 */ -81 private ConnectionFactory() { -82 } -83 -84 /** -85 * Initializes the connection factory. Ensuring that the appropriate drivers are loaded and that a connection can be made -86 * successfully. -87 * -88 * @throws DatabaseException thrown if we are unable to connect to the database -89 */ -90 public static synchronized void initialize() throws DatabaseException { -91 //this only needs to be called once. -92 if (connectionString != null) { -93 return; -94 } -95 Connection conn = null; -96 try { -97 //load the driver if necessary -98 final String driverName = Settings.getString(Settings.KEYS.DB_DRIVER_NAME, ""); -99 if (!driverName.isEmpty()) { //likely need to load the correct driver -100 LOGGER.debug("Loading driver: {}", driverName); -101 final String driverPath = Settings.getString(Settings.KEYS.DB_DRIVER_PATH, ""); -102 try { -103 if (!driverPath.isEmpty()) { -104 LOGGER.debug("Loading driver from: {}", driverPath); -105 driver = DriverLoader.load(driverName, driverPath); -106 } else { -107 driver = DriverLoader.load(driverName); -108 } -109 } catch (DriverLoadException ex) { -110 LOGGER.debug("Unable to load database driver", ex); -111 throw new DatabaseException("Unable to load database driver"); -112 } -113 } -114 userName = Settings.getString(Settings.KEYS.DB_USER, "dcuser"); -115 //yes, yes - hard-coded password - only if there isn't one in the properties file. -116 password = Settings.getString(Settings.KEYS.DB_PASSWORD, "DC-Pass1337!"); -117 try { -118 connectionString = Settings.getConnectionString( -119 Settings.KEYS.DB_CONNECTION_STRING, -120 Settings.KEYS.DB_FILE_NAME); -121 } catch (IOException ex) { -122 LOGGER.debug( -123 "Unable to retrieve the database connection string", ex); -124 throw new DatabaseException("Unable to retrieve the database connection string"); -125 } -126 boolean shouldCreateSchema = false; -127 try { -128 if (connectionString.startsWith("jdbc:h2:file:")) { //H2 -129 shouldCreateSchema = !h2DataFileExists(); -130 LOGGER.debug("Need to create DB Structure: {}", shouldCreateSchema); -131 } -132 } catch (IOException ioex) { -133 LOGGER.debug("Unable to verify database exists", ioex); -134 throw new DatabaseException("Unable to verify database exists"); -135 } -136 LOGGER.debug("Loading database connection"); -137 LOGGER.debug("Connection String: {}", connectionString); -138 LOGGER.debug("Database User: {}", userName); -139 -140 try { -141 conn = DriverManager.getConnection(connectionString, userName, password); -142 } catch (SQLException ex) { -143 if (ex.getMessage().contains("java.net.UnknownHostException") && connectionString.contains("AUTO_SERVER=TRUE;")) { -144 connectionString = connectionString.replace("AUTO_SERVER=TRUE;", ""); -145 try { -146 conn = DriverManager.getConnection(connectionString, userName, password); -147 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString); -148 LOGGER.debug( -149 "Unable to start the database in server mode; reverting to single user mode"); -150 } catch (SQLException sqlex) { -151 LOGGER.debug("Unable to connect to the database", ex); -152 throw new DatabaseException("Unable to connect to the database"); -153 } -154 } else { -155 LOGGER.debug("Unable to connect to the database", ex); -156 throw new DatabaseException("Unable to connect to the database"); -157 } -158 } -159 -160 if (shouldCreateSchema) { -161 try { -162 createTables(conn); -163 } catch (DatabaseException dex) { -164 LOGGER.debug("", dex); -165 throw new DatabaseException("Unable to create the database structure"); -166 } -167 } -168 try { -169 ensureSchemaVersion(conn); -170 } catch (DatabaseException dex) { -171 LOGGER.debug("", dex); -172 throw new DatabaseException("Database schema does not match this version of dependency-check", dex); -173 } -174 } finally { -175 if (conn != null) { -176 try { -177 conn.close(); -178 } catch (SQLException ex) { -179 LOGGER.debug("An error occurred closing the connection", ex); -180 } -181 } -182 } -183 } -184 -185 /** -186 * Cleans up resources and unloads any registered database drivers. This needs to be called to ensure the driver is -187 * unregistered prior to the finalize method being called as during shutdown the class loader used to load the driver may be -188 * unloaded prior to the driver being de-registered. -189 */ -190 public static synchronized void cleanup() { -191 if (driver != null) { -192 try { -193 DriverManager.deregisterDriver(driver); -194 } catch (SQLException ex) { -195 LOGGER.debug("An error occurred unloading the database driver", ex); -196 } catch (Throwable unexpected) { -197 LOGGER.debug( -198 "An unexpected throwable occurred unloading the database driver", unexpected); -199 } -200 driver = null; -201 } -202 connectionString = null; -203 userName = null; -204 password = null; -205 } -206 -207 /** -208 * Constructs a new database connection object per the database configuration. -209 * -210 * @return a database connection object -211 * @throws DatabaseException thrown if there is an exception loading the database connection -212 */ -213 public static Connection getConnection() throws DatabaseException { -214 initialize(); -215 Connection conn = null; -216 try { -217 conn = DriverManager.getConnection(connectionString, userName, password); -218 } catch (SQLException ex) { -219 LOGGER.debug("", ex); -220 throw new DatabaseException("Unable to connect to the database"); -221 } -222 return conn; -223 } -224 -225 /** -226 * Determines if the H2 database file exists. If it does not exist then the data structure will need to be created. -227 * -228 * @return true if the H2 database file does not exist; otherwise false -229 * @throws IOException thrown if the data directory does not exist and cannot be created -230 */ -231 private static boolean h2DataFileExists() throws IOException { -232 final File dir = Settings.getDataDirectory(); -233 final String fileName = Settings.getString(Settings.KEYS.DB_FILE_NAME); -234 final File file = new File(dir, fileName); -235 return file.exists(); -236 } -237 -238 /** -239 * Creates the database structure (tables and indexes) to store the CVE data. -240 * -241 * @param conn the database connection -242 * @throws DatabaseException thrown if there is a Database Exception -243 */ -244 private static void createTables(Connection conn) throws DatabaseException { -245 LOGGER.debug("Creating database structure"); -246 InputStream is; -247 InputStreamReader reader; -248 BufferedReader in = null; -249 try { -250 is = ConnectionFactory.class.getClassLoader().getResourceAsStream(DB_STRUCTURE_RESOURCE); -251 reader = new InputStreamReader(is, "UTF-8"); -252 in = new BufferedReader(reader); -253 final StringBuilder sb = new StringBuilder(2110); -254 String tmp; -255 while ((tmp = in.readLine()) != null) { -256 sb.append(tmp); -257 } -258 Statement statement = null; -259 try { -260 statement = conn.createStatement(); -261 statement.execute(sb.toString()); -262 } catch (SQLException ex) { -263 LOGGER.debug("", ex); -264 throw new DatabaseException("Unable to create database statement", ex); -265 } finally { -266 DBUtils.closeStatement(statement); -267 } -268 } catch (IOException ex) { -269 throw new DatabaseException("Unable to create database schema", ex); -270 } finally { -271 if (in != null) { -272 try { -273 in.close(); -274 } catch (IOException ex) { -275 LOGGER.trace("", ex); -276 } -277 } -278 } -279 } -280 -281 /** -282 * Updates the database schema by loading the upgrade script for the version specified. The intended use is that if the -283 * current schema version is 2.9 then we would call updateSchema(conn, "2.9"). This would load the upgrade_2.9.sql file and -284 * execute it against the database. The upgrade script must update the 'version' in the properties table. -285 * -286 * @param conn the database connection object -287 * @param schema the current schema version that is being upgraded -288 * @throws DatabaseException thrown if there is an exception upgrading the database schema -289 */ -290 private static void updateSchema(Connection conn, String schema) throws DatabaseException { -291 LOGGER.debug("Updating database structure"); -292 InputStream is; -293 InputStreamReader reader; -294 BufferedReader in = null; -295 String updateFile = null; -296 try { -297 updateFile = String.format(DB_STRUCTURE_UPDATE_RESOURCE, schema); -298 is = ConnectionFactory.class.getClassLoader().getResourceAsStream(updateFile); -299 if (is == null) { -300 throw new DatabaseException(String.format("Unable to load update file '%s'", updateFile)); -301 } -302 reader = new InputStreamReader(is, "UTF-8"); -303 in = new BufferedReader(reader); -304 final StringBuilder sb = new StringBuilder(2110); -305 String tmp; -306 while ((tmp = in.readLine()) != null) { -307 sb.append(tmp); -308 } -309 Statement statement = null; -310 try { -311 statement = conn.createStatement(); -312 statement.execute(sb.toString()); -313 } catch (SQLException ex) { -314 LOGGER.debug("", ex); -315 throw new DatabaseException("Unable to update database schema", ex); -316 } finally { -317 DBUtils.closeStatement(statement); -318 } -319 } catch (IOException ex) { -320 final String msg = String.format("Upgrade SQL file does not exist: %s", updateFile); -321 throw new DatabaseException(msg, ex); -322 } finally { -323 if (in != null) { -324 try { -325 in.close(); -326 } catch (IOException ex) { -327 LOGGER.trace("", ex); -328 } -329 } -330 } -331 } -332 -333 /** -334 * Uses the provided connection to check the specified schema version within the database. -335 * -336 * @param conn the database connection object -337 * @throws DatabaseException thrown if the schema version is not compatible with this version of dependency-check -338 */ -339 private static void ensureSchemaVersion(Connection conn) throws DatabaseException { -340 ResultSet rs = null; -341 CallableStatement cs = null; -342 try { -343 //TODO convert this to use DatabaseProperties -344 cs = conn.prepareCall("SELECT value FROM properties WHERE id = 'version'"); -345 rs = cs.executeQuery(); -346 if (rs.next()) { -347 if (!DB_SCHEMA_VERSION.equals(rs.getString(1))) { +81 private static String password = null; +82 +83 /** +84 * Private constructor for this factory class; no instance is ever needed. +85 */ +86 private ConnectionFactory() { +87 } +88 +89 /** +90 * Initializes the connection factory. Ensuring that the appropriate drivers are loaded and that a connection can be made +91 * successfully. +92 * +93 * @throws DatabaseException thrown if we are unable to connect to the database +94 */ +95 public static synchronized void initialize() throws DatabaseException { +96 //this only needs to be called once. +97 if (connectionString != null) { +98 return; +99 } +100 Connection conn = null; +101 try { +102 //load the driver if necessary +103 final String driverName = Settings.getString(Settings.KEYS.DB_DRIVER_NAME, ""); +104 if (!driverName.isEmpty()) { //likely need to load the correct driver +105 LOGGER.debug("Loading driver: {}", driverName); +106 final String driverPath = Settings.getString(Settings.KEYS.DB_DRIVER_PATH, ""); +107 try { +108 if (!driverPath.isEmpty()) { +109 LOGGER.debug("Loading driver from: {}", driverPath); +110 driver = DriverLoader.load(driverName, driverPath); +111 } else { +112 driver = DriverLoader.load(driverName); +113 } +114 } catch (DriverLoadException ex) { +115 LOGGER.debug("Unable to load database driver", ex); +116 throw new DatabaseException("Unable to load database driver"); +117 } +118 } +119 userName = Settings.getString(Settings.KEYS.DB_USER, "dcuser"); +120 //yes, yes - hard-coded password - only if there isn't one in the properties file. +121 password = Settings.getString(Settings.KEYS.DB_PASSWORD, "DC-Pass1337!"); +122 try { +123 connectionString = Settings.getConnectionString( +124 Settings.KEYS.DB_CONNECTION_STRING, +125 Settings.KEYS.DB_FILE_NAME); +126 } catch (IOException ex) { +127 LOGGER.debug( +128 "Unable to retrieve the database connection string", ex); +129 throw new DatabaseException("Unable to retrieve the database connection string"); +130 } +131 boolean shouldCreateSchema = false; +132 try { +133 if (connectionString.startsWith("jdbc:h2:file:")) { //H2 +134 shouldCreateSchema = !h2DataFileExists(); +135 LOGGER.debug("Need to create DB Structure: {}", shouldCreateSchema); +136 } +137 } catch (IOException ioex) { +138 LOGGER.debug("Unable to verify database exists", ioex); +139 throw new DatabaseException("Unable to verify database exists"); +140 } +141 LOGGER.debug("Loading database connection"); +142 LOGGER.debug("Connection String: {}", connectionString); +143 LOGGER.debug("Database User: {}", userName); +144 +145 try { +146 conn = DriverManager.getConnection(connectionString, userName, password); +147 } catch (SQLException ex) { +148 if (ex.getMessage().contains("java.net.UnknownHostException") && connectionString.contains("AUTO_SERVER=TRUE;")) { +149 connectionString = connectionString.replace("AUTO_SERVER=TRUE;", ""); +150 try { +151 conn = DriverManager.getConnection(connectionString, userName, password); +152 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString); +153 LOGGER.debug( +154 "Unable to start the database in server mode; reverting to single user mode"); +155 } catch (SQLException sqlex) { +156 LOGGER.debug("Unable to connect to the database", ex); +157 throw new DatabaseException("Unable to connect to the database"); +158 } +159 } else { +160 LOGGER.debug("Unable to connect to the database", ex); +161 throw new DatabaseException("Unable to connect to the database"); +162 } +163 } +164 +165 if (shouldCreateSchema) { +166 try { +167 createTables(conn); +168 } catch (DatabaseException dex) { +169 LOGGER.debug("", dex); +170 throw new DatabaseException("Unable to create the database structure"); +171 } +172 } +173 try { +174 ensureSchemaVersion(conn); +175 } catch (DatabaseException dex) { +176 LOGGER.debug("", dex); +177 throw new DatabaseException("Database schema does not match this version of dependency-check", dex); +178 } +179 } finally { +180 if (conn != null) { +181 try { +182 conn.close(); +183 } catch (SQLException ex) { +184 LOGGER.debug("An error occurred closing the connection", ex); +185 } +186 } +187 } +188 } +189 +190 /** +191 * Cleans up resources and unloads any registered database drivers. This needs to be called to ensure the driver is +192 * unregistered prior to the finalize method being called as during shutdown the class loader used to load the driver may be +193 * unloaded prior to the driver being de-registered. +194 */ +195 public static synchronized void cleanup() { +196 if (driver != null) { +197 try { +198 DriverManager.deregisterDriver(driver); +199 } catch (SQLException ex) { +200 LOGGER.debug("An error occurred unloading the database driver", ex); +201 } catch (Throwable unexpected) { +202 LOGGER.debug( +203 "An unexpected throwable occurred unloading the database driver", unexpected); +204 } +205 driver = null; +206 } +207 connectionString = null; +208 userName = null; +209 password = null; +210 } +211 +212 /** +213 * Constructs a new database connection object per the database configuration. +214 * +215 * @return a database connection object +216 * @throws DatabaseException thrown if there is an exception loading the database connection +217 */ +218 public static Connection getConnection() throws DatabaseException { +219 initialize(); +220 Connection conn = null; +221 try { +222 conn = DriverManager.getConnection(connectionString, userName, password); +223 } catch (SQLException ex) { +224 LOGGER.debug("", ex); +225 throw new DatabaseException("Unable to connect to the database"); +226 } +227 return conn; +228 } +229 +230 /** +231 * Determines if the H2 database file exists. If it does not exist then the data structure will need to be created. +232 * +233 * @return true if the H2 database file does not exist; otherwise false +234 * @throws IOException thrown if the data directory does not exist and cannot be created +235 */ +236 private static boolean h2DataFileExists() throws IOException { +237 final File dir = Settings.getDataDirectory(); +238 final String fileName = Settings.getString(Settings.KEYS.DB_FILE_NAME); +239 final File file = new File(dir, fileName); +240 return file.exists(); +241 } +242 +243 /** +244 * Creates the database structure (tables and indexes) to store the CVE data. +245 * +246 * @param conn the database connection +247 * @throws DatabaseException thrown if there is a Database Exception +248 */ +249 private static void createTables(Connection conn) throws DatabaseException { +250 LOGGER.debug("Creating database structure"); +251 InputStream is = null; +252 try { +253 is = ConnectionFactory.class.getClassLoader().getResourceAsStream(DB_STRUCTURE_RESOURCE); +254 final String dbStructure = IOUtils.toString(is, "UTF-8"); +255 +256 Statement statement = null; +257 try { +258 statement = conn.createStatement(); +259 statement.execute(dbStructure); +260 } catch (SQLException ex) { +261 LOGGER.debug("", ex); +262 throw new DatabaseException("Unable to create database statement", ex); +263 } finally { +264 DBUtils.closeStatement(statement); +265 } +266 } catch (IOException ex) { +267 throw new DatabaseException("Unable to create database schema", ex); +268 } finally { +269 IOUtils.closeQuietly(is); +270 } +271 } +272 +273 /** +274 * Updates the database schema by loading the upgrade script for the version specified. The intended use is that if the +275 * current schema version is 2.9 then we would call updateSchema(conn, "2.9"). This would load the upgrade_2.9.sql file and +276 * execute it against the database. The upgrade script must update the 'version' in the properties table. +277 * +278 * @param conn the database connection object +279 * @param schema the current schema version that is being upgraded +280 * @throws DatabaseException thrown if there is an exception upgrading the database schema +281 */ +282 private static void updateSchema(Connection conn, String schema) throws DatabaseException { +283 final String databaseProductName; +284 try { +285 databaseProductName = conn.getMetaData().getDatabaseProductName(); +286 } catch (SQLException ex) { +287 throw new DatabaseException("Unable to get the database product name"); +288 } +289 if ("h2".equalsIgnoreCase(databaseProductName)) { +290 LOGGER.debug("Updating database structure"); +291 InputStream is = null; +292 String updateFile = null; +293 try { +294 updateFile = String.format(DB_STRUCTURE_UPDATE_RESOURCE, schema); +295 is = ConnectionFactory.class.getClassLoader().getResourceAsStream(updateFile); +296 if (is == null) { +297 throw new DatabaseException(String.format("Unable to load update file '%s'", updateFile)); +298 } +299 final String dbStructureUpdate = IOUtils.toString(is, "UTF-8"); +300 +301 Statement statement = null; +302 try { +303 statement = conn.createStatement(); +304 final boolean success = statement.execute(dbStructureUpdate); +305 if (!success && statement.getUpdateCount() <= 0) { +306 throw new DatabaseException(String.format("Unable to upgrade the database schema to %s", schema)); +307 } +308 } catch (SQLException ex) { +309 LOGGER.debug("", ex); +310 throw new DatabaseException("Unable to update database schema", ex); +311 } finally { +312 DBUtils.closeStatement(statement); +313 } +314 } catch (IOException ex) { +315 final String msg = String.format("Upgrade SQL file does not exist: %s", updateFile); +316 throw new DatabaseException(msg, ex); +317 } finally { +318 IOUtils.closeQuietly(is); +319 } +320 } else { +321 LOGGER.error("The database schema must be upgraded to use this version of dependency-check. Please see {} for more information.", UPGRADE_HELP_URL); +322 throw new DatabaseException("Database schema is out of date"); +323 } +324 } +325 +326 /** +327 * Counter to ensure that calls to ensureSchemaVersion does not end up in an endless loop. +328 */ +329 private static int callDepth = 0; +330 +331 /** +332 * Uses the provided connection to check the specified schema version within the database. +333 * +334 * @param conn the database connection object +335 * @throws DatabaseException thrown if the schema version is not compatible with this version of dependency-check +336 */ +337 private static void ensureSchemaVersion(Connection conn) throws DatabaseException { +338 ResultSet rs = null; +339 CallableStatement cs = null; +340 try { +341 //TODO convert this to use DatabaseProperties +342 cs = conn.prepareCall("SELECT value FROM properties WHERE id = 'version'"); +343 rs = cs.executeQuery(); +344 if (rs.next()) { +345 final DependencyVersion current = DependencyVersionUtil.parseVersion(DB_SCHEMA_VERSION); +346 final DependencyVersion db = DependencyVersionUtil.parseVersion(rs.getString(1)); +347 if (current.compareTo(db) > 0) { 348 LOGGER.debug("Current Schema: " + DB_SCHEMA_VERSION); 349 LOGGER.debug("DB Schema: " + rs.getString(1)); 350 updateSchema(conn, rs.getString(1)); -351 } -352 } else { -353 throw new DatabaseException("Database schema is missing"); -354 } -355 } catch (SQLException ex) { -356 LOGGER.debug("", ex); -357 throw new DatabaseException("Unable to check the database schema version"); -358 } finally { -359 DBUtils.closeResultSet(rs); -360 DBUtils.closeStatement(cs); -361 } -362 } -363 } +351 if (++callDepth < 10) { +352 ensureSchemaVersion(conn); +353 } +354 } +355 } else { +356 throw new DatabaseException("Database schema is missing"); +357 } +358 } catch (SQLException ex) { +359 LOGGER.debug("", ex); +360 throw new DatabaseException("Unable to check the database schema version"); +361 } finally { +362 DBUtils.closeResultSet(rs); +363 DBUtils.closeStatement(cs); +364 } +365 } +366 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/CorruptDatabaseException.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/CorruptDatabaseException.html index dd658f644..8c3ce8b0b 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/CorruptDatabaseException.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/CorruptDatabaseException.html @@ -26,37 +26,36 @@ 18 package org.owasp.dependencycheck.data.nvdcve; 19 20 /** -21 * An exception used to indicate the db4o database is corrupt. This could be due to invalid data or a complete failure -22 * of the db. -23 * -24 * @author Jeremy Long -25 */ -26 class CorruptDatabaseException extends DatabaseException { -27 -28 /** -29 * the serial version uid. -30 */ -31 private static final long serialVersionUID = 1L; -32 -33 /** -34 * Creates an CorruptDatabaseException -35 * -36 * @param msg the exception message -37 */ -38 public CorruptDatabaseException(String msg) { -39 super(msg); -40 } -41 -42 /** -43 * Creates an CorruptDatabaseException -44 * -45 * @param msg the exception message -46 * @param ex the cause of the exception -47 */ -48 public CorruptDatabaseException(String msg, Exception ex) { -49 super(msg, ex); -50 } -51 } +21 * An exception used to indicate the db4o database is corrupt. This could be due to invalid data or a complete failure of the db. +22 * +23 * @author Jeremy Long +24 */ +25 public class CorruptDatabaseException extends DatabaseException { +26 +27 /** +28 * the serial version uid. +29 */ +30 private static final long serialVersionUID = 1L; +31 +32 /** +33 * Creates an CorruptDatabaseException. +34 * +35 * @param msg the exception message +36 */ +37 public CorruptDatabaseException(String msg) { +38 super(msg); +39 } +40 +41 /** +42 * Creates an CorruptDatabaseException. +43 * +44 * @param msg the exception message +45 * @param ex the cause of the exception +46 */ +47 public CorruptDatabaseException(String msg, Exception ex) { +48 super(msg, ex); +49 } +50 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/CveDB.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/CveDB.html index 6674fc18f..5c4576343 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/CveDB.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/CveDB.html @@ -37,799 +37,771 @@ 29 import java.util.HashMap; 30 import java.util.HashSet; 31 import java.util.List; -32 import java.util.Map; -33 import java.util.Map.Entry; -34 import java.util.Properties; -35 import java.util.ResourceBundle; -36 import java.util.Set; -37 import org.owasp.dependencycheck.data.cwe.CweDB; -38 import org.owasp.dependencycheck.dependency.Reference; -39 import org.owasp.dependencycheck.dependency.Vulnerability; -40 import org.owasp.dependencycheck.dependency.VulnerableSoftware; -41 import org.owasp.dependencycheck.utils.DBUtils; -42 import org.owasp.dependencycheck.utils.DependencyVersion; -43 import org.owasp.dependencycheck.utils.DependencyVersionUtil; -44 import org.owasp.dependencycheck.utils.Pair; -45 import org.owasp.dependencycheck.utils.Settings; -46 import org.slf4j.Logger; -47 import org.slf4j.LoggerFactory; -48 -49 /** -50 * The database holding information about the NVD CVE data. -51 * -52 * @author Jeremy Long -53 */ -54 public class CveDB { -55 -56 /** -57 * The logger. -58 */ -59 private static final Logger LOGGER = LoggerFactory.getLogger(CveDB.class); -60 /** -61 * Database connection -62 */ -63 private Connection conn; -64 /** -65 * The bundle of statements used when accessing the database. -66 */ -67 private ResourceBundle statementBundle = null; -68 -69 /** -70 * Creates a new CveDB object and opens the database connection. Note, the connection must be closed by the caller by calling -71 * the close method. -72 * -73 * @throws DatabaseException thrown if there is an exception opening the database. -74 */ -75 public CveDB() throws DatabaseException { -76 super(); -77 statementBundle = ResourceBundle.getBundle("data/dbStatements"); -78 try { -79 open(); -80 databaseProperties = new DatabaseProperties(this); -81 } catch (DatabaseException ex) { -82 throw ex; -83 } -84 } -85 -86 /** -87 * Returns the database connection. -88 * -89 * @return the database connection -90 */ -91 protected Connection getConnection() { -92 return conn; -93 } -94 -95 /** -96 * Opens the database connection. If the database does not exist, it will create a new one. -97 * -98 * @throws DatabaseException thrown if there is an error opening the database connection -99 */ -100 public final void open() throws DatabaseException { -101 if (!isOpen()) { -102 conn = ConnectionFactory.getConnection(); -103 } -104 } -105 -106 /** -107 * Closes the DB4O database. Close should be called on this object when it is done being used. -108 */ -109 public void close() { -110 if (conn != null) { -111 try { -112 conn.close(); -113 } catch (SQLException ex) { -114 LOGGER.error("There was an error attempting to close the CveDB, see the log for more details."); -115 LOGGER.debug("", ex); -116 } catch (Throwable ex) { -117 LOGGER.error("There was an exception attempting to close the CveDB, see the log for more details."); -118 LOGGER.debug("", ex); -119 } -120 conn = null; -121 } -122 } -123 -124 /** -125 * Returns whether the database connection is open or closed. -126 * -127 * @return whether the database connection is open or closed -128 */ -129 public boolean isOpen() { -130 return conn != null; -131 } -132 -133 /** -134 * Commits all completed transactions. -135 * -136 * @throws SQLException thrown if a SQL Exception occurs -137 */ -138 public void commit() throws SQLException { -139 //temporary remove this as autocommit is on. -140 //if (conn != null) { -141 // conn.commit(); -142 //} -143 } -144 -145 /** -146 * Cleans up the object and ensures that "close" has been called. -147 * -148 * @throws Throwable thrown if there is a problem -149 */ -150 @Override -151 @SuppressWarnings("FinalizeDeclaration") -152 protected void finalize() throws Throwable { -153 LOGGER.debug("Entering finalize"); -154 close(); -155 super.finalize(); -156 } -157 /** -158 * Database properties object containing the 'properties' from the database table. +32 import java.util.Locale; +33 import java.util.Map; +34 import java.util.Map.Entry; +35 import java.util.MissingResourceException; +36 import java.util.Properties; +37 import java.util.ResourceBundle; +38 import java.util.Set; +39 import org.owasp.dependencycheck.data.cwe.CweDB; +40 import org.owasp.dependencycheck.dependency.Reference; +41 import org.owasp.dependencycheck.dependency.Vulnerability; +42 import org.owasp.dependencycheck.dependency.VulnerableSoftware; +43 import org.owasp.dependencycheck.utils.DBUtils; +44 import org.owasp.dependencycheck.utils.DependencyVersion; +45 import org.owasp.dependencycheck.utils.DependencyVersionUtil; +46 import org.owasp.dependencycheck.utils.Pair; +47 import org.owasp.dependencycheck.utils.Settings; +48 import org.slf4j.Logger; +49 import org.slf4j.LoggerFactory; +50 +51 /** +52 * The database holding information about the NVD CVE data. +53 * +54 * @author Jeremy Long +55 */ +56 public class CveDB { +57 +58 /** +59 * The logger. +60 */ +61 private static final Logger LOGGER = LoggerFactory.getLogger(CveDB.class); +62 /** +63 * Database connection +64 */ +65 private Connection conn; +66 /** +67 * The bundle of statements used when accessing the database. +68 */ +69 private ResourceBundle statementBundle = null; +70 +71 /** +72 * Creates a new CveDB object and opens the database connection. Note, the connection must be closed by the caller by calling +73 * the close method. +74 * +75 * @throws DatabaseException thrown if there is an exception opening the database. +76 */ +77 public CveDB() throws DatabaseException { +78 super(); +79 try { +80 open(); +81 try { +82 final String databaseProductName = conn.getMetaData().getDatabaseProductName(); +83 LOGGER.debug("Database dialect: {}", databaseProductName); +84 final Locale dbDialect = new Locale(databaseProductName); +85 statementBundle = ResourceBundle.getBundle("data/dbStatements", dbDialect); +86 } catch (SQLException se) { +87 LOGGER.warn("Problem loading database specific dialect!", se); +88 statementBundle = ResourceBundle.getBundle("data/dbStatements"); +89 } +90 databaseProperties = new DatabaseProperties(this); +91 } catch (DatabaseException ex) { +92 throw ex; +93 } +94 } +95 +96 /** +97 * Returns the database connection. +98 * +99 * @return the database connection +100 */ +101 protected Connection getConnection() { +102 return conn; +103 } +104 +105 /** +106 * Opens the database connection. If the database does not exist, it will create a new one. +107 * +108 * @throws DatabaseException thrown if there is an error opening the database connection +109 */ +110 public final void open() throws DatabaseException { +111 if (!isOpen()) { +112 conn = ConnectionFactory.getConnection(); +113 } +114 } +115 +116 /** +117 * Closes the DB4O database. Close should be called on this object when it is done being used. +118 */ +119 public void close() { +120 if (conn != null) { +121 try { +122 conn.close(); +123 } catch (SQLException ex) { +124 LOGGER.error("There was an error attempting to close the CveDB, see the log for more details."); +125 LOGGER.debug("", ex); +126 } catch (Throwable ex) { +127 LOGGER.error("There was an exception attempting to close the CveDB, see the log for more details."); +128 LOGGER.debug("", ex); +129 } +130 conn = null; +131 } +132 } +133 +134 /** +135 * Returns whether the database connection is open or closed. +136 * +137 * @return whether the database connection is open or closed +138 */ +139 public boolean isOpen() { +140 return conn != null; +141 } +142 +143 /** +144 * Commits all completed transactions. +145 * +146 * @throws SQLException thrown if a SQL Exception occurs +147 */ +148 public void commit() throws SQLException { +149 //temporary remove this as autocommit is on. +150 //if (conn != null) { +151 // conn.commit(); +152 //} +153 } +154 +155 /** +156 * Cleans up the object and ensures that "close" has been called. +157 * +158 * @throws Throwable thrown if there is a problem 159 */ -160 private DatabaseProperties databaseProperties; -161 -162 /** -163 * Get the value of databaseProperties. -164 * -165 * @return the value of databaseProperties -166 */ -167 public DatabaseProperties getDatabaseProperties() { -168 return databaseProperties; -169 } -170 -171 /** -172 * Searches the CPE entries in the database and retrieves all entries for a given vendor and product combination. The returned -173 * list will include all versions of the product that are registered in the NVD CVE data. +160 @Override +161 @SuppressWarnings("FinalizeDeclaration") +162 protected void finalize() throws Throwable { +163 LOGGER.debug("Entering finalize"); +164 close(); +165 super.finalize(); +166 } +167 /** +168 * Database properties object containing the 'properties' from the database table. +169 */ +170 private DatabaseProperties databaseProperties; +171 +172 /** +173 * Get the value of databaseProperties. 174 * -175 * @param vendor the identified vendor name of the dependency being analyzed -176 * @param product the identified name of the product of the dependency being analyzed -177 * @return a set of vulnerable software -178 */ -179 public Set<VulnerableSoftware> getCPEs(String vendor, String product) { -180 final Set<VulnerableSoftware> cpe = new HashSet<VulnerableSoftware>(); -181 ResultSet rs = null; -182 PreparedStatement ps = null; -183 try { -184 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_CPE_ENTRIES")); -185 ps.setString(1, vendor); -186 ps.setString(2, product); -187 rs = ps.executeQuery(); -188 -189 while (rs.next()) { -190 final VulnerableSoftware vs = new VulnerableSoftware(); -191 vs.setCpe(rs.getString(1)); -192 cpe.add(vs); -193 } -194 } catch (SQLException ex) { -195 LOGGER.error("An unexpected SQL Exception occurred; please see the verbose log for more details."); -196 LOGGER.debug("", ex); -197 } finally { -198 DBUtils.closeResultSet(rs); -199 DBUtils.closeStatement(ps); -200 } -201 return cpe; -202 } -203 -204 /** -205 * Returns the entire list of vendor/product combinations. -206 * -207 * @return the entire list of vendor/product combinations -208 * @throws DatabaseException thrown when there is an error retrieving the data from the DB -209 */ -210 public Set<Pair<String, String>> getVendorProductList() throws DatabaseException { -211 final Set<Pair<String, String>> data = new HashSet<Pair<String, String>>(); -212 ResultSet rs = null; -213 PreparedStatement ps = null; -214 try { -215 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_VENDOR_PRODUCT_LIST")); -216 rs = ps.executeQuery(); -217 while (rs.next()) { -218 data.add(new Pair<String, String>(rs.getString(1), rs.getString(2))); -219 } -220 } catch (SQLException ex) { -221 final String msg = "An unexpected SQL Exception occurred; please see the verbose log for more details."; -222 throw new DatabaseException(msg, ex); -223 } finally { -224 DBUtils.closeResultSet(rs); -225 DBUtils.closeStatement(ps); -226 } -227 return data; -228 } -229 -230 /** -231 * Returns a set of properties. -232 * -233 * @return the properties from the database -234 */ -235 Properties getProperties() { -236 final Properties prop = new Properties(); -237 PreparedStatement ps = null; -238 ResultSet rs = null; -239 try { -240 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_PROPERTIES")); -241 rs = ps.executeQuery(); -242 while (rs.next()) { -243 prop.setProperty(rs.getString(1), rs.getString(2)); -244 } -245 } catch (SQLException ex) { -246 LOGGER.error("An unexpected SQL Exception occurred; please see the verbose log for more details."); -247 LOGGER.debug("", ex); -248 } finally { -249 DBUtils.closeStatement(ps); -250 DBUtils.closeResultSet(rs); -251 } -252 return prop; -253 } -254 -255 /** -256 * Saves a set of properties to the database. -257 * -258 * @param props a collection of properties -259 */ -260 void saveProperties(Properties props) { -261 PreparedStatement updateProperty = null; -262 PreparedStatement insertProperty = null; -263 try { -264 try { -265 updateProperty = getConnection().prepareStatement(statementBundle.getString("UPDATE_PROPERTY")); -266 insertProperty = getConnection().prepareStatement(statementBundle.getString("INSERT_PROPERTY")); -267 } catch (SQLException ex) { -268 LOGGER.warn("Unable to save properties to the database"); -269 LOGGER.debug("Unable to save properties to the database", ex); -270 return; -271 } -272 for (Entry<Object, Object> entry : props.entrySet()) { -273 final String key = entry.getKey().toString(); -274 final String value = entry.getValue().toString(); +175 * @return the value of databaseProperties +176 */ +177 public DatabaseProperties getDatabaseProperties() { +178 return databaseProperties; +179 } +180 +181 /** +182 * Searches the CPE entries in the database and retrieves all entries for a given vendor and product combination. The returned +183 * list will include all versions of the product that are registered in the NVD CVE data. +184 * +185 * @param vendor the identified vendor name of the dependency being analyzed +186 * @param product the identified name of the product of the dependency being analyzed +187 * @return a set of vulnerable software +188 */ +189 public Set<VulnerableSoftware> getCPEs(String vendor, String product) { +190 final Set<VulnerableSoftware> cpe = new HashSet<VulnerableSoftware>(); +191 ResultSet rs = null; +192 PreparedStatement ps = null; +193 try { +194 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_CPE_ENTRIES")); +195 ps.setString(1, vendor); +196 ps.setString(2, product); +197 rs = ps.executeQuery(); +198 +199 while (rs.next()) { +200 final VulnerableSoftware vs = new VulnerableSoftware(); +201 vs.setCpe(rs.getString(1)); +202 cpe.add(vs); +203 } +204 } catch (SQLException ex) { +205 LOGGER.error("An unexpected SQL Exception occurred; please see the verbose log for more details."); +206 LOGGER.debug("", ex); +207 } finally { +208 DBUtils.closeResultSet(rs); +209 DBUtils.closeStatement(ps); +210 } +211 return cpe; +212 } +213 +214 /** +215 * Returns the entire list of vendor/product combinations. +216 * +217 * @return the entire list of vendor/product combinations +218 * @throws DatabaseException thrown when there is an error retrieving the data from the DB +219 */ +220 public Set<Pair<String, String>> getVendorProductList() throws DatabaseException { +221 final Set<Pair<String, String>> data = new HashSet<Pair<String, String>>(); +222 ResultSet rs = null; +223 PreparedStatement ps = null; +224 try { +225 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_VENDOR_PRODUCT_LIST")); +226 rs = ps.executeQuery(); +227 while (rs.next()) { +228 data.add(new Pair<String, String>(rs.getString(1), rs.getString(2))); +229 } +230 } catch (SQLException ex) { +231 final String msg = "An unexpected SQL Exception occurred; please see the verbose log for more details."; +232 throw new DatabaseException(msg, ex); +233 } finally { +234 DBUtils.closeResultSet(rs); +235 DBUtils.closeStatement(ps); +236 } +237 return data; +238 } +239 +240 /** +241 * Returns a set of properties. +242 * +243 * @return the properties from the database +244 */ +245 Properties getProperties() { +246 final Properties prop = new Properties(); +247 PreparedStatement ps = null; +248 ResultSet rs = null; +249 try { +250 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_PROPERTIES")); +251 rs = ps.executeQuery(); +252 while (rs.next()) { +253 prop.setProperty(rs.getString(1), rs.getString(2)); +254 } +255 } catch (SQLException ex) { +256 LOGGER.error("An unexpected SQL Exception occurred; please see the verbose log for more details."); +257 LOGGER.debug("", ex); +258 } finally { +259 DBUtils.closeStatement(ps); +260 DBUtils.closeResultSet(rs); +261 } +262 return prop; +263 } +264 +265 /** +266 * Saves a property to the database. +267 * +268 * @param key the property key +269 * @param value the property value +270 */ +271 void saveProperty(String key, String value) { +272 try { +273 try { +274 final PreparedStatement mergeProperty = getConnection().prepareStatement(statementBundle.getString("MERGE_PROPERTY")); 275 try { -276 updateProperty.setString(1, value); -277 updateProperty.setString(2, key); -278 if (updateProperty.executeUpdate() == 0) { -279 insertProperty.setString(1, key); -280 insertProperty.setString(2, value); -281 } -282 } catch (SQLException ex) { -283 LOGGER.warn("Unable to save property '{}' with a value of '{}' to the database", key, value); -284 LOGGER.debug("", ex); -285 } -286 } -287 } finally { -288 DBUtils.closeStatement(updateProperty); -289 DBUtils.closeStatement(insertProperty); -290 } -291 } -292 -293 /** -294 * Saves a property to the database. -295 * -296 * @param key the property key -297 * @param value the property value -298 */ -299 void saveProperty(String key, String value) { -300 PreparedStatement updateProperty = null; -301 PreparedStatement insertProperty = null; -302 try { -303 try { -304 updateProperty = getConnection().prepareStatement(statementBundle.getString("UPDATE_PROPERTY")); -305 } catch (SQLException ex) { -306 LOGGER.warn("Unable to save properties to the database"); -307 LOGGER.debug("Unable to save properties to the database", ex); -308 return; -309 } -310 try { -311 updateProperty.setString(1, value); -312 updateProperty.setString(2, key); -313 if (updateProperty.executeUpdate() == 0) { -314 try { -315 insertProperty = getConnection().prepareStatement(statementBundle.getString("INSERT_PROPERTY")); -316 } catch (SQLException ex) { -317 LOGGER.warn("Unable to save properties to the database"); -318 LOGGER.debug("Unable to save properties to the database", ex); -319 return; -320 } -321 insertProperty.setString(1, key); -322 insertProperty.setString(2, value); -323 insertProperty.execute(); -324 } -325 } catch (SQLException ex) { -326 LOGGER.warn("Unable to save property '{}' with a value of '{}' to the database", key, value); -327 LOGGER.debug("", ex); -328 } -329 } finally { -330 DBUtils.closeStatement(updateProperty); -331 DBUtils.closeStatement(insertProperty); -332 } -333 } -334 -335 /** -336 * Retrieves the vulnerabilities associated with the specified CPE. -337 * -338 * @param cpeStr the CPE name -339 * @return a list of Vulnerabilities -340 * @throws DatabaseException thrown if there is an exception retrieving data -341 */ -342 public List<Vulnerability> getVulnerabilities(String cpeStr) throws DatabaseException { -343 final VulnerableSoftware cpe = new VulnerableSoftware(); -344 try { -345 cpe.parseName(cpeStr); -346 } catch (UnsupportedEncodingException ex) { -347 LOGGER.trace("", ex); -348 } -349 final DependencyVersion detectedVersion = parseDependencyVersion(cpe); -350 final List<Vulnerability> vulnerabilities = new ArrayList<Vulnerability>(); -351 -352 PreparedStatement ps = null; -353 ResultSet rs = null; -354 try { -355 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_CVE_FROM_SOFTWARE")); -356 ps.setString(1, cpe.getVendor()); -357 ps.setString(2, cpe.getProduct()); -358 rs = ps.executeQuery(); -359 String currentCVE = ""; -360 -361 final Map<String, Boolean> vulnSoftware = new HashMap<String, Boolean>(); -362 while (rs.next()) { -363 final String cveId = rs.getString(1); -364 if (!currentCVE.equals(cveId)) { //check for match and add -365 final Entry<String, Boolean> matchedCPE = getMatchingSoftware(vulnSoftware, cpe.getVendor(), cpe.getProduct(), detectedVersion); -366 if (matchedCPE != null) { -367 final Vulnerability v = getVulnerability(currentCVE); -368 v.setMatchedCPE(matchedCPE.getKey(), matchedCPE.getValue() ? "Y" : null); -369 vulnerabilities.add(v); -370 } -371 vulnSoftware.clear(); -372 currentCVE = cveId; -373 } -374 -375 final String cpeId = rs.getString(2); -376 final String previous = rs.getString(3); -377 final Boolean p = previous != null && !previous.isEmpty(); -378 vulnSoftware.put(cpeId, p); -379 } -380 //remember to process the last set of CVE/CPE entries -381 final Entry<String, Boolean> matchedCPE = getMatchingSoftware(vulnSoftware, cpe.getVendor(), cpe.getProduct(), detectedVersion); -382 if (matchedCPE != null) { -383 final Vulnerability v = getVulnerability(currentCVE); -384 v.setMatchedCPE(matchedCPE.getKey(), matchedCPE.getValue() ? "Y" : null); -385 vulnerabilities.add(v); -386 } -387 } catch (SQLException ex) { -388 throw new DatabaseException("Exception retrieving vulnerability for " + cpeStr, ex); -389 } finally { -390 DBUtils.closeResultSet(rs); -391 DBUtils.closeStatement(ps); -392 } -393 return vulnerabilities; -394 } -395 -396 /** -397 * Gets a vulnerability for the provided CVE. -398 * -399 * @param cve the CVE to lookup -400 * @return a vulnerability object -401 * @throws DatabaseException if an exception occurs -402 */ -403 private Vulnerability getVulnerability(String cve) throws DatabaseException { -404 PreparedStatement psV = null; -405 PreparedStatement psR = null; -406 PreparedStatement psS = null; -407 ResultSet rsV = null; -408 ResultSet rsR = null; -409 ResultSet rsS = null; -410 Vulnerability vuln = null; -411 try { -412 psV = getConnection().prepareStatement(statementBundle.getString("SELECT_VULNERABILITY")); -413 psV.setString(1, cve); -414 rsV = psV.executeQuery(); -415 if (rsV.next()) { -416 vuln = new Vulnerability(); -417 vuln.setName(cve); -418 vuln.setDescription(rsV.getString(2)); -419 String cwe = rsV.getString(3); -420 if (cwe != null) { -421 final String name = CweDB.getCweName(cwe); -422 if (name != null) { -423 cwe += " " + name; +276 mergeProperty.setString(1, key); +277 mergeProperty.setString(2, value); +278 mergeProperty.executeUpdate(); +279 } finally { +280 DBUtils.closeStatement(mergeProperty); +281 } +282 } catch (MissingResourceException mre) { +283 // No Merge statement, so doing an Update/Insert... +284 PreparedStatement updateProperty = null; +285 PreparedStatement insertProperty = null; +286 try { +287 updateProperty = getConnection().prepareStatement(statementBundle.getString("UPDATE_PROPERTY")); +288 updateProperty.setString(1, value); +289 updateProperty.setString(2, key); +290 if (updateProperty.executeUpdate() == 0) { +291 insertProperty = getConnection().prepareStatement(statementBundle.getString("INSERT_PROPERTY")); +292 insertProperty.setString(1, key); +293 insertProperty.setString(2, value); +294 insertProperty.executeUpdate(); +295 } +296 } finally { +297 DBUtils.closeStatement(updateProperty); +298 DBUtils.closeStatement(insertProperty); +299 } +300 } +301 } catch (SQLException ex) { +302 LOGGER.warn("Unable to save property '{}' with a value of '{}' to the database", key, value); +303 LOGGER.debug("", ex); +304 } +305 } +306 +307 /** +308 * Retrieves the vulnerabilities associated with the specified CPE. +309 * +310 * @param cpeStr the CPE name +311 * @return a list of Vulnerabilities +312 * @throws DatabaseException thrown if there is an exception retrieving data +313 */ +314 public List<Vulnerability> getVulnerabilities(String cpeStr) throws DatabaseException { +315 final VulnerableSoftware cpe = new VulnerableSoftware(); +316 try { +317 cpe.parseName(cpeStr); +318 } catch (UnsupportedEncodingException ex) { +319 LOGGER.trace("", ex); +320 } +321 final DependencyVersion detectedVersion = parseDependencyVersion(cpe); +322 final List<Vulnerability> vulnerabilities = new ArrayList<Vulnerability>(); +323 +324 PreparedStatement ps = null; +325 ResultSet rs = null; +326 try { +327 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_CVE_FROM_SOFTWARE")); +328 ps.setString(1, cpe.getVendor()); +329 ps.setString(2, cpe.getProduct()); +330 rs = ps.executeQuery(); +331 String currentCVE = ""; +332 +333 final Map<String, Boolean> vulnSoftware = new HashMap<String, Boolean>(); +334 while (rs.next()) { +335 final String cveId = rs.getString(1); +336 if (!currentCVE.equals(cveId)) { //check for match and add +337 final Entry<String, Boolean> matchedCPE = getMatchingSoftware(vulnSoftware, cpe.getVendor(), cpe.getProduct(), detectedVersion); +338 if (matchedCPE != null) { +339 final Vulnerability v = getVulnerability(currentCVE); +340 v.setMatchedCPE(matchedCPE.getKey(), matchedCPE.getValue() ? "Y" : null); +341 vulnerabilities.add(v); +342 } +343 vulnSoftware.clear(); +344 currentCVE = cveId; +345 } +346 +347 final String cpeId = rs.getString(2); +348 final String previous = rs.getString(3); +349 final Boolean p = previous != null && !previous.isEmpty(); +350 vulnSoftware.put(cpeId, p); +351 } +352 //remember to process the last set of CVE/CPE entries +353 final Entry<String, Boolean> matchedCPE = getMatchingSoftware(vulnSoftware, cpe.getVendor(), cpe.getProduct(), detectedVersion); +354 if (matchedCPE != null) { +355 final Vulnerability v = getVulnerability(currentCVE); +356 v.setMatchedCPE(matchedCPE.getKey(), matchedCPE.getValue() ? "Y" : null); +357 vulnerabilities.add(v); +358 } +359 } catch (SQLException ex) { +360 throw new DatabaseException("Exception retrieving vulnerability for " + cpeStr, ex); +361 } finally { +362 DBUtils.closeResultSet(rs); +363 DBUtils.closeStatement(ps); +364 } +365 return vulnerabilities; +366 } +367 +368 /** +369 * Gets a vulnerability for the provided CVE. +370 * +371 * @param cve the CVE to lookup +372 * @return a vulnerability object +373 * @throws DatabaseException if an exception occurs +374 */ +375 private Vulnerability getVulnerability(String cve) throws DatabaseException { +376 PreparedStatement psV = null; +377 PreparedStatement psR = null; +378 PreparedStatement psS = null; +379 ResultSet rsV = null; +380 ResultSet rsR = null; +381 ResultSet rsS = null; +382 Vulnerability vuln = null; +383 try { +384 psV = getConnection().prepareStatement(statementBundle.getString("SELECT_VULNERABILITY")); +385 psV.setString(1, cve); +386 rsV = psV.executeQuery(); +387 if (rsV.next()) { +388 vuln = new Vulnerability(); +389 vuln.setName(cve); +390 vuln.setDescription(rsV.getString(2)); +391 String cwe = rsV.getString(3); +392 if (cwe != null) { +393 final String name = CweDB.getCweName(cwe); +394 if (name != null) { +395 cwe += ' ' + name; +396 } +397 } +398 final int cveId = rsV.getInt(1); +399 vuln.setCwe(cwe); +400 vuln.setCvssScore(rsV.getFloat(4)); +401 vuln.setCvssAccessVector(rsV.getString(5)); +402 vuln.setCvssAccessComplexity(rsV.getString(6)); +403 vuln.setCvssAuthentication(rsV.getString(7)); +404 vuln.setCvssConfidentialityImpact(rsV.getString(8)); +405 vuln.setCvssIntegrityImpact(rsV.getString(9)); +406 vuln.setCvssAvailabilityImpact(rsV.getString(10)); +407 +408 psR = getConnection().prepareStatement(statementBundle.getString("SELECT_REFERENCES")); +409 psR.setInt(1, cveId); +410 rsR = psR.executeQuery(); +411 while (rsR.next()) { +412 vuln.addReference(rsR.getString(1), rsR.getString(2), rsR.getString(3)); +413 } +414 psS = getConnection().prepareStatement(statementBundle.getString("SELECT_SOFTWARE")); +415 psS.setInt(1, cveId); +416 rsS = psS.executeQuery(); +417 while (rsS.next()) { +418 final String cpe = rsS.getString(1); +419 final String prevVersion = rsS.getString(2); +420 if (prevVersion == null) { +421 vuln.addVulnerableSoftware(cpe); +422 } else { +423 vuln.addVulnerableSoftware(cpe, prevVersion); 424 } 425 } -426 final int cveId = rsV.getInt(1); -427 vuln.setCwe(cwe); -428 vuln.setCvssScore(rsV.getFloat(4)); -429 vuln.setCvssAccessVector(rsV.getString(5)); -430 vuln.setCvssAccessComplexity(rsV.getString(6)); -431 vuln.setCvssAuthentication(rsV.getString(7)); -432 vuln.setCvssConfidentialityImpact(rsV.getString(8)); -433 vuln.setCvssIntegrityImpact(rsV.getString(9)); -434 vuln.setCvssAvailabilityImpact(rsV.getString(10)); -435 -436 psR = getConnection().prepareStatement(statementBundle.getString("SELECT_REFERENCES")); -437 psR.setInt(1, cveId); -438 rsR = psR.executeQuery(); -439 while (rsR.next()) { -440 vuln.addReference(rsR.getString(1), rsR.getString(2), rsR.getString(3)); -441 } -442 psS = getConnection().prepareStatement(statementBundle.getString("SELECT_SOFTWARE")); -443 psS.setInt(1, cveId); -444 rsS = psS.executeQuery(); -445 while (rsS.next()) { -446 final String cpe = rsS.getString(1); -447 final String prevVersion = rsS.getString(2); -448 if (prevVersion == null) { -449 vuln.addVulnerableSoftware(cpe); -450 } else { -451 vuln.addVulnerableSoftware(cpe, prevVersion); -452 } -453 } -454 } -455 } catch (SQLException ex) { -456 throw new DatabaseException("Error retrieving " + cve, ex); -457 } finally { -458 DBUtils.closeResultSet(rsV); -459 DBUtils.closeResultSet(rsR); -460 DBUtils.closeResultSet(rsS); -461 DBUtils.closeStatement(psV); -462 DBUtils.closeStatement(psR); -463 DBUtils.closeStatement(psS); -464 } -465 return vuln; -466 } -467 -468 /** -469 * Updates the vulnerability within the database. If the vulnerability does not exist it will be added. -470 * -471 * @param vuln the vulnerability to add to the database -472 * @throws DatabaseException is thrown if the database -473 */ -474 public void updateVulnerability(Vulnerability vuln) throws DatabaseException { -475 PreparedStatement selectVulnerabilityId = null; -476 PreparedStatement deleteVulnerability = null; -477 PreparedStatement deleteReferences = null; -478 PreparedStatement deleteSoftware = null; -479 PreparedStatement updateVulnerability = null; -480 PreparedStatement insertVulnerability = null; -481 PreparedStatement insertReference = null; -482 PreparedStatement selectCpeId = null; -483 PreparedStatement insertCpe = null; -484 PreparedStatement insertSoftware = null; -485 -486 try { -487 selectVulnerabilityId = getConnection().prepareStatement(statementBundle.getString("SELECT_VULNERABILITY_ID")); -488 deleteVulnerability = getConnection().prepareStatement(statementBundle.getString("DELETE_VULNERABILITY")); -489 deleteReferences = getConnection().prepareStatement(statementBundle.getString("DELETE_REFERENCE")); -490 deleteSoftware = getConnection().prepareStatement(statementBundle.getString("DELETE_SOFTWARE")); -491 updateVulnerability = getConnection().prepareStatement(statementBundle.getString("UPDATE_VULNERABILITY")); -492 final String[] ids = {"id"}; -493 insertVulnerability = getConnection().prepareStatement(statementBundle.getString("INSERT_VULNERABILITY"), -494 //Statement.RETURN_GENERATED_KEYS); -495 ids); -496 insertReference = getConnection().prepareStatement(statementBundle.getString("INSERT_REFERENCE")); -497 selectCpeId = getConnection().prepareStatement(statementBundle.getString("SELECT_CPE_ID")); -498 insertCpe = getConnection().prepareStatement(statementBundle.getString("INSERT_CPE"), -499 //Statement.RETURN_GENERATED_KEYS); -500 ids); -501 insertSoftware = getConnection().prepareStatement(statementBundle.getString("INSERT_SOFTWARE")); -502 int vulnerabilityId = 0; -503 selectVulnerabilityId.setString(1, vuln.getName()); -504 ResultSet rs = selectVulnerabilityId.executeQuery(); -505 if (rs.next()) { -506 vulnerabilityId = rs.getInt(1); -507 // first delete any existing vulnerability info. We don't know what was updated. yes, slower but atm easier. -508 deleteReferences.setInt(1, vulnerabilityId); -509 deleteReferences.execute(); -510 deleteSoftware.setInt(1, vulnerabilityId); -511 deleteSoftware.execute(); -512 } -513 DBUtils.closeResultSet(rs); -514 rs = null; -515 if (vulnerabilityId != 0) { -516 if (vuln.getDescription().contains("** REJECT **")) { -517 deleteVulnerability.setInt(1, vulnerabilityId); -518 deleteVulnerability.executeUpdate(); -519 } else { -520 updateVulnerability.setString(1, vuln.getDescription()); -521 updateVulnerability.setString(2, vuln.getCwe()); -522 updateVulnerability.setFloat(3, vuln.getCvssScore()); -523 updateVulnerability.setString(4, vuln.getCvssAccessVector()); -524 updateVulnerability.setString(5, vuln.getCvssAccessComplexity()); -525 updateVulnerability.setString(6, vuln.getCvssAuthentication()); -526 updateVulnerability.setString(7, vuln.getCvssConfidentialityImpact()); -527 updateVulnerability.setString(8, vuln.getCvssIntegrityImpact()); -528 updateVulnerability.setString(9, vuln.getCvssAvailabilityImpact()); -529 updateVulnerability.setInt(10, vulnerabilityId); -530 updateVulnerability.executeUpdate(); -531 } -532 } else { -533 insertVulnerability.setString(1, vuln.getName()); -534 insertVulnerability.setString(2, vuln.getDescription()); -535 insertVulnerability.setString(3, vuln.getCwe()); -536 insertVulnerability.setFloat(4, vuln.getCvssScore()); -537 insertVulnerability.setString(5, vuln.getCvssAccessVector()); -538 insertVulnerability.setString(6, vuln.getCvssAccessComplexity()); -539 insertVulnerability.setString(7, vuln.getCvssAuthentication()); -540 insertVulnerability.setString(8, vuln.getCvssConfidentialityImpact()); -541 insertVulnerability.setString(9, vuln.getCvssIntegrityImpact()); -542 insertVulnerability.setString(10, vuln.getCvssAvailabilityImpact()); -543 insertVulnerability.execute(); -544 try { -545 rs = insertVulnerability.getGeneratedKeys(); -546 rs.next(); -547 vulnerabilityId = rs.getInt(1); -548 } catch (SQLException ex) { -549 final String msg = String.format("Unable to retrieve id for new vulnerability for '%s'", vuln.getName()); -550 throw new DatabaseException(msg, ex); -551 } finally { -552 DBUtils.closeResultSet(rs); -553 rs = null; -554 } -555 } -556 insertReference.setInt(1, vulnerabilityId); -557 for (Reference r : vuln.getReferences()) { -558 insertReference.setString(2, r.getName()); -559 insertReference.setString(3, r.getUrl()); -560 insertReference.setString(4, r.getSource()); -561 insertReference.execute(); -562 } -563 for (VulnerableSoftware s : vuln.getVulnerableSoftware()) { -564 int cpeProductId = 0; -565 selectCpeId.setString(1, s.getName()); -566 try { -567 rs = selectCpeId.executeQuery(); -568 if (rs.next()) { -569 cpeProductId = rs.getInt(1); -570 } -571 } catch (SQLException ex) { -572 throw new DatabaseException("Unable to get primary key for new cpe: " + s.getName(), ex); -573 } finally { -574 DBUtils.closeResultSet(rs); -575 rs = null; -576 } -577 -578 if (cpeProductId == 0) { -579 insertCpe.setString(1, s.getName()); -580 insertCpe.setString(2, s.getVendor()); -581 insertCpe.setString(3, s.getProduct()); -582 insertCpe.executeUpdate(); -583 cpeProductId = DBUtils.getGeneratedKey(insertCpe); -584 } -585 if (cpeProductId == 0) { -586 throw new DatabaseException("Unable to retrieve cpeProductId - no data returned"); -587 } +426 } +427 } catch (SQLException ex) { +428 throw new DatabaseException("Error retrieving " + cve, ex); +429 } finally { +430 DBUtils.closeResultSet(rsV); +431 DBUtils.closeResultSet(rsR); +432 DBUtils.closeResultSet(rsS); +433 DBUtils.closeStatement(psV); +434 DBUtils.closeStatement(psR); +435 DBUtils.closeStatement(psS); +436 } +437 return vuln; +438 } +439 +440 /** +441 * Updates the vulnerability within the database. If the vulnerability does not exist it will be added. +442 * +443 * @param vuln the vulnerability to add to the database +444 * @throws DatabaseException is thrown if the database +445 */ +446 public void updateVulnerability(Vulnerability vuln) throws DatabaseException { +447 PreparedStatement selectVulnerabilityId = null; +448 PreparedStatement deleteVulnerability = null; +449 PreparedStatement deleteReferences = null; +450 PreparedStatement deleteSoftware = null; +451 PreparedStatement updateVulnerability = null; +452 PreparedStatement insertVulnerability = null; +453 PreparedStatement insertReference = null; +454 PreparedStatement selectCpeId = null; +455 PreparedStatement insertCpe = null; +456 PreparedStatement insertSoftware = null; +457 +458 try { +459 selectVulnerabilityId = getConnection().prepareStatement(statementBundle.getString("SELECT_VULNERABILITY_ID")); +460 deleteVulnerability = getConnection().prepareStatement(statementBundle.getString("DELETE_VULNERABILITY")); +461 deleteReferences = getConnection().prepareStatement(statementBundle.getString("DELETE_REFERENCE")); +462 deleteSoftware = getConnection().prepareStatement(statementBundle.getString("DELETE_SOFTWARE")); +463 updateVulnerability = getConnection().prepareStatement(statementBundle.getString("UPDATE_VULNERABILITY")); +464 final String[] ids = {"id"}; +465 insertVulnerability = getConnection().prepareStatement(statementBundle.getString("INSERT_VULNERABILITY"), +466 //Statement.RETURN_GENERATED_KEYS); +467 ids); +468 insertReference = getConnection().prepareStatement(statementBundle.getString("INSERT_REFERENCE")); +469 selectCpeId = getConnection().prepareStatement(statementBundle.getString("SELECT_CPE_ID")); +470 insertCpe = getConnection().prepareStatement(statementBundle.getString("INSERT_CPE"), +471 //Statement.RETURN_GENERATED_KEYS); +472 ids); +473 insertSoftware = getConnection().prepareStatement(statementBundle.getString("INSERT_SOFTWARE")); +474 int vulnerabilityId = 0; +475 selectVulnerabilityId.setString(1, vuln.getName()); +476 ResultSet rs = selectVulnerabilityId.executeQuery(); +477 if (rs.next()) { +478 vulnerabilityId = rs.getInt(1); +479 // first delete any existing vulnerability info. We don't know what was updated. yes, slower but atm easier. +480 deleteReferences.setInt(1, vulnerabilityId); +481 deleteReferences.execute(); +482 deleteSoftware.setInt(1, vulnerabilityId); +483 deleteSoftware.execute(); +484 } +485 DBUtils.closeResultSet(rs); +486 rs = null; +487 if (vulnerabilityId != 0) { +488 if (vuln.getDescription().contains("** REJECT **")) { +489 deleteVulnerability.setInt(1, vulnerabilityId); +490 deleteVulnerability.executeUpdate(); +491 } else { +492 updateVulnerability.setString(1, vuln.getDescription()); +493 updateVulnerability.setString(2, vuln.getCwe()); +494 updateVulnerability.setFloat(3, vuln.getCvssScore()); +495 updateVulnerability.setString(4, vuln.getCvssAccessVector()); +496 updateVulnerability.setString(5, vuln.getCvssAccessComplexity()); +497 updateVulnerability.setString(6, vuln.getCvssAuthentication()); +498 updateVulnerability.setString(7, vuln.getCvssConfidentialityImpact()); +499 updateVulnerability.setString(8, vuln.getCvssIntegrityImpact()); +500 updateVulnerability.setString(9, vuln.getCvssAvailabilityImpact()); +501 updateVulnerability.setInt(10, vulnerabilityId); +502 updateVulnerability.executeUpdate(); +503 } +504 } else { +505 insertVulnerability.setString(1, vuln.getName()); +506 insertVulnerability.setString(2, vuln.getDescription()); +507 insertVulnerability.setString(3, vuln.getCwe()); +508 insertVulnerability.setFloat(4, vuln.getCvssScore()); +509 insertVulnerability.setString(5, vuln.getCvssAccessVector()); +510 insertVulnerability.setString(6, vuln.getCvssAccessComplexity()); +511 insertVulnerability.setString(7, vuln.getCvssAuthentication()); +512 insertVulnerability.setString(8, vuln.getCvssConfidentialityImpact()); +513 insertVulnerability.setString(9, vuln.getCvssIntegrityImpact()); +514 insertVulnerability.setString(10, vuln.getCvssAvailabilityImpact()); +515 insertVulnerability.execute(); +516 try { +517 rs = insertVulnerability.getGeneratedKeys(); +518 rs.next(); +519 vulnerabilityId = rs.getInt(1); +520 } catch (SQLException ex) { +521 final String msg = String.format("Unable to retrieve id for new vulnerability for '%s'", vuln.getName()); +522 throw new DatabaseException(msg, ex); +523 } finally { +524 DBUtils.closeResultSet(rs); +525 rs = null; +526 } +527 } +528 insertReference.setInt(1, vulnerabilityId); +529 for (Reference r : vuln.getReferences()) { +530 insertReference.setString(2, r.getName()); +531 insertReference.setString(3, r.getUrl()); +532 insertReference.setString(4, r.getSource()); +533 insertReference.execute(); +534 } +535 for (VulnerableSoftware s : vuln.getVulnerableSoftware()) { +536 int cpeProductId = 0; +537 selectCpeId.setString(1, s.getName()); +538 try { +539 rs = selectCpeId.executeQuery(); +540 if (rs.next()) { +541 cpeProductId = rs.getInt(1); +542 } +543 } catch (SQLException ex) { +544 throw new DatabaseException("Unable to get primary key for new cpe: " + s.getName(), ex); +545 } finally { +546 DBUtils.closeResultSet(rs); +547 rs = null; +548 } +549 +550 if (cpeProductId == 0) { +551 insertCpe.setString(1, s.getName()); +552 insertCpe.setString(2, s.getVendor()); +553 insertCpe.setString(3, s.getProduct()); +554 insertCpe.executeUpdate(); +555 cpeProductId = DBUtils.getGeneratedKey(insertCpe); +556 } +557 if (cpeProductId == 0) { +558 throw new DatabaseException("Unable to retrieve cpeProductId - no data returned"); +559 } +560 +561 insertSoftware.setInt(1, vulnerabilityId); +562 insertSoftware.setInt(2, cpeProductId); +563 if (s.getPreviousVersion() == null) { +564 insertSoftware.setNull(3, java.sql.Types.VARCHAR); +565 } else { +566 insertSoftware.setString(3, s.getPreviousVersion()); +567 } +568 insertSoftware.execute(); +569 } +570 +571 } catch (SQLException ex) { +572 final String msg = String.format("Error updating '%s'", vuln.getName()); +573 LOGGER.debug("", ex); +574 throw new DatabaseException(msg, ex); +575 } finally { +576 DBUtils.closeStatement(selectVulnerabilityId); +577 DBUtils.closeStatement(deleteReferences); +578 DBUtils.closeStatement(deleteSoftware); +579 DBUtils.closeStatement(updateVulnerability); +580 DBUtils.closeStatement(deleteVulnerability); +581 DBUtils.closeStatement(insertVulnerability); +582 DBUtils.closeStatement(insertReference); +583 DBUtils.closeStatement(selectCpeId); +584 DBUtils.closeStatement(insertCpe); +585 DBUtils.closeStatement(insertSoftware); +586 } +587 } 588 -589 insertSoftware.setInt(1, vulnerabilityId); -590 insertSoftware.setInt(2, cpeProductId); -591 if (s.getPreviousVersion() == null) { -592 insertSoftware.setNull(3, java.sql.Types.VARCHAR); -593 } else { -594 insertSoftware.setString(3, s.getPreviousVersion()); -595 } -596 insertSoftware.execute(); -597 } -598 -599 } catch (SQLException ex) { -600 final String msg = String.format("Error updating '%s'", vuln.getName()); -601 LOGGER.debug("", ex); -602 throw new DatabaseException(msg, ex); -603 } finally { -604 DBUtils.closeStatement(selectVulnerabilityId); -605 DBUtils.closeStatement(deleteReferences); -606 DBUtils.closeStatement(deleteSoftware); -607 DBUtils.closeStatement(updateVulnerability); -608 DBUtils.closeStatement(deleteVulnerability); -609 DBUtils.closeStatement(insertVulnerability); -610 DBUtils.closeStatement(insertReference); -611 DBUtils.closeStatement(selectCpeId); -612 DBUtils.closeStatement(insertCpe); -613 DBUtils.closeStatement(insertSoftware); -614 } -615 } -616 -617 /** -618 * Checks to see if data exists so that analysis can be performed. -619 * -620 * @return <code>true</code> if data exists; otherwise <code>false</code> -621 */ -622 public boolean dataExists() { -623 Statement cs = null; -624 ResultSet rs = null; -625 try { -626 cs = conn.createStatement(); -627 rs = cs.executeQuery("SELECT COUNT(*) records FROM cpeEntry"); -628 if (rs.next()) { -629 if (rs.getInt(1) > 0) { -630 return true; -631 } -632 } -633 } catch (SQLException ex) { -634 String dd; -635 try { -636 dd = Settings.getDataDirectory().getAbsolutePath(); -637 } catch (IOException ex1) { -638 dd = Settings.getString(Settings.KEYS.DATA_DIRECTORY); -639 } -640 LOGGER.error("Unable to access the local database.\n\nEnsure that '{}' is a writable directory. " -641 + "If the problem persist try deleting the files in '{}' and running {} again. If the problem continues, please " -642 + "create a log file (see documentation at http://jeremylong.github.io/DependencyCheck/) and open a ticket at " -643 + "https://github.com/jeremylong/DependencyCheck/issues and include the log file.\n\n", -644 dd, dd, Settings.getString(Settings.KEYS.APPLICATION_VAME)); -645 LOGGER.debug("", ex); -646 } finally { -647 DBUtils.closeResultSet(rs); -648 DBUtils.closeStatement(cs); -649 } -650 return false; -651 } -652 -653 /** -654 * It is possible that orphaned rows may be generated during database updates. This should be called after all updates have -655 * been completed to ensure orphan entries are removed. -656 */ -657 public void cleanupDatabase() { -658 PreparedStatement ps = null; -659 try { -660 ps = getConnection().prepareStatement(statementBundle.getString("CLEANUP_ORPHANS")); -661 if (ps != null) { -662 ps.executeUpdate(); -663 } -664 } catch (SQLException ex) { -665 LOGGER.error("An unexpected SQL Exception occurred; please see the verbose log for more details."); -666 LOGGER.debug("", ex); -667 } finally { -668 DBUtils.closeStatement(ps); -669 } -670 } -671 -672 /** -673 * Determines if the given identifiedVersion is affected by the given cpeId and previous version flag. A non-null, non-empty -674 * string passed to the previous version argument indicates that all previous versions are affected. -675 * -676 * @param vendor the vendor of the dependency being analyzed -677 * @param product the product name of the dependency being analyzed -678 * @param vulnerableSoftware a map of the vulnerable software with a boolean indicating if all previous versions are affected -679 * @param identifiedVersion the identified version of the dependency being analyzed -680 * @return true if the identified version is affected, otherwise false -681 */ -682 Entry<String, Boolean> getMatchingSoftware(Map<String, Boolean> vulnerableSoftware, String vendor, String product, -683 DependencyVersion identifiedVersion) { -684 -685 final boolean isVersionTwoADifferentProduct = "apache".equals(vendor) && "struts".equals(product); -686 -687 final Set<String> majorVersionsAffectingAllPrevious = new HashSet<String>(); -688 final boolean matchesAnyPrevious = identifiedVersion == null || "-".equals(identifiedVersion.toString()); -689 String majorVersionMatch = null; -690 for (Entry<String, Boolean> entry : vulnerableSoftware.entrySet()) { -691 final DependencyVersion v = parseDependencyVersion(entry.getKey()); -692 if (v == null || "-".equals(v.toString())) { //all versions -693 return entry; -694 } -695 if (entry.getValue()) { -696 if (matchesAnyPrevious) { -697 return entry; -698 } -699 if (identifiedVersion != null && identifiedVersion.getVersionParts().get(0).equals(v.getVersionParts().get(0))) { -700 majorVersionMatch = v.getVersionParts().get(0); -701 } -702 majorVersionsAffectingAllPrevious.add(v.getVersionParts().get(0)); -703 } -704 } -705 if (matchesAnyPrevious) { -706 return null; -707 } -708 -709 final boolean canSkipVersions = majorVersionMatch != null && majorVersionsAffectingAllPrevious.size() > 1; -710 //yes, we are iterating over this twice. The first time we are skipping versions those that affect all versions -711 //then later we process those that affect all versions. This could be done with sorting... -712 for (Entry<String, Boolean> entry : vulnerableSoftware.entrySet()) { -713 if (!entry.getValue()) { -714 final DependencyVersion v = parseDependencyVersion(entry.getKey()); -715 //this can't dereference a null 'majorVersionMatch' as canSkipVersions accounts for this. -716 if (canSkipVersions && !majorVersionMatch.equals(v.getVersionParts().get(0))) { -717 continue; -718 } -719 //this can't dereference a null 'identifiedVersion' because if it was null we would have exited -720 //in the above loop or just after loop (if matchesAnyPrevious return null). -721 if (identifiedVersion.equals(v)) { -722 return entry; -723 } -724 } -725 } -726 for (Entry<String, Boolean> entry : vulnerableSoftware.entrySet()) { -727 if (entry.getValue()) { -728 final DependencyVersion v = parseDependencyVersion(entry.getKey()); -729 //this can't dereference a null 'majorVersionMatch' as canSkipVersions accounts for this. -730 if (canSkipVersions && !majorVersionMatch.equals(v.getVersionParts().get(0))) { -731 continue; -732 } -733 //this can't dereference a null 'identifiedVersion' because if it was null we would have exited -734 //in the above loop or just after loop (if matchesAnyPrevious return null). -735 if (entry.getValue() && identifiedVersion.compareTo(v) <= 0) { -736 if (!(isVersionTwoADifferentProduct && !identifiedVersion.getVersionParts().get(0).equals(v.getVersionParts().get(0)))) { -737 return entry; -738 } -739 } -740 } -741 } -742 return null; -743 } -744 -745 /** -746 * Parses the version (including revision) from a CPE identifier. If no version is identified then a '-' is returned. -747 * -748 * @param cpeStr a cpe identifier -749 * @return a dependency version -750 */ -751 private DependencyVersion parseDependencyVersion(String cpeStr) { -752 final VulnerableSoftware cpe = new VulnerableSoftware(); -753 try { -754 cpe.parseName(cpeStr); -755 } catch (UnsupportedEncodingException ex) { -756 //never going to happen. -757 LOGGER.trace("", ex); -758 } -759 return parseDependencyVersion(cpe); -760 } -761 -762 /** -763 * Takes a CPE and parses out the version number. If no version is identified then a '-' is returned. -764 * -765 * @param cpe a cpe object -766 * @return a dependency version -767 */ -768 private DependencyVersion parseDependencyVersion(VulnerableSoftware cpe) { -769 final DependencyVersion cpeVersion; -770 if (cpe.getVersion() != null && !cpe.getVersion().isEmpty()) { -771 final String versionText; -772 if (cpe.getUpdate() != null && !cpe.getUpdate().isEmpty()) { -773 versionText = String.format("%s.%s", cpe.getVersion(), cpe.getUpdate()); -774 } else { -775 versionText = cpe.getVersion(); -776 } -777 cpeVersion = DependencyVersionUtil.parseVersion(versionText); -778 } else { -779 cpeVersion = new DependencyVersion("-"); -780 } -781 return cpeVersion; -782 } -783 -784 /** -785 * This method is only referenced in unused code. -786 * -787 * Deletes unused dictionary entries from the database. -788 */ -789 public void deleteUnusedCpe() { -790 CallableStatement cs = null; -791 try { -792 cs = getConnection().prepareCall(statementBundle.getString("DELETE_UNUSED_DICT_CPE")); -793 cs.executeUpdate(); -794 } catch (SQLException ex) { -795 LOGGER.error("Unable to delete CPE dictionary entries", ex); -796 } finally { -797 DBUtils.closeStatement(cs); -798 } -799 } -800 -801 /** -802 * This method is only referenced in unused code and will likely break on MySQL if ever used due to the MERGE statement. -803 * -804 * Merges CPE entries into the database. -805 * -806 * @param cpe the CPE identifier -807 * @param vendor the CPE vendor -808 * @param product the CPE product -809 */ -810 public void addCpe(String cpe, String vendor, String product) { -811 PreparedStatement ps = null; -812 try { -813 ps = getConnection().prepareCall(statementBundle.getString("ADD_DICT_CPE")); -814 ps.setString(1, cpe); -815 ps.setString(2, vendor); -816 ps.setString(3, product); -817 ps.executeUpdate(); -818 } catch (SQLException ex) { -819 LOGGER.error("Unable to add CPE dictionary entry", ex); -820 } finally { -821 DBUtils.closeStatement(ps); -822 } -823 } -824 } +589 /** +590 * Checks to see if data exists so that analysis can be performed. +591 * +592 * @return <code>true</code> if data exists; otherwise <code>false</code> +593 */ +594 public boolean dataExists() { +595 Statement cs = null; +596 ResultSet rs = null; +597 try { +598 cs = conn.createStatement(); +599 rs = cs.executeQuery("SELECT COUNT(*) records FROM cpeEntry"); +600 if (rs.next()) { +601 if (rs.getInt(1) > 0) { +602 return true; +603 } +604 } +605 } catch (SQLException ex) { +606 String dd; +607 try { +608 dd = Settings.getDataDirectory().getAbsolutePath(); +609 } catch (IOException ex1) { +610 dd = Settings.getString(Settings.KEYS.DATA_DIRECTORY); +611 } +612 LOGGER.error("Unable to access the local database.\n\nEnsure that '{}' is a writable directory. " +613 + "If the problem persist try deleting the files in '{}' and running {} again. If the problem continues, please " +614 + "create a log file (see documentation at http://jeremylong.github.io/DependencyCheck/) and open a ticket at " +615 + "https://github.com/jeremylong/DependencyCheck/issues and include the log file.\n\n", +616 dd, dd, Settings.getString(Settings.KEYS.APPLICATION_VAME)); +617 LOGGER.debug("", ex); +618 } finally { +619 DBUtils.closeResultSet(rs); +620 DBUtils.closeStatement(cs); +621 } +622 return false; +623 } +624 +625 /** +626 * It is possible that orphaned rows may be generated during database updates. This should be called after all updates have +627 * been completed to ensure orphan entries are removed. +628 */ +629 public void cleanupDatabase() { +630 PreparedStatement ps = null; +631 try { +632 ps = getConnection().prepareStatement(statementBundle.getString("CLEANUP_ORPHANS")); +633 if (ps != null) { +634 ps.executeUpdate(); +635 } +636 } catch (SQLException ex) { +637 LOGGER.error("An unexpected SQL Exception occurred; please see the verbose log for more details."); +638 LOGGER.debug("", ex); +639 } finally { +640 DBUtils.closeStatement(ps); +641 } +642 } +643 +644 /** +645 * Determines if the given identifiedVersion is affected by the given cpeId and previous version flag. A non-null, non-empty +646 * string passed to the previous version argument indicates that all previous versions are affected. +647 * +648 * @param vendor the vendor of the dependency being analyzed +649 * @param product the product name of the dependency being analyzed +650 * @param vulnerableSoftware a map of the vulnerable software with a boolean indicating if all previous versions are affected +651 * @param identifiedVersion the identified version of the dependency being analyzed +652 * @return true if the identified version is affected, otherwise false +653 */ +654 Entry<String, Boolean> getMatchingSoftware(Map<String, Boolean> vulnerableSoftware, String vendor, String product, +655 DependencyVersion identifiedVersion) { +656 +657 final boolean isVersionTwoADifferentProduct = "apache".equals(vendor) && "struts".equals(product); +658 +659 final Set<String> majorVersionsAffectingAllPrevious = new HashSet<String>(); +660 final boolean matchesAnyPrevious = identifiedVersion == null || "-".equals(identifiedVersion.toString()); +661 String majorVersionMatch = null; +662 for (Entry<String, Boolean> entry : vulnerableSoftware.entrySet()) { +663 final DependencyVersion v = parseDependencyVersion(entry.getKey()); +664 if (v == null || "-".equals(v.toString())) { //all versions +665 return entry; +666 } +667 if (entry.getValue()) { +668 if (matchesAnyPrevious) { +669 return entry; +670 } +671 if (identifiedVersion != null && identifiedVersion.getVersionParts().get(0).equals(v.getVersionParts().get(0))) { +672 majorVersionMatch = v.getVersionParts().get(0); +673 } +674 majorVersionsAffectingAllPrevious.add(v.getVersionParts().get(0)); +675 } +676 } +677 if (matchesAnyPrevious) { +678 return null; +679 } +680 +681 final boolean canSkipVersions = majorVersionMatch != null && majorVersionsAffectingAllPrevious.size() > 1; +682 //yes, we are iterating over this twice. The first time we are skipping versions those that affect all versions +683 //then later we process those that affect all versions. This could be done with sorting... +684 for (Entry<String, Boolean> entry : vulnerableSoftware.entrySet()) { +685 if (!entry.getValue()) { +686 final DependencyVersion v = parseDependencyVersion(entry.getKey()); +687 //this can't dereference a null 'majorVersionMatch' as canSkipVersions accounts for this. +688 if (canSkipVersions && !majorVersionMatch.equals(v.getVersionParts().get(0))) { +689 continue; +690 } +691 //this can't dereference a null 'identifiedVersion' because if it was null we would have exited +692 //in the above loop or just after loop (if matchesAnyPrevious return null). +693 if (identifiedVersion.equals(v)) { +694 return entry; +695 } +696 } +697 } +698 for (Entry<String, Boolean> entry : vulnerableSoftware.entrySet()) { +699 if (entry.getValue()) { +700 final DependencyVersion v = parseDependencyVersion(entry.getKey()); +701 //this can't dereference a null 'majorVersionMatch' as canSkipVersions accounts for this. +702 if (canSkipVersions && !majorVersionMatch.equals(v.getVersionParts().get(0))) { +703 continue; +704 } +705 //this can't dereference a null 'identifiedVersion' because if it was null we would have exited +706 //in the above loop or just after loop (if matchesAnyPrevious return null). +707 if (entry.getValue() && identifiedVersion.compareTo(v) <= 0) { +708 if (!(isVersionTwoADifferentProduct && !identifiedVersion.getVersionParts().get(0).equals(v.getVersionParts().get(0)))) { +709 return entry; +710 } +711 } +712 } +713 } +714 return null; +715 } +716 +717 /** +718 * Parses the version (including revision) from a CPE identifier. If no version is identified then a '-' is returned. +719 * +720 * @param cpeStr a cpe identifier +721 * @return a dependency version +722 */ +723 private DependencyVersion parseDependencyVersion(String cpeStr) { +724 final VulnerableSoftware cpe = new VulnerableSoftware(); +725 try { +726 cpe.parseName(cpeStr); +727 } catch (UnsupportedEncodingException ex) { +728 //never going to happen. +729 LOGGER.trace("", ex); +730 } +731 return parseDependencyVersion(cpe); +732 } +733 +734 /** +735 * Takes a CPE and parses out the version number. If no version is identified then a '-' is returned. +736 * +737 * @param cpe a cpe object +738 * @return a dependency version +739 */ +740 private DependencyVersion parseDependencyVersion(VulnerableSoftware cpe) { +741 final DependencyVersion cpeVersion; +742 if (cpe.getVersion() != null && !cpe.getVersion().isEmpty()) { +743 final String versionText; +744 if (cpe.getUpdate() != null && !cpe.getUpdate().isEmpty()) { +745 versionText = String.format("%s.%s", cpe.getVersion(), cpe.getUpdate()); +746 } else { +747 versionText = cpe.getVersion(); +748 } +749 cpeVersion = DependencyVersionUtil.parseVersion(versionText); +750 } else { +751 cpeVersion = new DependencyVersion("-"); +752 } +753 return cpeVersion; +754 } +755 +756 /** +757 * This method is only referenced in unused code. +758 * +759 * Deletes unused dictionary entries from the database. +760 */ +761 public void deleteUnusedCpe() { +762 CallableStatement cs = null; +763 try { +764 cs = getConnection().prepareCall(statementBundle.getString("DELETE_UNUSED_DICT_CPE")); +765 cs.executeUpdate(); +766 } catch (SQLException ex) { +767 LOGGER.error("Unable to delete CPE dictionary entries", ex); +768 } finally { +769 DBUtils.closeStatement(cs); +770 } +771 } +772 +773 /** +774 * This method is only referenced in unused code and will likely break on MySQL if ever used due to the MERGE statement. +775 * +776 * Merges CPE entries into the database. +777 * +778 * @param cpe the CPE identifier +779 * @param vendor the CPE vendor +780 * @param product the CPE product +781 */ +782 public void addCpe(String cpe, String vendor, String product) { +783 PreparedStatement ps = null; +784 try { +785 ps = getConnection().prepareCall(statementBundle.getString("ADD_DICT_CPE")); +786 ps.setString(1, cpe); +787 ps.setString(2, vendor); +788 ps.setString(3, product); +789 ps.executeUpdate(); +790 } catch (SQLException ex) { +791 LOGGER.error("Unable to add CPE dictionary entry", ex); +792 } finally { +793 DBUtils.closeStatement(ps); +794 } +795 } +796 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/DatabaseProperties.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/DatabaseProperties.html index 922117e5a..1f03b5eef 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/DatabaseProperties.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/DatabaseProperties.html @@ -54,144 +54,148 @@ 46 */ 47 public static final String MODIFIED = "Modified"; 48 /** -49 * The properties file key for the last updated field - used to store the last updated time of the Modified NVD CVE xml file. +49 * The properties file key for the last checked field - used to store the last check time of the Modified NVD CVE xml file. 50 */ -51 public static final String LAST_UPDATED = "NVD CVE Modified"; +51 public static final String LAST_CHECKED = "NVD CVE Checked"; 52 /** -53 * Stores the last updated time for each of the NVD CVE files. These timestamps should be updated if we process the modified -54 * file within 7 days of the last update. -55 */ -56 public static final String LAST_UPDATED_BASE = "NVD CVE "; -57 /** -58 * The key for the last time the CPE data was updated. +53 * The properties file key for the last updated field - used to store the last updated time of the Modified NVD CVE xml file. +54 */ +55 public static final String LAST_UPDATED = "NVD CVE Modified"; +56 /** +57 * Stores the last updated time for each of the NVD CVE files. These timestamps should be updated if we process the modified +58 * file within 7 days of the last update. 59 */ -60 public static final String LAST_CPE_UPDATE = "LAST_CPE_UPDATE"; +60 public static final String LAST_UPDATED_BASE = "NVD CVE "; 61 /** -62 * The key for the database schema version. +62 * The key for the last time the CPE data was updated. 63 */ -64 public static final String VERSION = "version"; -65 -66 /** -67 * A collection of properties about the data. -68 */ -69 private Properties properties; +64 public static final String LAST_CPE_UPDATE = "LAST_CPE_UPDATE"; +65 /** +66 * The key for the database schema version. +67 */ +68 public static final String VERSION = "version"; +69 70 /** -71 * A reference to the database. +71 * A collection of properties about the data. 72 */ -73 private CveDB cveDB; -74 -75 /** -76 * Constructs a new data properties object. -77 * -78 * @param cveDB the database object holding the properties -79 */ -80 DatabaseProperties(CveDB cveDB) { -81 this.cveDB = cveDB; -82 loadProperties(); -83 } -84 -85 /** -86 * Loads the properties from the database. -87 */ -88 private void loadProperties() { -89 this.properties = cveDB.getProperties(); -90 } -91 -92 /** -93 * Returns whether or not any properties are set. -94 * -95 * @return whether or not any properties are set -96 */ -97 public boolean isEmpty() { -98 return properties == null || properties.isEmpty(); -99 } -100 -101 /** -102 * Saves the last updated information to the properties file. -103 * -104 * @param updatedValue the updated NVD CVE entry -105 * @throws UpdateException is thrown if there is an update exception -106 */ -107 public void save(NvdCveInfo updatedValue) throws UpdateException { -108 if (updatedValue == null) { -109 return; -110 } -111 save(LAST_UPDATED_BASE + updatedValue.getId(), String.valueOf(updatedValue.getTimestamp())); -112 } -113 -114 /** -115 * Saves the key value pair to the properties store. -116 * -117 * @param key the property key -118 * @param value the property value -119 * @throws UpdateException is thrown if there is an update exception -120 */ -121 public void save(String key, String value) throws UpdateException { -122 properties.put(key, value); -123 cveDB.saveProperty(key, value); -124 } -125 -126 /** -127 * Returns the property value for the given key. If the key is not contained in the underlying properties null is returned. -128 * -129 * @param key the property key -130 * @return the value of the property -131 */ -132 public String getProperty(String key) { -133 return properties.getProperty(key); -134 } -135 -136 /** -137 * Returns the property value for the given key. If the key is not contained in the underlying properties the default value is -138 * returned. -139 * -140 * @param key the property key -141 * @param defaultValue the default value -142 * @return the value of the property -143 */ -144 public String getProperty(String key, String defaultValue) { -145 return properties.getProperty(key, defaultValue); -146 } -147 -148 /** -149 * Returns the collection of Database Properties as a properties collection. -150 * -151 * @return the collection of Database Properties -152 */ -153 public Properties getProperties() { -154 return properties; -155 } -156 -157 /** -158 * Returns a map of the meta data from the database properties. This primarily contains timestamps of when the NVD CVE -159 * information was last updated. -160 * -161 * @return a map of the database meta data -162 */ -163 public Map<String, String> getMetaData() { -164 final Map<String, String> map = new TreeMap<String, String>(); -165 for (Entry<Object, Object> entry : properties.entrySet()) { -166 final String key = (String) entry.getKey(); -167 if (!"version".equals(key)) { -168 if (key.startsWith("NVD CVE ")) { -169 try { -170 final long epoch = Long.parseLong((String) entry.getValue()); -171 final Date date = new Date(epoch); -172 final DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); -173 final String formatted = format.format(date); -174 map.put(key, formatted); -175 } catch (Throwable ex) { //deliberately being broad in this catch clause -176 LOGGER.debug("Unable to parse timestamp from DB", ex); -177 map.put(key, (String) entry.getValue()); -178 } -179 } else { -180 map.put(key, (String) entry.getValue()); -181 } -182 } -183 } -184 return map; -185 } -186 } +73 private Properties properties; +74 /** +75 * A reference to the database. +76 */ +77 private CveDB cveDB; +78 +79 /** +80 * Constructs a new data properties object. +81 * +82 * @param cveDB the database object holding the properties +83 */ +84 DatabaseProperties(CveDB cveDB) { +85 this.cveDB = cveDB; +86 loadProperties(); +87 } +88 +89 /** +90 * Loads the properties from the database. +91 */ +92 private void loadProperties() { +93 this.properties = cveDB.getProperties(); +94 } +95 +96 /** +97 * Returns whether or not any properties are set. +98 * +99 * @return whether or not any properties are set +100 */ +101 public boolean isEmpty() { +102 return properties == null || properties.isEmpty(); +103 } +104 +105 /** +106 * Saves the last updated information to the properties file. +107 * +108 * @param updatedValue the updated NVD CVE entry +109 * @throws UpdateException is thrown if there is an update exception +110 */ +111 public void save(NvdCveInfo updatedValue) throws UpdateException { +112 if (updatedValue == null) { +113 return; +114 } +115 save(LAST_UPDATED_BASE + updatedValue.getId(), String.valueOf(updatedValue.getTimestamp())); +116 } +117 +118 /** +119 * Saves the key value pair to the properties store. +120 * +121 * @param key the property key +122 * @param value the property value +123 * @throws UpdateException is thrown if there is an update exception +124 */ +125 public void save(String key, String value) throws UpdateException { +126 properties.put(key, value); +127 cveDB.saveProperty(key, value); +128 } +129 +130 /** +131 * Returns the property value for the given key. If the key is not contained in the underlying properties null is returned. +132 * +133 * @param key the property key +134 * @return the value of the property +135 */ +136 public String getProperty(String key) { +137 return properties.getProperty(key); +138 } +139 +140 /** +141 * Returns the property value for the given key. If the key is not contained in the underlying properties the default value is +142 * returned. +143 * +144 * @param key the property key +145 * @param defaultValue the default value +146 * @return the value of the property +147 */ +148 public String getProperty(String key, String defaultValue) { +149 return properties.getProperty(key, defaultValue); +150 } +151 +152 /** +153 * Returns the collection of Database Properties as a properties collection. +154 * +155 * @return the collection of Database Properties +156 */ +157 public Properties getProperties() { +158 return properties; +159 } +160 +161 /** +162 * Returns a map of the meta data from the database properties. This primarily contains timestamps of when the NVD CVE +163 * information was last updated. +164 * +165 * @return a map of the database meta data +166 */ +167 public Map<String, String> getMetaData() { +168 final Map<String, String> map = new TreeMap<String, String>(); +169 for (Entry<Object, Object> entry : properties.entrySet()) { +170 final String key = (String) entry.getKey(); +171 if (!"version".equals(key)) { +172 if (key.startsWith("NVD CVE ")) { +173 try { +174 final long epoch = Long.parseLong((String) entry.getValue()); +175 final Date date = new Date(epoch); +176 final DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); +177 final String formatted = format.format(date); +178 map.put(key, formatted); +179 } catch (Throwable ex) { //deliberately being broad in this catch clause +180 LOGGER.debug("Unable to parse timestamp from DB", ex); +181 map.put(key, (String) entry.getValue()); +182 } +183 } else { +184 map.put(key, (String) entry.getValue()); +185 } +186 } +187 } +188 return map; +189 } +190 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/DriverLoader.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/DriverLoader.html index 3385d85be..02e50b401 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/DriverLoader.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/DriverLoader.html @@ -71,92 +71,91 @@ 63 } 64 65 /** -66 * Loads the specified class by registering the supplied paths to the class loader and then registers the driver -67 * with the driver manager. The pathToDriver argument is added to the class loader so that an external driver can be -68 * loaded. Note, the pathToDriver can contain a semi-colon separated list of paths so any dependencies can be added -69 * as needed. If a path in the pathToDriver argument is a directory all files in the directory are added to the -70 * class path. -71 * -72 * @param className the fully qualified name of the desired class -73 * @param pathToDriver the path to the JAR file containing the driver; note, this can be a semi-colon separated list -74 * of paths -75 * @return the loaded Driver -76 * @throws DriverLoadException thrown if the driver cannot be loaded -77 */ -78 public static Driver load(String className, String pathToDriver) throws DriverLoadException { -79 final URLClassLoader parent = (URLClassLoader) ClassLoader.getSystemClassLoader(); -80 final List<URL> urls = new ArrayList<URL>(); -81 final String[] paths = pathToDriver.split(File.pathSeparator); -82 for (String path : paths) { -83 final File file = new File(path); -84 if (file.isDirectory()) { -85 final File[] files = file.listFiles(); -86 -87 for (File f : files) { -88 try { -89 urls.add(f.toURI().toURL()); -90 } catch (MalformedURLException ex) { -91 LOGGER.debug("Unable to load database driver '{}'; invalid path provided '{}'", -92 className, f.getAbsoluteFile(), ex); -93 throw new DriverLoadException("Unable to load database driver. Invalid path provided", ex); -94 } -95 } -96 } else if (file.exists()) { -97 try { -98 urls.add(file.toURI().toURL()); -99 } catch (MalformedURLException ex) { -100 LOGGER.debug("Unable to load database driver '{}'; invalid path provided '{}'", -101 className, file.getAbsoluteFile(), ex); -102 throw new DriverLoadException("Unable to load database driver. Invalid path provided", ex); -103 } -104 } -105 } -106 final URLClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() { -107 @Override -108 public URLClassLoader run() { -109 return new URLClassLoader(urls.toArray(new URL[urls.size()]), parent); -110 } -111 }); -112 -113 return load(className, loader); -114 } -115 -116 /** -117 * Loads the specified class using the supplied class loader and registers the driver with the driver manager. -118 * -119 * @param className the fully qualified name of the desired class -120 * @param loader the class loader to use when loading the driver -121 * @return the loaded Driver -122 * @throws DriverLoadException thrown if the driver cannot be loaded -123 */ -124 private static Driver load(String className, ClassLoader loader) throws DriverLoadException { -125 try { -126 final Class c = Class.forName(className, true, loader); -127 //final Class c = loader.loadClass(className); -128 final Driver driver = (Driver) c.newInstance(); -129 final Driver shim = new DriverShim(driver); -130 //using the DriverShim to get around the fact that the DriverManager won't register a driver not in the base class path -131 DriverManager.registerDriver(shim); -132 return shim; -133 } catch (ClassNotFoundException ex) { -134 final String msg = String.format("Unable to load database driver '%s'", className); -135 LOGGER.debug(msg, ex); -136 throw new DriverLoadException(msg, ex); -137 } catch (InstantiationException ex) { -138 final String msg = String.format("Unable to load database driver '%s'", className); -139 LOGGER.debug(msg, ex); -140 throw new DriverLoadException(msg, ex); -141 } catch (IllegalAccessException ex) { -142 final String msg = String.format("Unable to load database driver '%s'", className); -143 LOGGER.debug(msg, ex); -144 throw new DriverLoadException(msg, ex); -145 } catch (SQLException ex) { -146 final String msg = String.format("Unable to load database driver '%s'", className); -147 LOGGER.debug(msg, ex); -148 throw new DriverLoadException(msg, ex); -149 } -150 } -151 } +66 * Loads the specified class by registering the supplied paths to the class loader and then registers the driver with the +67 * driver manager. The pathToDriver argument is added to the class loader so that an external driver can be loaded. Note, the +68 * pathToDriver can contain a semi-colon separated list of paths so any dependencies can be added as needed. If a path in the +69 * pathToDriver argument is a directory all files in the directory are added to the class path. +70 * +71 * @param className the fully qualified name of the desired class +72 * @param pathToDriver the path to the JAR file containing the driver; note, this can be a semi-colon separated list of paths +73 * @return the loaded Driver +74 * @throws DriverLoadException thrown if the driver cannot be loaded +75 */ +76 public static Driver load(String className, String pathToDriver) throws DriverLoadException { +77 final URLClassLoader parent = (URLClassLoader) ClassLoader.getSystemClassLoader(); +78 final List<URL> urls = new ArrayList<URL>(); +79 final String[] paths = pathToDriver.split(File.pathSeparator); +80 for (String path : paths) { +81 final File file = new File(path); +82 if (file.isDirectory()) { +83 final File[] files = file.listFiles(); +84 if (files != null) { +85 for (File f : files) { +86 try { +87 urls.add(f.toURI().toURL()); +88 } catch (MalformedURLException ex) { +89 LOGGER.debug("Unable to load database driver '{}'; invalid path provided '{}'", +90 className, f.getAbsoluteFile(), ex); +91 throw new DriverLoadException("Unable to load database driver. Invalid path provided", ex); +92 } +93 } +94 } +95 } else if (file.exists()) { +96 try { +97 urls.add(file.toURI().toURL()); +98 } catch (MalformedURLException ex) { +99 LOGGER.debug("Unable to load database driver '{}'; invalid path provided '{}'", +100 className, file.getAbsoluteFile(), ex); +101 throw new DriverLoadException("Unable to load database driver. Invalid path provided", ex); +102 } +103 } +104 } +105 final URLClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() { +106 @Override +107 public URLClassLoader run() { +108 return new URLClassLoader(urls.toArray(new URL[urls.size()]), parent); +109 } +110 }); +111 +112 return load(className, loader); +113 } +114 +115 /** +116 * Loads the specified class using the supplied class loader and registers the driver with the driver manager. +117 * +118 * @param className the fully qualified name of the desired class +119 * @param loader the class loader to use when loading the driver +120 * @return the loaded Driver +121 * @throws DriverLoadException thrown if the driver cannot be loaded +122 */ +123 private static Driver load(String className, ClassLoader loader) throws DriverLoadException { +124 try { +125 final Class c = Class.forName(className, true, loader); +126 //final Class c = loader.loadClass(className); +127 final Driver driver = (Driver) c.newInstance(); +128 final Driver shim = new DriverShim(driver); +129 //using the DriverShim to get around the fact that the DriverManager won't register a driver not in the base class path +130 DriverManager.registerDriver(shim); +131 return shim; +132 } catch (ClassNotFoundException ex) { +133 final String msg = String.format("Unable to load database driver '%s'", className); +134 LOGGER.debug(msg, ex); +135 throw new DriverLoadException(msg, ex); +136 } catch (InstantiationException ex) { +137 final String msg = String.format("Unable to load database driver '%s'", className); +138 LOGGER.debug(msg, ex); +139 throw new DriverLoadException(msg, ex); +140 } catch (IllegalAccessException ex) { +141 final String msg = String.format("Unable to load database driver '%s'", className); +142 LOGGER.debug(msg, ex); +143 throw new DriverLoadException(msg, ex); +144 } catch (SQLException ex) { +145 final String msg = String.format("Unable to load database driver '%s'", className); +146 LOGGER.debug(msg, ex); +147 throw new DriverLoadException(msg, ex); +148 } +149 } +150 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/package-frame.html index 131c96d1c..89b4f31b8 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.nvdcve + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.nvdcve diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/package-summary.html index f1c18acd7..66df635f5 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/nvdcve/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.nvdcve + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.nvdcve diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/CpeUpdater.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/CpeUpdater.html index 25e85f441..b5e038900 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/CpeUpdater.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/CpeUpdater.html @@ -145,7 +145,7 @@ 137 */ 138 private boolean updateNeeded() { 139 final long now = System.currentTimeMillis(); -140 final int days = Settings.getInt(Settings.KEYS.CVE_MODIFIED_VALID_FOR_DAYS, 30); +140 final int days = Settings.getInt(Settings.KEYS.CPE_MODIFIED_VALID_FOR_DAYS, 30); 141 long timestamp = 0; 142 final String ts = getProperties().getProperty(LAST_CPE_UPDATE); 143 if (ts != null && ts.matches("^[0-9]+$")) { diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/NvdCveUpdater.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/NvdCveUpdater.html index 8093121a1..8bb0a7675 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/NvdCveUpdater.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/NvdCveUpdater.html @@ -74,222 +74,253 @@ 66 public void update() throws UpdateException { 67 try { 68 openDataStores(); -69 final UpdateableNvdCve updateable = getUpdatesNeeded(); -70 if (updateable.isUpdateNeeded()) { -71 performUpdate(updateable); -72 } -73 } catch (MalformedURLException ex) { -74 LOGGER.warn( -75 "NVD CVE properties files contain an invalid URL, unable to update the data to use the most current data."); -76 LOGGER.debug("", ex); -77 } catch (DownloadFailedException ex) { -78 LOGGER.warn( -79 "Unable to download the NVD CVE data; the results may not include the most recent CPE/CVEs from the NVD."); -80 if (Settings.getString(Settings.KEYS.PROXY_SERVER) == null) { -81 LOGGER.info( -82 "If you are behind a proxy you may need to configure dependency-check to use the proxy."); -83 } -84 LOGGER.debug("", ex); -85 } finally { -86 closeDataStores(); -87 } -88 } -89 -90 /** -91 * Downloads the latest NVD CVE XML file from the web and imports it into the current CVE Database. -92 * -93 * @param updateable a collection of NVD CVE data file references that need to be downloaded and processed to update the -94 * database -95 * @throws UpdateException is thrown if there is an error updating the database -96 */ -97 public void performUpdate(UpdateableNvdCve updateable) throws UpdateException { -98 int maxUpdates = 0; -99 try { -100 for (NvdCveInfo cve : updateable) { -101 if (cve.getNeedsUpdate()) { -102 maxUpdates += 1; -103 } -104 } -105 if (maxUpdates <= 0) { -106 return; -107 } -108 if (maxUpdates > 3) { -109 LOGGER.info( -110 "NVD CVE requires several updates; this could take a couple of minutes."); -111 } -112 if (maxUpdates > 0) { -113 openDataStores(); -114 } -115 -116 final int poolSize = (MAX_THREAD_POOL_SIZE < maxUpdates) ? MAX_THREAD_POOL_SIZE : maxUpdates; -117 -118 final ExecutorService downloadExecutors = Executors.newFixedThreadPool(poolSize); -119 final ExecutorService processExecutor = Executors.newSingleThreadExecutor(); -120 final Set<Future<Future<ProcessTask>>> downloadFutures = new HashSet<Future<Future<ProcessTask>>>(maxUpdates); -121 for (NvdCveInfo cve : updateable) { -122 if (cve.getNeedsUpdate()) { -123 final DownloadTask call = new DownloadTask(cve, processExecutor, getCveDB(), Settings.getInstance()); -124 downloadFutures.add(downloadExecutors.submit(call)); -125 } -126 } -127 downloadExecutors.shutdown(); -128 -129 //next, move the future future processTasks to just future processTasks -130 final Set<Future<ProcessTask>> processFutures = new HashSet<Future<ProcessTask>>(maxUpdates); -131 for (Future<Future<ProcessTask>> future : downloadFutures) { -132 Future<ProcessTask> task = null; -133 try { -134 task = future.get(); -135 } catch (InterruptedException ex) { -136 downloadExecutors.shutdownNow(); -137 processExecutor.shutdownNow(); -138 -139 LOGGER.debug("Thread was interrupted during download", ex); -140 throw new UpdateException("The download was interrupted", ex); -141 } catch (ExecutionException ex) { -142 downloadExecutors.shutdownNow(); -143 processExecutor.shutdownNow(); -144 -145 LOGGER.debug("Thread was interrupted during download execution", ex); -146 throw new UpdateException("The execution of the download was interrupted", ex); -147 } -148 if (task == null) { -149 downloadExecutors.shutdownNow(); -150 processExecutor.shutdownNow(); -151 LOGGER.debug("Thread was interrupted during download"); -152 throw new UpdateException("The download was interrupted; unable to complete the update"); -153 } else { -154 processFutures.add(task); -155 } -156 } -157 -158 for (Future<ProcessTask> future : processFutures) { -159 try { -160 final ProcessTask task = future.get(); -161 if (task.getException() != null) { -162 throw task.getException(); -163 } -164 } catch (InterruptedException ex) { -165 processExecutor.shutdownNow(); -166 LOGGER.debug("Thread was interrupted during processing", ex); -167 throw new UpdateException(ex); -168 } catch (ExecutionException ex) { -169 processExecutor.shutdownNow(); -170 LOGGER.debug("Execution Exception during process", ex); -171 throw new UpdateException(ex); -172 } finally { -173 processExecutor.shutdown(); -174 } -175 } -176 -177 if (maxUpdates >= 1) { //ensure the modified file date gets written (we may not have actually updated it) -178 getProperties().save(updateable.get(MODIFIED)); -179 LOGGER.info("Begin database maintenance."); -180 getCveDB().cleanupDatabase(); -181 LOGGER.info("End database maintenance."); -182 } -183 } finally { -184 closeDataStores(); -185 } -186 } -187 -188 /** -189 * Determines if the index needs to be updated. This is done by fetching the NVD CVE meta data and checking the last update -190 * date. If the data needs to be refreshed this method will return the NvdCveUrl for the files that need to be updated. -191 * -192 * @return the collection of files that need to be updated -193 * @throws MalformedURLException is thrown if the URL for the NVD CVE Meta data is incorrect -194 * @throws DownloadFailedException is thrown if there is an error. downloading the NVD CVE download data file -195 * @throws UpdateException Is thrown if there is an issue with the last updated properties file -196 */ -197 protected final UpdateableNvdCve getUpdatesNeeded() throws MalformedURLException, DownloadFailedException, UpdateException { -198 UpdateableNvdCve updates = null; -199 try { -200 updates = retrieveCurrentTimestampsFromWeb(); -201 } catch (InvalidDataException ex) { -202 final String msg = "Unable to retrieve valid timestamp from nvd cve downloads page"; -203 LOGGER.debug(msg, ex); -204 throw new DownloadFailedException(msg, ex); -205 } catch (InvalidSettingException ex) { -206 LOGGER.debug("Invalid setting found when retrieving timestamps", ex); -207 throw new DownloadFailedException("Invalid settings", ex); -208 } -209 -210 if (updates == null) { -211 throw new DownloadFailedException("Unable to retrieve the timestamps of the currently published NVD CVE data"); -212 } -213 if (!getProperties().isEmpty()) { -214 try { -215 final long lastUpdated = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_UPDATED, "0")); -216 final long now = System.currentTimeMillis(); -217 final int days = Settings.getInt(Settings.KEYS.CVE_MODIFIED_VALID_FOR_DAYS, 7); -218 if (lastUpdated == updates.getTimeStamp(MODIFIED)) { -219 updates.clear(); //we don't need to update anything. -220 } else if (DateUtil.withinDateRange(lastUpdated, now, days)) { -221 for (NvdCveInfo entry : updates) { -222 if (MODIFIED.equals(entry.getId())) { -223 entry.setNeedsUpdate(true); -224 } else { -225 entry.setNeedsUpdate(false); -226 } -227 } -228 } else { //we figure out which of the several XML files need to be downloaded. -229 for (NvdCveInfo entry : updates) { -230 if (MODIFIED.equals(entry.getId())) { -231 entry.setNeedsUpdate(true); -232 } else { -233 long currentTimestamp = 0; -234 try { -235 currentTimestamp = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_UPDATED_BASE -236 + entry.getId(), "0")); -237 } catch (NumberFormatException ex) { -238 LOGGER.debug("Error parsing '{}' '{}' from nvdcve.lastupdated", -239 DatabaseProperties.LAST_UPDATED_BASE, entry.getId(), ex); -240 } -241 if (currentTimestamp == entry.getTimestamp()) { -242 entry.setNeedsUpdate(false); -243 } -244 } -245 } -246 } -247 } catch (NumberFormatException ex) { -248 LOGGER.warn("An invalid schema version or timestamp exists in the data.properties file."); -249 LOGGER.debug("", ex); -250 } -251 } -252 return updates; -253 } -254 -255 /** -256 * Retrieves the timestamps from the NVD CVE meta data file. -257 * -258 * @return the timestamp from the currently published nvdcve downloads page -259 * @throws MalformedURLException thrown if the URL for the NVD CCE Meta data is incorrect. -260 * @throws DownloadFailedException thrown if there is an error downloading the nvd cve meta data file -261 * @throws InvalidDataException thrown if there is an exception parsing the timestamps -262 * @throws InvalidSettingException thrown if the settings are invalid -263 */ -264 private UpdateableNvdCve retrieveCurrentTimestampsFromWeb() -265 throws MalformedURLException, DownloadFailedException, InvalidDataException, InvalidSettingException { -266 -267 final UpdateableNvdCve updates = new UpdateableNvdCve(); -268 updates.add(MODIFIED, Settings.getString(Settings.KEYS.CVE_MODIFIED_20_URL), -269 Settings.getString(Settings.KEYS.CVE_MODIFIED_12_URL), -270 false); -271 -272 final int start = Settings.getInt(Settings.KEYS.CVE_START_YEAR); -273 final int end = Calendar.getInstance().get(Calendar.YEAR); -274 final String baseUrl20 = Settings.getString(Settings.KEYS.CVE_SCHEMA_2_0); -275 final String baseUrl12 = Settings.getString(Settings.KEYS.CVE_SCHEMA_1_2); -276 for (int i = start; i <= end; i++) { -277 updates.add(Integer.toString(i), String.format(baseUrl20, i), -278 String.format(baseUrl12, i), -279 true); -280 } -281 return updates; -282 } -283 -284 } +69 if (checkUpdate()) { +70 final UpdateableNvdCve updateable = getUpdatesNeeded(); +71 if (updateable.isUpdateNeeded()) { +72 performUpdate(updateable); +73 } +74 } +75 } catch (MalformedURLException ex) { +76 LOGGER.warn( +77 "NVD CVE properties files contain an invalid URL, unable to update the data to use the most current data."); +78 LOGGER.debug("", ex); +79 } catch (DownloadFailedException ex) { +80 LOGGER.warn( +81 "Unable to download the NVD CVE data; the results may not include the most recent CPE/CVEs from the NVD."); +82 if (Settings.getString(Settings.KEYS.PROXY_SERVER) == null) { +83 LOGGER.info( +84 "If you are behind a proxy you may need to configure dependency-check to use the proxy."); +85 } +86 LOGGER.debug("", ex); +87 } finally { +88 closeDataStores(); +89 } +90 } +91 +92 /** +93 * Checks if the NVD CVE XML files were last checked recently. As an optimization, we can avoid repetitive checks against the +94 * NVD. Setting CVE_CHECK_VALID_FOR_HOURS determines the duration since last check before checking again. A database property +95 * stores the timestamp of the last check. +96 * +97 * @return true to proceed with the check, or false to skip. +98 * @throws UpdateException thrown when there is an issue checking for updates. +99 */ +100 private boolean checkUpdate() throws UpdateException { +101 boolean proceed = true; +102 // If the valid setting has not been specified, then we proceed to check... +103 final int validForHours = Settings.getInt(Settings.KEYS.CVE_CHECK_VALID_FOR_HOURS, 0); +104 if (0 < validForHours) { +105 // ms Valid = valid (hours) x 60 min/hour x 60 sec/min x 1000 ms/sec +106 final long msValid = validForHours * 60L * 60L * 1000L; +107 final long lastChecked = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_CHECKED, "0")); +108 final long now = System.currentTimeMillis(); +109 proceed = (now - lastChecked) > msValid; +110 if (proceed) { +111 getProperties().save(DatabaseProperties.LAST_CHECKED, Long.toString(now)); +112 } else { +113 LOGGER.info("Skipping NVD check since last check was within {} hours.", validForHours); +114 LOGGER.debug("Last NVD was at {}, and now {} is within {} ms.", +115 lastChecked, now, msValid); +116 } +117 } +118 return proceed; +119 } +120 +121 /** +122 * Downloads the latest NVD CVE XML file from the web and imports it into the current CVE Database. +123 * +124 * @param updateable a collection of NVD CVE data file references that need to be downloaded and processed to update the +125 * database +126 * @throws UpdateException is thrown if there is an error updating the database +127 */ +128 public void performUpdate(UpdateableNvdCve updateable) throws UpdateException { +129 int maxUpdates = 0; +130 try { +131 for (NvdCveInfo cve : updateable) { +132 if (cve.getNeedsUpdate()) { +133 maxUpdates += 1; +134 } +135 } +136 if (maxUpdates <= 0) { +137 return; +138 } +139 if (maxUpdates > 3) { +140 LOGGER.info( +141 "NVD CVE requires several updates; this could take a couple of minutes."); +142 } +143 if (maxUpdates > 0) { +144 openDataStores(); +145 } +146 +147 final int poolSize = (MAX_THREAD_POOL_SIZE < maxUpdates) ? MAX_THREAD_POOL_SIZE : maxUpdates; +148 +149 final ExecutorService downloadExecutors = Executors.newFixedThreadPool(poolSize); +150 final ExecutorService processExecutor = Executors.newSingleThreadExecutor(); +151 final Set<Future<Future<ProcessTask>>> downloadFutures = new HashSet<Future<Future<ProcessTask>>>(maxUpdates); +152 for (NvdCveInfo cve : updateable) { +153 if (cve.getNeedsUpdate()) { +154 final DownloadTask call = new DownloadTask(cve, processExecutor, getCveDB(), Settings.getInstance()); +155 downloadFutures.add(downloadExecutors.submit(call)); +156 } +157 } +158 downloadExecutors.shutdown(); +159 +160 //next, move the future future processTasks to just future processTasks +161 final Set<Future<ProcessTask>> processFutures = new HashSet<Future<ProcessTask>>(maxUpdates); +162 for (Future<Future<ProcessTask>> future : downloadFutures) { +163 Future<ProcessTask> task = null; +164 try { +165 task = future.get(); +166 } catch (InterruptedException ex) { +167 downloadExecutors.shutdownNow(); +168 processExecutor.shutdownNow(); +169 +170 LOGGER.debug("Thread was interrupted during download", ex); +171 throw new UpdateException("The download was interrupted", ex); +172 } catch (ExecutionException ex) { +173 downloadExecutors.shutdownNow(); +174 processExecutor.shutdownNow(); +175 +176 LOGGER.debug("Thread was interrupted during download execution", ex); +177 throw new UpdateException("The execution of the download was interrupted", ex); +178 } +179 if (task == null) { +180 downloadExecutors.shutdownNow(); +181 processExecutor.shutdownNow(); +182 LOGGER.debug("Thread was interrupted during download"); +183 throw new UpdateException("The download was interrupted; unable to complete the update"); +184 } else { +185 processFutures.add(task); +186 } +187 } +188 +189 for (Future<ProcessTask> future : processFutures) { +190 try { +191 final ProcessTask task = future.get(); +192 if (task.getException() != null) { +193 throw task.getException(); +194 } +195 } catch (InterruptedException ex) { +196 processExecutor.shutdownNow(); +197 LOGGER.debug("Thread was interrupted during processing", ex); +198 throw new UpdateException(ex); +199 } catch (ExecutionException ex) { +200 processExecutor.shutdownNow(); +201 LOGGER.debug("Execution Exception during process", ex); +202 throw new UpdateException(ex); +203 } finally { +204 processExecutor.shutdown(); +205 } +206 } +207 +208 if (maxUpdates >= 1) { //ensure the modified file date gets written (we may not have actually updated it) +209 getProperties().save(updateable.get(MODIFIED)); +210 LOGGER.info("Begin database maintenance."); +211 getCveDB().cleanupDatabase(); +212 LOGGER.info("End database maintenance."); +213 } +214 } finally { +215 closeDataStores(); +216 } +217 } +218 +219 /** +220 * Determines if the index needs to be updated. This is done by fetching the NVD CVE meta data and checking the last update +221 * date. If the data needs to be refreshed this method will return the NvdCveUrl for the files that need to be updated. +222 * +223 * @return the collection of files that need to be updated +224 * @throws MalformedURLException is thrown if the URL for the NVD CVE Meta data is incorrect +225 * @throws DownloadFailedException is thrown if there is an error. downloading the NVD CVE download data file +226 * @throws UpdateException Is thrown if there is an issue with the last updated properties file +227 */ +228 protected final UpdateableNvdCve getUpdatesNeeded() throws MalformedURLException, DownloadFailedException, UpdateException { +229 UpdateableNvdCve updates = null; +230 try { +231 updates = retrieveCurrentTimestampsFromWeb(); +232 } catch (InvalidDataException ex) { +233 final String msg = "Unable to retrieve valid timestamp from nvd cve downloads page"; +234 LOGGER.debug(msg, ex); +235 throw new DownloadFailedException(msg, ex); +236 } catch (InvalidSettingException ex) { +237 LOGGER.debug("Invalid setting found when retrieving timestamps", ex); +238 throw new DownloadFailedException("Invalid settings", ex); +239 } +240 +241 if (updates == null) { +242 throw new DownloadFailedException("Unable to retrieve the timestamps of the currently published NVD CVE data"); +243 } +244 if (!getProperties().isEmpty()) { +245 try { +246 final long lastUpdated = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_UPDATED, "0")); +247 final long now = System.currentTimeMillis(); +248 final int days = Settings.getInt(Settings.KEYS.CVE_MODIFIED_VALID_FOR_DAYS, 7); +249 if (lastUpdated == updates.getTimeStamp(MODIFIED)) { +250 updates.clear(); //we don't need to update anything. +251 } else if (DateUtil.withinDateRange(lastUpdated, now, days)) { +252 for (NvdCveInfo entry : updates) { +253 if (MODIFIED.equals(entry.getId())) { +254 entry.setNeedsUpdate(true); +255 } else { +256 entry.setNeedsUpdate(false); +257 } +258 } +259 } else { //we figure out which of the several XML files need to be downloaded. +260 for (NvdCveInfo entry : updates) { +261 if (MODIFIED.equals(entry.getId())) { +262 entry.setNeedsUpdate(true); +263 } else { +264 long currentTimestamp = 0; +265 try { +266 currentTimestamp = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_UPDATED_BASE +267 + entry.getId(), "0")); +268 } catch (NumberFormatException ex) { +269 LOGGER.debug("Error parsing '{}' '{}' from nvdcve.lastupdated", +270 DatabaseProperties.LAST_UPDATED_BASE, entry.getId(), ex); +271 } +272 if (currentTimestamp == entry.getTimestamp()) { +273 entry.setNeedsUpdate(false); +274 } +275 } +276 } +277 } +278 } catch (NumberFormatException ex) { +279 LOGGER.warn("An invalid schema version or timestamp exists in the data.properties file."); +280 LOGGER.debug("", ex); +281 } +282 } +283 return updates; +284 } +285 +286 /** +287 * Retrieves the timestamps from the NVD CVE meta data file. +288 * +289 * @return the timestamp from the currently published nvdcve downloads page +290 * @throws MalformedURLException thrown if the URL for the NVD CCE Meta data is incorrect. +291 * @throws DownloadFailedException thrown if there is an error downloading the nvd cve meta data file +292 * @throws InvalidDataException thrown if there is an exception parsing the timestamps +293 * @throws InvalidSettingException thrown if the settings are invalid +294 */ +295 private UpdateableNvdCve retrieveCurrentTimestampsFromWeb() +296 throws MalformedURLException, DownloadFailedException, InvalidDataException, InvalidSettingException { +297 +298 final UpdateableNvdCve updates = new UpdateableNvdCve(); +299 updates.add(MODIFIED, Settings.getString(Settings.KEYS.CVE_MODIFIED_20_URL), +300 Settings.getString(Settings.KEYS.CVE_MODIFIED_12_URL), +301 false); +302 +303 final int start = Settings.getInt(Settings.KEYS.CVE_START_YEAR); +304 final int end = Calendar.getInstance().get(Calendar.YEAR); +305 final String baseUrl20 = Settings.getString(Settings.KEYS.CVE_SCHEMA_2_0); +306 final String baseUrl12 = Settings.getString(Settings.KEYS.CVE_SCHEMA_1_2); +307 for (int i = start; i <= end; i++) { +308 updates.add(Integer.toString(i), String.format(baseUrl20, i), +309 String.format(baseUrl12, i), +310 true); +311 } +312 return updates; +313 } +314 +315 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/cpe/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/cpe/package-frame.html index 32234e944..c499cff36 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/cpe/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/cpe/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.update.cpe + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.update.cpe diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/cpe/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/cpe/package-summary.html index 45c4cd0c6..a74cb0cd7 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/cpe/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/cpe/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.update.cpe + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.update.cpe diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/exception/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/exception/package-frame.html index 2e3247efd..182baf6d1 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/exception/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/exception/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.update.exception + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.update.exception diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/exception/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/exception/package-summary.html index 277eb71d0..54662f9e3 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/exception/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/exception/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.update.exception + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.update.exception diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/DownloadTask.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/DownloadTask.html index fd8103fe7..a63ef7bda 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/DownloadTask.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/DownloadTask.html @@ -76,8 +76,8 @@ 68 final File file2; 69 70 try { -71 file1 = File.createTempFile("cve" + nvdCveInfo.getId() + "_", ".xml", Settings.getTempDirectory()); -72 file2 = File.createTempFile("cve_1_2_" + nvdCveInfo.getId() + "_", ".xml", Settings.getTempDirectory()); +71 file1 = File.createTempFile("cve" + nvdCveInfo.getId() + '_', ".xml", Settings.getTempDirectory()); +72 file2 = File.createTempFile("cve_1_2_" + nvdCveInfo.getId() + '_', ".xml", Settings.getTempDirectory()); 73 } catch (IOException ex) { 74 throw new UpdateException("Unable to create temporary files", ex); 75 } diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/NvdCve12Handler.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/NvdCve12Handler.html index f0cad8fd9..f450e64f2 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/NvdCve12Handler.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/NvdCve12Handler.html @@ -122,10 +122,10 @@ 114 in the nvd cve 2.0. */ 115 String cpe = "cpe:/a:" + vendor + ":" + product; 116 if (num != null) { -117 cpe += ":" + num; +117 cpe += ':' + num; 118 } 119 if (edition != null) { -120 cpe += ":" + edition; +120 cpe += ':' + edition; 121 } 122 final VulnerableSoftware vs = new VulnerableSoftware(); 123 vs.setCpe(cpe); diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/package-frame.html index d214b48dc..b3a0f8625 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.update.nvd + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.update.nvd diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/package-summary.html index ee41b2745..2af9864d5 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/nvd/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.update.nvd + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.update.nvd diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/package-frame.html index 06818c771..66b774c1c 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.update + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.update diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/package-summary.html index fbde568dc..9c9baedc3 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/data/update/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/data/update/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.data.update + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.data.update diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/dependency/Dependency.html b/dependency-check-core/xref/org/owasp/dependencycheck/dependency/Dependency.html index e0fd33c81..96d73b20a 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/dependency/Dependency.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/dependency/Dependency.html @@ -349,7 +349,7 @@ 341 } 342 } 343 if (!found) { -344 LOGGER.debug("Adding new maven identifier {}", mavenArtifact.toString()); +344 LOGGER.debug("Adding new maven identifier {}", mavenArtifact); 345 this.addIdentifier("maven", mavenArtifact.toString(), mavenArtifact.getArtifactUrl(), Confidence.HIGHEST); 346 } 347 } diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/dependency/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/dependency/package-frame.html index 6ce02afb9..7a456293c 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/dependency/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/dependency/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.dependency + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.dependency diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/dependency/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/dependency/package-summary.html index ac8d55133..9261b527f 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/dependency/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/dependency/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.dependency + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.dependency diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/exception/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/exception/package-frame.html index a00b58610..c3fa59389 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/exception/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/exception/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.exception + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.exception diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/exception/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/exception/package-summary.html index bcef95ed9..ad72d4211 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/exception/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/exception/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.exception + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.exception diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/package-frame.html index fb64a4d5f..21796639c 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/package-summary.html index e1d687cfd..365cbc20c 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/reporting/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/reporting/package-frame.html index 7d4dff937..d0ad2c525 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/reporting/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/reporting/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.reporting + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.reporting diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/reporting/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/reporting/package-summary.html index 603d92cec..a712d1a59 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/reporting/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/reporting/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.reporting + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.reporting diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/suppression/SuppressionRule.html b/dependency-check-core/xref/org/owasp/dependencycheck/suppression/SuppressionRule.html index e8efe2522..20835f97e 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/suppression/SuppressionRule.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/suppression/SuppressionRule.html @@ -28,468 +28,446 @@ 20 import java.util.ArrayList; 21 import java.util.Iterator; 22 import java.util.List; -23 import org.owasp.dependencycheck.dependency.Dependency; -24 import org.owasp.dependencycheck.dependency.Identifier; -25 import org.owasp.dependencycheck.dependency.Vulnerability; -26 -27 /** -28 * -29 * @author Jeremy Long -30 */ -31 public class SuppressionRule { -32 -33 /** -34 * The file path for the suppression. -35 */ -36 private PropertyType filePath; -37 -38 /** -39 * Get the value of filePath. -40 * -41 * @return the value of filePath -42 */ -43 public PropertyType getFilePath() { -44 return filePath; -45 } -46 -47 /** -48 * Set the value of filePath. -49 * -50 * @param filePath new value of filePath -51 */ -52 public void setFilePath(PropertyType filePath) { -53 this.filePath = filePath; -54 } -55 /** -56 * The sha1 hash. -57 */ -58 private String sha1; -59 -60 /** -61 * Get the value of sha1. -62 * -63 * @return the value of sha1 -64 */ -65 public String getSha1() { -66 return sha1; -67 } -68 -69 /** -70 * Set the value of sha1. -71 * -72 * @param sha1 new value of sha1 -73 */ -74 public void setSha1(String sha1) { -75 this.sha1 = sha1; -76 } -77 /** -78 * A list of CPEs to suppression -79 */ -80 private List<PropertyType> cpe = new ArrayList<PropertyType>(); -81 -82 /** -83 * Get the value of cpe. -84 * -85 * @return the value of cpe -86 */ -87 public List<PropertyType> getCpe() { -88 return cpe; -89 } -90 -91 /** -92 * Set the value of cpe. -93 * -94 * @param cpe new value of cpe -95 */ -96 public void setCpe(List<PropertyType> cpe) { -97 this.cpe = cpe; -98 } -99 -100 /** -101 * Adds the cpe to the cpe list. -102 * -103 * @param cpe the cpe to add -104 */ -105 public void addCpe(PropertyType cpe) { -106 this.cpe.add(cpe); -107 } -108 -109 /** -110 * Returns whether or not this suppression rule as CPE entries. -111 * -112 * @return whether or not this suppression rule as CPE entries -113 */ -114 public boolean hasCpe() { -115 return !cpe.isEmpty(); -116 } -117 /** -118 * The list of cvssBelow scores. -119 */ -120 private List<Float> cvssBelow = new ArrayList<Float>(); -121 -122 /** -123 * Get the value of cvssBelow. -124 * -125 * @return the value of cvssBelow -126 */ -127 public List<Float> getCvssBelow() { -128 return cvssBelow; -129 } -130 -131 /** -132 * Set the value of cvssBelow. -133 * -134 * @param cvssBelow new value of cvssBelow -135 */ -136 public void setCvssBelow(List<Float> cvssBelow) { -137 this.cvssBelow = cvssBelow; -138 } -139 -140 /** -141 * Adds the cvss to the cvssBelow list. -142 * -143 * @param cvss the cvss to add -144 */ -145 public void addCvssBelow(Float cvss) { -146 this.cvssBelow.add(cvss); -147 } -148 -149 /** -150 * Returns whether or not this suppression rule has cvss suppressions. -151 * -152 * @return whether or not this suppression rule has cvss suppressions -153 */ -154 public boolean hasCvssBelow() { -155 return !cvssBelow.isEmpty(); -156 } -157 /** -158 * The list of cwe entries to suppress. -159 */ -160 private List<String> cwe = new ArrayList<String>(); -161 -162 /** -163 * Get the value of cwe. -164 * -165 * @return the value of cwe -166 */ -167 public List<String> getCwe() { -168 return cwe; -169 } -170 -171 /** -172 * Set the value of cwe. -173 * -174 * @param cwe new value of cwe -175 */ -176 public void setCwe(List<String> cwe) { -177 this.cwe = cwe; -178 } -179 -180 /** -181 * Adds the cwe to the cwe list. -182 * -183 * @param cwe the cwe to add -184 */ -185 public void addCwe(String cwe) { -186 this.cwe.add(cwe); -187 } -188 -189 /** -190 * Returns whether this suppression rule has CWE entries. -191 * -192 * @return whether this suppression rule has CWE entries -193 */ -194 public boolean hasCwe() { -195 return !cwe.isEmpty(); -196 } -197 /** -198 * The list of cve entries to suppress. -199 */ -200 private List<String> cve = new ArrayList<String>(); -201 -202 /** -203 * Get the value of cve. -204 * -205 * @return the value of cve -206 */ -207 public List<String> getCve() { -208 return cve; -209 } -210 -211 /** -212 * Set the value of cve. -213 * -214 * @param cve new value of cve -215 */ -216 public void setCve(List<String> cve) { -217 this.cve = cve; -218 } -219 -220 /** -221 * Adds the cve to the cve list. -222 * -223 * @param cve the cve to add -224 */ -225 public void addCve(String cve) { -226 this.cve.add(cve); -227 } -228 -229 /** -230 * Returns whether this suppression rule has CVE entries. -231 * -232 * @return whether this suppression rule has CVE entries -233 */ -234 public boolean hasCve() { -235 return !cve.isEmpty(); -236 } -237 /** -238 * A Maven GAV to suppression. -239 */ -240 private PropertyType gav = null; -241 -242 /** -243 * Get the value of Maven GAV. -244 * -245 * @return the value of gav -246 */ -247 public PropertyType getGav() { -248 return gav; -249 } -250 -251 /** -252 * Set the value of Maven GAV. -253 * -254 * @param gav new value of Maven gav -255 */ -256 public void setGav(PropertyType gav) { -257 this.gav = gav; -258 } -259 -260 /** -261 * Returns whether or not this suppression rule as GAV entries. -262 * -263 * @return whether or not this suppression rule as GAV entries -264 */ -265 public boolean hasGav() { -266 return gav != null; -267 } -268 -269 /** -270 * A flag indicating whether or not the suppression rule is a core/base rule that should not be included in the -271 * resulting report in the "suppressed" section. -272 */ -273 private boolean base; -274 -275 /** -276 * Get the value of base. -277 * -278 * @return the value of base -279 */ -280 public boolean isBase() { -281 return base; -282 } -283 -284 /** -285 * Set the value of base. -286 * -287 * @param base new value of base -288 */ -289 public void setBase(boolean base) { -290 this.base = base; -291 } -292 -293 /** -294 * Processes a given dependency to determine if any CPE, CVE, CWE, or CVSS scores should be suppressed. If any -295 * should be, they are removed from the dependency. -296 * -297 * @param dependency a project dependency to analyze -298 */ -299 public void process(Dependency dependency) { -300 if (filePath != null && !filePath.matches(dependency.getFilePath())) { -301 return; -302 } -303 if (sha1 != null && !sha1.equalsIgnoreCase(dependency.getSha1sum())) { -304 return; -305 } -306 if (gav != null) { -307 final Iterator<Identifier> itr = dependency.getIdentifiers().iterator(); -308 boolean gavFound = false; -309 while (itr.hasNext()) { -310 final Identifier i = itr.next(); -311 if (identifierMatches("maven", this.gav, i)) { -312 gavFound = true; -313 break; -314 } -315 } -316 if (!gavFound) { -317 return; -318 } -319 } -320 -321 if (this.hasCpe()) { -322 final Iterator<Identifier> itr = dependency.getIdentifiers().iterator(); -323 while (itr.hasNext()) { -324 final Identifier i = itr.next(); -325 for (PropertyType c : this.cpe) { -326 if (identifierMatches("cpe", c, i)) { -327 if (!isBase()) { -328 dependency.addSuppressedIdentifier(i); -329 } -330 itr.remove(); -331 break; -332 } -333 } -334 } -335 } -336 if (hasCve() || hasCwe() || hasCvssBelow()) { -337 final Iterator<Vulnerability> itr = dependency.getVulnerabilities().iterator(); -338 while (itr.hasNext()) { -339 boolean remove = false; -340 final Vulnerability v = itr.next(); -341 for (String entry : this.cve) { -342 if (entry.equalsIgnoreCase(v.getName())) { -343 remove = true; -344 break; -345 } -346 } -347 if (!remove) { -348 for (String entry : this.cwe) { -349 if (v.getCwe() != null) { -350 final String toMatch = String.format("CWE-%s ", entry); -351 final String toTest = v.getCwe().substring(0, toMatch.length()).toUpperCase(); -352 if (toTest.equals(toMatch)) { -353 remove = true; -354 break; -355 } -356 } -357 } -358 } -359 if (!remove) { -360 for (float cvss : this.cvssBelow) { -361 if (v.getCvssScore() < cvss) { -362 remove = true; -363 break; -364 } -365 } -366 } -367 if (remove) { -368 if (!isBase()) { -369 dependency.addSuppressedVulnerability(v); -370 } -371 itr.remove(); -372 } -373 } -374 } -375 } -376 -377 /** -378 * Identifies if the cpe specified by the cpe suppression rule does not specify a version. -379 * -380 * @param c a suppression rule identifier -381 * @return true if the property type does not specify a version; otherwise false -382 */ -383 boolean cpeHasNoVersion(PropertyType c) { -384 if (c.isRegex()) { -385 return false; -386 } -387 if (countCharacter(c.getValue(), ':') == 3) { -388 return true; -389 } -390 return false; -391 } -392 -393 /** -394 * Counts the number of occurrences of the character found within the string. -395 * -396 * @param str the string to check -397 * @param c the character to count -398 * @return the number of times the character is found in the string -399 */ -400 int countCharacter(String str, char c) { -401 int count = 0; -402 int pos = str.indexOf(c) + 1; -403 while (pos > 0) { -404 count += 1; -405 pos = str.indexOf(c, pos) + 1; -406 } -407 return count; -408 } -409 -410 /** -411 * Determines if the cpeEntry specified as a PropertyType matches the given Identifier. -412 * -413 * @param identifierType the type of identifier ("cpe", "maven", etc.) -414 * @param suppressionEntry a suppression rule entry -415 * @param identifier a CPE identifier to check -416 * @return true if the entry matches; otherwise false +23 import org.apache.commons.lang3.StringUtils; +24 import org.owasp.dependencycheck.dependency.Dependency; +25 import org.owasp.dependencycheck.dependency.Identifier; +26 import org.owasp.dependencycheck.dependency.Vulnerability; +27 +28 /** +29 * +30 * @author Jeremy Long +31 */ +32 public class SuppressionRule { +33 +34 /** +35 * The file path for the suppression. +36 */ +37 private PropertyType filePath; +38 +39 /** +40 * Get the value of filePath. +41 * +42 * @return the value of filePath +43 */ +44 public PropertyType getFilePath() { +45 return filePath; +46 } +47 +48 /** +49 * Set the value of filePath. +50 * +51 * @param filePath new value of filePath +52 */ +53 public void setFilePath(PropertyType filePath) { +54 this.filePath = filePath; +55 } +56 /** +57 * The sha1 hash. +58 */ +59 private String sha1; +60 +61 /** +62 * Get the value of sha1. +63 * +64 * @return the value of sha1 +65 */ +66 public String getSha1() { +67 return sha1; +68 } +69 +70 /** +71 * Set the value of sha1. +72 * +73 * @param sha1 new value of sha1 +74 */ +75 public void setSha1(String sha1) { +76 this.sha1 = sha1; +77 } +78 /** +79 * A list of CPEs to suppression +80 */ +81 private List<PropertyType> cpe = new ArrayList<PropertyType>(); +82 +83 /** +84 * Get the value of cpe. +85 * +86 * @return the value of cpe +87 */ +88 public List<PropertyType> getCpe() { +89 return cpe; +90 } +91 +92 /** +93 * Set the value of cpe. +94 * +95 * @param cpe new value of cpe +96 */ +97 public void setCpe(List<PropertyType> cpe) { +98 this.cpe = cpe; +99 } +100 +101 /** +102 * Adds the cpe to the cpe list. +103 * +104 * @param cpe the cpe to add +105 */ +106 public void addCpe(PropertyType cpe) { +107 this.cpe.add(cpe); +108 } +109 +110 /** +111 * Returns whether or not this suppression rule as CPE entries. +112 * +113 * @return whether or not this suppression rule as CPE entries +114 */ +115 public boolean hasCpe() { +116 return !cpe.isEmpty(); +117 } +118 /** +119 * The list of cvssBelow scores. +120 */ +121 private List<Float> cvssBelow = new ArrayList<Float>(); +122 +123 /** +124 * Get the value of cvssBelow. +125 * +126 * @return the value of cvssBelow +127 */ +128 public List<Float> getCvssBelow() { +129 return cvssBelow; +130 } +131 +132 /** +133 * Set the value of cvssBelow. +134 * +135 * @param cvssBelow new value of cvssBelow +136 */ +137 public void setCvssBelow(List<Float> cvssBelow) { +138 this.cvssBelow = cvssBelow; +139 } +140 +141 /** +142 * Adds the cvss to the cvssBelow list. +143 * +144 * @param cvss the cvss to add +145 */ +146 public void addCvssBelow(Float cvss) { +147 this.cvssBelow.add(cvss); +148 } +149 +150 /** +151 * Returns whether or not this suppression rule has cvss suppressions. +152 * +153 * @return whether or not this suppression rule has cvss suppressions +154 */ +155 public boolean hasCvssBelow() { +156 return !cvssBelow.isEmpty(); +157 } +158 /** +159 * The list of cwe entries to suppress. +160 */ +161 private List<String> cwe = new ArrayList<String>(); +162 +163 /** +164 * Get the value of cwe. +165 * +166 * @return the value of cwe +167 */ +168 public List<String> getCwe() { +169 return cwe; +170 } +171 +172 /** +173 * Set the value of cwe. +174 * +175 * @param cwe new value of cwe +176 */ +177 public void setCwe(List<String> cwe) { +178 this.cwe = cwe; +179 } +180 +181 /** +182 * Adds the cwe to the cwe list. +183 * +184 * @param cwe the cwe to add +185 */ +186 public void addCwe(String cwe) { +187 this.cwe.add(cwe); +188 } +189 +190 /** +191 * Returns whether this suppression rule has CWE entries. +192 * +193 * @return whether this suppression rule has CWE entries +194 */ +195 public boolean hasCwe() { +196 return !cwe.isEmpty(); +197 } +198 /** +199 * The list of cve entries to suppress. +200 */ +201 private List<String> cve = new ArrayList<String>(); +202 +203 /** +204 * Get the value of cve. +205 * +206 * @return the value of cve +207 */ +208 public List<String> getCve() { +209 return cve; +210 } +211 +212 /** +213 * Set the value of cve. +214 * +215 * @param cve new value of cve +216 */ +217 public void setCve(List<String> cve) { +218 this.cve = cve; +219 } +220 +221 /** +222 * Adds the cve to the cve list. +223 * +224 * @param cve the cve to add +225 */ +226 public void addCve(String cve) { +227 this.cve.add(cve); +228 } +229 +230 /** +231 * Returns whether this suppression rule has CVE entries. +232 * +233 * @return whether this suppression rule has CVE entries +234 */ +235 public boolean hasCve() { +236 return !cve.isEmpty(); +237 } +238 /** +239 * A Maven GAV to suppression. +240 */ +241 private PropertyType gav = null; +242 +243 /** +244 * Get the value of Maven GAV. +245 * +246 * @return the value of gav +247 */ +248 public PropertyType getGav() { +249 return gav; +250 } +251 +252 /** +253 * Set the value of Maven GAV. +254 * +255 * @param gav new value of Maven gav +256 */ +257 public void setGav(PropertyType gav) { +258 this.gav = gav; +259 } +260 +261 /** +262 * Returns whether or not this suppression rule as GAV entries. +263 * +264 * @return whether or not this suppression rule as GAV entries +265 */ +266 public boolean hasGav() { +267 return gav != null; +268 } +269 +270 /** +271 * A flag indicating whether or not the suppression rule is a core/base rule that should not be included in the +272 * resulting report in the "suppressed" section. +273 */ +274 private boolean base; +275 +276 /** +277 * Get the value of base. +278 * +279 * @return the value of base +280 */ +281 public boolean isBase() { +282 return base; +283 } +284 +285 /** +286 * Set the value of base. +287 * +288 * @param base new value of base +289 */ +290 public void setBase(boolean base) { +291 this.base = base; +292 } +293 +294 /** +295 * Processes a given dependency to determine if any CPE, CVE, CWE, or CVSS scores should be suppressed. If any +296 * should be, they are removed from the dependency. +297 * +298 * @param dependency a project dependency to analyze +299 */ +300 public void process(Dependency dependency) { +301 if (filePath != null && !filePath.matches(dependency.getFilePath())) { +302 return; +303 } +304 if (sha1 != null && !sha1.equalsIgnoreCase(dependency.getSha1sum())) { +305 return; +306 } +307 if (gav != null) { +308 final Iterator<Identifier> itr = dependency.getIdentifiers().iterator(); +309 boolean gavFound = false; +310 while (itr.hasNext()) { +311 final Identifier i = itr.next(); +312 if (identifierMatches("maven", this.gav, i)) { +313 gavFound = true; +314 break; +315 } +316 } +317 if (!gavFound) { +318 return; +319 } +320 } +321 +322 if (this.hasCpe()) { +323 final Iterator<Identifier> itr = dependency.getIdentifiers().iterator(); +324 while (itr.hasNext()) { +325 final Identifier i = itr.next(); +326 for (PropertyType c : this.cpe) { +327 if (identifierMatches("cpe", c, i)) { +328 if (!isBase()) { +329 dependency.addSuppressedIdentifier(i); +330 } +331 itr.remove(); +332 break; +333 } +334 } +335 } +336 } +337 if (hasCve() || hasCwe() || hasCvssBelow()) { +338 final Iterator<Vulnerability> itr = dependency.getVulnerabilities().iterator(); +339 while (itr.hasNext()) { +340 boolean remove = false; +341 final Vulnerability v = itr.next(); +342 for (String entry : this.cve) { +343 if (entry.equalsIgnoreCase(v.getName())) { +344 remove = true; +345 break; +346 } +347 } +348 if (!remove) { +349 for (String entry : this.cwe) { +350 if (v.getCwe() != null) { +351 final String toMatch = String.format("CWE-%s ", entry); +352 final String toTest = v.getCwe().substring(0, toMatch.length()).toUpperCase(); +353 if (toTest.equals(toMatch)) { +354 remove = true; +355 break; +356 } +357 } +358 } +359 } +360 if (!remove) { +361 for (float cvss : this.cvssBelow) { +362 if (v.getCvssScore() < cvss) { +363 remove = true; +364 break; +365 } +366 } +367 } +368 if (remove) { +369 if (!isBase()) { +370 dependency.addSuppressedVulnerability(v); +371 } +372 itr.remove(); +373 } +374 } +375 } +376 } +377 +378 /** +379 * Identifies if the cpe specified by the cpe suppression rule does not specify a version. +380 * +381 * @param c a suppression rule identifier +382 * @return true if the property type does not specify a version; otherwise false +383 */ +384 boolean cpeHasNoVersion(PropertyType c) { +385 return !c.isRegex() && StringUtils.countMatches(c.getValue(), ':') == 3; +386 } +387 +388 /** +389 * Determines if the cpeEntry specified as a PropertyType matches the given Identifier. +390 * +391 * @param identifierType the type of identifier ("cpe", "maven", etc.) +392 * @param suppressionEntry a suppression rule entry +393 * @param identifier a CPE identifier to check +394 * @return true if the entry matches; otherwise false +395 */ +396 boolean identifierMatches(String identifierType, PropertyType suppressionEntry, Identifier identifier) { +397 if (identifierType.equals(identifier.getType())) { +398 if (suppressionEntry.matches(identifier.getValue())) { +399 return true; +400 } else if ("cpe".equals(identifierType) && cpeHasNoVersion(suppressionEntry)) { +401 if (suppressionEntry.isCaseSensitive()) { +402 return identifier.getValue().startsWith(suppressionEntry.getValue()); +403 } else { +404 final String id = identifier.getValue().toLowerCase(); +405 final String check = suppressionEntry.getValue().toLowerCase(); +406 return id.startsWith(check); +407 } +408 } +409 } +410 return false; +411 } +412 +413 /** +414 * Standard toString implementation. +415 * +416 * @return a string representation of this object 417 */ -418 boolean identifierMatches(String identifierType, PropertyType suppressionEntry, Identifier identifier) { -419 if (identifierType.equals(identifier.getType())) { -420 if (suppressionEntry.matches(identifier.getValue())) { -421 return true; -422 } else if ("cpe".equals(identifierType) && cpeHasNoVersion(suppressionEntry)) { -423 if (suppressionEntry.isCaseSensitive()) { -424 return identifier.getValue().startsWith(suppressionEntry.getValue()); -425 } else { -426 final String id = identifier.getValue().toLowerCase(); -427 final String check = suppressionEntry.getValue().toLowerCase(); -428 return id.startsWith(check); -429 } -430 } -431 } -432 return false; -433 } -434 -435 /** -436 * Standard toString implementation. -437 * -438 * @return a string representation of this object -439 */ -440 @Override -441 public String toString() { -442 final StringBuilder sb = new StringBuilder(); -443 sb.append("SuppressionRule{"); -444 if (filePath != null) { -445 sb.append("filePath=").append(filePath).append(","); -446 } -447 if (sha1 != null) { -448 sb.append("sha1=").append(sha1).append(","); -449 } -450 if (gav != null) { -451 sb.append("gav=").append(gav).append(","); -452 } -453 if (cpe != null && !cpe.isEmpty()) { -454 sb.append("cpe={"); -455 for (PropertyType pt : cpe) { -456 sb.append(pt).append(","); -457 } -458 sb.append("}"); -459 } -460 if (cwe != null && !cwe.isEmpty()) { -461 sb.append("cwe={"); -462 for (String s : cwe) { -463 sb.append(s).append(","); -464 } -465 sb.append("}"); -466 } -467 if (cve != null && !cve.isEmpty()) { -468 sb.append("cve={"); -469 for (String s : cve) { -470 sb.append(s).append(","); -471 } -472 sb.append("}"); -473 } -474 if (cvssBelow != null && !cvssBelow.isEmpty()) { -475 sb.append("cvssBelow={"); -476 for (Float s : cvssBelow) { -477 sb.append(s).append(","); -478 } -479 sb.append("}"); -480 } -481 sb.append("}"); -482 return sb.toString(); -483 } -484 } +418 @Override +419 public String toString() { +420 final StringBuilder sb = new StringBuilder(); +421 sb.append("SuppressionRule{"); +422 if (filePath != null) { +423 sb.append("filePath=").append(filePath).append(','); +424 } +425 if (sha1 != null) { +426 sb.append("sha1=").append(sha1).append(','); +427 } +428 if (gav != null) { +429 sb.append("gav=").append(gav).append(','); +430 } +431 if (cpe != null && !cpe.isEmpty()) { +432 sb.append("cpe={"); +433 for (PropertyType pt : cpe) { +434 sb.append(pt).append(','); +435 } +436 sb.append('}'); +437 } +438 if (cwe != null && !cwe.isEmpty()) { +439 sb.append("cwe={"); +440 for (String s : cwe) { +441 sb.append(s).append(','); +442 } +443 sb.append('}'); +444 } +445 if (cve != null && !cve.isEmpty()) { +446 sb.append("cve={"); +447 for (String s : cve) { +448 sb.append(s).append(','); +449 } +450 sb.append('}'); +451 } +452 if (cvssBelow != null && !cvssBelow.isEmpty()) { +453 sb.append("cvssBelow={"); +454 for (Float s : cvssBelow) { +455 sb.append(s).append(','); +456 } +457 sb.append('}'); +458 } +459 sb.append('}'); +460 return sb.toString(); +461 } +462 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/suppression/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/suppression/package-frame.html index 8c8e31a2f..2dd08a97e 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/suppression/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/suppression/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.suppression + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.suppression diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/suppression/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/suppression/package-summary.html index 55f2751c8..0200c10e7 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/suppression/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/suppression/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.suppression + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.suppression diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/utils/DateUtil.html b/dependency-check-core/xref/org/owasp/dependencycheck/utils/DateUtil.html index 2524e1549..342fdb391 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/utils/DateUtil.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/utils/DateUtil.html @@ -44,14 +44,15 @@ 36 * 37 * @param date the date to be checked. 38 * @param compareTo the date to compare to. -39 * @param range the range in days to be considered valid. +39 * @param dayRange the range in days to be considered valid. 40 * @return whether or not the date is within the range. 41 */ -42 public static boolean withinDateRange(long date, long compareTo, int range) { -43 final double differenceInDays = (compareTo - date) / 1000.0 / 60.0 / 60.0 / 24.0; -44 return differenceInDays < range; -45 } -46 } +42 public static boolean withinDateRange(long date, long compareTo, int dayRange) { +43 // ms = dayRange x 24 hours/day x 60 min/hour x 60 sec/min x 1000 ms/sec +44 final long msRange = dayRange * 24L * 60L * 60L * 1000L; +45 return (compareTo - date) < msRange; +46 } +47 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/utils/DependencyVersion.html b/dependency-check-core/xref/org/owasp/dependencycheck/utils/DependencyVersion.html index ecda6b9a0..9025edebd 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/utils/DependencyVersion.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/utils/DependencyVersion.html @@ -123,7 +123,7 @@ 115 */ 116 @Override 117 public String toString() { -118 return StringUtils.join(versionParts.toArray(), "."); +118 return StringUtils.join(versionParts, '.'); 119 } 120 121 /** diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/utils/ExtractionUtil.html b/dependency-check-core/xref/org/owasp/dependencycheck/utils/ExtractionUtil.html index 93a6a362d..f6558b01c 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/utils/ExtractionUtil.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/utils/ExtractionUtil.html @@ -190,98 +190,94 @@ 182 while ((entry = input.getNextEntry()) != null) { 183 if (entry.isDirectory()) { 184 final File dir = new File(destination, entry.getName()); -185 if (!dir.exists()) { -186 if (!dir.mkdirs()) { -187 final String msg = String.format( -188 "Unable to create directory '%s'.", -189 dir.getAbsolutePath()); -190 throw new AnalysisException(msg); -191 } -192 } -193 } else { -194 extractFile(input, destination, filter, entry); -195 } -196 } -197 } catch (IOException ex) { +185 if (!dir.exists() && !dir.mkdirs()) { +186 final String msg = String.format( +187 "Unable to create directory '%s'.", +188 dir.getAbsolutePath()); +189 throw new AnalysisException(msg); +190 } +191 } else { +192 extractFile(input, destination, filter, entry); +193 } +194 } +195 } catch (IOException ex) { +196 throw new ArchiveExtractionException(ex); +197 } catch (Throwable ex) { 198 throw new ArchiveExtractionException(ex); -199 } catch (Throwable ex) { -200 throw new ArchiveExtractionException(ex); -201 } finally { -202 closeStream(input); -203 } -204 } -205 -206 /** -207 * Extracts a file from an archive (input stream) and correctly builds the directory structure. -208 * -209 * @param input the archive input stream -210 * @param destination where to write the file -211 * @param filter the file filter to apply to the files being extracted -212 * @param entry the entry from the archive to extract -213 * @throws ExtractionException thrown if there is an error reading from the archive stream -214 */ -215 private static void extractFile(ArchiveInputStream input, File destination, -216 FilenameFilter filter, ArchiveEntry entry) throws ExtractionException { -217 final File file = new File(destination, entry.getName()); -218 if (filter.accept(file.getParentFile(), file.getName())) { -219 LOGGER.debug("Extracting '{}'", -220 file.getPath()); -221 FileOutputStream fos = null; -222 try { -223 createParentFile(file); -224 fos = new FileOutputStream(file); -225 IOUtils.copy(input, fos); -226 } catch (FileNotFoundException ex) { -227 LOGGER.debug("", ex); -228 final String msg = String.format("Unable to find file '%s'.", -229 file.getName()); -230 throw new ExtractionException(msg, ex); -231 } catch (IOException ex) { -232 LOGGER.debug("", ex); -233 final String msg = String -234 .format("IO Exception while parsing file '%s'.", -235 file.getName()); -236 throw new ExtractionException(msg, ex); -237 } finally { -238 closeStream(fos); -239 } -240 } -241 } -242 -243 /** -244 * Closes the stream. -245 * -246 * @param stream the stream to close -247 */ -248 private static void closeStream(Closeable stream) { -249 if (stream != null) { -250 try { -251 stream.close(); -252 } catch (IOException ex) { -253 LOGGER.trace("", ex); -254 } -255 } -256 } -257 -258 /** -259 * Ensures the parent path is correctly created on disk so that the file can be extracted to the correct location. -260 * -261 * @param file the file path -262 * @throws ExtractionException thrown if the parent paths could not be created -263 */ -264 private static void createParentFile(final File file) -265 throws ExtractionException { -266 final File parent = file.getParentFile(); -267 if (!parent.isDirectory()) { -268 if (!parent.mkdirs()) { -269 final String msg = String.format( -270 "Unable to build directory '%s'.", -271 parent.getAbsolutePath()); -272 throw new ExtractionException(msg); -273 } -274 } -275 } -276 } +199 } finally { +200 closeStream(input); +201 } +202 } +203 +204 /** +205 * Extracts a file from an archive (input stream) and correctly builds the directory structure. +206 * +207 * @param input the archive input stream +208 * @param destination where to write the file +209 * @param filter the file filter to apply to the files being extracted +210 * @param entry the entry from the archive to extract +211 * @throws ExtractionException thrown if there is an error reading from the archive stream +212 */ +213 private static void extractFile(ArchiveInputStream input, File destination, +214 FilenameFilter filter, ArchiveEntry entry) throws ExtractionException { +215 final File file = new File(destination, entry.getName()); +216 if (filter.accept(file.getParentFile(), file.getName())) { +217 LOGGER.debug("Extracting '{}'", +218 file.getPath()); +219 FileOutputStream fos = null; +220 try { +221 createParentFile(file); +222 fos = new FileOutputStream(file); +223 IOUtils.copy(input, fos); +224 } catch (FileNotFoundException ex) { +225 LOGGER.debug("", ex); +226 final String msg = String.format("Unable to find file '%s'.", +227 file.getName()); +228 throw new ExtractionException(msg, ex); +229 } catch (IOException ex) { +230 LOGGER.debug("", ex); +231 final String msg = String +232 .format("IO Exception while parsing file '%s'.", +233 file.getName()); +234 throw new ExtractionException(msg, ex); +235 } finally { +236 closeStream(fos); +237 } +238 } +239 } +240 +241 /** +242 * Closes the stream. +243 * +244 * @param stream the stream to close +245 */ +246 private static void closeStream(Closeable stream) { +247 if (stream != null) { +248 try { +249 stream.close(); +250 } catch (IOException ex) { +251 LOGGER.trace("", ex); +252 } +253 } +254 } +255 +256 /** +257 * Ensures the parent path is correctly created on disk so that the file can be extracted to the correct location. +258 * +259 * @param file the file path +260 * @throws ExtractionException thrown if the parent paths could not be created +261 */ +262 private static void createParentFile(final File file) +263 throws ExtractionException { +264 final File parent = file.getParentFile(); +265 if (!parent.isDirectory() && !parent.mkdirs()) { +266 final String msg = String.format( +267 "Unable to build directory '%s'.", +268 parent.getAbsolutePath()); +269 throw new ExtractionException(msg); +270 } +271 } +272 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/utils/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/utils/package-frame.html index f749a7f9c..985dbe015 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/utils/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/utils/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.utils + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.utils @@ -38,9 +38,6 @@
  • FilterIterator -
  • -
  • - NonClosingStream
  • Pair diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/utils/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/utils/package-summary.html index 7b34ecf71..169f496f6 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/utils/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/utils/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.utils + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.utils @@ -74,11 +74,6 @@
  • FilterIterator
    - NonClosingStream -
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/xml/pom/Model.html b/dependency-check-core/xref/org/owasp/dependencycheck/xml/pom/Model.html index 04728c400..0fcb6f461 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/xml/pom/Model.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/xml/pom/Model.html @@ -29,322 +29,333 @@ 21 import java.util.List; 22 import java.util.Properties; 23 -24 /** -25 * A simple pojo to hold data related to a Maven POM file. -26 * -27 * @author jeremy -28 */ -29 public class Model { -30 -31 /** -32 * The name of the project. -33 */ -34 private String name; -35 -36 /** -37 * Get the value of name. -38 * -39 * @return the value of name -40 */ -41 public String getName() { -42 return name; -43 } -44 -45 /** -46 * Set the value of name. -47 * -48 * @param name new value of name -49 */ -50 public void setName(String name) { -51 this.name = name; -52 } -53 -54 /** -55 * The organization name. -56 */ -57 private String organization; -58 -59 /** -60 * Get the value of organization. -61 * -62 * @return the value of organization -63 */ -64 public String getOrganization() { -65 return organization; -66 } -67 -68 /** -69 * Set the value of organization. -70 * -71 * @param organization new value of organization -72 */ -73 public void setOrganization(String organization) { -74 this.organization = organization; -75 } -76 -77 /** -78 * The description. -79 */ -80 private String description; -81 -82 /** -83 * Get the value of description. -84 * -85 * @return the value of description -86 */ -87 public String getDescription() { -88 return description; -89 } -90 -91 /** -92 * Set the value of description. -93 * -94 * @param description new value of description -95 */ -96 public void setDescription(String description) { -97 this.description = description; -98 } -99 -100 /** -101 * The group id. -102 */ -103 private String groupId; -104 -105 /** -106 * Get the value of groupId. -107 * -108 * @return the value of groupId -109 */ -110 public String getGroupId() { -111 return groupId; -112 } -113 -114 /** -115 * Set the value of groupId. -116 * -117 * @param groupId new value of groupId -118 */ -119 public void setGroupId(String groupId) { -120 this.groupId = groupId; -121 } -122 -123 /** -124 * The artifact id. -125 */ -126 private String artifactId; -127 -128 /** -129 * Get the value of artifactId. -130 * -131 * @return the value of artifactId -132 */ -133 public String getArtifactId() { -134 return artifactId; -135 } -136 -137 /** -138 * Set the value of artifactId. -139 * -140 * @param artifactId new value of artifactId -141 */ -142 public void setArtifactId(String artifactId) { -143 this.artifactId = artifactId; -144 } -145 -146 /** -147 * The version number. -148 */ -149 private String version; -150 -151 /** -152 * Get the value of version. -153 * -154 * @return the value of version -155 */ -156 public String getVersion() { -157 return version; -158 } -159 -160 /** -161 * Set the value of version. -162 * -163 * @param version new value of version -164 */ -165 public void setVersion(String version) { -166 this.version = version; -167 } -168 -169 /** -170 * The parent group id. -171 */ -172 private String parentGroupId; -173 -174 /** -175 * Get the value of parentGroupId. -176 * -177 * @return the value of parentGroupId -178 */ -179 public String getParentGroupId() { -180 return parentGroupId; -181 } -182 -183 /** -184 * Set the value of parentGroupId. -185 * -186 * @param parentGroupId new value of parentGroupId -187 */ -188 public void setParentGroupId(String parentGroupId) { -189 this.parentGroupId = parentGroupId; -190 } -191 -192 /** -193 * The parent artifact id. -194 */ -195 private String parentArtifactId; -196 -197 /** -198 * Get the value of parentArtifactId. -199 * -200 * @return the value of parentArtifactId -201 */ -202 public String getParentArtifactId() { -203 return parentArtifactId; -204 } -205 -206 /** -207 * Set the value of parentArtifactId. -208 * -209 * @param parentArtifactId new value of parentArtifactId -210 */ -211 public void setParentArtifactId(String parentArtifactId) { -212 this.parentArtifactId = parentArtifactId; -213 } -214 -215 /** -216 * The parent version number. -217 */ -218 private String parentVersion; -219 -220 /** -221 * Get the value of parentVersion. -222 * -223 * @return the value of parentVersion -224 */ -225 public String getParentVersion() { -226 return parentVersion; -227 } -228 -229 /** -230 * Set the value of parentVersion. -231 * -232 * @param parentVersion new value of parentVersion -233 */ -234 public void setParentVersion(String parentVersion) { -235 this.parentVersion = parentVersion; -236 } -237 -238 /** -239 * The list of licenses. -240 */ -241 private List<License> licenses = new ArrayList<License>(); -242 -243 /** -244 * Returns the list of licenses. -245 * -246 * @return the list of licenses -247 */ -248 public List<License> getLicenses() { -249 return licenses; -250 } -251 -252 /** -253 * Adds a new license to the list of licenses. -254 * -255 * @param license the license to add -256 */ -257 public void addLicense(License license) { -258 licenses.add(license); -259 } -260 -261 /** -262 * Process the Maven properties file and interpolate all properties. -263 * -264 * @param properties new value of properties -265 */ -266 public void processProperties(Properties properties) { -267 this.groupId = interpolateString(this.groupId, properties); -268 this.artifactId = interpolateString(this.artifactId, properties); -269 this.version = interpolateString(this.version, properties); -270 this.description = interpolateString(this.description, properties); -271 for (License l : this.getLicenses()) { -272 l.setName(interpolateString(l.getName(), properties)); -273 l.setUrl(interpolateString(l.getUrl(), properties)); -274 } -275 this.name = interpolateString(this.name, properties); -276 this.organization = interpolateString(this.organization, properties); -277 this.parentGroupId = interpolateString(this.parentGroupId, properties); -278 this.parentArtifactId = interpolateString(this.parentArtifactId, properties); -279 this.parentVersion = interpolateString(this.parentVersion, properties); -280 -281 } -282 -283 /** -284 * <p> -285 * A utility function that will interpolate strings based on values given in the properties file. It will also interpolate the -286 * strings contained within the properties file so that properties can reference other properties.</p> +24 import org.apache.commons.lang3.text.StrLookup; +25 import org.apache.commons.lang3.text.StrSubstitutor; +26 +27 /** +28 * A simple pojo to hold data related to a Maven POM file. +29 * +30 * @author jeremy +31 */ +32 public class Model { +33 +34 /** +35 * The name of the project. +36 */ +37 private String name; +38 +39 /** +40 * Get the value of name. +41 * +42 * @return the value of name +43 */ +44 public String getName() { +45 return name; +46 } +47 +48 /** +49 * Set the value of name. +50 * +51 * @param name new value of name +52 */ +53 public void setName(String name) { +54 this.name = name; +55 } +56 +57 /** +58 * The organization name. +59 */ +60 private String organization; +61 +62 /** +63 * Get the value of organization. +64 * +65 * @return the value of organization +66 */ +67 public String getOrganization() { +68 return organization; +69 } +70 +71 /** +72 * Set the value of organization. +73 * +74 * @param organization new value of organization +75 */ +76 public void setOrganization(String organization) { +77 this.organization = organization; +78 } +79 +80 /** +81 * The description. +82 */ +83 private String description; +84 +85 /** +86 * Get the value of description. +87 * +88 * @return the value of description +89 */ +90 public String getDescription() { +91 return description; +92 } +93 +94 /** +95 * Set the value of description. +96 * +97 * @param description new value of description +98 */ +99 public void setDescription(String description) { +100 this.description = description; +101 } +102 +103 /** +104 * The group id. +105 */ +106 private String groupId; +107 +108 /** +109 * Get the value of groupId. +110 * +111 * @return the value of groupId +112 */ +113 public String getGroupId() { +114 return groupId; +115 } +116 +117 /** +118 * Set the value of groupId. +119 * +120 * @param groupId new value of groupId +121 */ +122 public void setGroupId(String groupId) { +123 this.groupId = groupId; +124 } +125 +126 /** +127 * The artifact id. +128 */ +129 private String artifactId; +130 +131 /** +132 * Get the value of artifactId. +133 * +134 * @return the value of artifactId +135 */ +136 public String getArtifactId() { +137 return artifactId; +138 } +139 +140 /** +141 * Set the value of artifactId. +142 * +143 * @param artifactId new value of artifactId +144 */ +145 public void setArtifactId(String artifactId) { +146 this.artifactId = artifactId; +147 } +148 +149 /** +150 * The version number. +151 */ +152 private String version; +153 +154 /** +155 * Get the value of version. +156 * +157 * @return the value of version +158 */ +159 public String getVersion() { +160 return version; +161 } +162 +163 /** +164 * Set the value of version. +165 * +166 * @param version new value of version +167 */ +168 public void setVersion(String version) { +169 this.version = version; +170 } +171 +172 /** +173 * The parent group id. +174 */ +175 private String parentGroupId; +176 +177 /** +178 * Get the value of parentGroupId. +179 * +180 * @return the value of parentGroupId +181 */ +182 public String getParentGroupId() { +183 return parentGroupId; +184 } +185 +186 /** +187 * Set the value of parentGroupId. +188 * +189 * @param parentGroupId new value of parentGroupId +190 */ +191 public void setParentGroupId(String parentGroupId) { +192 this.parentGroupId = parentGroupId; +193 } +194 +195 /** +196 * The parent artifact id. +197 */ +198 private String parentArtifactId; +199 +200 /** +201 * Get the value of parentArtifactId. +202 * +203 * @return the value of parentArtifactId +204 */ +205 public String getParentArtifactId() { +206 return parentArtifactId; +207 } +208 +209 /** +210 * Set the value of parentArtifactId. +211 * +212 * @param parentArtifactId new value of parentArtifactId +213 */ +214 public void setParentArtifactId(String parentArtifactId) { +215 this.parentArtifactId = parentArtifactId; +216 } +217 +218 /** +219 * The parent version number. +220 */ +221 private String parentVersion; +222 +223 /** +224 * Get the value of parentVersion. +225 * +226 * @return the value of parentVersion +227 */ +228 public String getParentVersion() { +229 return parentVersion; +230 } +231 +232 /** +233 * Set the value of parentVersion. +234 * +235 * @param parentVersion new value of parentVersion +236 */ +237 public void setParentVersion(String parentVersion) { +238 this.parentVersion = parentVersion; +239 } +240 +241 /** +242 * The list of licenses. +243 */ +244 private List<License> licenses = new ArrayList<License>(); +245 +246 /** +247 * Returns the list of licenses. +248 * +249 * @return the list of licenses +250 */ +251 public List<License> getLicenses() { +252 return licenses; +253 } +254 +255 /** +256 * Adds a new license to the list of licenses. +257 * +258 * @param license the license to add +259 */ +260 public void addLicense(License license) { +261 licenses.add(license); +262 } +263 +264 /** +265 * Process the Maven properties file and interpolate all properties. +266 * +267 * @param properties new value of properties +268 */ +269 public void processProperties(Properties properties) { +270 this.groupId = interpolateString(this.groupId, properties); +271 this.artifactId = interpolateString(this.artifactId, properties); +272 this.version = interpolateString(this.version, properties); +273 this.description = interpolateString(this.description, properties); +274 for (License l : this.getLicenses()) { +275 l.setName(interpolateString(l.getName(), properties)); +276 l.setUrl(interpolateString(l.getUrl(), properties)); +277 } +278 this.name = interpolateString(this.name, properties); +279 this.organization = interpolateString(this.organization, properties); +280 this.parentGroupId = interpolateString(this.parentGroupId, properties); +281 this.parentArtifactId = interpolateString(this.parentArtifactId, properties); +282 this.parentVersion = interpolateString(this.parentVersion, properties); +283 +284 } +285 +286 /** 287 * <p> -288 * <b>Note:</b> if there is no property found the reference will be removed. In other words, if the interpolated string will -289 * be replaced with an empty string. -290 * </p> -291 * <p> -292 * Example:</p> -293 * <code> -294 * Properties p = new Properties(); -295 * p.setProperty("key", "value"); -296 * String s = interpolateString("'${key}' and '${nothing}'", p); -297 * System.out.println(s); -298 * </code> -299 * <p> -300 * Will result in:</p> -301 * <code> -302 * 'value' and '' -303 * </code> -304 * -305 * @param text the string that contains references to properties. -306 * @param properties a collection of properties that may be referenced within the text. -307 * @return the interpolated text. -308 */ -309 public static String interpolateString(String text, Properties properties) { -310 final Properties props = properties; -311 if (text == null) { -312 return text; -313 } -314 if (props == null) { -315 return text; -316 } -317 -318 final int pos = text.indexOf("${"); -319 if (pos < 0) { -320 return text; -321 } -322 final int end = text.indexOf("}"); -323 if (end < pos) { -324 return text; -325 } -326 -327 final String propName = text.substring(pos + 2, end); -328 String propValue = interpolateString(props.getProperty(propName), props); -329 if (propValue == null) { -330 propValue = ""; -331 } -332 final StringBuilder sb = new StringBuilder(propValue.length() + text.length()); -333 sb.append(text.subSequence(0, pos)); -334 sb.append(propValue); -335 sb.append(text.substring(end + 1)); -336 return interpolateString(sb.toString(), props); //yes yes, this should be a loop... -337 } +288 * A utility function that will interpolate strings based on values given in the properties file. It will also interpolate the +289 * strings contained within the properties file so that properties can reference other properties.</p> +290 * <p> +291 * <b>Note:</b> if there is no property found the reference will be removed. In other words, if the interpolated string will +292 * be replaced with an empty string. +293 * </p> +294 * <p> +295 * Example:</p> +296 * <code> +297 * Properties p = new Properties(); +298 * p.setProperty("key", "value"); +299 * String s = interpolateString("'${key}' and '${nothing}'", p); +300 * System.out.println(s); +301 * </code> +302 * <p> +303 * Will result in:</p> +304 * <code> +305 * 'value' and '' +306 * </code> +307 * +308 * @param text the string that contains references to properties. +309 * @param properties a collection of properties that may be referenced within the text. +310 * @return the interpolated text. +311 */ +312 public static String interpolateString(String text, Properties properties) { +313 if (null == text || null == properties) { +314 return text; +315 } +316 final StrSubstitutor substitutor = new StrSubstitutor(new PropertyLookup(properties)); +317 return substitutor.replace(text); +318 } +319 +320 /** +321 * Utility class that can provide values from a Properties object to a StrSubstitutor. +322 */ +323 private static class PropertyLookup extends StrLookup { +324 +325 /** +326 * Reference to the properties to lookup. +327 */ +328 private final Properties props; +329 +330 /** +331 * Constructs a new property lookup. +332 * +333 * @param props the properties to wrap. +334 */ +335 PropertyLookup(Properties props) { +336 this.props = props; +337 } 338 -339 } +339 /** +340 * Looks up the given property. +341 * +342 * @param key the key to the property +343 * @return the value of the property specified by the key +344 */ +345 @Override +346 public String lookup(String key) { +347 return props.getProperty(key); +348 } +349 } +350 }
    diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/xml/pom/package-frame.html b/dependency-check-core/xref/org/owasp/dependencycheck/xml/pom/package-frame.html index 2cf6dbaf4..0b6e0a8b4 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/xml/pom/package-frame.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/xml/pom/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.xml.pom + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.xml.pom @@ -32,6 +32,9 @@
  • PomUtils +
  • +
  • + PropertyLookup
  • diff --git a/dependency-check-core/xref/org/owasp/dependencycheck/xml/pom/package-summary.html b/dependency-check-core/xref/org/owasp/dependencycheck/xml/pom/package-summary.html index 2ed1d19cd..c97da2041 100644 --- a/dependency-check-core/xref/org/owasp/dependencycheck/xml/pom/package-summary.html +++ b/dependency-check-core/xref/org/owasp/dependencycheck/xml/pom/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference Package org.owasp.dependencycheck.xml.pom + Dependency-Check Core 1.3.2 Reference Package org.owasp.dependencycheck.xml.pom @@ -64,6 +64,11 @@
    PomUtils
    + PropertyLookup +
    diff --git a/dependency-check-core/xref/overview-frame.html b/dependency-check-core/xref/overview-frame.html index e77dee1f6..3f8c83b4f 100644 --- a/dependency-check-core/xref/overview-frame.html +++ b/dependency-check-core/xref/overview-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference + Dependency-Check Core 1.3.2 Reference diff --git a/dependency-check-core/xref/overview-summary.html b/dependency-check-core/xref/overview-summary.html index 274a7829f..5152f33c0 100644 --- a/dependency-check-core/xref/overview-summary.html +++ b/dependency-check-core/xref/overview-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Core 1.3.1 Reference + Dependency-Check Core 1.3.2 Reference @@ -24,7 +24,7 @@
    -

    Dependency-Check Core 1.3.1 Reference

    +

    Dependency-Check Core 1.3.2 Reference

    diff --git a/dependency-check-gradle/configuration-purge.html b/dependency-check-gradle/configuration-purge.html new file mode 100644 index 000000000..3ba35e25b --- /dev/null +++ b/dependency-check-gradle/configuration-purge.html @@ -0,0 +1,401 @@ + + + + + + + + + dependency-check – Tasks + + + + + + + + + + + + + + + + + + + + + Fork me on GitHub + + + + + +
    + + + + + +
    +
    + +
    + + +
    + +

    Tasks

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Task Description
    dependencyCheck Runs dependency-check against the project and generates a report.
    [dependencyCheckUpdate]](configuration-update.html) Updates the local cache of the NVD data from NIST.
    dependencyCheckPurge Deletes the local copy of the NVD. This is used to force a refresh of the data.
    +

    Configuration: dependencyCheckPurge

    +
    +
    +
    +

    Example

    + +
    +
    dependencyCheckPurge {
    +}
    +
    +
    +

    Advanced Configuration

    +

    The following properties can be configured in the dependencyCheckPurge task. However, they are less frequently changed.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Config Group Property Description Default Value
    data directory Sets the data directory to hold SQL CVEs contents. This should generally not be changed.  
    +

    $H$H$H$H Example groovy +dependencyCheckPurge { + data { + directory='d:/nvd' + } +} +

    + + + + +
    + +
    +
    +
    +

    Copyright © 2012–2015 + OWASP. + All rights reserved. + +

    +
    + + +
    +
    + + diff --git a/dependency-check-gradle/configuration-update.html b/dependency-check-gradle/configuration-update.html new file mode 100644 index 000000000..0acb2ee5b --- /dev/null +++ b/dependency-check-gradle/configuration-update.html @@ -0,0 +1,604 @@ + + + + + + + + + dependency-check – Tasks + + + + + + + + + + + + + + + + + + + + + Fork me on GitHub + + + + + +
    + + + + + +
    +
    + +
    + + +
    + +

    Tasks

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Task Description
    dependencyCheck Runs dependency-check against the project and generates a report.
    dependencyCheckUpdate Updates the local cache of the NVD data from NIST.
    dependencyCheckPurge Deletes the local copy of the NVD. This is used to force a refresh of the data.
    +

    Configuration: dependencyCheckUpdate

    +

    The following properties can be configured for the dependencyCheckUpdate task:

    + + + + + + + + + + + + + + + + + + + + + + + + +
    Property Description Default Value
    cveValidForHours Sets the number of hours to wait before checking for new updates from the NVD. 4
    +
    +
    +
    +

    Example

    + +
    +
    dependencyCheckUpdate {
    +    cveValidForHours=1
    +}
    +
    +
    +

    Proxy Configuration

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Property Description Default Value
    server The proxy server.  
    port The proxy port.  
    username Defines the proxy user name.  
    password Defines the proxy password.  
    connectionTimeout The URL Connection Timeout.  
    +
    +

    Example

    + +
    +
    dependencyCheckUpdate {
    +    proxy {
    +        server=some.proxy.server
    +        port=8989
    +    }
    +}
    +
    +
    +

    Advanced Configuration

    +

    The following properties can be configured in the dependencyCheck task. However, they are less frequently changed. One exception may be the cvedUrl properties, which can be used to host a mirror of the NVD within an enterprise environment. Note, if ANY of the cve configuration group are set - they should all be set to ensure things work as expected.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Config Group Property Description Default Value
    cve url12Modified URL for the modified CVE 1.2. https://nvd.nist.gov/download/nvdcve-Modified.xml.gz
    cve url20Modified URL for the modified CVE 2.0. https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-Modified.xml.gz
    cve url12Base Base URL for each year’s CVE 1.2, the %d will be replaced with the year. https://nvd.nist.gov/download/nvdcve-%d.xml.gz
    cve url20Base Base URL for each year’s CVE 2.0, the %d will be replaced with the year. https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml.gz
    data directory Sets the data directory to hold SQL CVEs contents. This should generally not be changed.  
    data driver The name of the database driver. Example: org.h2.Driver.  
    data driverPath The path to the database driver JAR file; only used if the driver is not in the class path.  
    data connectionString The connection string used to connect to the database.  
    data username The username used when connecting to the database.  
    data password The password used when connecting to the database.  
    +
    +

    Example

    + +
    +
    dependencyCheckUpdate {
    +    data {
    +        directory='d:/nvd'
    +    }
    +}
    +
    +
    +
    +
    + +
    + +
    +
    +
    +

    Copyright © 2012–2015 + OWASP. + All rights reserved. + +

    +
    + + +
    +
    + + diff --git a/dependency-check-gradle/configuration.html b/dependency-check-gradle/configuration.html new file mode 100644 index 000000000..cdcd49757 --- /dev/null +++ b/dependency-check-gradle/configuration.html @@ -0,0 +1,851 @@ + + + + + + + + + dependency-check – Tasks + + + + + + + + + + + + + + + + + + + + + Fork me on GitHub + + + + + +
    + + + + + +
    +
    + +
    + + +
    + +

    Tasks

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Task Description
    dependencyCheck Runs dependency-check against the project and generates a report.
    dependencyCheckUpdate Updates the local cache of the NVD data from NIST.
    dependencyCheckPurge Deletes the local copy of the NVD. This is used to force a refresh of the data.
    +

    Configuration: dependencyCheck

    +

    The following properties can be configured for the dependencyCheck task:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Property Description Default Value
    autoUpdate Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not recommended that this be turned to false. true
    cveValidForHours Sets the number of hours to wait before checking for new updates from the NVD. 4
    failBuildOnCVSS Specifies if the build should be failed if a CVSS score above a specified level is identified. The default is 11; since the CVSS scores are 0-10, by default the build will never fail. 11
    format The report format to be generated (HTML, XML, VULN, ALL). HTML
    reportsDirName The location to write the report(s). This directory will be located in the build directory. reports
    skipTestGroups When set to true (the default) all dependency groups that being with ‘test’ will be skipped. true
    suppressionFile The file path to the XML suppression file - used to suppress false positives  
    +
    +
    +
    +

    Example

    + +
    +
    dependencyCheck {
    +    autoUpdate=false
    +    cveValidForHours=1
    +    format=ALL
    +}
    +
    +
    +

    Proxy Configuration

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Property Description Default Value
    server The proxy server.  
    port The proxy port.  
    username Defines the proxy user name.  
    password Defines the proxy password.  
    connectionTimeout The URL Connection Timeout.  
    +
    +

    Example

    + +
    +
    dependencyCheck {
    +    proxy {
    +        server=some.proxy.server
    +        port=8989
    +    }
    +}
    +
    +
    +

    Advanced Configuration

    +

    The following properties can be configured in the dependencyCheck task. However, they are less frequently changed. One exception may be the cvedUrl properties, which can be used to host a mirror of the NVD within an enterprise environment. Note, if ANY of the cve configuration group are set - they should all be set to ensure things work as expected.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Config Group Property Description Default Value
    cve url12Modified URL for the modified CVE 1.2. https://nvd.nist.gov/download/nvdcve-Modified.xml.gz
    cve url20Modified URL for the modified CVE 2.0. https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-Modified.xml.gz
    cve url12Base Base URL for each year’s CVE 1.2, the %d will be replaced with the year. https://nvd.nist.gov/download/nvdcve-%d.xml.gz
    cve url20Base Base URL for each year’s CVE 2.0, the %d will be replaced with the year. https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml.gz
    data directory Sets the data directory to hold SQL CVEs contents. This should generally not be changed.  
    data driver The name of the database driver. Example: org.h2.Driver.  
    data driverPath The path to the database driver JAR file; only used if the driver is not in the class path.  
    data connectionString The connection string used to connect to the database.  
    data username The username used when connecting to the database.  
    data password The password used when connecting to the database.  
    +
    +

    Example

    + +
    +
    dependencyCheck {
    +    data {
    +        directory='d:/nvd'
    +    }
    +}
    +
    +
    +

    Analyzer Configuration

    +

    In addition to the above, the dependencyCheck plugin can be configured to enable or disable specific analyzers by configuring the analyzer section. Note, specific file type analyzers will automatically disable themselves if no file types that they support are detected - so specifically disabling the analyzers is likely not needed.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Property Description Default Value
    archiveEnabled Sets whether the Archive Analyzer will be used. true
    zipExtensions A comma-separated list of additional file extensions to be treated like a ZIP file, the contents will be extracted and analyzed.  
    jarEnabled Sets whether Jar Analyzer will be used. true
    centralEnabled Sets whether Central Analyzer will be used. If this analyzer is being disabled there is a good chance you also want to disable the Nexus Analyzer (see below). true
    nexusEnabled Sets whether Nexus Analyzer will be used. This analyzer is superceded by the Central Analyzer; however, you can configure this to run against a Nexus Pro installation. true
    nexusUrl Defines the Nexus Server’s web service end point (example http://domain.enterprise/service/local/). If not set the Nexus Analyzer will be disabled.  
    nexusUsesProxy Whether or not the defined proxy should be used when connecting to Nexus. true
    pyDistributionEnabled Sets whether the Python Distribution Analyzer will be used. true
    pyPackageEnabled Sets whether the Python Package Analyzer will be used. true
    rubygemsEnabled Sets whether the Ruby Gemspec Analyzer will be used. true
    opensslEnabled Sets whether or not the openssl Analyzer should be used. true
    cmakeEnabled Sets whether or not the CMake Analyzer should be used. true
    autoconfEnabled Sets whether or not the autoconf Analyzer should be used. true
    composerEnabled Sets whether or not the PHP Composer Lock File Analyzer should be used. true
    nodeEnabled Sets whether or not the Node.js Analyzer should be used. true
    nuspecEnabled Sets whether or not the .NET Nuget Nuspec Analyzer will be used. true
    assemblyEnabled Sets whether or not the .NET Assembly Analyzer should be used. true
    pathToMono The path to Mono for .NET assembly analysis on non-windows systems.  
    +
    +

    Example

    + +
    +
    dependencyCheck {
    +    analyzer {
    +        assemblyEnabled=false
    +    }
    +}
    +
    +
    +
    +
    + +
    + +
    +
    +
    +

    Copyright © 2012–2015 + OWASP. + All rights reserved. + +

    +
    + + +
    +
    + + diff --git a/dependency-check-gradle/index.html b/dependency-check-gradle/index.html index 50b898b18..fb5f72e7c 100644 --- a/dependency-check-gradle/index.html +++ b/dependency-check-gradle/index.html @@ -1,21 +1,21 @@ - + - dependency-check-gradle – Dependency-Check Gradle Plugin - - - + dependency-check – Usage + + + - + @@ -42,7 +42,7 @@
  • - + /
  • -
  • - - dependency-check - / -
  • -
  • Dependency-Check Gradle Plugin
  • +
  • Usage
  • -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 0.0.6 + Version: 1.3.2
  • @@ -82,18 +77,177 @@ @@ -82,18 +77,154 @@ @@ -105,7 +105,7 @@ Project Information - +
  • @@ -123,7 +123,7 @@ -
    +
    @@ -138,7 +138,7 @@
    -
    + built with maven @@ -163,7 +163,7 @@

    Full name:

    -

    org.owasp:dependency-check-maven:1.3.1:aggregate

    +

    org.owasp:dependency-check-maven:1.3.2:aggregate

    Description:

    @@ -181,7 +181,7 @@ vulnerabilities.
  • The goal is thread-safe and supports parallel builds.
  • -
  • Binds by default to the lifecycle phase: compile.
  • +
  • Binds by default to the lifecycle phase: verify.
  • Requires that Maven runs in online mode.
  • @@ -204,18 +204,6 @@ vulnerabilities. -autoUpdate - -boolean - -- - -Sets whether auto-updating of the NVD CVE/CPE data is enabled. It -is not recommended that this be turned to false. Default is true.
    Default value is: true.
    User property is: autoupdate. - - - - dataFileName String @@ -225,7 +213,7 @@ is not recommended that this be turned to false. Default is true.
    Defaul Sets whether or not the external report format should be used.
    Default value is: dependency-check.ser.
    User property is: metaFileName. - + failBuildOnCVSS @@ -238,7 +226,7 @@ specified level is identified. The default is 11 which means since the CVSS scores are 0-10, by default the build will never fail.
    Default value is: 11.
    User property is: failBuildOnCVSS. - + format @@ -251,6 +239,17 @@ configuration option has no affect if using this within the Site plug-in unless the externalReport is set to true. Default is HTML.
    Default value is: HTML.
    User property is: format. + + +name + +String + +- + +The name of the report in the site.
    Default value is: dependency-check:aggregate.
    User property is: name. + + outputDirectory @@ -296,44 +295,90 @@ Dependency-Check report. This generally maps to "target/site".
    aggregate -boolean +Boolean - -Deprecated. use the aggregate goal instead
    Default value is: false.
    User property is: aggregate. +Deprecated. use the aggregate goal instead
    User property is: aggregate. archiveAnalyzerEnabled -boolean +Boolean - -Whether or not the Archive Analyzer is enabled.
    Default value is: true.
    User property is: archiveAnalyzerEnabled. +Whether or not the Archive Analyzer is enabled.
    User property is: archiveAnalyzerEnabled. assemblyAnalyzerEnabled -boolean +Boolean - -Whether or not the .NET Assembly Analyzer is enabled.
    Default value is: true.
    User property is: assemblyAnalyzerEnabled. +Whether or not the .NET Assembly Analyzer is enabled.
    User property is: assemblyAnalyzerEnabled. + + + + +autoUpdate + +Boolean + +- + +Sets whether auto-updating of the NVD CVE/CPE data is enabled. It +is not recommended that this be turned to false. Default is true.
    User property is: autoupdate. + + + + +autoconfAnalyzerEnabled + +Boolean + +- + +Sets whether or not the autoconf Analyzer should be used.
    User property is: autoconfAnalyzerEnabled. centralAnalyzerEnabled -boolean +Boolean - -Whether or not the Central Analyzer is enabled.
    Default value is: true.
    User property is: centralAnalyzerEnabled. +Whether or not the Central Analyzer is enabled.
    User property is: centralAnalyzerEnabled. + + + + +cmakeAnalyzerEnabled + +Boolean + +- + +Sets whether or not the CMake Analyzer should be used.
    User property is: cmakeAnalyzerEnabled. + + + + +composerAnalyzerEnabled + +Boolean + +- + +Sets whether or not the PHP Composer Lock File Analyzer should be +used.
    User property is: composerAnalyzerEnabled. @@ -404,6 +449,18 @@ Dependency-Check report. This generally maps to "target/site".
    +cveValidForHours + +Integer + +- + +Optionally skip excessive CVE update checks for a designated +duration in hours.
    User property is: cveValidForHours. + + + + dataDirectory String @@ -413,7 +470,7 @@ Dependency-Check report. This generally maps to "target/site".
    The data directory, hold DC SQL DB.
    User property is: dataDirectory. - + databaseDriverName @@ -424,7 +481,7 @@ Dependency-Check report. This generally maps to "target/site".
    The database driver name. An example would be org.h2.Driver.
    User property is: databaseDriverName. - + databaseDriverPath @@ -435,7 +492,7 @@ Dependency-Check report. This generally maps to "target/site".
    The path to the database driver if it is not on the class path.
    User property is: databaseDriverPath. - + databasePassword @@ -446,7 +503,7 @@ Dependency-Check report. This generally maps to "target/site".
    The password to use when connecting to the database.
    User property is: databasePassword. - + databaseUser @@ -457,7 +514,7 @@ Dependency-Check report. This generally maps to "target/site".
    The database user name.
    User property is: databaseUser. - + externalReport @@ -468,18 +525,18 @@ Dependency-Check report. This generally maps to "target/site".
    Deprecated. the internal report is no longer supported
    User property is: externalReport. - + jarAnalyzerEnabled -boolean +Boolean - -Whether or not the Jar Analyzer is enabled.
    Default value is: true.
    User property is: jarAnalyzerEnabled. +Whether or not the Jar Analyzer is enabled.
    User property is: jarAnalyzerEnabled. - + mavenSettings @@ -490,7 +547,7 @@ Dependency-Check report. This generally maps to "target/site".
    The Maven settings.
    Default value is: ${settings}.
    User property is: mavenSettings. - + mavenSettingsProxyId @@ -501,18 +558,18 @@ Dependency-Check report. This generally maps to "target/site".
    The maven settings proxy id.
    User property is: mavenSettingsProxyId. - + nexusAnalyzerEnabled -boolean +Boolean - -Whether or not the Nexus Analyzer is enabled.
    Default value is: true.
    User property is: nexusAnalyzerEnabled. +Whether or not the Nexus Analyzer is enabled.
    User property is: nexusAnalyzerEnabled. - + nexusUrl @@ -524,30 +581,52 @@ Dependency-Check report. This generally maps to "target/site".
    User property is: nexusUrl. - + nexusUsesProxy -boolean +Boolean - -Whether or not the configured proxy is used to connect to Nexus.
    Default value is: true.
    User property is: nexusUsesProxy. +Whether or not the configured proxy is used to connect to Nexus.
    User property is: nexusUsesProxy. + + + + +nodeAnalyzerEnabled + +Boolean + +- + +Sets whether or not the Node.js Analyzer should be used.
    User property is: nodeAnalyzerEnabled. nuspecAnalyzerEnabled -boolean +Boolean - -Whether or not the .NET Nuspec Analyzer is enabled.
    Default value is: true.
    User property is: nuspecAnalyzerEnabled. +Whether or not the .NET Nuspec Analyzer is enabled.
    User property is: nuspecAnalyzerEnabled. +opensslAnalyzerEnabled + +Boolean + +- + +Sets whether or not the openssl Analyzer should be used.
    User property is: opensslAnalyzerEnabled. + + + + pathToMono String @@ -557,7 +636,7 @@ Dependency-Check report. This generally maps to "target/site".
    The path to mono for .NET Assembly analysis on non-windows systems.
    User property is: pathToMono. - + proxyUrl @@ -568,6 +647,39 @@ Dependency-Check report. This generally maps to "target/site".
    Deprecated. Please use mavenSettings instead
    User property is: proxyUrl. + + +pyDistributionAnalyzerEnabled + +Boolean + +- + +Sets whether the Python Distribution Analyzer will be used.
    User property is: pyDistributionAnalyzerEnabled. + + + + +pyPackageAnalyzerEnabled + +Boolean + +- + +Sets whether the Python Package Analyzer will be used.
    User property is: pyPackageAnalyzerEnabled. + + + + +rubygemsAnalyzerEnabled + +Boolean + +- + +Sets whether the Ruby Gemspec Analyzer will be used.
    User property is: rubygemsAnalyzerEnabled. + + showSummary @@ -581,6 +693,17 @@ Dependency-Check report. This generally maps to "target/site".
    +skip + +boolean + +- + +Skip Dependency Check altogether.
    Default value is: false.
    User property is: dependency-check.skip. + + + + skipProvidedScope boolean @@ -590,7 +713,7 @@ Dependency-Check report. This generally maps to "target/site".
    Skip Analysis for Provided Scope Dependencies.
    Default value is: false.
    User property is: skipProvidedScope. - + skipRuntimeScope @@ -601,7 +724,7 @@ Dependency-Check report. This generally maps to "target/site".
    Skip Analysis for Runtime Scope Dependencies.
    Default value is: false.
    User property is: skipRuntimeScope. - + skipTestScope @@ -612,7 +735,7 @@ Dependency-Check report. This generally maps to "target/site".
    Skip Analysis for Test Scope Dependencies.
    Default value is: true.
    User property is: skipTestScope. - + suppressionFile @@ -623,7 +746,7 @@ Dependency-Check report. This generally maps to "target/site".
    The path to the suppression file.
    User property is: suppressionFile. - + zipExtensions @@ -648,13 +771,11 @@ to jar, zip, ....
    User property is: zipExtensions.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: aggregate
    • - -
    • Default: false

    archiveAnalyzerEnabled:

    @@ -662,13 +783,11 @@ to jar, zip, ....
    User property is: zipExtensions.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: archiveAnalyzerEnabled
    • - -
    • Default: true

    assemblyAnalyzerEnabled:

    @@ -676,13 +795,11 @@ to jar, zip, ....
    User property is: zipExtensions.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: assemblyAnalyzerEnabled
    • - -
    • Default: true

    autoUpdate:

    @@ -691,13 +808,23 @@ is not recommended that this be turned to false. Default is true.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • -
    • Required: Yes
    • +
    • Required: No
    • User Property: autoupdate
    • +

    +

    autoconfAnalyzerEnabled:

    + +
    Sets whether or not the autoconf Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: autoconfAnalyzerEnabled

    centralAnalyzerEnabled:

    @@ -705,13 +832,36 @@ is not recommended that this be turned to false. Default is true.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: centralAnalyzerEnabled
    • +

    +

    cmakeAnalyzerEnabled:

    + +
    Sets whether or not the CMake Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: cmakeAnalyzerEnabled
    • +

    +

    composerAnalyzerEnabled:

    + +
    Sets whether or not the PHP Composer Lock File Analyzer should be +used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: composerAnalyzerEnabled

    connectionString:

    @@ -785,6 +935,19 @@ is not recommended that this be turned to false. Default is true.
  • User Property: cveUrl20Modified

  • +

    cveValidForHours:

    + +
    Optionally skip excessive CVE update checks for a designated +duration in hours.
    + +
      + +
    • Type: java.lang.Integer
    • + +
    • Required: No
    • + +
    • User Property: cveValidForHours
    • +

    dataDirectory:

    The data directory, hold DC SQL DB.
    @@ -911,13 +1074,11 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: jarAnalyzerEnabled
    • - -
    • Default: true

    mavenSettings:

    @@ -945,19 +1106,31 @@ plug-in unless the externalReport is set to true. Default is HTML.
  • User Property: mavenSettingsProxyId

  • +

    name:

    + +
    The name of the report in the site.
    + +
      + +
    • Type: java.lang.String
    • + +
    • Required: Yes
    • + +
    • User Property: name
    • + +
    • Default: dependency-check:aggregate
    • +

    nexusAnalyzerEnabled:

    Whether or not the Nexus Analyzer is enabled.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: nexusAnalyzerEnabled
    • - -
    • Default: true

    nexusUrl:

    @@ -978,13 +1151,23 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: nexusUsesProxy
    • +

    +

    nodeAnalyzerEnabled:

    + +
    Sets whether or not the Node.js Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: nodeAnalyzerEnabled

    nuspecAnalyzerEnabled:

    @@ -992,13 +1175,23 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: nuspecAnalyzerEnabled
    • +

    +

    opensslAnalyzerEnabled:

    + +
    Sets whether or not the openssl Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: opensslAnalyzerEnabled

    outputDirectory:

    @@ -1038,6 +1231,30 @@ plug-in unless the externalReport is set to true. Default is HTML.
  • User Property: proxyUrl

  • +

    pyDistributionAnalyzerEnabled:

    + +
    Sets whether the Python Distribution Analyzer will be used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: pyDistributionAnalyzerEnabled
    • +

    +

    pyPackageAnalyzerEnabled:

    + +
    Sets whether the Python Package Analyzer will be used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: pyPackageAnalyzerEnabled
    • +

    reportOutputDirectory:

    Specifies the destination directory for the generated @@ -1051,6 +1268,18 @@ Dependency-Check report. This generally maps to "target/site".
  • User Property: project.reporting.outputDirectory

  • +

    rubygemsAnalyzerEnabled:

    + +
    Sets whether the Ruby Gemspec Analyzer will be used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: rubygemsAnalyzerEnabled
    • +

    showSummary:

    Flag indicating whether or not to show a summary in the output.
    @@ -1065,6 +1294,20 @@ Dependency-Check report. This generally maps to "target/site".
  • Default: true

  • +

    skip:

    + +
    Skip Dependency Check altogether.
    + +
      + +
    • Type: boolean
    • + +
    • Required: No
    • + +
    • User Property: dependency-check.skip
    • + +
    • Default: false
    • +

    skipProvidedScope:

    Skip Analysis for Provided Scope Dependencies.
    diff --git a/dependency-check-maven/apidocs/allclasses-frame.html b/dependency-check-maven/apidocs/allclasses-frame.html index 712650748..9f2286741 100644 --- a/dependency-check-maven/apidocs/allclasses-frame.html +++ b/dependency-check-maven/apidocs/allclasses-frame.html @@ -2,10 +2,10 @@ - + -All Classes (Dependency-Check Maven Plugin 1.3.1 API) - +All Classes (Dependency-Check Maven Plugin 1.3.2 API) + diff --git a/dependency-check-maven/apidocs/allclasses-noframe.html b/dependency-check-maven/apidocs/allclasses-noframe.html index 7cafba158..76e0a6f73 100644 --- a/dependency-check-maven/apidocs/allclasses-noframe.html +++ b/dependency-check-maven/apidocs/allclasses-noframe.html @@ -2,10 +2,10 @@ - + -All Classes (Dependency-Check Maven Plugin 1.3.1 API) - +All Classes (Dependency-Check Maven Plugin 1.3.2 API) + diff --git a/dependency-check-maven/apidocs/constant-values.html b/dependency-check-maven/apidocs/constant-values.html index 650cdfe3d..afbb1b478 100644 --- a/dependency-check-maven/apidocs/constant-values.html +++ b/dependency-check-maven/apidocs/constant-values.html @@ -2,16 +2,16 @@ - + -Constant Field Values (Dependency-Check Maven Plugin 1.3.1 API) - +Constant Field Values (Dependency-Check Maven Plugin 1.3.2 API) + @@ -141,6 +141,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/deprecated-list.html b/dependency-check-maven/apidocs/deprecated-list.html index 3d0ae971a..e7da44278 100644 --- a/dependency-check-maven/apidocs/deprecated-list.html +++ b/dependency-check-maven/apidocs/deprecated-list.html @@ -2,16 +2,16 @@ - + -Deprecated List (Dependency-Check Maven Plugin 1.3.1 API) - +Deprecated List (Dependency-Check Maven Plugin 1.3.2 API) + @@ -136,6 +136,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/help-doc.html b/dependency-check-maven/apidocs/help-doc.html index c23354125..192ea8024 100644 --- a/dependency-check-maven/apidocs/help-doc.html +++ b/dependency-check-maven/apidocs/help-doc.html @@ -2,16 +2,16 @@ - + -API Help (Dependency-Check Maven Plugin 1.3.1 API) - +API Help (Dependency-Check Maven Plugin 1.3.2 API) + @@ -217,6 +217,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/index-all.html b/dependency-check-maven/apidocs/index-all.html index 8b705025f..757fa6675 100644 --- a/dependency-check-maven/apidocs/index-all.html +++ b/dependency-check-maven/apidocs/index-all.html @@ -2,16 +2,16 @@ - + -Index (Dependency-Check Maven Plugin 1.3.1 API) - +Index (Dependency-Check Maven Plugin 1.3.2 API) + @@ -591,6 +591,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/index.html b/dependency-check-maven/apidocs/index.html index fa5760058..261d81b75 100644 --- a/dependency-check-maven/apidocs/index.html +++ b/dependency-check-maven/apidocs/index.html @@ -2,9 +2,9 @@ - + -Dependency-Check Maven Plugin 1.3.1 API +Dependency-Check Maven Plugin 1.3.2 API @@ -112,7 +112,7 @@

    @Mojo(name="aggregate",
    -      defaultPhase=COMPILE,
    +      defaultPhase=VERIFY,
           threadSafe=true,
           requiresDependencyResolution=COMPILE_PLUS_RUNTIME,
           requiresOnline=true)
    @@ -455,6 +455,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.html index 42a1bc35c..9053acbed 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.html @@ -2,16 +2,16 @@ - + -BaseDependencyCheckMojo (Dependency-Check Maven Plugin 1.3.1 API) - +BaseDependencyCheckMojo (Dependency-Check Maven Plugin 1.3.2 API) + @@ -845,6 +845,6 @@ public final void generate(org.codehaus.doxia.sink.Sink sink,
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/CheckMojo.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/CheckMojo.html index 8cb969a92..ebdf902b1 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/CheckMojo.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/CheckMojo.html @@ -2,16 +2,16 @@ - + -CheckMojo (Dependency-Check Maven Plugin 1.3.1 API) - +CheckMojo (Dependency-Check Maven Plugin 1.3.2 API) + @@ -112,7 +112,7 @@

    @Mojo(name="check",
    -      defaultPhase=COMPILE,
    +      defaultPhase=VERIFY,
           threadSafe=true,
           requiresDependencyResolution=COMPILE_PLUS_RUNTIME,
           requiresOnline=true)
    @@ -375,6 +375,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/Engine.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/Engine.html index 15f9aee94..b43eb2657 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/Engine.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/Engine.html @@ -2,16 +2,16 @@ - + -Engine (Dependency-Check Maven Plugin 1.3.1 API) - +Engine (Dependency-Check Maven Plugin 1.3.2 API) + @@ -213,7 +213,7 @@ extends
    Engine -accept, doUpdates, getAnalyzers, getAnalyzers, getDependencies, getFileTypeAnalyzers, initializeEngine, scan, scan, scan, scan, scan, scan, scanDirectory, scanFile, setDependencies +accept, doUpdates, getAnalyzers, getAnalyzers, getDependencies, getFileTypeAnalyzers, initializeEngine, scan, scan, scan, scan, scan, scanDirectory, scanFile, setDependencies
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/PurgeMojo.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/PurgeMojo.html index eb6d8b9f9..fd39ff190 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/PurgeMojo.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/PurgeMojo.html @@ -2,16 +2,16 @@ - + -PurgeMojo (Dependency-Check Maven Plugin 1.3.1 API) - +PurgeMojo (Dependency-Check Maven Plugin 1.3.2 API) + @@ -375,6 +375,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/UpdateMojo.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/UpdateMojo.html index 6a4ff9af6..b03046829 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/UpdateMojo.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/UpdateMojo.html @@ -2,16 +2,16 @@ - + -UpdateMojo (Dependency-Check Maven Plugin 1.3.1 API) - +UpdateMojo (Dependency-Check Maven Plugin 1.3.2 API) + @@ -375,6 +375,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/AggregateMojo.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/AggregateMojo.html index ffd0134d0..b49d28fac 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/AggregateMojo.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/AggregateMojo.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.maven.AggregateMojo (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.maven.AggregateMojo (Dependency-Check Maven Plugin 1.3.2 API) + @@ -112,6 +112,6 @@
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/BaseDependencyCheckMojo.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/BaseDependencyCheckMojo.html index b38569400..162c9dfa1 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/BaseDependencyCheckMojo.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/BaseDependencyCheckMojo.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.maven.BaseDependencyCheckMojo (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.maven.BaseDependencyCheckMojo (Dependency-Check Maven Plugin 1.3.2 API) + @@ -175,6 +175,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/CheckMojo.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/CheckMojo.html index c14f9289b..e41bb2109 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/CheckMojo.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/CheckMojo.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.maven.CheckMojo (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.maven.CheckMojo (Dependency-Check Maven Plugin 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/Engine.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/Engine.html index 7f91de454..4c219dd69 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/Engine.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/Engine.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.maven.Engine (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.maven.Engine (Dependency-Check Maven Plugin 1.3.2 API) + @@ -200,6 +200,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/HelpMojo.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/HelpMojo.html index c3f8033d1..7c7848317 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/HelpMojo.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/HelpMojo.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.maven.HelpMojo (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.maven.HelpMojo (Dependency-Check Maven Plugin 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/PurgeMojo.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/PurgeMojo.html index 4029562e0..05f85dfd2 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/PurgeMojo.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/PurgeMojo.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.maven.PurgeMojo (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.maven.PurgeMojo (Dependency-Check Maven Plugin 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/UpdateMojo.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/UpdateMojo.html index 2729bc2f9..407a05dcc 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/UpdateMojo.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/class-use/UpdateMojo.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.maven.UpdateMojo (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.maven.UpdateMojo (Dependency-Check Maven Plugin 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-frame.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-frame.html index 70f8900d4..8f3ee683f 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-frame.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.maven (Dependency-Check Maven Plugin 1.3.1 API) - +org.owasp.dependencycheck.maven (Dependency-Check Maven Plugin 1.3.2 API) + diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-summary.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-summary.html index 12cd99e76..77fb683ef 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-summary.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.maven (Dependency-Check Maven Plugin 1.3.1 API) - +org.owasp.dependencycheck.maven (Dependency-Check Maven Plugin 1.3.2 API) + @@ -178,6 +178,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-tree.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-tree.html index eb465cb46..aeb212f6a 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-tree.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.maven Class Hierarchy (Dependency-Check Maven Plugin 1.3.1 API) - +org.owasp.dependencycheck.maven Class Hierarchy (Dependency-Check Maven Plugin 1.3.2 API) + @@ -142,6 +142,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-use.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-use.html index e5f2a5f28..4bef692b7 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-use.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.maven (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.maven (Dependency-Check Maven Plugin 1.3.2 API) + @@ -153,6 +153,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/MavenLoggerAdapter.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/MavenLoggerAdapter.html index 47114f9ea..9e5a49acd 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/MavenLoggerAdapter.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/MavenLoggerAdapter.html @@ -2,16 +2,16 @@ - + -MavenLoggerAdapter (Dependency-Check Maven Plugin 1.3.1 API) - +MavenLoggerAdapter (Dependency-Check Maven Plugin 1.3.2 API) + @@ -767,6 +767,6 @@ extends org.slf4j.helpers.MarkerIgnoringBase
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/MavenLoggerFactory.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/MavenLoggerFactory.html index bc0780dbc..8c465fa15 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/MavenLoggerFactory.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/MavenLoggerFactory.html @@ -2,16 +2,16 @@ - + -MavenLoggerFactory (Dependency-Check Maven Plugin 1.3.1 API) - +MavenLoggerFactory (Dependency-Check Maven Plugin 1.3.2 API) + @@ -273,6 +273,6 @@ implements org.slf4j.ILoggerFactory -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/class-use/MavenLoggerAdapter.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/class-use/MavenLoggerAdapter.html index 2e2980765..fd6192434 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/class-use/MavenLoggerAdapter.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/class-use/MavenLoggerAdapter.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.maven.slf4j.MavenLoggerAdapter (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.maven.slf4j.MavenLoggerAdapter (Dependency-Check Maven Plugin 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/class-use/MavenLoggerFactory.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/class-use/MavenLoggerFactory.html index bd153a848..0bf9f8330 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/class-use/MavenLoggerFactory.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/class-use/MavenLoggerFactory.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.maven.slf4j.MavenLoggerFactory (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.maven.slf4j.MavenLoggerFactory (Dependency-Check Maven Plugin 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-frame.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-frame.html index f841b93d2..1aedabb10 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-frame.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.maven.slf4j (Dependency-Check Maven Plugin 1.3.1 API) - +org.owasp.dependencycheck.maven.slf4j (Dependency-Check Maven Plugin 1.3.2 API) + diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-summary.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-summary.html index d53d0ab02..5381b47ad 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-summary.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.maven.slf4j (Dependency-Check Maven Plugin 1.3.1 API) - +org.owasp.dependencycheck.maven.slf4j (Dependency-Check Maven Plugin 1.3.2 API) + @@ -147,6 +147,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-tree.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-tree.html index 5c6246558..0ce344881 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-tree.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.maven.slf4j Class Hierarchy (Dependency-Check Maven Plugin 1.3.1 API) - +org.owasp.dependencycheck.maven.slf4j Class Hierarchy (Dependency-Check Maven Plugin 1.3.2 API) + @@ -130,6 +130,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-use.html b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-use.html index dcc763495..a1dffd46a 100644 --- a/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-use.html +++ b/dependency-check-maven/apidocs/org/owasp/dependencycheck/maven/slf4j/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.maven.slf4j (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.maven.slf4j (Dependency-Check Maven Plugin 1.3.2 API) + @@ -112,6 +112,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/slf4j/impl/StaticLoggerBinder.html b/dependency-check-maven/apidocs/org/slf4j/impl/StaticLoggerBinder.html index 82285df00..9415208be 100644 --- a/dependency-check-maven/apidocs/org/slf4j/impl/StaticLoggerBinder.html +++ b/dependency-check-maven/apidocs/org/slf4j/impl/StaticLoggerBinder.html @@ -2,16 +2,16 @@ - + -StaticLoggerBinder (Dependency-Check Maven Plugin 1.3.1 API) - +StaticLoggerBinder (Dependency-Check Maven Plugin 1.3.2 API) + @@ -329,6 +329,6 @@ implements org.slf4j.spi.LoggerFactoryBinder -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/slf4j/impl/class-use/StaticLoggerBinder.html b/dependency-check-maven/apidocs/org/slf4j/impl/class-use/StaticLoggerBinder.html index bf02b15fb..956e9ec3a 100644 --- a/dependency-check-maven/apidocs/org/slf4j/impl/class-use/StaticLoggerBinder.html +++ b/dependency-check-maven/apidocs/org/slf4j/impl/class-use/StaticLoggerBinder.html @@ -2,16 +2,16 @@ - + -Uses of Class org.slf4j.impl.StaticLoggerBinder (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Class org.slf4j.impl.StaticLoggerBinder (Dependency-Check Maven Plugin 1.3.2 API) + @@ -156,6 +156,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/slf4j/impl/package-frame.html b/dependency-check-maven/apidocs/org/slf4j/impl/package-frame.html index 2a4388984..de6f5b57d 100644 --- a/dependency-check-maven/apidocs/org/slf4j/impl/package-frame.html +++ b/dependency-check-maven/apidocs/org/slf4j/impl/package-frame.html @@ -2,10 +2,10 @@ - + -org.slf4j.impl (Dependency-Check Maven Plugin 1.3.1 API) - +org.slf4j.impl (Dependency-Check Maven Plugin 1.3.2 API) + diff --git a/dependency-check-maven/apidocs/org/slf4j/impl/package-summary.html b/dependency-check-maven/apidocs/org/slf4j/impl/package-summary.html index b4f1163bb..1489550c4 100644 --- a/dependency-check-maven/apidocs/org/slf4j/impl/package-summary.html +++ b/dependency-check-maven/apidocs/org/slf4j/impl/package-summary.html @@ -2,16 +2,16 @@ - + -org.slf4j.impl (Dependency-Check Maven Plugin 1.3.1 API) - +org.slf4j.impl (Dependency-Check Maven Plugin 1.3.2 API) + @@ -142,6 +142,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/slf4j/impl/package-tree.html b/dependency-check-maven/apidocs/org/slf4j/impl/package-tree.html index e4d5226a6..f659b4f99 100644 --- a/dependency-check-maven/apidocs/org/slf4j/impl/package-tree.html +++ b/dependency-check-maven/apidocs/org/slf4j/impl/package-tree.html @@ -2,16 +2,16 @@ - + -org.slf4j.impl Class Hierarchy (Dependency-Check Maven Plugin 1.3.1 API) - +org.slf4j.impl Class Hierarchy (Dependency-Check Maven Plugin 1.3.2 API) + @@ -125,6 +125,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/org/slf4j/impl/package-use.html b/dependency-check-maven/apidocs/org/slf4j/impl/package-use.html index 54476b83b..6d74506bc 100644 --- a/dependency-check-maven/apidocs/org/slf4j/impl/package-use.html +++ b/dependency-check-maven/apidocs/org/slf4j/impl/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.slf4j.impl (Dependency-Check Maven Plugin 1.3.1 API) - +Uses of Package org.slf4j.impl (Dependency-Check Maven Plugin 1.3.2 API) + @@ -150,6 +150,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/overview-frame.html b/dependency-check-maven/apidocs/overview-frame.html index 881a6d408..2b669f188 100644 --- a/dependency-check-maven/apidocs/overview-frame.html +++ b/dependency-check-maven/apidocs/overview-frame.html @@ -2,10 +2,10 @@ - + -Overview List (Dependency-Check Maven Plugin 1.3.1 API) - +Overview List (Dependency-Check Maven Plugin 1.3.2 API) + diff --git a/dependency-check-maven/apidocs/overview-summary.html b/dependency-check-maven/apidocs/overview-summary.html index 22fd4d273..a1d4c43d6 100644 --- a/dependency-check-maven/apidocs/overview-summary.html +++ b/dependency-check-maven/apidocs/overview-summary.html @@ -2,16 +2,16 @@ - + -Overview (Dependency-Check Maven Plugin 1.3.1 API) - +Overview (Dependency-Check Maven Plugin 1.3.2 API) + @@ -64,7 +64,7 @@
    -

    Dependency-Check Maven Plugin 1.3.1 API

    +

    Dependency-Check Maven Plugin 1.3.2 API

    @@ -140,6 +140,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/overview-tree.html b/dependency-check-maven/apidocs/overview-tree.html index 22bbf40c8..694e090cb 100644 --- a/dependency-check-maven/apidocs/overview-tree.html +++ b/dependency-check-maven/apidocs/overview-tree.html @@ -2,16 +2,16 @@ - + -Class Hierarchy (Dependency-Check Maven Plugin 1.3.1 API) - +Class Hierarchy (Dependency-Check Maven Plugin 1.3.2 API) + @@ -151,6 +151,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/apidocs/serialized-form.html b/dependency-check-maven/apidocs/serialized-form.html index a1b45c463..68500af54 100644 --- a/dependency-check-maven/apidocs/serialized-form.html +++ b/dependency-check-maven/apidocs/serialized-form.html @@ -2,16 +2,16 @@ - + -Serialized Form (Dependency-Check Maven Plugin 1.3.1 API) - +Serialized Form (Dependency-Check Maven Plugin 1.3.2 API) + @@ -139,6 +139,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-maven/check-mojo.html b/dependency-check-maven/check-mojo.html index b91db7b06..e20638a5c 100644 --- a/dependency-check-maven/check-mojo.html +++ b/dependency-check-maven/check-mojo.html @@ -1,13 +1,13 @@ - + dependency-check-maven – dependency-check:check @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • @@ -123,7 +123,7 @@ -
    +
    @@ -138,7 +138,7 @@
    -
    + built with maven @@ -163,7 +163,7 @@

    Full name:

    -

    org.owasp:dependency-check-maven:1.3.1:check

    +

    org.owasp:dependency-check-maven:1.3.2:check

    Description:

    @@ -180,7 +180,7 @@ have any known published vulnerabilities.
  • The goal is thread-safe and supports parallel builds.
  • -
  • Binds by default to the lifecycle phase: compile.
  • +
  • Binds by default to the lifecycle phase: verify.
  • Requires that Maven runs in online mode.
  • @@ -203,18 +203,6 @@ have any known published vulnerabilities. - - - - - - - - - - - @@ -224,7 +212,7 @@ is not recommended that this be turned to false. Default is true.
    Defaul - + @@ -237,7 +225,7 @@ specified level is identified. The default is 11 which means since the CVSS scores are 0-10, by default the build will never fail.
    Default value is: 11.
    User property is: failBuildOnCVSS.
    - + @@ -250,6 +238,17 @@ configuration option has no affect if using this within the Site plug-in unless the externalReport is set to true. Default is HTML.
    Default value is: HTML.
    User property is: format.
    + + + + + + + + + + + @@ -295,44 +294,90 @@ Dependency-Check report. This generally maps to "target/site".
    aggregate -
    + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + @@ -403,6 +448,18 @@ Dependency-Check report. This generally maps to "target/site".
    +
    + + + + + + + + + + @@ -412,7 +469,7 @@ Dependency-Check report. This generally maps to "target/site".
    The data directory, hold DC SQL DB.
    User property is: dataDirectory.
    - + @@ -423,7 +480,7 @@ Dependency-Check report. This generally maps to "target/site".
    The database driver name. An example would be org.h2.Driver.
    User property is: databaseDriverName.
    - + @@ -434,7 +491,7 @@ Dependency-Check report. This generally maps to "target/site".
    The path to the database driver if it is not on the class path.
    User property is: databaseDriverPath.
    - + @@ -445,7 +502,7 @@ Dependency-Check report. This generally maps to "target/site".
    The password to use when connecting to the database.
    User property is: databasePassword.
    - + @@ -456,7 +513,7 @@ Dependency-Check report. This generally maps to "target/site".
    The database user name.
    User property is: databaseUser.
    - + @@ -467,18 +524,18 @@ Dependency-Check report. This generally maps to "target/site".
    Deprecated. the internal report is no longer supported
    User property is: externalReport.
    - + - + - + - + @@ -489,7 +546,7 @@ Dependency-Check report. This generally maps to "target/site".
    The Maven settings.
    Default value is: ${settings}.
    User property is: mavenSettings.
    - + @@ -500,18 +557,18 @@ Dependency-Check report. This generally maps to "target/site".
    The maven settings proxy id.
    User property is: mavenSettingsProxyId.
    - + - + - + - + @@ -523,30 +580,52 @@ Dependency-Check report. This generally maps to "target/site".
    User property is: nexusUrl.
    - + - + - + + + + + + + + + + + + - + - + + + + + + + + + + + + @@ -556,7 +635,7 @@ Dependency-Check report. This generally maps to "target/site".
    The path to mono for .NET Assembly analysis on non-windows systems.
    User property is: pathToMono.
    - + @@ -567,6 +646,39 @@ Dependency-Check report. This generally maps to "target/site".
    Deprecated. Please use mavenSettings instead
    User property is: proxyUrl.
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -580,6 +692,17 @@ Dependency-Check report. This generally maps to "target/site".
    +
    + + + + + + + + + + @@ -589,7 +712,7 @@ Dependency-Check report. This generally maps to "target/site".
    Skip Analysis for Provided Scope Dependencies.
    Default value is: false.
    User property is: skipProvidedScope.
    - + @@ -600,7 +723,7 @@ Dependency-Check report. This generally maps to "target/site".
    Skip Analysis for Runtime Scope Dependencies.
    Default value is: false.
    User property is: skipRuntimeScope.
    - + @@ -611,7 +734,7 @@ Dependency-Check report. This generally maps to "target/site".
    Skip Analysis for Test Scope Dependencies.
    Default value is: true.
    User property is: skipTestScope.
    - + @@ -622,7 +745,7 @@ Dependency-Check report. This generally maps to "target/site".
    The path to the suppression file.
    User property is: suppressionFile.
    - + @@ -647,13 +770,11 @@ to jar, zip, ....
    User property is: zipExtensions.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: aggregate
    • - -
    • Default: false

    archiveAnalyzerEnabled:

    @@ -661,13 +782,11 @@ to jar, zip, ....
    User property is: zipExtensions.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: archiveAnalyzerEnabled
    • - -
    • Default: true

    assemblyAnalyzerEnabled:

    @@ -675,13 +794,11 @@ to jar, zip, ....
    User property is: zipExtensions.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: assemblyAnalyzerEnabled
    • - -
    • Default: true

    autoUpdate:

    @@ -690,13 +807,23 @@ is not recommended that this be turned to false. Default is true.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • -
    • Required: Yes
    • +
    • Required: No
    • User Property: autoupdate
    • +

    +

    autoconfAnalyzerEnabled:

    + +
    Sets whether or not the autoconf Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: autoconfAnalyzerEnabled

    centralAnalyzerEnabled:

    @@ -704,13 +831,36 @@ is not recommended that this be turned to false. Default is true.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: centralAnalyzerEnabled
    • +

    +

    cmakeAnalyzerEnabled:

    + +
    Sets whether or not the CMake Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: cmakeAnalyzerEnabled
    • +

    +

    composerAnalyzerEnabled:

    + +
    Sets whether or not the PHP Composer Lock File Analyzer should be +used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: composerAnalyzerEnabled

    connectionString:

    @@ -784,6 +934,19 @@ is not recommended that this be turned to false. Default is true.
  • User Property: cveUrl20Modified

  • +

    cveValidForHours:

    + +
    Optionally skip excessive CVE update checks for a designated +duration in hours.
    + +
      + +
    • Type: java.lang.Integer
    • + +
    • Required: No
    • + +
    • User Property: cveValidForHours
    • +

    dataDirectory:

    The data directory, hold DC SQL DB.
    @@ -910,13 +1073,11 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: jarAnalyzerEnabled
    • - -
    • Default: true

    mavenSettings:

    @@ -944,19 +1105,31 @@ plug-in unless the externalReport is set to true. Default is HTML.
  • User Property: mavenSettingsProxyId

  • +

    name:

    + +
    The name of the report in the site.
    + +
      + +
    • Type: java.lang.String
    • + +
    • Required: Yes
    • + +
    • User Property: name
    • + +
    • Default: dependency-check
    • +

    nexusAnalyzerEnabled:

    Whether or not the Nexus Analyzer is enabled.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: nexusAnalyzerEnabled
    • - -
    • Default: true

    nexusUrl:

    @@ -977,13 +1150,23 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: nexusUsesProxy
    • +

    +

    nodeAnalyzerEnabled:

    + +
    Sets whether or not the Node.js Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: nodeAnalyzerEnabled

    nuspecAnalyzerEnabled:

    @@ -991,13 +1174,23 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: nuspecAnalyzerEnabled
    • +

    +

    opensslAnalyzerEnabled:

    + +
    Sets whether or not the openssl Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: opensslAnalyzerEnabled

    outputDirectory:

    @@ -1037,6 +1230,30 @@ plug-in unless the externalReport is set to true. Default is HTML.
  • User Property: proxyUrl

  • +

    pyDistributionAnalyzerEnabled:

    + +
    Sets whether the Python Distribution Analyzer will be used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: pyDistributionAnalyzerEnabled
    • +

    +

    pyPackageAnalyzerEnabled:

    + +
    Sets whether the Python Package Analyzer will be used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: pyPackageAnalyzerEnabled
    • +

    reportOutputDirectory:

    Specifies the destination directory for the generated @@ -1050,6 +1267,18 @@ Dependency-Check report. This generally maps to "target/site".
  • User Property: project.reporting.outputDirectory

  • +

    rubygemsAnalyzerEnabled:

    + +
    Sets whether the Ruby Gemspec Analyzer will be used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: rubygemsAnalyzerEnabled
    • +

    showSummary:

    Flag indicating whether or not to show a summary in the output.
    @@ -1064,6 +1293,20 @@ Dependency-Check report. This generally maps to "target/site".
  • Default: true

  • +

    skip:

    + +
    Skip Dependency Check altogether.
    + +
      + +
    • Type: boolean
    • + +
    • Required: No
    • + +
    • User Property: dependency-check.skip
    • + +
    • Default: false
    • +

    skipProvidedScope:

    Skip Analysis for Provided Scope Dependencies.
    diff --git a/dependency-check-maven/checkstyle.html b/dependency-check-maven/checkstyle.html index 95155f241..657cd561b 100644 --- a/dependency-check-maven/checkstyle.html +++ b/dependency-check-maven/checkstyle.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Checkstyle Results @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • @@ -194,13 +194,6 @@ Checkstyle
  • - -
  • - - - - PMD -
  • @@ -214,7 +207,7 @@ -
    +
    @@ -229,7 +222,7 @@
    - + built with maven @@ -247,7 +240,7 @@

    Checkstyle Results

    -

    The following document contains the results of Checkstyle 6.2 with C:\Users\jeremy\Projects\DependencyCheck\dependency-check-maven/../src/main/config/checkstyle-checks.xml ruleset. rss feed

    +

    The following document contains the results of Checkstyle 6.11.2 with C:\Users\jeremy\Projects\DependencyCheck\dependency-check-maven/../src/main/config/checkstyle-checks.xml ruleset. rss feed

    Summary

    autoUpdateboolean-Sets whether auto-updating of the NVD CVE/CPE data is enabled. It -is not recommended that this be turned to false. Default is true.
    Default value is: true.
    User property is: autoupdate.
    dataFileName StringSets whether or not the external report format should be used.
    Default value is: dependency-check.ser.
    User property is: metaFileName.
    failBuildOnCVSS
    format
    nameString-The name of the report in the site.
    Default value is: dependency-check.
    User property is: name.
    outputDirectorybooleanBoolean -Deprecated. use the aggregate goal instead
    Default value is: false.
    User property is: aggregate.
    Deprecated. use the aggregate goal instead
    User property is: aggregate.
    archiveAnalyzerEnabledbooleanBoolean -Whether or not the Archive Analyzer is enabled.
    Default value is: true.
    User property is: archiveAnalyzerEnabled.
    Whether or not the Archive Analyzer is enabled.
    User property is: archiveAnalyzerEnabled.
    assemblyAnalyzerEnabledbooleanBoolean -Whether or not the .NET Assembly Analyzer is enabled.
    Default value is: true.
    User property is: assemblyAnalyzerEnabled.
    Whether or not the .NET Assembly Analyzer is enabled.
    User property is: assemblyAnalyzerEnabled.
    autoUpdateBoolean-Sets whether auto-updating of the NVD CVE/CPE data is enabled. It +is not recommended that this be turned to false. Default is true.
    User property is: autoupdate.
    autoconfAnalyzerEnabledBoolean-Sets whether or not the autoconf Analyzer should be used.
    User property is: autoconfAnalyzerEnabled.
    centralAnalyzerEnabledbooleanBoolean -Whether or not the Central Analyzer is enabled.
    Default value is: true.
    User property is: centralAnalyzerEnabled.
    Whether or not the Central Analyzer is enabled.
    User property is: centralAnalyzerEnabled.
    cmakeAnalyzerEnabledBoolean-Sets whether or not the CMake Analyzer should be used.
    User property is: cmakeAnalyzerEnabled.
    composerAnalyzerEnabledBoolean-Sets whether or not the PHP Composer Lock File Analyzer should be +used.
    User property is: composerAnalyzerEnabled.
    cveValidForHoursInteger-Optionally skip excessive CVE update checks for a designated +duration in hours.
    User property is: cveValidForHours.
    dataDirectory String
    databaseDriverName
    databaseDriverPath
    databasePassword
    databaseUser
    externalReport
    jarAnalyzerEnabledbooleanBoolean -Whether or not the Jar Analyzer is enabled.
    Default value is: true.
    User property is: jarAnalyzerEnabled.
    Whether or not the Jar Analyzer is enabled.
    User property is: jarAnalyzerEnabled.
    mavenSettings
    mavenSettingsProxyId
    nexusAnalyzerEnabledbooleanBoolean -Whether or not the Nexus Analyzer is enabled.
    Default value is: true.
    User property is: nexusAnalyzerEnabled.
    Whether or not the Nexus Analyzer is enabled.
    User property is: nexusAnalyzerEnabled.
    nexusUrl
    nexusUsesProxybooleanBoolean -Whether or not the configured proxy is used to connect to Nexus.
    Default value is: true.
    User property is: nexusUsesProxy.
    Whether or not the configured proxy is used to connect to Nexus.
    User property is: nexusUsesProxy.
    nodeAnalyzerEnabledBoolean-Sets whether or not the Node.js Analyzer should be used.
    User property is: nodeAnalyzerEnabled.
    nuspecAnalyzerEnabledbooleanBoolean -Whether or not the .NET Nuspec Analyzer is enabled.
    Default value is: true.
    User property is: nuspecAnalyzerEnabled.
    Whether or not the .NET Nuspec Analyzer is enabled.
    User property is: nuspecAnalyzerEnabled.
    opensslAnalyzerEnabledBoolean-Sets whether or not the openssl Analyzer should be used.
    User property is: opensslAnalyzerEnabled.
    pathToMono String
    proxyUrl
    pyDistributionAnalyzerEnabledBoolean-Sets whether the Python Distribution Analyzer will be used.
    User property is: pyDistributionAnalyzerEnabled.
    pyPackageAnalyzerEnabledBoolean-Sets whether the Python Package Analyzer will be used.
    User property is: pyPackageAnalyzerEnabled.
    rubygemsAnalyzerEnabledBoolean-Sets whether the Ruby Gemspec Analyzer will be used.
    User property is: rubygemsAnalyzerEnabled.
    showSummaryskipboolean-Skip Dependency Check altogether.
    Default value is: false.
    User property is: dependency-check.skip.
    skipProvidedScope boolean
    skipRuntimeScope
    skipTestScope
    suppressionFile
    zipExtensions
    diff --git a/dependency-check-maven/checkstyle.rss b/dependency-check-maven/checkstyle.rss index 73b5357bd..b7a7ca556 100644 --- a/dependency-check-maven/checkstyle.rss +++ b/dependency-check-maven/checkstyle.rss @@ -20,7 +20,7 @@ under the License. Dependency-Check Maven Plugin - Checkstyle report - http://maven.apache.org + https://github.com/jeremylong/DependencyCheck.git/dependency-check-maven Dependency-Check Maven Plugin - Checkstyle report en-us ©2013 - 2015 OWASP @@ -30,9 +30,9 @@ under the License. Warnings: 0, Infos: 0 - http://maven.apache.org/checkstyle.html + https://github.com/jeremylong/DependencyCheck.git/dependency-check-maven/checkstyle.html -

    Click here for the full Checkstyle report.

    +

    Click here for the full Checkstyle report.

    @@ -46,7 +46,7 @@ under the License. - + diff --git a/dependency-check-maven/cobertura/frame-sourcefiles.html b/dependency-check-maven/cobertura/frame-sourcefiles.html index a7aa17f6f..6bf87839b 100644 --- a/dependency-check-maven/cobertura/frame-sourcefiles.html +++ b/dependency-check-maven/cobertura/frame-sourcefiles.html @@ -18,7 +18,7 @@ All Packages - + diff --git a/dependency-check-maven/cobertura/frame-summary-org.owasp.dependencycheck.maven.html b/dependency-check-maven/cobertura/frame-summary-org.owasp.dependencycheck.maven.html index 5bda6d9e9..cf713b804 100644 --- a/dependency-check-maven/cobertura/frame-summary-org.owasp.dependencycheck.maven.html +++ b/dependency-check-maven/cobertura/frame-summary-org.owasp.dependencycheck.maven.html @@ -16,7 +16,7 @@
    - org/owasp/dependencycheck/maven/package-info.java + org/owasp/dependencycheck/maven/package-info.java 0 @@ -60,7 +60,7 @@ under the License.
    - target/generated-classes/cobertura/mojo.properties + target/generated-classes/cobertura/mojo.properties 0 @@ -74,7 +74,7 @@ under the License.
    - LICENSE.txt + LICENSE.txt 0 @@ -88,7 +88,7 @@ under the License.
    - org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java + org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java 0 @@ -102,7 +102,7 @@ under the License.
    - org/owasp/dependencycheck/maven/slf4j/package-info.java + org/owasp/dependencycheck/maven/slf4j/package-info.java 0 @@ -116,7 +116,7 @@ under the License.
    - target/maven-archiver/pom.properties + target/maven-archiver/pom.properties 0 @@ -130,7 +130,7 @@ under the License.
    - mojo.properties + mojo.properties 0 @@ -144,7 +144,7 @@ under the License.
    - org/owasp/dependencycheck/maven/CheckMojo.java + org/owasp/dependencycheck/maven/CheckMojo.java 0 @@ -158,7 +158,7 @@ under the License.
    - target/generated-classes/cobertura/cobertura.properties + target/generated-classes/cobertura/cobertura.properties 0 @@ -172,7 +172,7 @@ under the License.
    - org/owasp/dependencycheck/maven/PurgeMojo.java + org/owasp/dependencycheck/maven/PurgeMojo.java 0 @@ -186,7 +186,7 @@ under the License.
    - target/test-classes/mojo.properties + target/test-classes/mojo.properties 0 @@ -200,7 +200,7 @@ under the License.
    - org/owasp/dependencycheck/maven/UpdateMojo.java + org/owasp/dependencycheck/maven/UpdateMojo.java 0 @@ -214,7 +214,7 @@ under the License.
    - target/maven-plugin-help.properties + target/maven-plugin-help.properties 0 @@ -228,7 +228,7 @@ under the License.
    - org/owasp/dependencycheck/maven/Engine.java + org/owasp/dependencycheck/maven/Engine.java 0 @@ -242,7 +242,7 @@ under the License.
    - org/slf4j/impl/StaticLoggerBinder.java + org/slf4j/impl/StaticLoggerBinder.java 0 @@ -256,7 +256,7 @@ under the License.
    - NOTICE.txt + NOTICE.txt 0 @@ -270,7 +270,7 @@ under the License.
    - org/owasp/dependencycheck/maven/AggregateMojo.java + org/owasp/dependencycheck/maven/AggregateMojo.java 0 @@ -284,7 +284,7 @@ under the License.
    - org/owasp/dependencycheck/maven/slf4j/MavenLoggerFactory.java + org/owasp/dependencycheck/maven/slf4j/MavenLoggerFactory.java 0 @@ -298,7 +298,7 @@ under the License.
    - org/slf4j/impl/package-info.java + org/slf4j/impl/package-info.java 0 @@ -312,7 +312,7 @@ under the License.
    - target/classes/mojo.properties + target/classes/mojo.properties 0 @@ -326,7 +326,7 @@ under the License.
    - src/test/resources/mojo.properties + src/test/resources/mojo.properties 0 @@ -340,7 +340,7 @@ under the License.
    - org/owasp/dependencycheck/maven/slf4j/MavenLoggerAdapter.java + org/owasp/dependencycheck/maven/slf4j/MavenLoggerAdapter.java 0 diff --git a/dependency-check-maven/cobertura/frame-sourcefiles-org.owasp.dependencycheck.maven.html b/dependency-check-maven/cobertura/frame-sourcefiles-org.owasp.dependencycheck.maven.html index cd8e6324f..d83e8f6f5 100644 --- a/dependency-check-maven/cobertura/frame-sourcefiles-org.owasp.dependencycheck.maven.html +++ b/dependency-check-maven/cobertura/frame-sourcefiles-org.owasp.dependencycheck.maven.html @@ -18,7 +18,7 @@ org.owasp.dependencycheck.maven AggregateMojo (0%)
    BaseDependencyCheckMojo (11%)BaseDependencyCheckMojo (10%)
    CheckMojo (0%)AggregateMojo (0%)
    BaseDependencyCheckMojo (11%)BaseDependencyCheckMojo (10%)
    CheckMojo (0%)
    - +
    Package # Classes Line Coverage Branch Coverage Complexity
    org.owasp.dependencycheck.maven7
    6%
    47/718
    2%
    12/470
    4.895
    org.owasp.dependencycheck.maven7
    5%
    38/685
    2%
    12/404
    4.434
    org.owasp.dependencycheck.maven.slf4j2
    16%
    23/142
    8%
    5/60
    2.061
    @@ -29,11 +29,11 @@ packageTable.sort(0); - + - + - + @@ -50,6 +50,6 @@ var classTable = new SortableTable(document.getElementById("classResults"), ["String", "Percentage", "Percentage", "FormattedNumber"]); classTable.sort(0); - + diff --git a/dependency-check-maven/cobertura/frame-summary-org.owasp.dependencycheck.maven.slf4j.html b/dependency-check-maven/cobertura/frame-summary-org.owasp.dependencycheck.maven.slf4j.html index bb097f57f..163832447 100644 --- a/dependency-check-maven/cobertura/frame-summary-org.owasp.dependencycheck.maven.slf4j.html +++ b/dependency-check-maven/cobertura/frame-summary-org.owasp.dependencycheck.maven.slf4j.html @@ -39,6 +39,6 @@ var classTable = new SortableTable(document.getElementById("classResults"), ["String", "Percentage", "Percentage", "FormattedNumber"]); classTable.sort(0); - + diff --git a/dependency-check-maven/cobertura/frame-summary-org.slf4j.impl.html b/dependency-check-maven/cobertura/frame-summary-org.slf4j.impl.html index 15c37bbc5..973d6bc0b 100644 --- a/dependency-check-maven/cobertura/frame-summary-org.slf4j.impl.html +++ b/dependency-check-maven/cobertura/frame-summary-org.slf4j.impl.html @@ -37,6 +37,6 @@ var classTable = new SortableTable(document.getElementById("classResults"), ["String", "Percentage", "Percentage", "FormattedNumber"]); classTable.sort(0); - + diff --git a/dependency-check-maven/cobertura/frame-summary.html b/dependency-check-maven/cobertura/frame-summary.html index ded97472d..7d7d83a26 100644 --- a/dependency-check-maven/cobertura/frame-summary.html +++ b/dependency-check-maven/cobertura/frame-summary.html @@ -16,8 +16,8 @@
    Classes in this Package Line Coverage Branch Coverage Complexity
    AggregateMojo
    0%
    0/113
    0%
    0/84
    7
    AggregateMojo
    0%
    0/115
    0%
    0/86
    7.125
    BaseDependencyCheckMojo
    11%
    38/320
    5%
    11/210
    5.567
    BaseDependencyCheckMojo
    10%
    29/284
    7%
    11/142
    4.367
    CheckMojo
    0%
    0/27
    0%
    0/8
    2.5
    CheckMojo
    0%
    0/28
    0%
    0/8
    2.5
    Engine
    12%
    9/70
    2%
    1/50
    3.727
    - - + + @@ -27,6 +27,6 @@ var packageTable = new SortableTable(document.getElementById("packageResults"), ["String", "Number", "Percentage", "Percentage", "FormattedNumber"]); packageTable.sort(0); - + diff --git a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.AggregateMojo.html b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.AggregateMojo.html index 57afc0f63..d62b125b8 100644 --- a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.AggregateMojo.html +++ b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.AggregateMojo.html @@ -12,7 +12,7 @@
     
    Package # Classes Line Coverage Branch Coverage Complexity
    All Packages10
    9%
    80/873
    3%
    17/530
    3.904
    org.owasp.dependencycheck.maven7
    6%
    47/718
    2%
    12/470
    4.895
    All Packages10
    8%
    71/840
    3%
    17/464
    3.596
    org.owasp.dependencycheck.maven7
    5%
    38/685
    2%
    12/404
    4.434
    org.owasp.dependencycheck.maven.slf4j2
    16%
    23/142
    8%
    5/60
    2.061
    org.slf4j.impl1
    76%
    10/13
    N/A
    1
    - +
    Classes in this File Line Coverage Branch Coverage Complexity
    AggregateMojo
    0%
    0/113
    0%
    0/84
    7
    AggregateMojo
    0%
    0/115
    0%
    0/86
    7.125
     
    @@ -80,398 +80,416 @@  31  
     import org.apache.maven.plugins.annotations.Mojo;
     32   -
     import org.apache.maven.plugins.annotations.ResolutionScope;
    +
     import org.apache.maven.plugins.annotations.Parameter;
     33   -
     import org.apache.maven.project.MavenProject;
    +
     import org.apache.maven.plugins.annotations.ResolutionScope;
     34   -
     import org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzer;
    +
     import org.apache.maven.project.MavenProject;
     35   -
     import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
    +
     import org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzer;
     36   -
     import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
    +
     import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
     37   -
     import org.owasp.dependencycheck.dependency.Dependency;
    +
     import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
     38   -
     import org.owasp.dependencycheck.utils.Settings;
    +
     import org.owasp.dependencycheck.dependency.Dependency;
     39   -
     
    +
     import org.owasp.dependencycheck.utils.Settings;
     40   -
     /**
    +
     
     41   -
      * Maven Plugin that checks project dependencies and the dependencies of all child modules to see if they have any known published
    +
     /**
     42   -
      * vulnerabilities.
    +
      * Maven Plugin that checks project dependencies and the dependencies of all child modules to see if they have any known published
     43   -
      *
    +
      * vulnerabilities.
     44   -
      * @author Jeremy Long
    +
      *
     45   -
      */
    +
      * @author Jeremy Long
     46   -
     @Mojo(
    +
      */
     47   -
             name = "aggregate",
    +
     @Mojo(
     48   -
             defaultPhase = LifecyclePhase.COMPILE,
    +
             name = "aggregate",
     49   -
             /*aggregator = true,*/
    +
             defaultPhase = LifecyclePhase.VERIFY,
     50   -
             threadSafe = true,
    +
             /*aggregator = true,*/
     51   -
             requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,
    +
             threadSafe = true,
     52   -
             requiresOnline = true
    +
             requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,
     53   +
             requiresOnline = true
    +  54  
     )
    -  54  0
     public class AggregateMojo extends BaseDependencyCheckMojo {
    -  55   -
     
    +  55  0
     public class AggregateMojo extends BaseDependencyCheckMojo {
     56   -
         /**
    +
     
     57   -
          * Executes the aggregate dependency-check goal. This runs dependency-check and generates the subsequent reports.
    -  58   -
          *
    -  59   -
          * @throws MojoExecutionException thrown if there is ane exception running the mojo
    -  60   -
          * @throws MojoFailureException thrown if dependency-check is configured to fail the build
    -  61   -
          */
    -  62   -
         @Override
    -  63   -
         public void runCheck() throws MojoExecutionException, MojoFailureException {
    -  64  0
             final Engine engine = generateDataFile();
    -  65   -
     
    -  66  0
             if (getProject() == getReactorProjects().get(getReactorProjects().size() - 1)) {
    -  67   -
     
    -  68   -
                 //ensure that the .ser file was created for each.
    -  69  0
                 for (MavenProject current : getReactorProjects()) {
    -  70  0
                     final File dataFile = getDataFile(current);
    -  71  0
                     if (dataFile == null) { //dc was never run on this project. write the ser to the target.
    -  72  0
                         getLog().error(String.format("Module '%s' did not execute dependency-check; an attempt will be made to perform "
    -  73   -
                                 + "the check but dependencies may be missed resulting in false negatives.", current.getName()));
    -  74  0
                         generateDataFile(engine, current);
    -  75   -
                     }
    -  76  0
                 }
    -  77   -
     
    -  78  0
                 for (MavenProject current : getReactorProjects()) {
    -  79  0
                     List<Dependency> dependencies = readDataFile(current);
    -  80  0
                     if (dependencies == null) {
    -  81  0
                         dependencies = new ArrayList<Dependency>();
    -  82   -
                     }
    -  83  0
                     final Set<MavenProject> childProjects = getDescendants(current);
    -  84  0
                     for (MavenProject reportOn : childProjects) {
    -  85  0
                         final List<Dependency> childDeps = readDataFile(reportOn);
    -  86  0
                         if (childDeps != null && !childDeps.isEmpty()) {
    -  87  0
                             if (getLog().isDebugEnabled()) {
    -  88  0
                                 getLog().debug(String.format("Adding %d dependencies from %s", childDeps.size(), reportOn.getName()));
    -  89   -
                             }
    -  90  0
                             dependencies.addAll(childDeps);
    -  91   -
                         } else {
    -  92  0
                             if (getLog().isDebugEnabled()) {
    -  93  0
                                 getLog().debug(String.format("No dependencies read for %s", reportOn.getName()));
    -  94   -
                             }
    -  95   -
                         }
    -  96  0
                     }
    -  97  0
                     engine.getDependencies().clear();
    -  98  0
                     engine.getDependencies().addAll(dependencies);
    -  99  0
                     final DependencyBundlingAnalyzer bundler = new DependencyBundlingAnalyzer();
    -  100   -
                     try {
    -  101  0
                         if (getLog().isDebugEnabled()) {
    -  102  0
                             getLog().debug(String.format("Dependency count pre-bundler: %s", engine.getDependencies().size()));
    -  103   -
                         }
    -  104  0
                         bundler.analyze(null, engine);
    -  105  0
                         if (getLog().isDebugEnabled()) {
    -  106  0
                             getLog().debug(String.format("Dependency count post-bundler: %s", engine.getDependencies().size()));
    -  107   -
                         }
    -  108  0
                     } catch (AnalysisException ex) {
    -  109  0
                         getLog().warn("An error occured grouping the dependencies; duplicate entries may exist in the report", ex);
    -  110  0
                         getLog().debug("Bundling Exception", ex);
    -  111  0
                     }
    -  112   -
     
    -  113  0
                     File outputDir = getCorrectOutputDirectory(current);
    -  114  0
                     if (outputDir == null) {
    -  115   -
                         //in some regards we shouldn't be writting this, but we are anyway.
    -  116   -
                         //we shouldn't write this because nothing is configured to generate this report.
    -  117  0
                         outputDir = new File(current.getBuild().getDirectory());
    -  118   -
                     }
    -  119  0
                     writeReports(engine, current, outputDir);
    -  120  0
                 }
    -  121   -
             }
    -  122  0
             engine.cleanup();
    -  123  0
             Settings.cleanup();
    -  124  0
         }
    -  125   -
     
    -  126  
         /**
    -  127   -
          * Returns a set containing all the descendant projects of the given project.
    -  128   +  58   +
          * Executes the aggregate dependency-check goal. This runs dependency-check and generates the subsequent reports.
    +  59  
          *
    -  129   -
          * @param project the project for which all descendants will be returned
    -  130   -
          * @return the set of descendant projects
    -  131   +  60   +
          * @throws MojoExecutionException thrown if there is ane exception running the mojo
    +  61   +
          * @throws MojoFailureException thrown if dependency-check is configured to fail the build
    +  62  
          */
    -  132   -
         protected Set<MavenProject> getDescendants(MavenProject project) {
    -  133  0
             if (project == null) {
    -  134  0
                 return Collections.emptySet();
    -  135   -
             }
    -  136  0
             final Set<MavenProject> descendants = new HashSet<MavenProject>();
    -  137  0
             int size = 0;
    -  138  0
             if (getLog().isDebugEnabled()) {
    -  139  0
                 getLog().debug(String.format("Collecting descendants of %s", project.getName()));
    -  140   -
             }
    -  141  0
             for (String m : project.getModules()) {
    -  142  0
                 for (MavenProject mod : getReactorProjects()) {
    -  143   +  63   +
         @Override
    +  64   +
         public void runCheck() throws MojoExecutionException, MojoFailureException {
    +  65  0
             final Engine engine = generateDataFile();
    +  66   +
     
    +  67  0
             if (getProject() == getReactorProjects().get(getReactorProjects().size() - 1)) {
    +  68   +
     
    +  69   +
                 //ensure that the .ser file was created for each.
    +  70  0
                 for (MavenProject current : getReactorProjects()) {
    +  71  0
                     final File dataFile = getDataFile(current);
    +  72  0
                     if (dataFile == null) { //dc was never run on this project. write the ser to the target.
    +  73  0
                         getLog().error(String.format("Module '%s' did not execute dependency-check; an attempt will be made to perform "
    +  74   +
                                 + "the check but dependencies may be missed resulting in false negatives.", current.getName()));
    +  75  0
                         generateDataFile(engine, current);
    +  76   +
                     }
    +  77  0
                 }
    +  78   +
     
    +  79  0
                 for (MavenProject current : getReactorProjects()) {
    +  80  0
                     List<Dependency> dependencies = readDataFile(current);
    +  81  0
                     if (dependencies == null) {
    +  82  0
                         dependencies = new ArrayList<Dependency>();
    +  83   +
                     }
    +  84  0
                     final Set<MavenProject> childProjects = getDescendants(current);
    +  85  0
                     for (MavenProject reportOn : childProjects) {
    +  86  0
                         final List<Dependency> childDeps = readDataFile(reportOn);
    +  87  0
                         if (childDeps != null && !childDeps.isEmpty()) {
    +  88  0
                             if (getLog().isDebugEnabled()) {
    +  89  0
                                 getLog().debug(String.format("Adding %d dependencies from %s", childDeps.size(), reportOn.getName()));
    +  90   +
                             }
    +  91  0
                             dependencies.addAll(childDeps);
    +  92   +
                         } else {
    +  93  0
                             if (getLog().isDebugEnabled()) {
    +  94  0
                                 getLog().debug(String.format("No dependencies read for %s", reportOn.getName()));
    +  95   +
                             }
    +  96   +
                         }
    +  97  0
                     }
    +  98  0
                     engine.getDependencies().clear();
    +  99  0
                     engine.getDependencies().addAll(dependencies);
    +  100  0
                     final DependencyBundlingAnalyzer bundler = new DependencyBundlingAnalyzer();
    +  101  
                     try {
    -  144  0
                         File mpp = new File(project.getBasedir(), m);
    -  145  0
                         mpp = mpp.getCanonicalFile();
    -  146  0
                         if (mpp.compareTo(mod.getBasedir()) == 0 && descendants.add(mod)) {
    -  147  0
                             if (getLog().isDebugEnabled()) {
    -  148  0
                                 getLog().debug(String.format("Decendent module %s added", mod.getName()));
    -  149   -
                             }
    +  102  0
                         if (getLog().isDebugEnabled()) {
    +  103  0
                             getLog().debug(String.format("Dependency count pre-bundler: %s", engine.getDependencies().size()));
    +  104   +
                         }
    +  105  0
                         bundler.analyze(null, engine);
    +  106  0
                         if (getLog().isDebugEnabled()) {
    +  107  0
                             getLog().debug(String.format("Dependency count post-bundler: %s", engine.getDependencies().size()));
    +  108   +
                         }
    +  109  0
                     } catch (AnalysisException ex) {
    +  110  0
                         getLog().warn("An error occured grouping the dependencies; duplicate entries may exist in the report", ex);
    +  111  0
                         getLog().debug("Bundling Exception", ex);
    +  112  0
                     }
    +  113   +
     
    +  114  0
                     File outputDir = getCorrectOutputDirectory(current);
    +  115  0
                     if (outputDir == null) {
    +  116   +
                         //in some regards we shouldn't be writting this, but we are anyway.
    +  117   +
                         //we shouldn't write this because nothing is configured to generate this report.
    +  118  0
                         outputDir = new File(current.getBuild().getDirectory());
    +  119   +
                     }
    +  120  0
                     writeReports(engine, current, outputDir);
    +  121  0
                 }
    +  122   +
             }
    +  123  0
             engine.cleanup();
    +  124  0
             Settings.cleanup();
    +  125  0
         }
    +  126   +
     
    +  127   +
         /**
    +  128   +
          * Returns a set containing all the descendant projects of the given project.
    +  129   +
          *
    +  130   +
          * @param project the project for which all descendants will be returned
    +  131   +
          * @return the set of descendant projects
    +  132   +
          */
    +  133   +
         protected Set<MavenProject> getDescendants(MavenProject project) {
    +  134  0
             if (project == null) {
    +  135  0
                 return Collections.emptySet();
    +  136   +
             }
    +  137  0
             final Set<MavenProject> descendants = new HashSet<MavenProject>();
    +  138  0
             int size = 0;
    +  139  0
             if (getLog().isDebugEnabled()) {
    +  140  0
                 getLog().debug(String.format("Collecting descendants of %s", project.getName()));
    +  141   +
             }
    +  142  0
             for (String m : project.getModules()) {
    +  143  0
                 for (MavenProject mod : getReactorProjects()) {
    +  144   +
                     try {
    +  145  0
                         File mpp = new File(project.getBasedir(), m);
    +  146  0
                         mpp = mpp.getCanonicalFile();
    +  147  0
                         if (mpp.compareTo(mod.getBasedir()) == 0 && descendants.add(mod)
    +  148   +
                                 && getLog().isDebugEnabled()) {
    +  149  0
                             getLog().debug(String.format("Decendent module %s added", mod.getName()));
     150   +
     
    +  151  
                         }
    -  151  0
                     } catch (IOException ex) {
    -  152  0
                         if (getLog().isDebugEnabled()) {
    -  153  0
                             getLog().debug("Unable to determine module path", ex);
    -  154   +  152  0
                     } catch (IOException ex) {
    +  153  0
                         if (getLog().isDebugEnabled()) {
    +  154  0
                             getLog().debug("Unable to determine module path", ex);
    +  155  
                         }
    -  155  0
                     }
    -  156  0
                 }
    -  157  0
             }
    -  158   +  156  0
                     }
    +  157  0
                 }
    +  158  0
             }
    +  159  
             do {
    -  159  0
                 size = descendants.size();
    -  160  0
                 for (MavenProject p : getReactorProjects()) {
    -  161  0
                     if (project.equals(p.getParent()) || descendants.contains(p.getParent())) {
    -  162  0
                         if (descendants.add(p)) {
    -  163  0
                             if (getLog().isDebugEnabled()) {
    -  164  0
                                 getLog().debug(String.format("Decendent %s added", p.getName()));
    +  160  0
                 size = descendants.size();
    +  161  0
                 for (MavenProject p : getReactorProjects()) {
    +  162  0
                     if (project.equals(p.getParent()) || descendants.contains(p.getParent())) {
    +  163  0
                         if (descendants.add(p) && getLog().isDebugEnabled()) {
    +  164  0
                             getLog().debug(String.format("Decendent %s added", p.getName()));
     165   -
                             }
    +
     
     166  
                         }
     167  0
                         for (MavenProject modTest : getReactorProjects()) {
    -  168  0
                             if (p.getModules() != null && p.getModules().contains(modTest.getName())
    +  168  0
                             if (p.getModules() != null && p.getModules().contains(modTest.getName())
     169   -
                                     && descendants.add(modTest)) {
    -  170  0
                                 if (getLog().isDebugEnabled()) {
    -  171  0
                                     getLog().debug(String.format("Decendent %s added", modTest.getName()));
    +
                                     && descendants.add(modTest)
    +  170   +
                                     && getLog().isDebugEnabled()) {
    +  171  0
                                 getLog().debug(String.format("Decendent %s added", modTest.getName()));
     172   -
                                 }
    -  173  
                             }
    -  174  0
                         }
    -  175   +  173  0
                         }
    +  174  
                     }
    +  175  0
                     final Set<MavenProject> addedDescendants = new HashSet<MavenProject>();
     176  0
                     for (MavenProject dec : descendants) {
     177  0
                         for (String mod : dec.getModules()) {
     178  
                             try {
     179  0
                                 File mpp = new File(dec.getBasedir(), mod);
     180  0
                                 mpp = mpp.getCanonicalFile();
    -  181  0
                                 if (mpp.compareTo(p.getBasedir()) == 0 && descendants.add(p)) {
    -  182  0
                                     if (getLog().isDebugEnabled()) {
    -  183  0
                                         getLog().debug(String.format("Decendent module %s added", p.getName()));
    -  184   -
                                     }
    -  185   +  181  0
                                 if (mpp.compareTo(p.getBasedir()) == 0) {
    +  182  0
                                     addedDescendants.add(p);
    +  183  
                                 }
    -  186  0
                             } catch (IOException ex) {
    -  187  0
                                 if (getLog().isDebugEnabled()) {
    -  188  0
                                     getLog().debug("Unable to determine module path", ex);
    -  189   +  184  0
                             } catch (IOException ex) {
    +  185  0
                                 if (getLog().isDebugEnabled()) {
    +  186  0
                                     getLog().debug("Unable to determine module path", ex);
    +  187  
                                 }
    -  190  0
                             }
    -  191  0
                         }
    -  192  0
                     }
    -  193  0
                 }
    -  194  0
             } while (size != 0 && size != descendants.size());
    -  195  0
             if (getLog().isDebugEnabled()) {
    -  196  0
                 getLog().debug(String.format("%s has %d children", project, descendants.size()));
    -  197   -
             }
    -  198  0
             return descendants;
    -  199   -
         }
    +  188  0
                             }
    +  189  0
                         }
    +  190  0
                     }
    +  191  0
                     for (MavenProject addedDescendant : addedDescendants) {
    +  192  0
                         if (descendants.add(addedDescendant) && getLog().isDebugEnabled()) {
    +  193  0
                             getLog().debug(String.format("Decendent module %s added", addedDescendant.getName()));
    +  194   +
                         }
    +  195  0
                     }
    +  196  0
                 }
    +  197  0
             } while (size != 0 && size != descendants.size());
    +  198  0
             if (getLog().isDebugEnabled()) {
    +  199  0
                 getLog().debug(String.format("%s has %d children", project, descendants.size()));
     200   -
     
    -  201   -
         /**
    -  202   -
          * Test if the project has pom packaging
    -  203   -
          *
    -  204   -
          * @param mavenProject Project to test
    -  205   -
          * @return <code>true</code> if it has a pom packaging; otherwise <code>false</code>
    -  206   -
          */
    -  207   -
         protected boolean isMultiModule(MavenProject mavenProject) {
    -  208  0
             return "pom".equals(mavenProject.getPackaging());
    -  209   -
         }
    -  210   -
     
    -  211   -
         /**
    -  212   -
          * Initilizes the engine, runs a scan, and writes the serialized dependencies to disk.
    -  213   -
          *
    -  214   -
          * @return the Engine used to execute dependency-check
    -  215   -
          * @throws MojoExecutionException thrown if there is an exception running the mojo
    -  216   -
          * @throws MojoFailureException thrown if dependency-check is configured to fail the build if severe CVEs are identified.
    -  217   -
          */
    -  218   -
         protected Engine generateDataFile() throws MojoExecutionException, MojoFailureException {
    -  219   -
             final Engine engine;
    -  220   -
             try {
    -  221  0
                 engine = initializeEngine();
    -  222  0
             } catch (DatabaseException ex) {
    -  223  0
                 if (getLog().isDebugEnabled()) {
    -  224  0
                     getLog().debug("Database connection error", ex);
    -  225   -
                 }
    -  226  0
                 throw new MojoExecutionException("An exception occured connecting to the local database. Please see the log file for more details.", ex);
    -  227  0
             }
    -  228  0
             return generateDataFile(engine, getProject());
    -  229   -
         }
    -  230   -
     
    -  231   -
         /**
    -  232   -
          * Runs dependency-check's Engine and writes the serialized dependencies to disk.
    -  233   -
          *
    -  234   -
          * @param engine the Engine to use when scanning.
    -  235   -
          * @param project the project to scan and generate the data file for
    -  236   -
          * @return the Engine used to execute dependency-check
    -  237   -
          * @throws MojoExecutionException thrown if there is an exception running the mojo
    -  238   -
          * @throws MojoFailureException thrown if dependency-check is configured to fail the build if severe CVEs are identified.
    -  239   -
          */
    -  240   -
         protected Engine generateDataFile(Engine engine, MavenProject project) throws MojoExecutionException, MojoFailureException {
    -  241  0
             if (getLog().isDebugEnabled()) {
    -  242  0
                 getLog().debug(String.format("Begin Scanning: %s", project.getName()));
    -  243  
             }
    -  244  0
             engine.getDependencies().clear();
    -  245  0
             engine.resetFileTypeAnalyzers();
    -  246  0
             scanArtifacts(project, engine);
    -  247  0
             engine.analyzeDependencies();
    -  248  0
             final File target = new File(project.getBuild().getDirectory());
    -  249  0
             writeDataFile(project, target, engine.getDependencies());
    -  250  0
             showSummary(project, engine.getDependencies());
    -  251  0
             checkForFailure(engine.getDependencies());
    -  252  0
             return engine;
    -  253   +  201  0
             return descendants;
    +  202  
         }
    -  254   +  203  
     
    -  255   -
         @Override
    -  256   -
         public boolean canGenerateReport() {
    -  257  0
             return true; //aggregate always returns true for now - we can look at a more complicated/acurate solution later
    -  258   -
         }
    -  259   -
     
    -  260   +  204  
         /**
    -  261   -
          * Returns the report name.
    -  262   +  205   +
          * Test if the project has pom packaging
    +  206  
          *
    +  207   +
          * @param mavenProject Project to test
    +  208   +
          * @return <code>true</code> if it has a pom packaging; otherwise <code>false</code>
    +  209   +
          */
    +  210   +
         protected boolean isMultiModule(MavenProject mavenProject) {
    +  211  0
             return "pom".equals(mavenProject.getPackaging());
    +  212   +
         }
    +  213   +
     
    +  214   +
         /**
    +  215   +
          * Initilizes the engine, runs a scan, and writes the serialized dependencies to disk.
    +  216   +
          *
    +  217   +
          * @return the Engine used to execute dependency-check
    +  218   +
          * @throws MojoExecutionException thrown if there is an exception running the mojo
    +  219   +
          * @throws MojoFailureException thrown if dependency-check is configured to fail the build if severe CVEs are identified.
    +  220   +
          */
    +  221   +
         protected Engine generateDataFile() throws MojoExecutionException, MojoFailureException {
    +  222   +
             final Engine engine;
    +  223   +
             try {
    +  224  0
                 engine = initializeEngine();
    +  225  0
             } catch (DatabaseException ex) {
    +  226  0
                 if (getLog().isDebugEnabled()) {
    +  227  0
                     getLog().debug("Database connection error", ex);
    +  228   +
                 }
    +  229  0
                 throw new MojoExecutionException("An exception occured connecting to the local database. Please see the log file for more details.", ex);
    +  230  0
             }
    +  231  0
             return generateDataFile(engine, getProject());
    +  232   +
         }
    +  233   +
     
    +  234   +
         /**
    +  235   +
          * Runs dependency-check's Engine and writes the serialized dependencies to disk.
    +  236   +
          *
    +  237   +
          * @param engine the Engine to use when scanning.
    +  238   +
          * @param project the project to scan and generate the data file for
    +  239   +
          * @return the Engine used to execute dependency-check
    +  240   +
          * @throws MojoExecutionException thrown if there is an exception running the mojo
    +  241   +
          * @throws MojoFailureException thrown if dependency-check is configured to fail the build if severe CVEs are identified.
    +  242   +
          */
    +  243   +
         protected Engine generateDataFile(Engine engine, MavenProject project) throws MojoExecutionException, MojoFailureException {
    +  244  0
             if (getLog().isDebugEnabled()) {
    +  245  0
                 getLog().debug(String.format("Begin Scanning: %s", project.getName()));
    +  246   +
             }
    +  247  0
             engine.getDependencies().clear();
    +  248  0
             engine.resetFileTypeAnalyzers();
    +  249  0
             scanArtifacts(project, engine);
    +  250  0
             engine.analyzeDependencies();
    +  251  0
             final File target = new File(project.getBuild().getDirectory());
    +  252  0
             writeDataFile(project, target, engine.getDependencies());
    +  253  0
             showSummary(project, engine.getDependencies());
    +  254  0
             checkForFailure(engine.getDependencies());
    +  255  0
             return engine;
    +  256   +
         }
    +  257   +
     
    +  258   +
         @Override
    +  259   +
         public boolean canGenerateReport() {
    +  260  0
             return true; //aggregate always returns true for now - we can look at a more complicated/acurate solution later
    +  261   +
         }
    +  262   +
     
     263   -
          * @param locale the location
    +
         /**
     264   -
          * @return the report name
    +
          * The name of the report in the site.
     265  
          */
    -  266   -
         @Override
    +  266  0
         @SuppressWarnings("CanBeFinal")
     267   -
         public String getName(Locale locale) {
    -  268  0
             return "dependency-check:aggregate";
    +
         @Parameter(property = "name", defaultValue = "dependency-check:aggregate", required = true)
    +  268   +
         private String name = "dependency-check:aggregate";
     269   -
         }
    -  270  
     
    -  271   +  270  
         /**
    +  271   +
          * Returns the report name.
     272   -
          * Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page.
    -  273  
          *
    +  273   +
          * @param locale the location
     274   -
          * @param locale The Locale to get the description for
    +
          * @return the report name
     275   -
          * @return the description
    -  276  
          */
    -  277   +  276  
         @Override
    -  278   -
         public String getDescription(Locale locale) {
    -  279  0
             return "Generates an aggregate report of all child Maven projects providing details on any "
    -  280   -
                     + "published vulnerabilities within project dependencies. This report is a best "
    -  281   -
                     + "effort and may contain false positives and false negatives.";
    -  282   +  277   +
         public String getName(Locale locale) {
    +  278  0
             return name;
    +  279  
         }
    +  280   +
     
    +  281   +
         /**
    +  282   +
          * Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page.
     283   +
          *
    +  284   +
          * @param locale The Locale to get the description for
    +  285   +
          * @return the description
    +  286   +
          */
    +  287   +
         @Override
    +  288   +
         public String getDescription(Locale locale) {
    +  289  0
             return "Generates an aggregate report of all child Maven projects providing details on any "
    +  290   +
                     + "published vulnerabilities within project dependencies. This report is a best "
    +  291   +
                     + "effort and may contain false positives and false negatives.";
    +  292   +
         }
    +  293  
     }
    - + diff --git a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.BaseDependencyCheckMojo.html b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.BaseDependencyCheckMojo.html index cba0f452b..dee7b1230 100644 --- a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.BaseDependencyCheckMojo.html +++ b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.BaseDependencyCheckMojo.html @@ -12,7 +12,7 @@
     
    - +
    Classes in this File Line Coverage Branch Coverage Complexity
    BaseDependencyCheckMojo
    11%
    38/320
    5%
    11/210
    5.567
    BaseDependencyCheckMojo
    10%
    29/284
    7%
    11/142
    4.367
     
    @@ -74,1483 +74,1502 @@  28  
     import java.io.ObjectOutputStream;
     29   -
     import java.io.OutputStream;
    -  30  
     import java.util.List;
    -  31   +  30  
     import java.util.Locale;
    -  32   +  31  
     import org.apache.maven.artifact.Artifact;
    -  33   +  32  
     import org.apache.maven.doxia.sink.Sink;
    -  34   +  33  
     import org.apache.maven.plugin.AbstractMojo;
    -  35   +  34  
     import org.apache.maven.plugin.MojoExecutionException;
    -  36   +  35  
     import org.apache.maven.plugin.MojoFailureException;
    -  37   +  36  
     import org.apache.maven.plugins.annotations.Parameter;
    -  38   +  37  
     import org.apache.maven.project.MavenProject;
    -  39   +  38  
     import org.apache.maven.reporting.MavenReport;
    -  40   +  39  
     import org.apache.maven.reporting.MavenReportException;
    -  41   +  40  
     import org.apache.maven.settings.Proxy;
    -  42   +  41  
     import org.owasp.dependencycheck.data.nexus.MavenArtifact;
    -  43   +  42  
     import org.owasp.dependencycheck.data.nvdcve.CveDB;
    -  44   +  43  
     import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
    -  45   +  44  
     import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties;
    -  46   +  45  
     import org.owasp.dependencycheck.dependency.Confidence;
    -  47   +  46  
     import org.owasp.dependencycheck.dependency.Dependency;
    -  48   +  47  
     import org.owasp.dependencycheck.dependency.Identifier;
    -  49   +  48  
     import org.owasp.dependencycheck.dependency.Vulnerability;
    -  50   +  49  
     import org.owasp.dependencycheck.reporting.ReportGenerator;
    -  51   +  50  
     import org.owasp.dependencycheck.utils.Settings;
    +  51   +
     
     52   -
     
    -  53  
     /**
    -  54   +  53  
      *
    -  55   +  54  
      * @author Jeremy Long
    -  56   +  55  
      */
    -  57  1
     public abstract class BaseDependencyCheckMojo extends AbstractMojo implements MavenReport {
    +  56  1
     public abstract class BaseDependencyCheckMojo extends AbstractMojo implements MavenReport {
    +  57   +
     
     58   -
     
    -  59  
         //<editor-fold defaultstate="collapsed" desc="Private fields">
    +  59   +
         /**
     60   -
         /**
    -  61  
          * The properties file location.
    +  61   +
          */
     62   -
          */
    -  63  
         private static final String PROPERTIES_FILE = "mojo.properties";
    +  63   +
         /**
     64   -
         /**
    -  65  
          * System specific new line character.
    -  66   +  65  
          */
    -  67  1
         private static final String NEW_LINE = System.getProperty("line.separator", "\n").intern();
    +  66  1
         private static final String NEW_LINE = System.getProperty("line.separator", "\n").intern();
    +  67   +
         /**
     68   -
         /**
    -  69  
          * Sets whether or not the external report format should be used.
    +  69   +
          */
     70   -
          */
    -  71  
         @Parameter(property = "metaFileName", defaultValue = "dependency-check.ser", required = true)
    -  72   +  71  
         private String dataFileName;
    +  72   +
     
     73   -
     
    -  74  
         //</editor-fold>
    -  75   +  74  
         // <editor-fold defaultstate="collapsed" desc="Maven bound parameters and components">
    +  75   +
         /**
     76   -
         /**
    -  77  
          * The Maven Project Object.
    +  77   +
          */
     78   -
          */
    -  79  
         @Parameter(property = "project", required = true, readonly = true)
    -  80   +  79  
         private MavenProject project;
    +  80   +
         /**
     81   -
         /**
    -  82  
          * List of Maven project of the current build
    +  82   +
          */
     83   -
          */
    -  84  
         @Parameter(readonly = true, required = true, property = "reactorProjects")
    -  85   +  84  
         private List<MavenProject> reactorProjects;
    +  85   +
     
     86   -
     
    +
         /**
     87   -
         /**
    -  88  
          * The output directory. This generally maps to "target".
    +  88   +
          */
     89   -
          */
    -  90  
         @Parameter(defaultValue = "${project.build.directory}", required = true)
    -  91   +  90  
         private File outputDirectory;
    +  91   +
         /**
     92   -
         /**
    -  93  
          * Specifies the destination directory for the generated Dependency-Check report. This generally maps to "target/site".
    +  93   +
          */
     94   -
          */
    -  95  
         @Parameter(property = "project.reporting.outputDirectory", required = true)
    -  96   +  95  
         private File reportOutputDirectory;
    +  96   +
         /**
     97   -
         /**
    -  98  
          * Specifies if the build should be failed if a CVSS score above a specified level is identified. The default is 11 which
    -  99   +  98  
          * means since the CVSS scores are 0-10, by default the build will never fail.
    -  100   +  99  
          */
    -  101  1
         @SuppressWarnings("CanBeFinal")
    -  102   +  100  1
         @SuppressWarnings("CanBeFinal")
    +  101  
         @Parameter(property = "failBuildOnCVSS", defaultValue = "11", required = true)
    -  103   +  102  
         private float failBuildOnCVSS = 11;
    +  103   +
         /**
     104   -
         /**
    -  105  
          * Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not recommended that this be turned to false. Default
    -  106   +  105  
          * is true.
    +  106   +
          */
     107   -
          */
    -  108  1
         @SuppressWarnings("CanBeFinal")
    -  109   -
         @Parameter(property = "autoupdate", defaultValue = "true", required = true)
    -  110   -
         private boolean autoUpdate = true;
    -  111   -
         /**
    -  112   -
          * Generate aggregate reports in multi-module projects.
    -  113   -
          *
    -  114   -
          * @deprecated use the aggregate goal instead
    -  115   -
          */
    -  116   -
         @Parameter(property = "aggregate", defaultValue = "false")
    -  117   -
         @Deprecated
    -  118   -
         private boolean aggregate;
    -  119   -
         /**
    -  120   -
          * The report format to be generated (HTML, XML, VULN, ALL). This configuration option has no affect if using this within the
    -  121   -
          * Site plug-in unless the externalReport is set to true. Default is HTML.
    -  122   -
          */
    -  123  1
         @SuppressWarnings("CanBeFinal")
    -  124   -
         @Parameter(property = "format", defaultValue = "HTML", required = true)
    -  125   -
         private String format = "HTML";
    -  126   -
         /**
    -  127   -
          * The Maven settings.
    -  128   -
          */
    -  129   -
         @Parameter(property = "mavenSettings", defaultValue = "${settings}", required = false)
    -  130   -
         private org.apache.maven.settings.Settings mavenSettings;
    -  131   -
     
    -  132   -
         /**
    -  133   -
          * The maven settings proxy id.
    -  134   -
          */
    -  135  
         @SuppressWarnings("CanBeFinal")
    -  136   +  108   +
         @Parameter(property = "autoupdate")
    +  109   +
         private Boolean autoUpdate;
    +  110   +
         /**
    +  111   +
          * Generate aggregate reports in multi-module projects.
    +  112   +
          *
    +  113   +
          * @deprecated use the aggregate goal instead
    +  114   +
          */
    +  115   +
         @Parameter(property = "aggregate")
    +  116   +
         @Deprecated
    +  117   +
         private Boolean aggregate;
    +  118   +
         /**
    +  119   +
          * The report format to be generated (HTML, XML, VULN, ALL). This configuration option has no affect if using this within the
    +  120   +
          * Site plug-in unless the externalReport is set to true. Default is HTML.
    +  121   +
          */
    +  122  1
         @SuppressWarnings("CanBeFinal")
    +  123   +
         @Parameter(property = "format", defaultValue = "HTML", required = true)
    +  124   +
         private String format = "HTML";
    +  125   +
         /**
    +  126   +
          * The Maven settings.
    +  127   +
          */
    +  128   +
         @Parameter(property = "mavenSettings", defaultValue = "${settings}", required = false)
    +  129   +
         private org.apache.maven.settings.Settings mavenSettings;
    +  130   +
     
    +  131   +
         /**
    +  132   +
          * The maven settings proxy id.
    +  133   +
          */
    +  134   +
         @SuppressWarnings("CanBeFinal")
    +  135  
         @Parameter(property = "mavenSettingsProxyId", required = false)
    -  137   +  136  
         private String mavenSettingsProxyId;
    +  137   +
     
     138   -
     
    +
         /**
     139   -
         /**
    -  140  
          * The Connection Timeout.
    +  140   +
          */
     141   -
          */
    -  142  1
         @SuppressWarnings("CanBeFinal")
    -  143  
         @Parameter(property = "connectionTimeout", defaultValue = "", required = false)
    +  142   +
         private String connectionTimeout;
    +  143   +
         /**
     144   -
         private String connectionTimeout = null;
    -  145   -
         /**
    -  146  
          * The path to the suppression file.
    -  147   +  145  
          */
    -  148  1
         @SuppressWarnings("CanBeFinal")
    -  149   +  146  
         @Parameter(property = "suppressionFile", defaultValue = "", required = false)
    -  150   -
         private String suppressionFile = null;
    -  151   +  147   +
         private String suppressionFile;
    +  148  
         /**
    -  152   +  149  
          * Flag indicating whether or not to show a summary in the output.
    -  153   +  150  
          */
    -  154  1
         @SuppressWarnings("CanBeFinal")
    -  155   -
         @Parameter(property = "showSummary", defaultValue = "true", required = false)
    -  156   +  151  1
         @Parameter(property = "showSummary", defaultValue = "true", required = false)
    +  152  
         private boolean showSummary = true;
    -  157   +  153  
     
    -  158   +  154  
         /**
    -  159   +  155  
          * Whether or not the Jar Analyzer is enabled.
    +  156   +
          */
    +  157   +
         @Parameter(property = "jarAnalyzerEnabled", required = false)
    +  158   +
         private Boolean jarAnalyzerEnabled;
    +  159   +
     
     160   -
          */
    -  161  1
         @SuppressWarnings("CanBeFinal")
    -  162   -
         @Parameter(property = "jarAnalyzerEnabled", defaultValue = "true", required = false)
    -  163   -
         private boolean jarAnalyzerEnabled = true;
    -  164   -
     
    -  165  
         /**
    -  166   +  161  
          * Whether or not the Archive Analyzer is enabled.
    +  162   +
          */
    +  163   +
         @Parameter(property = "archiveAnalyzerEnabled", required = false)
    +  164   +
         private Boolean archiveAnalyzerEnabled;
    +  165   +
     
    +  166   +
         /**
     167   +
          * Sets whether the Python Distribution Analyzer will be used.
    +  168  
          */
    -  168  1
         @SuppressWarnings("CanBeFinal")
     169   -
         @Parameter(property = "archiveAnalyzerEnabled", defaultValue = "true", required = false)
    +
         @Parameter(property = "pyDistributionAnalyzerEnabled", required = false)
     170   -
         private boolean archiveAnalyzerEnabled = true;
    +
         private Boolean pyDistributionAnalyzerEnabled;
     171   -
     
    +
         /**
     172   -
         /**
    +
          * Sets whether the Python Package Analyzer will be used.
     173   -
          * Whether or not the .NET Assembly Analyzer is enabled.
    +
          */
     174   -
          */
    -  175  1
         @SuppressWarnings("CanBeFinal")
    +
         @Parameter(property = "pyPackageAnalyzerEnabled", required = false)
    +  175   +
         private Boolean pyPackageAnalyzerEnabled;
     176   -
         @Parameter(property = "assemblyAnalyzerEnabled", defaultValue = "true", required = false)
    -  177   -
         private boolean assemblyAnalyzerEnabled = true;
    -  178   -
     
    -  179  
         /**
    -  180   -
          * Whether or not the .NET Nuspec Analyzer is enabled.
    -  181   +  177   +
          * Sets whether the Ruby Gemspec Analyzer will be used.
    +  178  
          */
    -  182  1
         @SuppressWarnings("CanBeFinal")
    +  179   +
         @Parameter(property = "rubygemsAnalyzerEnabled", required = false)
    +  180   +
         private Boolean rubygemsAnalyzerEnabled;
    +  181   +
         /**
    +  182   +
          * Sets whether or not the openssl Analyzer should be used.
     183   -
         @Parameter(property = "nuspecAnalyzerEnabled", defaultValue = "true", required = false)
    +
          */
     184   -
         private boolean nuspecAnalyzerEnabled = true;
    +
         @Parameter(property = "opensslAnalyzerEnabled", required = false)
     185   -
     
    +
         private Boolean opensslAnalyzerEnabled;
     186  
         /**
     187   -
          * Whether or not the Central Analyzer is enabled.
    +
          * Sets whether or not the CMake Analyzer should be used.
     188  
          */
    -  189  1
         @SuppressWarnings("CanBeFinal")
    +  189   +
         @Parameter(property = "cmakeAnalyzerEnabled", required = false)
     190   -
         @Parameter(property = "centralAnalyzerEnabled", defaultValue = "true", required = false)
    +
         private Boolean cmakeAnalyzerEnabled;
     191   -
         private boolean centralAnalyzerEnabled = true;
    +
         /**
     192   -
     
    +
          * Sets whether or not the autoconf Analyzer should be used.
     193   -
         /**
    +
          */
     194   -
          * Whether or not the Nexus Analyzer is enabled.
    +
         @Parameter(property = "autoconfAnalyzerEnabled", required = false)
     195   -
          */
    -  196  1
         @SuppressWarnings("CanBeFinal")
    +
         private Boolean autoconfAnalyzerEnabled;
    +  196   +
         /**
     197   -
         @Parameter(property = "nexusAnalyzerEnabled", defaultValue = "true", required = false)
    +
          * Sets whether or not the PHP Composer Lock File Analyzer should be used.
     198   -
         private boolean nexusAnalyzerEnabled = true;
    +
          */
     199   -
     
    +
         @Parameter(property = "composerAnalyzerEnabled", required = false)
     200   -
         /**
    +
         private Boolean composerAnalyzerEnabled;
     201   -
          * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local).
    +
         /**
     202   -
          */
    +
          * Sets whether or not the Node.js Analyzer should be used.
     203   -
         @Parameter(property = "nexusUrl", defaultValue = "", required = false)
    +
          */
     204   -
         private String nexusUrl;
    +
         @Parameter(property = "nodeAnalyzerEnabled", required = false)
     205   -
         /**
    +
         private Boolean nodeAnalyzerEnabled;
     206   -
          * Whether or not the configured proxy is used to connect to Nexus.
    -  207   -
          */
    -  208  1
         @Parameter(property = "nexusUsesProxy", defaultValue = "true", required = false)
    -  209   -
         private boolean nexusUsesProxy = true;
    -  210   -
         /**
    -  211   -
          * The database connection string.
    -  212   -
          */
    -  213   -
         @Parameter(property = "connectionString", defaultValue = "", required = false)
    -  214   -
         private String connectionString;
    -  215  
     
    +  207   +
         /**
    +  208   +
          * Whether or not the .NET Assembly Analyzer is enabled.
    +  209   +
          */
    +  210   +
         @Parameter(property = "assemblyAnalyzerEnabled", required = false)
    +  211   +
         private Boolean assemblyAnalyzerEnabled;
    +  212   +
     
    +  213   +
         /**
    +  214   +
          * Whether or not the .NET Nuspec Analyzer is enabled.
    +  215   +
          */
     216   -
         /**
    +
         @Parameter(property = "nuspecAnalyzerEnabled", required = false)
     217   -
          * Returns the connection string.
    +
         private Boolean nuspecAnalyzerEnabled;
     218   -
          *
    +
     
     219   -
          * @return the connection string
    +
         /**
     220   -
          */
    +
          * Whether or not the Central Analyzer is enabled.
     221   -
         protected String getConnectionString() {
    -  222  0
             return connectionString;
    +
          */
    +  222   +
         @Parameter(property = "centralAnalyzerEnabled", required = false)
     223   -
         }
    +
         private Boolean centralAnalyzerEnabled;
     224   -
         /**
    +
     
     225   -
          * The database driver name. An example would be org.h2.Driver.
    +
         /**
     226   -
          */
    +
          * Whether or not the Nexus Analyzer is enabled.
     227   -
         @Parameter(property = "databaseDriverName", defaultValue = "", required = false)
    +
          */
     228   -
         private String databaseDriverName;
    +
         @Parameter(property = "nexusAnalyzerEnabled", required = false)
     229   -
         /**
    +
         private Boolean nexusAnalyzerEnabled;
     230   -
          * The path to the database driver if it is not on the class path.
    +
     
     231   -
          */
    +
         /**
     232   -
         @Parameter(property = "databaseDriverPath", defaultValue = "", required = false)
    +
          * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local).
     233   -
         private String databaseDriverPath;
    +
          */
     234   -
         /**
    +
         @Parameter(property = "nexusUrl", required = false)
     235   -
          * The database user name.
    +
         private String nexusUrl;
     236   -
          */
    +
         /**
     237   -
         @Parameter(property = "databaseUser", defaultValue = "", required = false)
    +
          * Whether or not the configured proxy is used to connect to Nexus.
     238   -
         private String databaseUser;
    +
          */
     239   -
         /**
    +
         @Parameter(property = "nexusUsesProxy", required = false)
     240   -
          * The password to use when connecting to the database.
    +
         private Boolean nexusUsesProxy;
     241   -
          */
    +
         /**
     242   -
         @Parameter(property = "databasePassword", defaultValue = "", required = false)
    +
          * The database connection string.
     243   -
         private String databasePassword;
    -  244   -
         /**
    -  245   -
          * A comma-separated list of file extensions to add to analysis next to jar, zip, ....
    -  246  
          */
    +  244   +
         @Parameter(property = "connectionString", defaultValue = "", required = false)
    +  245   +
         private String connectionString;
    +  246   +
     
     247   -
         @Parameter(property = "zipExtensions", required = false)
    -  248   -
         private String zipExtensions;
    -  249  
         /**
    +  248   +
          * Returns the connection string.
    +  249   +
          *
     250   -
          * Skip Analysis for Test Scope Dependencies.
    +
          * @return the connection string
     251  
          */
    -  252  1
         @SuppressWarnings("CanBeFinal")
    -  253   -
         @Parameter(property = "skipTestScope", defaultValue = "true", required = false)
    +  252   +
         protected String getConnectionString() {
    +  253  0
             return connectionString;
     254   -
         private boolean skipTestScope = true;
    +
         }
     255  
         /**
     256   -
          * Skip Analysis for Runtime Scope Dependencies.
    +
          * The database driver name. An example would be org.h2.Driver.
     257  
          */
    -  258  1
         @SuppressWarnings("CanBeFinal")
    +  258   +
         @Parameter(property = "databaseDriverName", defaultValue = "", required = false)
     259   -
         @Parameter(property = "skipRuntimeScope", defaultValue = "false", required = false)
    +
         private String databaseDriverName;
     260   -
         private boolean skipRuntimeScope = false;
    +
         /**
     261   -
         /**
    +
          * The path to the database driver if it is not on the class path.
     262   -
          * Skip Analysis for Provided Scope Dependencies.
    +
          */
     263   -
          */
    -  264  1
         @SuppressWarnings("CanBeFinal")
    +
         @Parameter(property = "databaseDriverPath", defaultValue = "", required = false)
    +  264   +
         private String databaseDriverPath;
     265   -
         @Parameter(property = "skipProvidedScope", defaultValue = "false", required = false)
    +
         /**
     266   -
         private boolean skipProvidedScope = false;
    +
          * The database user name.
     267   -
         /**
    +
          */
     268   -
          * The data directory, hold DC SQL DB.
    +
         @Parameter(property = "databaseUser", defaultValue = "", required = false)
     269   -
          */
    +
         private String databaseUser;
     270   -
         @Parameter(property = "dataDirectory", defaultValue = "", required = false)
    +
         /**
     271   -
         private String dataDirectory;
    +
          * The password to use when connecting to the database.
     272   -
         /**
    +
          */
     273   -
          * Data Mirror URL for CVE 1.2.
    +
         @Parameter(property = "databasePassword", defaultValue = "", required = false)
     274   -
          */
    +
         private String databasePassword;
     275   -
         @Parameter(property = "cveUrl12Modified", defaultValue = "", required = false)
    +
         /**
     276   -
         private String cveUrl12Modified;
    +
          * A comma-separated list of file extensions to add to analysis next to jar, zip, ....
     277   -
         /**
    +
          */
     278   -
          * Data Mirror URL for CVE 2.0.
    +
         @Parameter(property = "zipExtensions", required = false)
     279   -
          */
    +
         private String zipExtensions;
     280   -
         @Parameter(property = "cveUrl20Modified", defaultValue = "", required = false)
    +
         /**
     281   -
         private String cveUrl20Modified;
    +
          * Skip Dependency Check altogether.
     282   -
         /**
    -  283   -
          * Base Data Mirror URL for CVE 1.2.
    +
          */
    +  283  1
         @SuppressWarnings("CanBeFinal")
     284   -
          */
    +
         @Parameter(property = "dependency-check.skip", defaultValue = "false", required = false)
     285   -
         @Parameter(property = "cveUrl12Base", defaultValue = "", required = false)
    +
         private boolean skip = false;
     286   -
         private String cveUrl12Base;
    +
         /**
     287   -
         /**
    +
          * Skip Analysis for Test Scope Dependencies.
     288   -
          * Data Mirror URL for CVE 2.0.
    -  289  
          */
    +  289  1
         @SuppressWarnings("CanBeFinal")
     290   -
         @Parameter(property = "cveUrl20Base", defaultValue = "", required = false)
    +
         @Parameter(property = "skipTestScope", defaultValue = "true", required = false)
     291   -
         private String cveUrl20Base;
    +
         private boolean skipTestScope = true;
     292   -
     
    +
         /**
     293   -
         /**
    +
          * Skip Analysis for Runtime Scope Dependencies.
     294   -
          * The path to mono for .NET Assembly analysis on non-windows systems.
    -  295  
          */
    +  295  1
         @SuppressWarnings("CanBeFinal")
     296   -
         @Parameter(property = "pathToMono", defaultValue = "", required = false)
    +
         @Parameter(property = "skipRuntimeScope", defaultValue = "false", required = false)
     297   -
         private String pathToMono;
    +
         private boolean skipRuntimeScope = false;
     298   -
     
    +
         /**
     299   -
         /**
    +
          * Skip Analysis for Provided Scope Dependencies.
     300   -
          * The Proxy URL.
    -  301   -
          *
    +
          */
    +  301  1
         @SuppressWarnings("CanBeFinal")
     302   -
          * @deprecated Please use mavenSettings instead
    +
         @Parameter(property = "skipProvidedScope", defaultValue = "false", required = false)
     303   -
          */
    -  304  1
         @SuppressWarnings("CanBeFinal")
    +
         private boolean skipProvidedScope = false;
    +  304   +
         /**
     305   -
         @Parameter(property = "proxyUrl", defaultValue = "", required = false)
    +
          * The data directory, hold DC SQL DB.
     306   -
         @Deprecated
    +
          */
     307   -
         private String proxyUrl = null;
    +
         @Parameter(property = "dataDirectory", defaultValue = "", required = false)
     308   -
         /**
    +
         private String dataDirectory;
     309   -
          * Sets whether or not the external report format should be used.
    +
         /**
     310   -
          *
    +
          * Data Mirror URL for CVE 1.2.
     311   -
          * @deprecated the internal report is no longer supported
    +
          */
     312   -
          */
    -  313  1
         @SuppressWarnings("CanBeFinal")
    +
         @Parameter(property = "cveUrl12Modified", defaultValue = "", required = false)
    +  313   +
         private String cveUrl12Modified;
     314   -
         @Parameter(property = "externalReport")
    +
         /**
     315   -
         @Deprecated
    +
          * Data Mirror URL for CVE 2.0.
     316   -
         private String externalReport = null;
    +
          */
     317   -
         // </editor-fold>
    +
         @Parameter(property = "cveUrl20Modified", defaultValue = "", required = false)
     318   -
         //<editor-fold defaultstate="collapsed" desc="Base Maven implementation">
    +
         private String cveUrl20Modified;
     319   -
     
    +
         /**
     320   -
         /**
    +
          * Base Data Mirror URL for CVE 1.2.
     321   -
          * Executes dependency-check.
    +
          */
     322   -
          *
    +
         @Parameter(property = "cveUrl12Base", defaultValue = "", required = false)
     323   -
          * @throws MojoExecutionException thrown if there is an exception executing the mojo
    +
         private String cveUrl12Base;
     324   -
          * @throws MojoFailureException thrown if dependency-check failed the build
    +
         /**
     325   -
          */
    +
          * Data Mirror URL for CVE 2.0.
     326   -
         @Override
    -  327   -
         public void execute() throws MojoExecutionException, MojoFailureException {
    -  328  0
             validateAggregate();
    -  329  0
             project.setContextValue(getOutputDirectoryContextKey(), this.outputDirectory);
    -  330  0
             runCheck();
    -  331  0
         }
    -  332   -
     
    -  333   -
         /**
    -  334   -
          * Checks if the aggregate configuration parameter has been set to true. If it has a MojoExecutionException is thrown because
    -  335   -
          * the aggregate configuration parameter is no longer supported.
    -  336   -
          *
    -  337   -
          * @throws MojoExecutionException thrown if aggregate is set to true
    -  338  
          */
    -  339   -
         private void validateAggregate() throws MojoExecutionException {
    -  340  0
             if (aggregate) {
    -  341  0
                 final String msg = "Aggregate configuration detected - as of dependency-check 1.2.8 this no longer supported. "
    -  342   -
                         + "Please use the aggregate goal instead.";
    -  343  0
                 throw new MojoExecutionException(msg);
    -  344   -
             }
    -  345  0
         }
    -  346   -
     
    -  347   +  327   +
         @Parameter(property = "cveUrl20Base", defaultValue = "", required = false)
    +  328   +
         private String cveUrl20Base;
    +  329  
         /**
    -  348   -
          * Generates the Dependency-Check Site Report.
    -  349   +  330   +
          * Optionally skip excessive CVE update checks for a designated duration in hours.
    +  331   +
          */
    +  332   +
         @Parameter(property = "cveValidForHours", defaultValue = "", required = false)
    +  333   +
         private Integer cveValidForHours;
    +  334   +
     
    +  335   +
         /**
    +  336   +
          * The path to mono for .NET Assembly analysis on non-windows systems.
    +  337   +
          */
    +  338   +
         @Parameter(property = "pathToMono", defaultValue = "", required = false)
    +  339   +
         private String pathToMono;
    +  340   +
     
    +  341   +
         /**
    +  342   +
          * The Proxy URL.
    +  343  
          *
    +  344   +
          * @deprecated Please use mavenSettings instead
    +  345   +
          */
    +  346  1
         @SuppressWarnings("CanBeFinal")
    +  347   +
         @Parameter(property = "proxyUrl", defaultValue = "", required = false)
    +  348   +
         @Deprecated
    +  349   +
         private String proxyUrl = null;
     350   -
          * @param sink the sink to write the report to
    +
         /**
     351   -
          * @param locale the locale to use when generating the report
    +
          * Sets whether or not the external report format should be used.
     352   -
          * @throws MavenReportException if a maven report exception occurs
    +
          *
     353   -
          * @deprecated use {@link #generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)} instead.
    +
          * @deprecated the internal report is no longer supported
     354  
          */
    -  355   -
         @Override
    +  355  1
         @SuppressWarnings("CanBeFinal")
     356   -
         @Deprecated
    +
         @Parameter(property = "externalReport")
     357   -
         public final void generate(@SuppressWarnings("deprecation") org.codehaus.doxia.sink.Sink sink, Locale locale) throws MavenReportException {
    -  358  0
             generate((Sink) sink, locale);
    -  359  0
         }
    +
         @Deprecated
    +  358   +
         private String externalReport = null;
    +  359   +
         // </editor-fold>
     360   -
     
    +
         //<editor-fold defaultstate="collapsed" desc="Base Maven implementation">
     361   -
         /**
    +
     
     362   -
          * Generates the Dependency-Check Site Report.
    +
         /**
     363   -
          *
    +
          * Executes dependency-check.
     364   -
          * @param sink the sink to write the report to
    +
          *
     365   -
          * @param locale the locale to use when generating the report
    +
          * @throws MojoExecutionException thrown if there is an exception executing the mojo
     366   -
          * @throws MavenReportException if a maven report exception occurs
    +
          * @throws MojoFailureException thrown if dependency-check failed the build
     367  
          */
     368   -
         public void generate(Sink sink, Locale locale) throws MavenReportException {
    +
         @Override
     369   -
             try {
    -  370  0
                 validateAggregate();
    -  371  0
             } catch (MojoExecutionException ex) {
    -  372  0
                 throw new MavenReportException(ex.getMessage());
    -  373  0
             }
    -  374  0
             project.setContextValue(getOutputDirectoryContextKey(), getReportOutputDirectory());
    -  375   -
             try {
    -  376  0
                 runCheck();
    -  377  0
             } catch (MojoExecutionException ex) {
    -  378  0
                 throw new MavenReportException(ex.getMessage(), ex);
    -  379  0
             } catch (MojoFailureException ex) {
    -  380  0
                 getLog().warn("Vulnerabilities were identifies that exceed the CVSS threshold for failing the build");
    -  381  0
             }
    -  382  0
         }
    -  383   -
     
    -  384   -
         /**
    -  385   -
          * Returns the correct output directory depending on if a site is being executed or not.
    -  386   -
          *
    -  387   -
          * @return the directory to write the report(s)
    -  388   -
          * @throws MojoExecutionException thrown if there is an error loading the file path
    -  389   -
          */
    -  390   -
         protected File getCorrectOutputDirectory() throws MojoExecutionException {
    -  391  0
             return getCorrectOutputDirectory(this.project);
    -  392   -
         }
    -  393   -
     
    -  394   -
         /**
    -  395   -
          * Returns the correct output directory depending on if a site is being executed or not.
    -  396   -
          *
    -  397   -
          * @param current the Maven project to get the output directory from
    -  398   -
          * @return the directory to write the report(s)
    -  399   -
          */
    -  400   -
         protected File getCorrectOutputDirectory(MavenProject current) {
    -  401  0
             final Object obj = current.getContextValue(getOutputDirectoryContextKey());
    -  402  0
             if (obj != null && obj instanceof File) {
    -  403  0
                 return (File) obj;
    -  404   -
             }
    -  405  0
             File target = new File(current.getBuild().getDirectory());
    -  406  0
             if (target.getParentFile() != null && "target".equals(target.getParentFile().getName())) {
    -  407  0
                 target = target.getParentFile();
    -  408   -
             }
    -  409  0
             return target;
    -  410   -
         }
    -  411   -
     
    -  412   -
         /**
    -  413   -
          * Returns the correct output directory depending on if a site is being executed or not.
    -  414   -
          *
    -  415   -
          * @param current the Maven project to get the output directory from
    -  416   -
          * @return the directory to write the report(s)
    -  417   -
          */
    -  418   -
         protected File getDataFile(MavenProject current) {
    -  419  0
             if (getLog().isDebugEnabled()) {
    -  420  0
                 getLog().debug(String.format("Getting data filefor %s using key '%s'", current.getName(), getDataFileContextKey()));
    -  421   -
             }
    -  422  0
             final Object obj = current.getContextValue(getDataFileContextKey());
    -  423  0
             if (obj != null) {
    -  424  0
                 if (obj instanceof String) {
    -  425  0
                     final File f = new File((String) obj);
    -  426  0
                     return f;
    -  427   -
                 }
    -  428   +
         public void execute() throws MojoExecutionException, MojoFailureException {
    +  370  0
             if (skip) {
    +  371  0
                 getLog().info("Skipping " + getName(Locale.US));
    +  372  
             } else {
    -  429  0
                 if (getLog().isDebugEnabled()) {
    -  430  0
                     getLog().debug("Context value not found");
    -  431   -
                 }
    -  432   +  373  0
                 validateAggregate();
    +  374  0
                 project.setContextValue(getOutputDirectoryContextKey(), this.outputDirectory);
    +  375  0
                 runCheck();
    +  376  
             }
    -  433  0
             return null;
    +  377  0
         }
    +  378   +
     
    +  379   +
         /**
    +  380   +
          * Checks if the aggregate configuration parameter has been set to true. If it has a MojoExecutionException is thrown because
    +  381   +
          * the aggregate configuration parameter is no longer supported.
    +  382   +
          *
    +  383   +
          * @throws MojoExecutionException thrown if aggregate is set to true
    +  384   +
          */
    +  385   +
         private void validateAggregate() throws MojoExecutionException {
    +  386  0
             if (aggregate != null && aggregate) {
    +  387  0
                 final String msg = "Aggregate configuration detected - as of dependency-check 1.2.8 this no longer supported. "
    +  388   +
                         + "Please use the aggregate goal instead.";
    +  389  0
                 throw new MojoExecutionException(msg);
    +  390   +
             }
    +  391  0
         }
    +  392   +
     
    +  393   +
         /**
    +  394   +
          * Generates the Dependency-Check Site Report.
    +  395   +
          *
    +  396   +
          * @param sink the sink to write the report to
    +  397   +
          * @param locale the locale to use when generating the report
    +  398   +
          * @throws MavenReportException if a maven report exception occurs
    +  399   +
          * @deprecated use {@link #generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)} instead.
    +  400   +
          */
    +  401   +
         @Override
    +  402   +
         @Deprecated
    +  403   +
         public final void generate(@SuppressWarnings("deprecation") org.codehaus.doxia.sink.Sink sink, Locale locale) throws MavenReportException {
    +  404  0
             generate((Sink) sink, locale);
    +  405  0
         }
    +  406   +
     
    +  407   +
         /**
    +  408   +
          * Generates the Dependency-Check Site Report.
    +  409   +
          *
    +  410   +
          * @param sink the sink to write the report to
    +  411   +
          * @param locale the locale to use when generating the report
    +  412   +
          * @throws MavenReportException if a maven report exception occurs
    +  413   +
          */
    +  414   +
         public void generate(Sink sink, Locale locale) throws MavenReportException {
    +  415   +
             try {
    +  416  0
                 validateAggregate();
    +  417  0
             } catch (MojoExecutionException ex) {
    +  418  0
                 throw new MavenReportException(ex.getMessage());
    +  419  0
             }
    +  420  0
             project.setContextValue(getOutputDirectoryContextKey(), getReportOutputDirectory());
    +  421   +
             try {
    +  422  0
                 runCheck();
    +  423  0
             } catch (MojoExecutionException ex) {
    +  424  0
                 throw new MavenReportException(ex.getMessage(), ex);
    +  425  0
             } catch (MojoFailureException ex) {
    +  426  0
                 getLog().warn("Vulnerabilities were identifies that exceed the CVSS threshold for failing the build");
    +  427  0
             }
    +  428  0
         }
    +  429   +
     
    +  430   +
         /**
    +  431   +
          * Returns the correct output directory depending on if a site is being executed or not.
    +  432   +
          *
    +  433   +
          * @return the directory to write the report(s)
     434   -
         }
    +
          * @throws MojoExecutionException thrown if there is an error loading the file path
     435   -
     
    +
          */
     436   -
         /**
    -  437   -
          * Scans the project's artifacts and adds them to the engine's dependency list.
    +
         protected File getCorrectOutputDirectory() throws MojoExecutionException {
    +  437  0
             return getCorrectOutputDirectory(this.project);
     438   -
          *
    +
         }
     439   -
          * @param project the project to scan the dependencies of
    +
     
     440   -
          * @param engine the engine to use to scan the dependencies
    +
         /**
     441   -
          */
    +
          * Returns the correct output directory depending on if a site is being executed or not.
     442   -
         protected void scanArtifacts(MavenProject project, Engine engine) {
    -  443  1
             for (Artifact a : project.getArtifacts()) {
    -  444  1
                 if (excludeFromScan(a)) {
    -  445  0
                     continue;
    +
          *
    +  443   +
          * @param current the Maven project to get the output directory from
    +  444   +
          * @return the directory to write the report(s)
    +  445   +
          */
     446   -
                 }
    -  447  1
                 final List<Dependency> deps = engine.scan(a.getFile().getAbsoluteFile());
    -  448  1
                 if (deps != null) {
    -  449  1
                     if (deps.size() == 1) {
    -  450  1
                         final Dependency d = deps.get(0);
    -  451  1
                         if (d != null) {
    -  452  1
                             final MavenArtifact ma = new MavenArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion());
    -  453  1
                             d.addAsEvidence("pom", ma, Confidence.HIGHEST);
    -  454  1
                             d.addProjectReference(project.getName());
    -  455  1
                             if (getLog().isDebugEnabled()) {
    -  456  0
                                 getLog().debug(String.format("Adding project reference %s on dependency %s", project.getName(),
    +
         protected File getCorrectOutputDirectory(MavenProject current) {
    +  447  0
             final Object obj = current.getContextValue(getOutputDirectoryContextKey());
    +  448  0
             if (obj != null && obj instanceof File) {
    +  449  0
                 return (File) obj;
    +  450   +
             }
    +  451  0
             File target = new File(current.getBuild().getDirectory());
    +  452  0
             if (target.getParentFile() != null && "target".equals(target.getParentFile().getName())) {
    +  453  0
                 target = target.getParentFile();
    +  454   +
             }
    +  455  0
             return target;
    +  456   +
         }
     457   -
                                         d.getDisplayFileName()));
    +
     
     458   -
                             }
    +
         /**
     459   -
                         }
    -  460  1
                     } else {
    -  461  0
                         if (getLog().isDebugEnabled()) {
    -  462  0
                             final String msg = String.format("More then 1 dependency was identified in first pass scan of '%s:%s:%s'",
    +
          * Returns the correct output directory depending on if a site is being executed or not.
    +  460   +
          *
    +  461   +
          * @param current the Maven project to get the output directory from
    +  462   +
          * @return the directory to write the report(s)
     463   -
                                     a.getGroupId(), a.getArtifactId(), a.getVersion());
    -  464  0
                             getLog().debug(msg);
    -  465   -
                         }
    -  466   -
                     }
    +
          */
    +  464   +
         protected File getDataFile(MavenProject current) {
    +  465  0
             if (getLog().isDebugEnabled()) {
    +  466  0
                 getLog().debug(String.format("Getting data filefor %s using key '%s'", current.getName(), getDataFileContextKey()));
     467   -
                 }
    -  468  1
             }
    -  469  1
         }
    -  470   -
     
    -  471   -
         /**
    -  472   -
          * Executes the dependency-check scan and generates the necassary report.
    +
             }
    +  468  0
             final Object obj = current.getContextValue(getDataFileContextKey());
    +  469  0
             if (obj != null) {
    +  470  0
                 if (obj instanceof String) {
    +  471  0
                     final File f = new File((String) obj);
    +  472  0
                     return f;
     473   -
          *
    +
                 }
     474   -
          * @throws MojoExecutionException thrown if there is an exception running the scan
    -  475   -
          * @throws MojoFailureException thrown if dependency-check is configured to fail the build
    -  476   -
          */
    +
             } else {
    +  475  0
                 if (getLog().isDebugEnabled()) {
    +  476  0
                     getLog().debug("Context value not found");
     477   -
         public abstract void runCheck() throws MojoExecutionException, MojoFailureException;
    +
                 }
     478   -
     
    -  479   -
         /**
    +
             }
    +  479  0
             return null;
     480   -
          * Sets the Reporting output directory.
    +
         }
     481   -
          *
    +
     
     482   -
          * @param directory the output directory
    +
         /**
     483   -
          */
    +
          * Scans the project's artifacts and adds them to the engine's dependency list.
     484   -
         @Override
    +
          *
     485   -
         public void setReportOutputDirectory(File directory) {
    -  486  0
             reportOutputDirectory = directory;
    -  487  0
         }
    +
          * @param project the project to scan the dependencies of
    +  486   +
          * @param engine the engine to use to scan the dependencies
    +  487   +
          */
     488   -
     
    -  489   -
         /**
    -  490   -
          * Returns the report output directory.
    -  491   -
          *
    +
         protected void scanArtifacts(MavenProject project, Engine engine) {
    +  489  1
             for (Artifact a : project.getArtifacts()) {
    +  490  1
                 if (excludeFromScan(a)) {
    +  491  0
                     continue;
     492   -
          * @return the report output directory
    -  493   -
          */
    -  494   -
         @Override
    -  495   -
         public File getReportOutputDirectory() {
    -  496  0
             return reportOutputDirectory;
    -  497   -
         }
    -  498   -
     
    -  499   -
         /**
    -  500   -
          * Returns the output directory.
    -  501   -
          *
    -  502   -
          * @return the output directory
    +
                 }
    +  493  1
                 final List<Dependency> deps = engine.scan(a.getFile().getAbsoluteFile());
    +  494  1
                 if (deps != null) {
    +  495  1
                     if (deps.size() == 1) {
    +  496  1
                         final Dependency d = deps.get(0);
    +  497  1
                         if (d != null) {
    +  498  1
                             final MavenArtifact ma = new MavenArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion());
    +  499  1
                             d.addAsEvidence("pom", ma, Confidence.HIGHEST);
    +  500  1
                             d.addProjectReference(project.getName());
    +  501  1
                             if (getLog().isDebugEnabled()) {
    +  502  0
                                 getLog().debug(String.format("Adding project reference %s on dependency %s", project.getName(),
     503   -
          */
    +
                                         d.getDisplayFileName()));
     504   -
         public File getOutputDirectory() {
    -  505  0
             return outputDirectory;
    -  506   -
         }
    -  507   -
     
    -  508   -
         /**
    +
                             }
    +  505   +
                         }
    +  506  1
                     } else {
    +  507  0
                         if (getLog().isDebugEnabled()) {
    +  508  0
                             final String msg = String.format("More then 1 dependency was identified in first pass scan of '%s:%s:%s'",
     509   -
          * Returns whether this is an external report. This method always returns true.
    -  510   -
          *
    +
                                     a.getGroupId(), a.getArtifactId(), a.getVersion());
    +  510  0
                             getLog().debug(msg);
     511   -
          * @return <code>true</code>
    +
                         }
     512   -
          */
    +
                     }
     513   -
         @Override
    -  514   -
         public final boolean isExternalReport() {
    -  515  0
             return true;
    +
                 }
    +  514  1
             }
    +  515  1
         }
     516   -
         }
    -  517  
     
    -  518   +  517  
         /**
    +  518   +
          * Executes the dependency-check scan and generates the necassary report.
     519   -
          * Returns the output name.
    -  520  
          *
    +  520   +
          * @throws MojoExecutionException thrown if there is an exception running the scan
     521   -
          * @return the output name
    +
          * @throws MojoFailureException thrown if dependency-check is configured to fail the build
     522  
          */
     523   -
         @Override
    +
         public abstract void runCheck() throws MojoExecutionException, MojoFailureException;
     524   -
         public String getOutputName() {
    -  525  0
             if ("HTML".equalsIgnoreCase(this.format) || "ALL".equalsIgnoreCase(this.format)) {
    -  526  0
                 return "dependency-check-report";
    -  527  0
             } else if ("XML".equalsIgnoreCase(this.format)) {
    -  528  0
                 return "dependency-check-report.xml#";
    -  529  0
             } else if ("VULN".equalsIgnoreCase(this.format)) {
    -  530  0
                 return "dependency-check-vulnerability";
    -  531   -
             } else {
    -  532  0
                 getLog().warn("Unknown report format used during site generation.");
    -  533  0
                 return "dependency-check-report";
    -  534   -
             }
    -  535   -
         }
    -  536  
     
    -  537   +  525  
         /**
    -  538   -
          * Returns the category name.
    -  539   +  526   +
          * Sets the Reporting output directory.
    +  527  
          *
    -  540   -
          * @return the category name
    -  541   +  528   +
          * @param directory the output directory
    +  529  
          */
    -  542   +  530  
         @Override
    -  543   -
         public String getCategoryName() {
    -  544  0
             return MavenReport.CATEGORY_PROJECT_REPORTS;
    -  545   -
         }
    -  546   -
         //</editor-fold>
    -  547   +  531   +
         public void setReportOutputDirectory(File directory) {
    +  532  0
             reportOutputDirectory = directory;
    +  533  0
         }
    +  534  
     
    -  548   +  535  
         /**
    -  549   -
          * Initializes a new <code>Engine</code> that can be used for scanning.
    -  550   +  536   +
          * Returns the report output directory.
    +  537  
          *
    -  551   -
          * @return a newly instantiated <code>Engine</code>
    -  552   -
          * @throws DatabaseException thrown if there is a database exception
    -  553   +  538   +
          * @return the report output directory
    +  539  
          */
    -  554   -
         protected Engine initializeEngine() throws DatabaseException {
    -  555  0
             populateSettings();
    -  556  0
             return new Engine(this.project,
    -  557   -
                     this.reactorProjects);
    -  558   +  540   +
         @Override
    +  541   +
         public File getReportOutputDirectory() {
    +  542  0
             return reportOutputDirectory;
    +  543  
         }
    -  559   +  544  
     
    -  560   +  545  
         /**
    -  561   -
          * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties
    -  562   -
          * required to change the proxy url, port, and connection timeout.
    -  563   +  546   +
          * Returns the output directory.
    +  547   +
          *
    +  548   +
          * @return the output directory
    +  549  
          */
    +  550   +
         public File getOutputDirectory() {
    +  551  0
             return outputDirectory;
    +  552   +
         }
    +  553   +
     
    +  554   +
         /**
    +  555   +
          * Returns whether this is an external report. This method always returns true.
    +  556   +
          *
    +  557   +
          * @return <code>true</code>
    +  558   +
          */
    +  559   +
         @Override
    +  560   +
         public final boolean isExternalReport() {
    +  561  0
             return true;
    +  562   +
         }
    +  563   +
     
     564   -
         protected void populateSettings() {
    -  565  0
             Settings.initialize();
    -  566  0
             InputStream mojoProperties = null;
    +
         /**
    +  565   +
          * Returns the output name.
    +  566   +
          *
     567   -
             try {
    -  568  0
                 mojoProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE);
    -  569  0
                 Settings.mergeProperties(mojoProperties);
    -  570  0
             } catch (IOException ex) {
    -  571  0
                 getLog().warn("Unable to load the dependency-check ant task.properties file.");
    -  572  0
                 if (getLog().isDebugEnabled()) {
    -  573  0
                     getLog().debug("", ex);
    -  574   -
                 }
    -  575   -
             } finally {
    -  576  0
                 if (mojoProperties != null) {
    +
          * @return the output name
    +  568   +
          */
    +  569   +
         @Override
    +  570   +
         public String getOutputName() {
    +  571  0
             if ("HTML".equalsIgnoreCase(this.format) || "ALL".equalsIgnoreCase(this.format)) {
    +  572  0
                 return "dependency-check-report";
    +  573  0
             } else if ("XML".equalsIgnoreCase(this.format)) {
    +  574  0
                 return "dependency-check-report.xml#";
    +  575  0
             } else if ("VULN".equalsIgnoreCase(this.format)) {
    +  576  0
                 return "dependency-check-vulnerability";
     577   -
                     try {
    -  578  0
                         mojoProperties.close();
    -  579  0
                     } catch (IOException ex) {
    -  580  0
                         if (getLog().isDebugEnabled()) {
    -  581  0
                             getLog().debug("", ex);
    +
             } else {
    +  578  0
                 getLog().warn("Unknown report format used during site generation.");
    +  579  0
                 return "dependency-check-report";
    +  580   +
             }
    +  581   +
         }
     582   -
                         }
    -  583  0
                     }
    +
     
    +  583   +
         /**
     584   -
                 }
    +
          * Returns the category name.
     585   -
             }
    +
          *
     586   -
     
    -  587  0
             Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate);
    -  588  0
             if (externalReport != null) {
    -  589  0
                 getLog().warn("The 'externalReport' option was set; this configuration option has been removed. "
    -  590   -
                         + "Please update the dependency-check-maven plugin's configuration");
    +
          * @return the category name
    +  587   +
          */
    +  588   +
         @Override
    +  589   +
         public String getCategoryName() {
    +  590  0
             return MavenReport.CATEGORY_PROJECT_REPORTS;
     591   -
             }
    +
         }
     592   +
         //</editor-fold>
    +  593  
     
    -  593  0
             if (proxyUrl != null && !proxyUrl.isEmpty()) {
    -  594  0
                 getLog().warn("Deprecated configuration detected, proxyUrl will be ignored; use the maven settings " + "to configure the proxy instead");
    +  594   +
         /**
     595   -
             }
    -  596  0
             final Proxy proxy = getMavenProxy();
    -  597  0
             if (proxy != null) {
    -  598  0
                 Settings.setString(Settings.KEYS.PROXY_SERVER, proxy.getHost());
    -  599  0
                 Settings.setString(Settings.KEYS.PROXY_PORT, Integer.toString(proxy.getPort()));
    -  600  0
                 final String userName = proxy.getUsername();
    -  601  0
                 final String password = proxy.getPassword();
    -  602  0
                 if (userName != null) {
    -  603  0
                     Settings.setString(Settings.KEYS.PROXY_USERNAME, userName);
    +
          * Initializes a new <code>Engine</code> that can be used for scanning.
    +  596   +
          *
    +  597   +
          * @return a newly instantiated <code>Engine</code>
    +  598   +
          * @throws DatabaseException thrown if there is a database exception
    +  599   +
          */
    +  600   +
         protected Engine initializeEngine() throws DatabaseException {
    +  601  0
             populateSettings();
    +  602  0
             return new Engine(this.project,
    +  603   +
                     this.reactorProjects);
     604   -
                 }
    -  605  0
                 if (password != null) {
    -  606  0
                     Settings.setString(Settings.KEYS.PROXY_PASSWORD, password);
    +
         }
    +  605   +
     
    +  606   +
         /**
     607   -
                 }
    +
          * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties
     608   -
     
    +
          * required to change the proxy url, port, and connection timeout.
     609   -
             }
    +
          */
     610   -
     
    -  611  0
             if (connectionTimeout != null && !connectionTimeout.isEmpty()) {
    -  612  0
                 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout);
    +
         protected void populateSettings() {
    +  611  0
             Settings.initialize();
    +  612  0
             InputStream mojoProperties = null;
     613   -
             }
    -  614  0
             if (suppressionFile != null && !suppressionFile.isEmpty()) {
    -  615  0
                 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile);
    -  616   -
             }
    -  617   -
     
    -  618   -
             //File Type Analyzer Settings
    -  619   -
             //JAR ANALYZER
    -  620  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled);
    +
             try {
    +  614  0
                 mojoProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE);
    +  615  0
                 Settings.mergeProperties(mojoProperties);
    +  616  0
             } catch (IOException ex) {
    +  617  0
                 getLog().warn("Unable to load the dependency-check ant task.properties file.");
    +  618  0
                 if (getLog().isDebugEnabled()) {
    +  619  0
                     getLog().debug("", ex);
    +  620   +
                 }
     621   -
             //NUSPEC ANALYZER
    -  622  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled);
    +
             } finally {
    +  622  0
                 if (mojoProperties != null) {
     623   -
             //NEXUS ANALYZER
    -  624  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled);
    -  625   -
             //NEXUS ANALYZER
    -  626  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled);
    -  627  0
             if (nexusUrl != null && !nexusUrl.isEmpty()) {
    -  628  0
                 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
    -  629   -
             }
    -  630  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy);
    +
                     try {
    +  624  0
                         mojoProperties.close();
    +  625  0
                     } catch (IOException ex) {
    +  626  0
                         if (getLog().isDebugEnabled()) {
    +  627  0
                             getLog().debug("", ex);
    +  628   +
                         }
    +  629  0
                     }
    +  630   +
                 }
     631   -
             //ARCHIVE ANALYZER
    -  632  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled);
    -  633  0
             if (zipExtensions != null && !zipExtensions.isEmpty()) {
    -  634  0
                 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions);
    -  635  
             }
    +  632  0
             Settings.setBooleanIfNotNull(Settings.KEYS.AUTO_UPDATE, autoUpdate);
    +  633   +
     
    +  634  0
             if (externalReport != null) {
    +  635  0
                 getLog().warn("The 'externalReport' option was set; this configuration option has been removed. "
     636   -
             //ASSEMBLY ANALYZER
    -  637  0
             Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled);
    -  638  0
             if (pathToMono != null && !pathToMono.isEmpty()) {
    -  639  0
                 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono);
    -  640   +
                         + "Please update the dependency-check-maven plugin's configuration");
    +  637  
             }
    +  638   +
     
    +  639  0
             if (proxyUrl != null && !proxyUrl.isEmpty()) {
    +  640  0
                 getLog().warn("Deprecated configuration detected, proxyUrl will be ignored; use the maven settings " + "to configure the proxy instead");
     641   -
     
    -  642   -
             //Database configuration
    -  643  0
             if (databaseDriverName != null && !databaseDriverName.isEmpty()) {
    -  644  0
                 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName);
    -  645  
             }
    -  646  0
             if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) {
    -  647  0
                 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath);
    -  648   +  642  0
             final Proxy proxy = getMavenProxy();
    +  643  0
             if (proxy != null) {
    +  644  0
                 Settings.setString(Settings.KEYS.PROXY_SERVER, proxy.getHost());
    +  645  0
                 Settings.setString(Settings.KEYS.PROXY_PORT, Integer.toString(proxy.getPort()));
    +  646  0
                 final String userName = proxy.getUsername();
    +  647  0
                 final String password = proxy.getPassword();
    +  648  0
                 Settings.setStringIfNotNull(Settings.KEYS.PROXY_USERNAME, userName);
    +  649  0
                 Settings.setStringIfNotNull(Settings.KEYS.PROXY_PASSWORD, password);
    +  650  
             }
    -  649  0
             if (connectionString != null && !connectionString.isEmpty()) {
    -  650  0
                 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString);
     651   -
             }
    -  652  0
             if (databaseUser != null && !databaseUser.isEmpty()) {
    -  653  0
                 Settings.setString(Settings.KEYS.DB_USER, databaseUser);
    +
     
    +  652  0
             Settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout);
    +  653  0
             Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile);
     654   -
             }
    -  655  0
             if (databasePassword != null && !databasePassword.isEmpty()) {
    -  656  0
                 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword);
    -  657   -
             }
    -  658   -
             // Data Directory
    -  659  0
             if (dataDirectory != null && !dataDirectory.isEmpty()) {
    -  660  0
                 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory);
    -  661   -
             }
    -  662  
     
    -  663   -
             // Scope Exclusion
    -  664  0
             Settings.setBoolean(Settings.KEYS.SKIP_TEST_SCOPE, skipTestScope);
    -  665  0
             Settings.setBoolean(Settings.KEYS.SKIP_RUNTIME_SCOPE, skipRuntimeScope);
    -  666  0
             Settings.setBoolean(Settings.KEYS.SKIP_PROVIDED_SCOPE, skipProvidedScope);
    -  667   +  655   +
             //File Type Analyzer Settings
    +  656  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled);
    +  657  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled);
    +  658  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled);
    +  659  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled);
    +  660  0
             Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
    +  661  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy);
    +  662  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled);
    +  663  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled);
    +  664  0
             Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions);
    +  665  0
             Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono);
    +  666  
     
    -  668   -
             // CVE Data Mirroring
    -  669  0
             if (cveUrl12Modified != null && !cveUrl12Modified.isEmpty()) {
    -  670  0
                 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified);
    -  671   -
             }
    -  672  0
             if (cveUrl20Modified != null && !cveUrl20Modified.isEmpty()) {
    -  673  0
                 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified);
    -  674   -
             }
    -  675  0
             if (cveUrl12Base != null && !cveUrl12Base.isEmpty()) {
    -  676  0
                 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base);
    -  677   -
             }
    -  678  0
             if (cveUrl20Base != null && !cveUrl20Base.isEmpty()) {
    -  679  0
                 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base);
    -  680   -
             }
    -  681  0
         }
    +  667  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, pyDistributionAnalyzerEnabled);
    +  668  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, pyPackageAnalyzerEnabled);
    +  669  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, rubygemsAnalyzerEnabled);
    +  670  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, opensslAnalyzerEnabled);
    +  671  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CMAKE_ENABLED, cmakeAnalyzerEnabled);
    +  672  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, autoconfAnalyzerEnabled);
    +  673  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, composerAnalyzerEnabled);
    +  674  0
             Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, nodeAnalyzerEnabled);
    +  675   +
     
    +  676   +
             //Database configuration
    +  677  0
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName);
    +  678  0
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath);
    +  679  0
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString);
    +  680  0
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser);
    +  681  0
             Settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword);
     682  
     
    -  683   -
         /**
    +  683  0
             Settings.setStringIfNotEmpty(Settings.KEYS.DATA_DIRECTORY, dataDirectory);
     684   +
     
    +  685  0
             Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified);
    +  686  0
             Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified);
    +  687  0
             Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base);
    +  688  0
             Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base);
    +  689  0
             Settings.setIntIfNotNull(Settings.KEYS.CVE_CHECK_VALID_FOR_HOURS, cveValidForHours);
    +  690   +
     
    +  691  0
         }
    +  692   +
     
    +  693   +
         /**
    +  694  
          * Returns the maven proxy.
    -  685   +  695  
          *
    -  686   -
          * @return the maven proxy
    -  687   -
          */
    -  688   -
         private Proxy getMavenProxy() {
    -  689  0
             if (mavenSettings != null) {
    -  690  0
                 final List<Proxy> proxies = mavenSettings.getProxies();
    -  691  0
                 if (proxies != null && !proxies.isEmpty()) {
    -  692  0
                     if (mavenSettingsProxyId != null) {
    -  693  0
                         for (Proxy proxy : proxies) {
    -  694  0
                             if (mavenSettingsProxyId.equalsIgnoreCase(proxy.getId())) {
    -  695  0
                                 return proxy;
     696   -
                             }
    -  697  0
                         }
    -  698  0
                     } else if (proxies.size() == 1) {
    -  699  0
                         return proxies.get(0);
    -  700   -
                     } else {
    -  701  0
                         getLog().warn("Multiple proxy definitions exist in the Maven settings. In the dependency-check "
    -  702   -
                                 + "configuration set the mavenSettingsProxyId so that the correct proxy will be used.");
    -  703  0
                         throw new IllegalStateException("Ambiguous proxy definition");
    -  704   -
                     }
    -  705   -
                 }
    +
          * @return the maven proxy
    +  697   +
          */
    +  698   +
         private Proxy getMavenProxy() {
    +  699  0
             if (mavenSettings != null) {
    +  700  0
                 final List<Proxy> proxies = mavenSettings.getProxies();
    +  701  0
                 if (proxies != null && !proxies.isEmpty()) {
    +  702  0
                     if (mavenSettingsProxyId != null) {
    +  703  0
                         for (Proxy proxy : proxies) {
    +  704  0
                             if (mavenSettingsProxyId.equalsIgnoreCase(proxy.getId())) {
    +  705  0
                                 return proxy;
     706   -
             }
    -  707  0
             return null;
    -  708   -
         }
    -  709   -
     
    +
                             }
    +  707  0
                         }
    +  708  0
                     } else if (proxies.size() == 1) {
    +  709  0
                         return proxies.get(0);
     710   -
         /**
    -  711   -
          * Tests is the artifact should be included in the scan (i.e. is the dependency in a scope that is being scanned).
    +
                     } else {
    +  711  0
                         getLog().warn("Multiple proxy definitions exist in the Maven settings. In the dependency-check "
     712   -
          *
    -  713   -
          * @param a the Artifact to test
    +
                                 + "configuration set the mavenSettingsProxyId so that the correct proxy will be used.");
    +  713  0
                         throw new IllegalStateException("Ambiguous proxy definition");
     714   -
          * @return <code>true</code> if the artifact is in an excluded scope; otherwise <code>false</code>
    +
                     }
     715   -
          */
    +
                 }
     716   -
         protected boolean excludeFromScan(Artifact a) {
    -  717  1
             if (skipTestScope && Artifact.SCOPE_TEST.equals(a.getScope())) {
    -  718  0
                 return true;
    +
             }
    +  717  0
             return null;
    +  718   +
         }
     719   -
             }
    -  720  1
             if (skipProvidedScope && Artifact.SCOPE_PROVIDED.equals(a.getScope())) {
    -  721  0
                 return true;
    +
     
    +  720   +
         /**
    +  721   +
          * Tests is the artifact should be included in the scan (i.e. is the dependency in a scope that is being scanned).
     722   -
             }
    -  723  1
             if (skipRuntimeScope && !Artifact.SCOPE_RUNTIME.equals(a.getScope())) {
    -  724  0
                 return true;
    +
          *
    +  723   +
          * @param a the Artifact to test
    +  724   +
          * @return <code>true</code> if the artifact is in an excluded scope; otherwise <code>false</code>
     725   -
             }
    -  726  1
             return false;
    -  727   -
         }
    -  728   -
     
    +
          */
    +  726   +
         protected boolean excludeFromScan(Artifact a) {
    +  727  1
             if (skipTestScope && Artifact.SCOPE_TEST.equals(a.getScope())) {
    +  728  0
                 return true;
     729   -
         /**
    -  730   -
          * Returns a reference to the current project. This method is used instead of auto-binding the project via component
    -  731   -
          * annotation in concrete implementations of this. If the child has a <code>@Component MavenProject project;</code> defined
    -  732   -
          * then the abstract class (i.e. this class) will not have access to the current project (just the way Maven works with the
    -  733   -
          * binding).
    -  734   -
          *
    -  735   -
          * @return returns a reference to the current project
    -  736   -
          */
    -  737   -
         protected MavenProject getProject() {
    -  738  0
             return project;
    -  739   -
         }
    -  740   -
     
    -  741   -
         /**
    -  742   -
          * Returns the list of Maven Projects in this build.
    -  743   -
          *
    -  744   -
          * @return the list of Maven Projects in this build
    -  745   -
          */
    -  746   -
         protected List<MavenProject> getReactorProjects() {
    -  747  0
             return reactorProjects;
    -  748   -
         }
    -  749   -
     
    -  750   -
         /**
    -  751   -
          * Returns the report format.
    -  752   -
          *
    -  753   -
          * @return the report format
    -  754   -
          */
    -  755   -
         protected String getFormat() {
    -  756  0
             return format;
    -  757   -
         }
    -  758   -
     
    -  759   -
         /**
    -  760   -
          * Generates the reports for a given dependency-check engine.
    -  761   -
          *
    -  762   -
          * @param engine a dependency-check engine
    -  763   -
          * @param p the maven project
    -  764   -
          * @param outputDir the directory path to write the report(s).
    -  765   -
          */
    -  766   -
         protected void writeReports(Engine engine, MavenProject p, File outputDir) {
    -  767  0
             DatabaseProperties prop = null;
    -  768  0
             CveDB cve = null;
    -  769   -
             try {
    -  770  0
                 cve = new CveDB();
    -  771  0
                 cve.open();
    -  772  0
                 prop = cve.getDatabaseProperties();
    -  773  0
             } catch (DatabaseException ex) {
    -  774  0
                 if (getLog().isDebugEnabled()) {
    -  775  0
                     getLog().debug("Unable to retrieve DB Properties", ex);
    -  776   -
                 }
    -  777   -
             } finally {
    -  778  0
                 if (cve != null) {
    -  779  0
                     cve.close();
    -  780   -
                 }
    -  781  
             }
    -  782  0
             final ReportGenerator r = new ReportGenerator(p.getName(), engine.getDependencies(), engine.getAnalyzers(), prop);
    -  783   +  730  1
             if (skipProvidedScope && Artifact.SCOPE_PROVIDED.equals(a.getScope())) {
    +  731  0
                 return true;
    +  732   +
             }
    +  733  1
             if (skipRuntimeScope && !Artifact.SCOPE_RUNTIME.equals(a.getScope())) {
    +  734  0
                 return true;
    +  735   +
             }
    +  736  1
             return false;
    +  737   +
         }
    +  738   +
     
    +  739   +
         /**
    +  740   +
          * Returns a reference to the current project. This method is used instead of auto-binding the project via component
    +  741   +
          * annotation in concrete implementations of this. If the child has a <code>@Component MavenProject project;</code> defined
    +  742   +
          * then the abstract class (i.e. this class) will not have access to the current project (just the way Maven works with the
    +  743   +
          * binding).
    +  744   +
          *
    +  745   +
          * @return returns a reference to the current project
    +  746   +
          */
    +  747   +
         protected MavenProject getProject() {
    +  748  0
             return project;
    +  749   +
         }
    +  750   +
     
    +  751   +
         /**
    +  752   +
          * Returns the list of Maven Projects in this build.
    +  753   +
          *
    +  754   +
          * @return the list of Maven Projects in this build
    +  755   +
          */
    +  756   +
         protected List<MavenProject> getReactorProjects() {
    +  757  0
             return reactorProjects;
    +  758   +
         }
    +  759   +
     
    +  760   +
         /**
    +  761   +
          * Returns the report format.
    +  762   +
          *
    +  763   +
          * @return the report format
    +  764   +
          */
    +  765   +
         protected String getFormat() {
    +  766  0
             return format;
    +  767   +
         }
    +  768   +
     
    +  769   +
         /**
    +  770   +
          * Generates the reports for a given dependency-check engine.
    +  771   +
          *
    +  772   +
          * @param engine a dependency-check engine
    +  773   +
          * @param p the maven project
    +  774   +
          * @param outputDir the directory path to write the report(s).
    +  775   +
          */
    +  776   +
         protected void writeReports(Engine engine, MavenProject p, File outputDir) {
    +  777  0
             DatabaseProperties prop = null;
    +  778  0
             CveDB cve = null;
    +  779  
             try {
    -  784  0
                 r.generateReports(outputDir.getAbsolutePath(), format);
    -  785  0
             } catch (IOException ex) {
    -  786  0
                 getLog().error(
    +  780  0
                 cve = new CveDB();
    +  781  0
                 cve.open();
    +  782  0
                 prop = cve.getDatabaseProperties();
    +  783  0
             } catch (DatabaseException ex) {
    +  784  0
                 if (getLog().isDebugEnabled()) {
    +  785  0
                     getLog().debug("Unable to retrieve DB Properties", ex);
    +  786   +
                 }
     787   -
                         "Unexpected exception occurred during analysis; please see the verbose error log for more details.");
    -  788  0
                 if (getLog().isDebugEnabled()) {
    -  789  0
                     getLog().debug("", ex);
    +
             } finally {
    +  788  0
                 if (cve != null) {
    +  789  0
                     cve.close();
     790  
                 }
    -  791  0
             } catch (Throwable ex) {
    -  792  0
                 getLog().error(
    +  791   +
             }
    +  792  0
             final ReportGenerator r = new ReportGenerator(p.getName(), engine.getDependencies(), engine.getAnalyzers(), prop);
     793   +
             try {
    +  794  0
                 r.generateReports(outputDir.getAbsolutePath(), format);
    +  795  0
             } catch (IOException ex) {
    +  796  0
                 getLog().error(
    +  797  
                         "Unexpected exception occurred during analysis; please see the verbose error log for more details.");
    -  794  0
                 if (getLog().isDebugEnabled()) {
    -  795  0
                     getLog().debug("", ex);
    -  796   -
                 }
    -  797  0
             }
    -  798  0
         }
    -  799   -
     
    +  798  0
                 if (getLog().isDebugEnabled()) {
    +  799  0
                     getLog().debug("", ex);
     800   -
         //<editor-fold defaultstate="collapsed" desc="Methods to fail build or show summary">
    -  801   -
         /**
    -  802   -
          * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the
    +
                 }
    +  801  0
             } catch (Throwable ex) {
    +  802  0
                 getLog().error(
     803   -
          * configuration.
    -  804   -
          *
    -  805   -
          * @param dependencies the list of dependency objects
    +
                         "Unexpected exception occurred during analysis; please see the verbose error log for more details.");
    +  804  0
                 if (getLog().isDebugEnabled()) {
    +  805  0
                     getLog().debug("", ex);
     806   +
                 }
    +  807  0
             }
    +  808  0
         }
    +  809   +
     
    +  810   +
         //<editor-fold defaultstate="collapsed" desc="Methods to fail build or show summary">
    +  811   +
         /**
    +  812   +
          * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the
    +  813   +
          * configuration.
    +  814   +
          *
    +  815   +
          * @param dependencies the list of dependency objects
    +  816  
          * @throws MojoFailureException thrown if a CVSS score is found that is higher then the threshold set
    -  807   +  817  
          */
    -  808   +  818  
         protected void checkForFailure(List<Dependency> dependencies) throws MojoFailureException {
    -  809  0
             if (failBuildOnCVSS <= 10) {
    -  810  0
                 final StringBuilder ids = new StringBuilder();
    -  811  0
                 for (Dependency d : dependencies) {
    -  812  0
                     boolean addName = true;
    -  813  0
                     for (Vulnerability v : d.getVulnerabilities()) {
    -  814  0
                         if (v.getCvssScore() >= failBuildOnCVSS) {
    -  815  0
                             if (addName) {
    -  816  0
                                 addName = false;
    -  817  0
                                 ids.append(NEW_LINE).append(d.getFileName()).append(": ");
    -  818  0
                                 ids.append(v.getName());
    -  819   +  819  0
             if (failBuildOnCVSS <= 10) {
    +  820  0
                 final StringBuilder ids = new StringBuilder();
    +  821  0
                 for (Dependency d : dependencies) {
    +  822  0
                     boolean addName = true;
    +  823  0
                     for (Vulnerability v : d.getVulnerabilities()) {
    +  824  0
                         if (v.getCvssScore() >= failBuildOnCVSS) {
    +  825  0
                             if (addName) {
    +  826  0
                                 addName = false;
    +  827  0
                                 ids.append(NEW_LINE).append(d.getFileName()).append(": ");
    +  828  0
                                 ids.append(v.getName());
    +  829  
                             } else {
    -  820  0
                                 ids.append(", ").append(v.getName());
    -  821   -
                             }
    -  822   -
                         }
    -  823  0
                     }
    -  824  0
                 }
    -  825  0
                 if (ids.length() > 0) {
    -  826  0
                     final String msg = String.format("%n%nDependency-Check Failure:%n"
    -  827   -
                             + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n"
    -  828   -
                             + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString());
    -  829  0
                     throw new MojoFailureException(msg);
    -  830   -
                 }
    +  830  0
                                 ids.append(", ").append(v.getName());
     831   -
             }
    -  832  0
         }
    -  833   -
     
    -  834   -
         /**
    -  835   -
          * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries.
    -  836   -
          *
    -  837   -
          * @param mp the Maven project for which the summary is shown
    -  838   -
          * @param dependencies a list of dependency objects
    -  839   -
          */
    -  840   -
         protected void showSummary(MavenProject mp, List<Dependency> dependencies) {
    -  841  0
             if (showSummary) {
    -  842  0
                 final StringBuilder summary = new StringBuilder();
    -  843  0
                 for (Dependency d : dependencies) {
    -  844  0
                     boolean firstEntry = true;
    -  845  0
                     final StringBuilder ids = new StringBuilder();
    -  846  0
                     for (Vulnerability v : d.getVulnerabilities()) {
    -  847  0
                         if (firstEntry) {
    -  848  0
                             firstEntry = false;
    -  849   -
                         } else {
    -  850  0
                             ids.append(", ");
    -  851   -
                         }
    -  852  0
                         ids.append(v.getName());
    -  853  0
                     }
    -  854  0
                     if (ids.length() > 0) {
    -  855  0
                         summary.append(d.getFileName()).append(" (");
    -  856  0
                         firstEntry = true;
    -  857  0
                         for (Identifier id : d.getIdentifiers()) {
    -  858  0
                             if (firstEntry) {
    -  859  0
                                 firstEntry = false;
    -  860   -
                             } else {
    -  861  0
                                 summary.append(", ");
    -  862  
                             }
    -  863  0
                             summary.append(id.getValue());
    -  864  0
                         }
    -  865  0
                         summary.append(") : ").append(ids).append(NEW_LINE);
    -  866   -
                     }
    -  867  0
                 }
    -  868  0
                 if (summary.length() > 0) {
    -  869  0
                     final String msg = String.format("%n%n" + "One or more dependencies were identified with known vulnerabilities in %s:%n%n%s"
    -  870   -
                             + "%n%nSee the dependency-check report for more details.%n%n", mp.getName(), summary.toString());
    -  871  0
                     getLog().warn(msg);
    -  872   +  832   +
                         }
    +  833  0
                     }
    +  834  0
                 }
    +  835  0
                 if (ids.length() > 0) {
    +  836  0
                     final String msg = String.format("%n%nDependency-Check Failure:%n"
    +  837   +
                             + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n"
    +  838   +
                             + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString());
    +  839  0
                     throw new MojoFailureException(msg);
    +  840  
                 }
    -  873   +  841  
             }
    -  874  0
         }
    -  875   +  842  0
         }
    +  843  
     
    -  876   -
         //</editor-fold>
    -  877   -
         //<editor-fold defaultstate="collapsed" desc="Methods to read/write the serialized data file">
    -  878   +  844  
         /**
    -  879   -
          * Returns the key used to store the path to the data file that is saved by <code>writeDataFile()</code>. This key is used in
    -  880   -
          * the <code>MavenProject.(set|get)ContextValue</code>.
    -  881   +  845   +
          * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries.
    +  846  
          *
    -  882   -
          * @return the key used to store the path to the data file
    -  883   +  847   +
          * @param mp the Maven project for which the summary is shown
    +  848   +
          * @param dependencies a list of dependency objects
    +  849  
          */
    -  884   -
         protected String getDataFileContextKey() {
    -  885  0
             return "dependency-check-path-" + dataFileName;
    -  886   -
         }
    -  887   +  850   +
         protected void showSummary(MavenProject mp, List<Dependency> dependencies) {
    +  851  0
             if (showSummary) {
    +  852  0
                 final StringBuilder summary = new StringBuilder();
    +  853  0
                 for (Dependency d : dependencies) {
    +  854  0
                     boolean firstEntry = true;
    +  855  0
                     final StringBuilder ids = new StringBuilder();
    +  856  0
                     for (Vulnerability v : d.getVulnerabilities()) {
    +  857  0
                         if (firstEntry) {
    +  858  0
                             firstEntry = false;
    +  859   +
                         } else {
    +  860  0
                             ids.append(", ");
    +  861   +
                         }
    +  862  0
                         ids.append(v.getName());
    +  863  0
                     }
    +  864  0
                     if (ids.length() > 0) {
    +  865  0
                         summary.append(d.getFileName()).append(" (");
    +  866  0
                         firstEntry = true;
    +  867  0
                         for (Identifier id : d.getIdentifiers()) {
    +  868  0
                             if (firstEntry) {
    +  869  0
                                 firstEntry = false;
    +  870   +
                             } else {
    +  871  0
                                 summary.append(", ");
    +  872   +
                             }
    +  873  0
                             summary.append(id.getValue());
    +  874  0
                         }
    +  875  0
                         summary.append(") : ").append(ids).append(NEW_LINE);
    +  876   +
                     }
    +  877  0
                 }
    +  878  0
                 if (summary.length() > 0) {
    +  879  0
                     final String msg = String.format("%n%n" + "One or more dependencies were identified with known vulnerabilities in %s:%n%n%s"
    +  880   +
                             + "%n%nSee the dependency-check report for more details.%n%n", mp.getName(), summary.toString());
    +  881  0
                     getLog().warn(msg);
    +  882   +
                 }
    +  883   +
             }
    +  884  0
         }
    +  885  
     
    +  886   +
         //</editor-fold>
    +  887   +
         //<editor-fold defaultstate="collapsed" desc="Methods to read/write the serialized data file">
     888  
         /**
     889   -
          * Returns the key used to store the path to the output directory. When generating the report in the
    +
          * Returns the key used to store the path to the data file that is saved by <code>writeDataFile()</code>. This key is used in
     890   -
          * <code>executeAggregateReport()</code> the output directory should be obtained by using this key.
    +
          * the <code>MavenProject.(set|get)ContextValue</code>.
     891  
          *
     892   -
          * @return the key used to store the path to the output directory
    +
          * @return the key used to store the path to the data file
     893  
          */
     894   -
         protected String getOutputDirectoryContextKey() {
    -  895  0
             return "dependency-output-dir-" + dataFileName;
    +
         protected String getDataFileContextKey() {
    +  895  0
             return "dependency-check-path-" + dataFileName;
     896  
         }
     897   @@ -1558,181 +1577,164 @@  898  
         /**
     899   -
          * Writes the scan data to disk. This is used to serialize the scan data between the "check" and "aggregate" phase.
    +
          * Returns the key used to store the path to the output directory. When generating the report in the
     900   -
          *
    +
          * <code>executeAggregateReport()</code> the output directory should be obtained by using this key.
     901   -
          * @param mp the mMven project for which the data file was created
    -  902   -
          * @param writeTo the directory to write the data file
    -  903   -
          * @param dependencies the list of dependencies to serialize
    -  904   -
          */
    -  905   -
         protected void writeDataFile(MavenProject mp, File writeTo, List<Dependency> dependencies) {
    -  906   -
             File file;
    -  907   -
             //check to see if this was already written out
    -  908  0
             if (mp.getContextValue(this.getDataFileContextKey()) == null) {
    -  909  0
                 if (writeTo == null) {
    -  910  0
                     file = new File(mp.getBuild().getDirectory());
    -  911  0
                     file = new File(file, dataFileName);
    -  912   -
                 } else {
    -  913  0
                     file = new File(writeTo, dataFileName);
    -  914   -
                 }
    -  915  0
                 final File parent = file.getParentFile();
    -  916  0
                 if (!parent.isDirectory() && parent.mkdirs()) {
    -  917  0
                     getLog().error(String.format("Directory '%s' does not exist and cannot be created; unable to write data file.",
    -  918   -
                             parent.getAbsolutePath()));
    -  919   -
                 }
    -  920   -
     
    -  921  0
                 OutputStream os = null;
    -  922  0
                 OutputStream bos = null;
    -  923  0
                 ObjectOutputStream out = null;
    -  924   -
                 try {
    -  925  0
                     if (dependencies != null) {
    -  926  0
                         os = new FileOutputStream(file);
    -  927  0
                         bos = new BufferedOutputStream(os);
    -  928  0
                         out = new ObjectOutputStream(bos);
    -  929  0
                         out.writeObject(dependencies);
    -  930  0
                         out.flush();
    -  931   -
     
    -  932   -
                         //call reset to prevent resource leaks per
    -  933   -
                         //https://www.securecoding.cert.org/confluence/display/java/SER10-J.+Avoid+memory+and+resource+leaks+during+serialization
    -  934  0
                         out.reset();
    -  935   -
                     }
    -  936  0
                     if (getLog().isDebugEnabled()) {
    -  937  0
                         getLog().debug(String.format("Serialized data file written to '%s' for %s, referenced by key %s",
    -  938   -
                                 file.getAbsolutePath(), mp.getName(), this.getDataFileContextKey()));
    -  939   -
                     }
    -  940  0
                     mp.setContextValue(this.getDataFileContextKey(), file.getAbsolutePath());
    -  941  0
                 } catch (IOException ex) {
    -  942  0
                     getLog().warn("Unable to create data file used for report aggregation; "
    -  943   -
                             + "if report aggregation is being used the results may be incomplete.");
    -  944  0
                     if (getLog().isDebugEnabled()) {
    -  945  0
                         getLog().debug(ex.getMessage(), ex);
    -  946   -
                     }
    -  947   -
                 } finally {
    -  948  0
                     if (out != null) {
    -  949   -
                         try {
    -  950  0
                             out.close();
    -  951  0
                         } catch (IOException ex) {
    -  952  0
                             if (getLog().isDebugEnabled()) {
    -  953  0
                                 getLog().debug("ignore", ex);
    -  954   -
                             }
    -  955  0
                         }
    -  956   -
                     }
    -  957  0
                     if (bos != null) {
    -  958   -
                         try {
    -  959  0
                             bos.close();
    -  960  0
                         } catch (IOException ex) {
    -  961  0
                             if (getLog().isDebugEnabled()) {
    -  962  0
                                 getLog().debug("ignore", ex);
    -  963   -
                             }
    -  964  0
                         }
    -  965   -
                     }
    -  966  0
                     if (os != null) {
    -  967   -
                         try {
    -  968  0
                             os.close();
    -  969  0
                         } catch (IOException ex) {
    -  970  0
                             if (getLog().isDebugEnabled()) {
    -  971  0
                                 getLog().debug("ignore", ex);
    -  972   -
                             }
    -  973  0
                         }
    -  974   -
                     }
    -  975   -
                 }
    -  976   -
             }
    -  977  0
         }
    -  978   -
     
    -  979   -
         /**
    -  980   -
          * Reads the serialized scan data from disk. This is used to serialize the scan data between the "check" and "aggregate"
    -  981   -
          * phase.
    -  982  
          *
    -  983   -
          * @param project the Maven project to read the data file from
    -  984   -
          * @return a <code>Engine</code> object populated with dependencies if the serialized data file exists; otherwise
    -  985   -
          * <code>null</code> is returned
    -  986   +  902   +
          * @return the key used to store the path to the output directory
    +  903  
          */
    -  987   -
         protected List<Dependency> readDataFile(MavenProject project) {
    -  988  0
             final Object oPath = project.getContextValue(this.getDataFileContextKey());
    -  989  0
             if (oPath == null) {
    -  990  0
                 return null;
    -  991   -
             }
    -  992  0
             List<Dependency> ret = null;
    -  993  0
             final String path = (String) oPath;
    -  994  0
             ObjectInputStream ois = null;
    -  995   -
             try {
    -  996  0
                 ois = new ObjectInputStream(new FileInputStream(path));
    -  997  0
                 ret = (List<Dependency>) ois.readObject();
    -  998  0
             } catch (FileNotFoundException ex) {
    -  999   -
                 //TODO fix logging
    -  1000  0
                 getLog().error("", ex);
    -  1001  0
             } catch (IOException ex) {
    -  1002  0
                 getLog().error("", ex);
    -  1003  0
             } catch (ClassNotFoundException ex) {
    -  1004  0
                 getLog().error("", ex);
    -  1005   -
             } finally {
    -  1006  0
                 if (ois != null) {
    -  1007   -
                     try {
    -  1008  0
                         ois.close();
    -  1009  0
                     } catch (IOException ex) {
    -  1010  0
                         getLog().error("", ex);
    -  1011  0
                     }
    -  1012   -
                 }
    -  1013   -
             }
    -  1014  0
             return ret;
    -  1015   +  904   +
         protected String getOutputDirectoryContextKey() {
    +  905  0
             return "dependency-output-dir-" + dataFileName;
    +  906  
         }
    -  1016   +  907   +
     
    +  908   +
         /**
    +  909   +
          * Writes the scan data to disk. This is used to serialize the scan data between the "check" and "aggregate" phase.
    +  910   +
          *
    +  911   +
          * @param mp the mMven project for which the data file was created
    +  912   +
          * @param writeTo the directory to write the data file
    +  913   +
          * @param dependencies the list of dependencies to serialize
    +  914   +
          */
    +  915   +
         protected void writeDataFile(MavenProject mp, File writeTo, List<Dependency> dependencies) {
    +  916   +
             File file;
    +  917   +
             //check to see if this was already written out
    +  918  0
             if (mp.getContextValue(this.getDataFileContextKey()) == null) {
    +  919  0
                 if (writeTo == null) {
    +  920  0
                     file = new File(mp.getBuild().getDirectory());
    +  921  0
                     file = new File(file, dataFileName);
    +  922   +
                 } else {
    +  923  0
                     file = new File(writeTo, dataFileName);
    +  924   +
                 }
    +  925  0
                 final File parent = file.getParentFile();
    +  926  0
                 if (!parent.isDirectory() && parent.mkdirs()) {
    +  927  0
                     getLog().error(String.format("Directory '%s' does not exist and cannot be created; unable to write data file.",
    +  928   +
                             parent.getAbsolutePath()));
    +  929   +
                 }
    +  930   +
     
    +  931  0
                 ObjectOutputStream out = null;
    +  932   +
                 try {
    +  933  0
                     if (dependencies != null) {
    +  934  0
                         out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
    +  935  0
                         out.writeObject(dependencies);
    +  936   +
                     }
    +  937  0
                     if (getLog().isDebugEnabled()) {
    +  938  0
                         getLog().debug(String.format("Serialized data file written to '%s' for %s, referenced by key %s",
    +  939   +
                                 file.getAbsolutePath(), mp.getName(), this.getDataFileContextKey()));
    +  940   +
                     }
    +  941  0
                     mp.setContextValue(this.getDataFileContextKey(), file.getAbsolutePath());
    +  942  0
                 } catch (IOException ex) {
    +  943  0
                     getLog().warn("Unable to create data file used for report aggregation; "
    +  944   +
                             + "if report aggregation is being used the results may be incomplete.");
    +  945  0
                     if (getLog().isDebugEnabled()) {
    +  946  0
                         getLog().debug(ex.getMessage(), ex);
    +  947   +
                     }
    +  948   +
                 } finally {
    +  949  0
                     if (out != null) {
    +  950   +
                         try {
    +  951  0
                             out.close();
    +  952  0
                         } catch (IOException ex) {
    +  953  0
                             if (getLog().isDebugEnabled()) {
    +  954  0
                                 getLog().debug("ignore", ex);
    +  955   +
                             }
    +  956  0
                         }
    +  957   +
                     }
    +  958   +
                 }
    +  959   +
             }
    +  960  0
         }
    +  961   +
     
    +  962   +
         /**
    +  963   +
          * Reads the serialized scan data from disk. This is used to serialize the scan data between the "check" and "aggregate"
    +  964   +
          * phase.
    +  965   +
          *
    +  966   +
          * @param project the Maven project to read the data file from
    +  967   +
          * @return a <code>Engine</code> object populated with dependencies if the serialized data file exists; otherwise
    +  968   +
          * <code>null</code> is returned
    +  969   +
          */
    +  970   +
         protected List<Dependency> readDataFile(MavenProject project) {
    +  971  0
             final Object oPath = project.getContextValue(this.getDataFileContextKey());
    +  972  0
             if (oPath == null) {
    +  973  0
                 return null;
    +  974   +
             }
    +  975  0
             List<Dependency> ret = null;
    +  976  0
             final String path = (String) oPath;
    +  977  0
             ObjectInputStream ois = null;
    +  978   +
             try {
    +  979  0
                 ois = new ObjectInputStream(new FileInputStream(path));
    +  980  0
                 ret = (List<Dependency>) ois.readObject();
    +  981  0
             } catch (FileNotFoundException ex) {
    +  982   +
                 //TODO fix logging
    +  983  0
                 getLog().error("", ex);
    +  984  0
             } catch (IOException ex) {
    +  985  0
                 getLog().error("", ex);
    +  986  0
             } catch (ClassNotFoundException ex) {
    +  987  0
                 getLog().error("", ex);
    +  988   +
             } finally {
    +  989  0
                 if (ois != null) {
    +  990   +
                     try {
    +  991  0
                         ois.close();
    +  992  0
                     } catch (IOException ex) {
    +  993  0
                         getLog().error("", ex);
    +  994  0
                     }
    +  995   +
                 }
    +  996   +
             }
    +  997  0
             return ret;
    +  998   +
         }
    +  999  
         //</editor-fold>
    -  1017   +  1000  
     }
    - + diff --git a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.CheckMojo.html b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.CheckMojo.html index 97d02103d..89d3e6fe8 100644 --- a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.CheckMojo.html +++ b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.CheckMojo.html @@ -12,7 +12,7 @@
     
    - +
    Classes in this File Line Coverage Branch Coverage Complexity
    CheckMojo
    0%
    0/27
    0%
    0/8
    2.5
    CheckMojo
    0%
    0/28
    0%
    0/8
    2.5
     
    @@ -68,160 +68,175 @@  25  
     import org.apache.maven.plugins.annotations.Mojo;
     26   -
     import org.apache.maven.plugins.annotations.ResolutionScope;
    +
     import org.apache.maven.plugins.annotations.Parameter;
     27   -
     import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
    +
     import org.apache.maven.plugins.annotations.ResolutionScope;
     28   -
     import org.owasp.dependencycheck.utils.Settings;
    +
     import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
     29   -
     
    +
     import org.owasp.dependencycheck.utils.Settings;
     30   -
     /**
    +
     
     31   -
      * Maven Plugin that checks the project dependencies to see if they have any known published vulnerabilities.
    +
     /**
     32   -
      *
    +
      * Maven Plugin that checks the project dependencies to see if they have any known published vulnerabilities.
     33   -
      * @author Jeremy Long
    +
      *
     34   -
      */
    +
      * @author Jeremy Long
     35   -
     @Mojo(
    +
      */
     36   -
             name = "check",
    +
     @Mojo(
     37   -
             defaultPhase = LifecyclePhase.COMPILE,
    +
             name = "check",
     38   -
             threadSafe = true,
    +
             defaultPhase = LifecyclePhase.VERIFY,
     39   -
             requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,
    +
             threadSafe = true,
     40   -
             requiresOnline = true
    +
             requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,
     41   +
             requiresOnline = true
    +  42  
     )
    -  42  0
     public class CheckMojo extends BaseDependencyCheckMojo {
    -  43   -
     
    +  43  0
     public class CheckMojo extends BaseDependencyCheckMojo {
     44   -
         /**
    +
     
     45   -
          * Returns whether or not a the report can be generated.
    +
         /**
     46   -
          *
    +
          * Returns whether or not a the report can be generated.
     47   -
          * @return <code>true</code> if the report can be generated; otherwise <code>false</code>
    +
          *
     48   -
          */
    +
          * @return <code>true</code> if the report can be generated; otherwise <code>false</code>
     49   -
         @Override
    +
          */
     50   +
         @Override
    +  51  
         public boolean canGenerateReport() {
    -  51  0
             boolean isCapable = false;
    -  52  0
             for (Artifact a : getProject().getArtifacts()) {
    -  53  0
                 if (!excludeFromScan(a)) {
    -  54  0
                     isCapable = true;
    -  55  0
                     break;
    -  56   +  52  0
             boolean isCapable = false;
    +  53  0
             for (Artifact a : getProject().getArtifacts()) {
    +  54  0
                 if (!excludeFromScan(a)) {
    +  55  0
                     isCapable = true;
    +  56  0
                     break;
    +  57  
                 }
    -  57  0
             }
    -  58  0
             return isCapable;
    -  59   -
         }
    +  58  0
             }
    +  59  0
             return isCapable;
     60   -
     
    +
         }
     61   -
         /**
    +
     
     62   -
          * Executes the dependency-check engine on the project's dependencies and generates the report.
    +
         /**
     63   -
          *
    +
          * Executes the dependency-check engine on the project's dependencies and generates the report.
     64   -
          * @throws MojoExecutionException thrown if there is an exception executing the goal
    +
          *
     65   -
          * @throws MojoFailureException thrown if dependency-check is configured to fail the build
    +
          * @throws MojoExecutionException thrown if there is an exception executing the goal
     66   -
          */
    +
          * @throws MojoFailureException thrown if dependency-check is configured to fail the build
     67   -
         @Override
    +
          */
     68   -
         public void runCheck() throws MojoExecutionException, MojoFailureException {
    +
         @Override
     69   -
             final Engine engine;
    +
         public void runCheck() throws MojoExecutionException, MojoFailureException {
     70   +
             final Engine engine;
    +  71  
             try {
    -  71  0
                 engine = initializeEngine();
    -  72  0
             } catch (DatabaseException ex) {
    -  73  0
                 if (getLog().isDebugEnabled()) {
    -  74  0
                     getLog().debug("Database connection error", ex);
    -  75   +  72  0
                 engine = initializeEngine();
    +  73  0
             } catch (DatabaseException ex) {
    +  74  0
                 if (getLog().isDebugEnabled()) {
    +  75  0
                     getLog().debug("Database connection error", ex);
    +  76  
                 }
    -  76  0
                 throw new MojoExecutionException("An exception occured connecting to the local database. Please see the log file for more details.", ex);
    -  77  0
             }
    -  78  0
             scanArtifacts(getProject(), engine);
    -  79  0
             if (engine.getDependencies().isEmpty()) {
    -  80  0
                 getLog().info("No dependencies were identified that could be analyzed by dependency-check");
    -  81   +  77  0
                 throw new MojoExecutionException("An exception occured connecting to the local database. Please see the log file for more details.", ex);
    +  78  0
             }
    +  79  0
             scanArtifacts(getProject(), engine);
    +  80  0
             if (engine.getDependencies().isEmpty()) {
    +  81  0
                 getLog().info("No dependencies were identified that could be analyzed by dependency-check");
    +  82  
             } else {
    -  82  0
                 engine.analyzeDependencies();
    -  83  0
                 writeReports(engine, getProject(), getCorrectOutputDirectory());
    -  84  0
                 writeDataFile(getProject(), null, engine.getDependencies());
    -  85  0
                 showSummary(getProject(), engine.getDependencies());
    -  86  0
                 checkForFailure(engine.getDependencies());
    -  87   +  83  0
                 engine.analyzeDependencies();
    +  84  0
                 writeReports(engine, getProject(), getCorrectOutputDirectory());
    +  85  0
                 writeDataFile(getProject(), null, engine.getDependencies());
    +  86  0
                 showSummary(getProject(), engine.getDependencies());
    +  87  0
                 checkForFailure(engine.getDependencies());
    +  88  
             }
    -  88  0
             engine.cleanup();
    -  89  0
             Settings.cleanup();
    -  90  0
         }
    -  91   -
     
    +  89  0
             engine.cleanup();
    +  90  0
             Settings.cleanup();
    +  91  0
         }
     92   -
         /**
    +
     
     93   -
          * Returns the report name.
    -  94   -
          *
    -  95   -
          * @param locale the location
    -  96   -
          * @return the report name
    -  97   -
          */
    -  98   -
         @Override
    -  99   -
         public String getName(Locale locale) {
    -  100  0
             return "dependency-check";
    -  101   -
         }
    -  102   -
     
    -  103  
         /**
    -  104   -
          * Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page.
    -  105   -
          *
    -  106   -
          * @param locale The Locale to get the description for
    -  107   -
          * @return the description
    -  108   +  94   +
          * The name of the report in the site.
    +  95  
          */
    -  109   -
         @Override
    -  110   -
         public String getDescription(Locale locale) {
    -  111  0
             return "Generates a report providing details on any published vulnerabilities within project dependencies. "
    -  112   -
                     + "This report is a best effort and may contain false positives and false negatives.";
    -  113   -
         }
    -  114   +  96  0
         @SuppressWarnings("CanBeFinal")
    +  97   +
         @Parameter(property = "name", defaultValue = "dependency-check", required = true)
    +  98   +
         private String name = "dependency-check";
    +  99  
     
    +  100   +
         /**
    +  101   +
          * Returns the report name.
    +  102   +
          *
    +  103   +
          * @param locale the location
    +  104   +
          * @return the report name
    +  105   +
          */
    +  106   +
         @Override
    +  107   +
         public String getName(Locale locale) {
    +  108  0
             return name;
    +  109   +
         }
    +  110   +
     
    +  111   +
         /**
    +  112   +
          * Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page.
    +  113   +
          *
    +  114   +
          * @param locale The Locale to get the description for
     115   +
          * @return the description
    +  116   +
          */
    +  117   +
         @Override
    +  118   +
         public String getDescription(Locale locale) {
    +  119  0
             return "Generates a report providing details on any published vulnerabilities within project dependencies. "
    +  120   +
                     + "This report is a best effort and may contain false positives and false negatives.";
    +  121   +
         }
    +  122   +
     
    +  123  
     }
    - + diff --git a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.Engine.html b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.Engine.html index 62beaf8b8..2f797106d 100644 --- a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.Engine.html +++ b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.Engine.html @@ -403,6 +403,6 @@
     }
    - + diff --git a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.HelpMojo.html b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.HelpMojo.html index cd2391ec8..dccfafe89 100644 --- a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.HelpMojo.html +++ b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.HelpMojo.html @@ -771,6 +771,6 @@
     }
    - + diff --git a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.PurgeMojo.html b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.PurgeMojo.html index 88a689e15..7a7935338 100644 --- a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.PurgeMojo.html +++ b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.PurgeMojo.html @@ -217,6 +217,6 @@
     }
    - + diff --git a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.UpdateMojo.html b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.UpdateMojo.html index 672ca7525..de39844d9 100644 --- a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.UpdateMojo.html +++ b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.UpdateMojo.html @@ -199,6 +199,6 @@
     }
    - + diff --git a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.slf4j.MavenLoggerAdapter.html b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.slf4j.MavenLoggerAdapter.html index 40832493d..5f1da8e46 100644 --- a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.slf4j.MavenLoggerAdapter.html +++ b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.slf4j.MavenLoggerAdapter.html @@ -131,14 +131,14 @@
         @Override
     60  
         public void trace(String msg) {
    -  61  4
             if (log != null) {
    +  61  1
             if (log != null) {
     62  0
                 log.debug(msg);
     63  
             } else {
    -  64  4
                 System.out.println(msg);
    +  64  1
                 System.out.println(msg);
     65  
             }
    -  66  4
         }
    +  66  1
         }
     67  
     
     68   @@ -218,14 +218,14 @@
         @Override
     117  
         public void debug(String msg) {
    -  118  13
             if (log != null) {
    +  118  7
             if (log != null) {
     119  0
                 log.debug(msg);
     120  
             } else {
    -  121  13
                 System.out.println(msg);
    +  121  7
                 System.out.println(msg);
     122  
             }
    -  123  13
         }
    +  123  7
         }
     124  
     
     125   @@ -551,6 +551,6 @@
     }
    - + diff --git a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.slf4j.MavenLoggerFactory.html b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.slf4j.MavenLoggerFactory.html index 1ed4e6889..2a4e7fff6 100644 --- a/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.slf4j.MavenLoggerFactory.html +++ b/dependency-check-maven/cobertura/org.owasp.dependencycheck.maven.slf4j.MavenLoggerFactory.html @@ -120,13 +120,13 @@
         @Override
     53  
         public Logger getLogger(String name) {
    -  54  27
             return mavenLoggerAdapter;
    +  54  28
             return mavenLoggerAdapter;
     55  
         }
     56  
     }
    - + diff --git a/dependency-check-maven/cobertura/org.slf4j.impl.StaticLoggerBinder.html b/dependency-check-maven/cobertura/org.slf4j.impl.StaticLoggerBinder.html index 98df08dbd..2b1ad0c05 100644 --- a/dependency-check-maven/cobertura/org.slf4j.impl.StaticLoggerBinder.html +++ b/dependency-check-maven/cobertura/org.slf4j.impl.StaticLoggerBinder.html @@ -106,7 +106,7 @@
          */
     45  
         public static final StaticLoggerBinder getSingleton() {
    -  46  29
             return SINGLETON;
    +  46  30
             return SINGLETON;
     47  
         }
     48   @@ -202,7 +202,7 @@
         @Override
     98  
         public ILoggerFactory getLoggerFactory() {
    -  99  27
             return loggerFactory;
    +  99  28
             return loggerFactory;
     100  
         }
     101   @@ -228,6 +228,6 @@
     }
    - + diff --git a/dependency-check-maven/configuration.html b/dependency-check-maven/configuration.html index 37e9b4bb2..6f9ae4b52 100644 --- a/dependency-check-maven/configuration.html +++ b/dependency-check-maven/configuration.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Goals @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -103,7 +103,7 @@ Project Information - +
  • @@ -121,7 +121,7 @@ -
    +
    @@ -136,7 +136,7 @@
  • -
    + built with maven @@ -214,15 +214,6 @@ -aggregate - -Deprecated - use the aggregate goal instead. - -  - - - - autoUpdate Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not recommended that this be turned to false. @@ -230,16 +221,16 @@ true - + -outputDirectory +cveValidForHours -The location to write the report(s). Note, this is not used if generating the report as part of a mvn site build +Sets the number of hours to wait before checking for new updates from the NVD. -‘target’ +4 - + failBuildOnCVSS @@ -248,7 +239,7 @@ 11 - + format @@ -257,17 +248,35 @@ HTML + + +name + +The name of the report in the site + +dependency-check or dependency-check:aggregate + + -suppressionFile +outputDirectory -The file path to the XML suppression file - used to suppress false positives +The location to write the report(s). Note, this is not used if generating the report as part of a mvn site build -  +‘target’ +skip + +Skips the dependency-check analysis + +false + + + + skipTestScope Should be skip analysis for artifacts with Test Scope @@ -275,7 +284,7 @@ true - + skipProvidedScope @@ -284,7 +293,7 @@ false - + skipRuntimeScope @@ -292,6 +301,15 @@ false + + + +suppressionFile + +The file path to the XML suppression file - used to suppress false positives + +  +

    Analyzer Configuration

    @@ -376,6 +394,78 @@ +pyDistributionAnalyzerEnabled + +Sets whether the Python Distribution Analyzer will be used. + +true + + + + +pyPackageAnalyzerEnabled + +Sets whether the Python Package Analyzer will be used. + +true + + + + +rubygemsAnalyzerEnabled + +Sets whether the Ruby Gemspec Analyzer will be used. + +true + + + + +opensslAnalyzerEnabled + +Sets whether or not the openssl Analyzer should be used. + +true + + + + +cmakeAnalyzerEnabled + +Sets whether or not the CMake Analyzer should be used. + +true + + + + +autoconfAnalyzerEnabled + +Sets whether or not the autoconf Analyzer should be used. + +true + + + + +composerAnalyzerEnabled + +Sets whether or not the PHP Composer Lock File Analyzer should be used. + +true + + + + +nodeAnalyzerEnabled + +Sets whether or not the Node.js Analyzer should be used. + +true + + + + nuspecAnalyzerEnabled Sets whether or not the .NET Nuget Nuspec Analyzer will be used. @@ -425,7 +515,7 @@ URL for the modified CVE 1.2. -http://nvd.nist.gov/download/nvdcve-modified.xml +https://nvd.nist.gov/download/nvdcve-Modified.xml.gz @@ -434,7 +524,7 @@ URL for the modified CVE 2.0. -http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-modified.xml +https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-Modified.xml.gz @@ -443,7 +533,7 @@ Base URL for each year’s CVE 1.2, the %d will be replaced with the year. -http://nvd.nist.gov/download/nvdcve-%d.xml +https://nvd.nist.gov/download/nvdcve-%d.xml.gz @@ -452,7 +542,7 @@ Base URL for each year’s CVE 2.0, the %d will be replaced with the year. -http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml +https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml.gz diff --git a/dependency-check-maven/dependency-analysis.html b/dependency-check-maven/dependency-analysis.html index 9c93e5dc3..e0ef5e9c6 100644 --- a/dependency-check-maven/dependency-analysis.html +++ b/dependency-check-maven/dependency-analysis.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Dependencies Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • @@ -194,13 +194,6 @@ Checkstyle
  • - -
  • - - - - PMD -
  • @@ -214,7 +207,7 @@ -
    +
    @@ -229,7 +222,7 @@
    - + built with maven @@ -261,7 +254,7 @@ org.owasp dependency-check-core -1.3.1 +1.3.2 compile jar @@ -269,7 +262,7 @@ org.owasp dependency-check-utils -1.3.1 +1.3.2 compile jar @@ -317,7 +310,7 @@ org.jmockit jmockit -1.19 +1.20 test jar @@ -352,7 +345,7 @@ org.slf4j slf4j-api -1.7.12 +1.7.13 compile jar @@ -403,7 +396,7 @@ com.google.code.findbugs annotations -3.0.0 +3.0.1u2 provided jar diff --git a/dependency-check-maven/dependency-updates-report.html b/dependency-check-maven/dependency-updates-report.html index 8e7a0d769..934363fa6 100644 --- a/dependency-check-maven/dependency-updates-report.html +++ b/dependency-check-maven/dependency-updates-report.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Dependency Updates Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • @@ -194,13 +194,6 @@ Checkstyle
  • - -
  • - - - - PMD -
  • @@ -214,7 +207,7 @@ -
    +
    @@ -229,7 +222,7 @@
    - + built with maven @@ -252,7 +245,7 @@ # of dependencies using the latest version available -27 +24 # of dependencies where the next version available is smaller than an incremental version update @@ -260,7 +253,7 @@ # of dependencies where the next version available is an incremental version update -0 +3 # of dependencies where the next version available is a minor version update @@ -312,7 +305,7 @@ com.google.code.findbugs annotations -3.0.0 +3.0.1u2 jar @@ -477,7 +470,7 @@ 4.8.0 5.0.0 - + org.apache.maven maven-core 3.3.3 @@ -485,11 +478,11 @@ jar - +3.3.9 - + org.apache.maven maven-plugin-api 3.3.3 @@ -497,11 +490,11 @@ jar - +3.3.9 - + org.apache.maven maven-settings 3.3.3 @@ -509,7 +502,7 @@ jar - +3.3.9 @@ -600,7 +593,7 @@ org.jmockit jmockit -1.19 +1.20 test jar @@ -624,7 +617,7 @@ org.slf4j slf4j-api -1.7.12 +1.7.13 jar @@ -636,7 +629,7 @@ org.slf4j slf4j-simple -1.7.12 +1.7.13 jar @@ -675,7 +668,7 @@ org.owasp dependency-check-core -1.3.1 +1.3.2 compile jar @@ -687,7 +680,7 @@ org.owasp dependency-check-utils -1.3.1 +1.3.2 compile jar @@ -772,7 +765,7 @@ annotations Current Version -3.0.0 +3.0.1u2 Scope @@ -808,7 +801,7 @@ jar Newer versions -1.4.177 Next Minor
    1.4.178
    1.4.179
    1.4.180
    1.4.181
    1.4.182
    1.4.183
    1.4.184
    1.4.185
    1.4.186
    1.4.187
    1.4.188
    1.4.189 Latest Minor +1.4.177 Next Minor
    1.4.178
    1.4.179
    1.4.180
    1.4.181
    1.4.182
    1.4.183
    1.4.184
    1.4.185
    1.4.186
    1.4.187
    1.4.188
    1.4.189
    1.4.190 Latest Minor

    com.sun.mail:mailapi

    @@ -1027,7 +1020,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-core

    @@ -1054,7 +1047,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-queryparser

    @@ -1081,7 +1074,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-test-framework

    @@ -1108,13 +1101,13 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.maven:maven-core

    - + @@ -1132,13 +1125,16 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven:maven-plugin-api

    - + @@ -1156,13 +1152,16 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven:maven-settings

    - + @@ -1180,7 +1179,10 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven.plugin-testing:maven-plugin-testing-harness

    @@ -1363,7 +1365,7 @@ - + @@ -1411,7 +1413,7 @@ - + @@ -1435,7 +1437,7 @@ - + @@ -1459,7 +1461,7 @@ - + @@ -1483,7 +1485,7 @@ - + diff --git a/dependency-check-maven/findbugs.html b/dependency-check-maven/findbugs.html index f4fa512eb..e86f6dbab 100644 --- a/dependency-check-maven/findbugs.html +++ b/dependency-check-maven/findbugs.html @@ -1,13 +1,13 @@ - + dependency-check-maven – FindBugs Bug Detector Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • @@ -194,13 +194,6 @@ Checkstyle
  • - -
  • - - - - PMD -
  • @@ -214,7 +207,7 @@ -
    +
    @@ -229,7 +222,7 @@
    - + built with maven diff --git a/dependency-check-maven/help-mojo.html b/dependency-check-maven/help-mojo.html index 03d1d6645..030144cba 100644 --- a/dependency-check-maven/help-mojo.html +++ b/dependency-check-maven/help-mojo.html @@ -1,13 +1,13 @@ - + dependency-check-maven – dependency-check:help @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • @@ -123,7 +123,7 @@ -
    +
    @@ -138,7 +138,7 @@
    -
    + built with maven @@ -161,7 +161,7 @@

    Full name:

    -

    org.owasp:dependency-check-maven:1.3.1:help

    +

    org.owasp:dependency-check-maven:1.3.2:help

    Description:

    diff --git a/dependency-check-maven/index.html b/dependency-check-maven/index.html index 2769f633a..78dd92e39 100644 --- a/dependency-check-maven/index.html +++ b/dependency-check-maven/index.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Usage @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -103,7 +103,7 @@ Project Information - +
  • @@ -121,7 +121,7 @@ -
    +
    @@ -136,7 +136,7 @@
    -
    + built with maven @@ -171,7 +171,7 @@ <plugin> <groupId>org.owasp</groupId> <artifactId>dependency-check-maven</artifactId> - <version>1.3.1</version> + <version>1.3.2</version> <executions> <execution> <goals> @@ -202,7 +202,7 @@ <plugin> <groupId>org.owasp</groupId> <artifactId>dependency-check-maven</artifactId> - <version>1.3.1</version> + <version>1.3.2</version> <reportSets> <reportSet> <reports> @@ -233,7 +233,7 @@ <plugin> <groupId>org.owasp</groupId> <artifactId>dependency-check-maven</artifactId> - <version>1.3.1</version> + <version>1.3.2</version> <configuration> <failBuildOnCVSS>8</failBuildOnCVSS> </configuration> @@ -266,7 +266,7 @@ <plugin> <groupId>org.owasp</groupId> <artifactId>dependency-check-maven</artifactId> - <version>1.3.1</version> + <version>1.3.2</version> <configuration> <skipProvidedScope>true</skipProvidedScope> <skipRuntimeScope>true</skipRuntimeScope> @@ -300,7 +300,7 @@ <plugin> <groupId>org.owasp</groupId> <artifactId>dependency-check-maven</artifactId> - <version>1.3.1</version> + <version>1.3.2</version> <configuration> <cveUrl12Modified>http://internal-mirror.mycorp.com/downloads/nist/nvdcve-modified.xml</cveUrl12Modified> <cveUrl20Modified>http://internal-mirror.mycorp.com/downloads/nist/nvdcve-2.0-modified.xml</cveUrl20Modified> @@ -336,7 +336,7 @@ <plugin> <groupId>org.owasp</groupId> <artifactId>dependency-check-maven</artifactId> - <version>1.3.1</version> + <version>1.3.2</version> <executions> <execution> <goals> diff --git a/dependency-check-maven/integration.html b/dependency-check-maven/integration.html index 82ebf62bf..a019ecc47 100644 --- a/dependency-check-maven/integration.html +++ b/dependency-check-maven/integration.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Continuous Integration @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -154,7 +154,7 @@ - +
  • @@ -172,7 +172,7 @@ -
    +
    @@ -187,7 +187,7 @@
    -
    + built with maven diff --git a/dependency-check-maven/issue-tracking.html b/dependency-check-maven/issue-tracking.html index 70e1ffc98..5eee0843a 100644 --- a/dependency-check-maven/issue-tracking.html +++ b/dependency-check-maven/issue-tracking.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Issue Tracking @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -154,7 +154,7 @@ - +
  • @@ -172,7 +172,7 @@ -
    +
    @@ -187,7 +187,7 @@
    -
    + built with maven diff --git a/dependency-check-maven/license.html b/dependency-check-maven/license.html index 9f238c76d..b6582a038 100644 --- a/dependency-check-maven/license.html +++ b/dependency-check-maven/license.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Project License @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -154,7 +154,7 @@ - +
  • @@ -172,7 +172,7 @@ -
    +
    @@ -187,7 +187,7 @@
    -
    + built with maven diff --git a/dependency-check-maven/mail-lists.html b/dependency-check-maven/mail-lists.html index 575efd5c9..2c0e33d37 100644 --- a/dependency-check-maven/mail-lists.html +++ b/dependency-check-maven/mail-lists.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Project Mailing Lists @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -154,7 +154,7 @@ - +
  • @@ -172,7 +172,7 @@ -
    +
    @@ -187,7 +187,7 @@
    -
    + built with maven diff --git a/dependency-check-maven/plugin-info.html b/dependency-check-maven/plugin-info.html index 58d5f73fa..ff15e91b6 100644 --- a/dependency-check-maven/plugin-info.html +++ b/dependency-check-maven/plugin-info.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Plugin Documentation @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • @@ -194,13 +194,6 @@ Checkstyle
  • - -
  • - - - - PMD -
  • @@ -214,7 +207,7 @@ -
    +
    @@ -229,7 +222,7 @@
    - + built with maven @@ -307,7 +300,7 @@ have any known published vulnerabilities.
    jmockit
    Current Version1.19
    1.20
    Scope test
    dependency-check-core
    Current Version1.3.1
    1.3.2
    Scope compile
    dependency-check-utils
    Current Version1.3.1
    1.3.2
    Scope compile
    slf4j-api
    Current Version1.7.12
    1.7.13
    Scope
    slf4j-simple
    Current Version1.7.12
    1.7.13
    Scope
    <plugin> <groupId>org.owasp</groupId> <artifactId>dependency-check-maven</artifactId> - <version>1.3.1</version> + <version>1.3.2</version> </plugin> ... </plugins> @@ -317,7 +310,7 @@ have any known published vulnerabilities. <plugin> <groupId>org.owasp</groupId> <artifactId>dependency-check-maven</artifactId> - <version>1.3.1</version> + <version>1.3.2</version> </plugin> ... </plugins> @@ -329,7 +322,7 @@ have any known published vulnerabilities. <plugin> <groupId>org.owasp</groupId> <artifactId>dependency-check-maven</artifactId> - <version>1.3.1</version> + <version>1.3.2</version> </plugin> ... </plugins> diff --git a/dependency-check-maven/plugin-updates-report.html b/dependency-check-maven/plugin-updates-report.html index dc4192e60..98f0937e2 100644 --- a/dependency-check-maven/plugin-updates-report.html +++ b/dependency-check-maven/plugin-updates-report.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Plugin Updates Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • @@ -194,13 +194,6 @@ Checkstyle
  • - -
  • - - - - PMD -
  • @@ -214,7 +207,7 @@ -
    +
    @@ -229,7 +222,7 @@
    - + built with maven @@ -264,7 +257,7 @@ # of plugins where the next version available is a minor version update -0 +2 # of plugins where the next version available is a major version update @@ -300,7 +293,7 @@ org.apache.maven.plugins maven-assembly-plugin -2.5.5 +2.6 @@ -360,7 +353,7 @@ org.apache.maven.plugins maven-failsafe-plugin -2.18.1 +2.19 @@ -397,16 +390,26 @@ + +org.apache.maven.plugins +maven-javadoc-plugin +2.9.1 + + +2.10 + + + org.apache.maven.plugins maven-release-plugin -2.5.2 +2.5.3 - + org.apache.maven.plugins maven-resources-plugin @@ -416,7 +419,7 @@ - + org.apache.maven.plugins maven-site-plugin @@ -426,6 +429,16 @@ + + +org.apache.maven.plugins +maven-source-plugin +2.2.1 + + +2.3 + + org.apache.maven.plugins @@ -531,7 +544,7 @@ maven-assembly-plugin Current Version -2.5.5 +2.6

    Plugin org.apache.maven.plugins:maven-clean-plugin

    @@ -621,7 +634,7 @@ -
    maven-failsafe-plugin
    Current Version2.18.1
    +2.19

    Plugin org.apache.maven.plugins:maven-gpg-plugin

    @@ -668,6 +681,24 @@
    Current Version 2.6
    +

    Plugin org.apache.maven.plugins:maven-javadoc-plugin

    + + + + + + + + + + + + + + + +
    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-javadoc-plugin
    Current Version2.9.1
    Newer versions2.10 Next Minor
    2.10.1
    2.10.2
    2.10.3 Latest Minor
    +

    Plugin org.apache.maven.plugins:maven-plugin-plugin

    @@ -696,7 +727,7 @@ -
    maven-release-plugin
    Current Version2.5.2
    +2.5.3

    Plugin org.apache.maven.plugins:maven-resources-plugin

    @@ -728,6 +759,24 @@
    Current Version 3.4
    +

    Plugin org.apache.maven.plugins:maven-source-plugin

    + + + + + + + + + + + + + + + +
    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-source-plugin
    Current Version2.2.1
    Newer versions2.3 Next Minor
    2.4 Latest Minor
    +

    Plugin org.apache.maven.plugins:maven-surefire-plugin

    diff --git a/dependency-check-maven/project-info.html b/dependency-check-maven/project-info.html index 7dd1cfde6..09c734810 100644 --- a/dependency-check-maven/project-info.html +++ b/dependency-check-maven/project-info.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Project Information @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -154,7 +154,7 @@ - +
  • @@ -172,7 +172,7 @@ -
    +
    @@ -187,7 +187,7 @@
    -
    + built with maven diff --git a/dependency-check-maven/project-reports.html b/dependency-check-maven/project-reports.html index 063fca362..a98f95692 100644 --- a/dependency-check-maven/project-reports.html +++ b/dependency-check-maven/project-reports.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Generated Reports @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • Project Reports @@ -194,13 +194,6 @@ Checkstyle
  • - -
  • - - - - PMD -
  • @@ -214,7 +207,7 @@ -
    +
    @@ -229,7 +222,7 @@
    - + built with maven @@ -289,10 +282,7 @@ - - - -
    This report provides goals and parameters documentation of a plugin.
    CheckstyleReport on coding style conventions.
    PMDVerification of coding rules.
    +Report on coding style conventions. diff --git a/dependency-check-maven/project-summary.html b/dependency-check-maven/project-summary.html index c81980eec..340e21cba 100644 --- a/dependency-check-maven/project-summary.html +++ b/dependency-check-maven/project-summary.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Project Summary @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -154,7 +154,7 @@ - +
  • @@ -172,7 +172,7 @@ -
    +
    @@ -187,7 +187,7 @@
    -
    + built with maven @@ -219,7 +219,7 @@ dependency-check-maven is a Maven Plugin that uses dependency-check-core to detect publicly disclosed vulnerabilities associated with the project's dependencies. The plugin will generate a report listing the dependency, any identified Common Platform Enumeration (CPE) identifiers, and the associated Common Vulnerability and Exposure (CVE) entries. Homepage -http://maven.apache.org +https://github.com/jeremylong/DependencyCheck.git/dependency-check-maven

    Project Organization

    @@ -246,7 +246,7 @@ - + diff --git a/dependency-check-maven/purge-mojo.html b/dependency-check-maven/purge-mojo.html index cff8c1d07..af019e1c7 100644 --- a/dependency-check-maven/purge-mojo.html +++ b/dependency-check-maven/purge-mojo.html @@ -1,13 +1,13 @@ - + dependency-check-maven – dependency-check:purge @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • @@ -123,7 +123,7 @@ -
    +
    @@ -138,7 +138,7 @@
    -
    + built with maven @@ -163,7 +163,7 @@

    Full name:

    -

    org.owasp:dependency-check-maven:1.3.1:purge

    +

    org.owasp:dependency-check-maven:1.3.2:purge

    Description:

    @@ -200,18 +200,6 @@
  • - - - - - - - - - - - @@ -221,7 +209,7 @@ is not recommended that this be turned to false. Default is true.
    Defaul
    - + @@ -234,7 +222,7 @@ specified level is identified. The default is 11 which means since the CVSS scores are 0-10, by default the build will never fail.
    Default value is: 11.
    User property is: failBuildOnCVSS.
    - + @@ -247,7 +235,7 @@ configuration option has no affect if using this within the Site plug-in unless the externalReport is set to true. Default is HTML.
    Default value is: HTML.
    User property is: format.
    - + @@ -258,7 +246,7 @@ plug-in unless the externalReport is set to true. Default is HTML.
    Defau
    - + @@ -292,44 +280,90 @@ Dependency-Check report. This generally maps to "target/site".
    aggregate - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + @@ -400,6 +434,18 @@ Dependency-Check report. This generally maps to "target/site".
    +
    + + + + + + + + + + @@ -409,7 +455,7 @@ Dependency-Check report. This generally maps to "target/site".
    The data directory, hold DC SQL DB.
    User property is: dataDirectory.
    - + @@ -420,7 +466,7 @@ Dependency-Check report. This generally maps to "target/site".
    The database driver name. An example would be org.h2.Driver.
    User property is: databaseDriverName.
    - + @@ -431,7 +477,7 @@ Dependency-Check report. This generally maps to "target/site".
    The path to the database driver if it is not on the class path.
    User property is: databaseDriverPath.
    - + @@ -442,7 +488,7 @@ Dependency-Check report. This generally maps to "target/site".
    The password to use when connecting to the database.
    User property is: databasePassword.
    - + @@ -453,7 +499,7 @@ Dependency-Check report. This generally maps to "target/site".
    The database user name.
    User property is: databaseUser.
    - + @@ -464,18 +510,18 @@ Dependency-Check report. This generally maps to "target/site".
    Deprecated. the internal report is no longer supported
    User property is: externalReport.
    - + - + - + - + @@ -486,7 +532,7 @@ Dependency-Check report. This generally maps to "target/site".
    The Maven settings.
    Default value is: ${settings}.
    User property is: mavenSettings.
    - + @@ -497,18 +543,18 @@ Dependency-Check report. This generally maps to "target/site".
    The maven settings proxy id.
    User property is: mavenSettingsProxyId.
    - + - + - + - + @@ -520,30 +566,52 @@ Dependency-Check report. This generally maps to "target/site".
    User property is: nexusUrl.
    - + - + - + + + + + + + + + + + + - + - + + + + + + + + + + + + @@ -553,7 +621,7 @@ Dependency-Check report. This generally maps to "target/site".
    The path to mono for .NET Assembly analysis on non-windows systems.
    User property is: pathToMono.
    - + @@ -564,6 +632,39 @@ Dependency-Check report. This generally maps to "target/site".
    Deprecated. Please use mavenSettings instead
    User property is: proxyUrl.
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -577,6 +678,17 @@ Dependency-Check report. This generally maps to "target/site".
    +
    + + + + + + + + + + @@ -586,7 +698,7 @@ Dependency-Check report. This generally maps to "target/site".
    Skip Analysis for Provided Scope Dependencies.
    Default value is: false.
    User property is: skipProvidedScope.
    - + @@ -597,7 +709,7 @@ Dependency-Check report. This generally maps to "target/site".
    Skip Analysis for Runtime Scope Dependencies.
    Default value is: false.
    User property is: skipRuntimeScope.
    - + @@ -608,7 +720,7 @@ Dependency-Check report. This generally maps to "target/site".
    Skip Analysis for Test Scope Dependencies.
    Default value is: true.
    User property is: skipTestScope.
    - + @@ -619,7 +731,7 @@ Dependency-Check report. This generally maps to "target/site".
    The path to the suppression file.
    User property is: suppressionFile.
    - + @@ -644,13 +756,11 @@ to jar, zip, ....
    User property is: zipExtensions.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: aggregate
    • - -
    • Default: false

    archiveAnalyzerEnabled:

    @@ -658,13 +768,11 @@ to jar, zip, ....
    User property is: zipExtensions.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: archiveAnalyzerEnabled
    • - -
    • Default: true

    assemblyAnalyzerEnabled:

    @@ -672,13 +780,11 @@ to jar, zip, ....
    User property is: zipExtensions.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: assemblyAnalyzerEnabled
    • - -
    • Default: true

    autoUpdate:

    @@ -687,13 +793,23 @@ is not recommended that this be turned to false. Default is true.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • -
    • Required: Yes
    • +
    • Required: No
    • User Property: autoupdate
    • +

    +

    autoconfAnalyzerEnabled:

    + +
    Sets whether or not the autoconf Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: autoconfAnalyzerEnabled

    centralAnalyzerEnabled:

    @@ -701,13 +817,36 @@ is not recommended that this be turned to false. Default is true.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: centralAnalyzerEnabled
    • +

    +

    cmakeAnalyzerEnabled:

    + +
    Sets whether or not the CMake Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: cmakeAnalyzerEnabled
    • +

    +

    composerAnalyzerEnabled:

    + +
    Sets whether or not the PHP Composer Lock File Analyzer should be +used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: composerAnalyzerEnabled

    connectionString:

    @@ -781,6 +920,19 @@ is not recommended that this be turned to false. Default is true.
  • User Property: cveUrl20Modified

  • +

    cveValidForHours:

    + +
    Optionally skip excessive CVE update checks for a designated +duration in hours.
    + +
      + +
    • Type: java.lang.Integer
    • + +
    • Required: No
    • + +
    • User Property: cveValidForHours
    • +

    dataDirectory:

    The data directory, hold DC SQL DB.
    @@ -907,13 +1059,11 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: jarAnalyzerEnabled
    • - -
    • Default: true

    mavenSettings:

    @@ -947,13 +1097,11 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: nexusAnalyzerEnabled
    • - -
    • Default: true

    nexusUrl:

    @@ -974,13 +1122,23 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: nexusUsesProxy
    • +

    +

    nodeAnalyzerEnabled:

    + +
    Sets whether or not the Node.js Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: nodeAnalyzerEnabled

    nuspecAnalyzerEnabled:

    @@ -988,13 +1146,23 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: nuspecAnalyzerEnabled
    • +

    +

    opensslAnalyzerEnabled:

    + +
    Sets whether or not the openssl Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: opensslAnalyzerEnabled

    outputDirectory:

    @@ -1034,6 +1202,30 @@ plug-in unless the externalReport is set to true. Default is HTML.
  • User Property: proxyUrl

  • +

    pyDistributionAnalyzerEnabled:

    + +
    Sets whether the Python Distribution Analyzer will be used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: pyDistributionAnalyzerEnabled
    • +

    +

    pyPackageAnalyzerEnabled:

    + +
    Sets whether the Python Package Analyzer will be used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: pyPackageAnalyzerEnabled
    • +

    reportOutputDirectory:

    Specifies the destination directory for the generated @@ -1047,6 +1239,18 @@ Dependency-Check report. This generally maps to "target/site".
  • User Property: project.reporting.outputDirectory

  • +

    rubygemsAnalyzerEnabled:

    + +
    Sets whether the Ruby Gemspec Analyzer will be used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: rubygemsAnalyzerEnabled
    • +

    showSummary:

    Flag indicating whether or not to show a summary in the output.
    @@ -1061,6 +1265,20 @@ Dependency-Check report. This generally maps to "target/site".
  • Default: true

  • +

    skip:

    + +
    Skip Dependency Check altogether.
    + +
      + +
    • Type: boolean
    • + +
    • Required: No
    • + +
    • User Property: dependency-check.skip
    • + +
    • Default: false
    • +

    skipProvidedScope:

    Skip Analysis for Provided Scope Dependencies.
    diff --git a/dependency-check-maven/source-repository.html b/dependency-check-maven/source-repository.html index 83459a1e6..1a7b4bc61 100644 --- a/dependency-check-maven/source-repository.html +++ b/dependency-check-maven/source-repository.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Source Repository @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -154,7 +154,7 @@ - +
  • @@ -172,7 +172,7 @@ -
    +
    @@ -187,7 +187,7 @@
    -
    + built with maven diff --git a/dependency-check-maven/surefire-report.html b/dependency-check-maven/surefire-report.html index 9408eb5cd..f5a59b1a0 100644 --- a/dependency-check-maven/surefire-report.html +++ b/dependency-check-maven/surefire-report.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Surefire Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • @@ -194,13 +194,6 @@ Checkstyle
  • - -
  • - - - - PMD -
  • @@ -214,7 +207,7 @@ -
    +
    @@ -229,7 +222,7 @@
    - + built with maven @@ -281,7 +274,7 @@ function toggleDisplay(elementId) {
    -
    dependency-check-maven
    Version1.3.1
    1.3.2
    Type maven-plugin
    autoUpdateboolean-Sets whether auto-updating of the NVD CVE/CPE data is enabled. It -is not recommended that this be turned to false. Default is true.
    Default value is: true.
    User property is: autoupdate.
    dataFileName StringSets whether or not the external report format should be used.
    Default value is: dependency-check.ser.
    User property is: metaFileName.
    failBuildOnCVSS
    format
    outputDirectoryThe output directory. This generally maps to "target".
    Default value is: ${project.build.directory}.
    reportOutputDirectorybooleanBoolean -Deprecated. use the aggregate goal instead
    Default value is: false.
    User property is: aggregate.
    Deprecated. use the aggregate goal instead
    User property is: aggregate.
    archiveAnalyzerEnabledbooleanBoolean -Whether or not the Archive Analyzer is enabled.
    Default value is: true.
    User property is: archiveAnalyzerEnabled.
    Whether or not the Archive Analyzer is enabled.
    User property is: archiveAnalyzerEnabled.
    assemblyAnalyzerEnabledbooleanBoolean -Whether or not the .NET Assembly Analyzer is enabled.
    Default value is: true.
    User property is: assemblyAnalyzerEnabled.
    Whether or not the .NET Assembly Analyzer is enabled.
    User property is: assemblyAnalyzerEnabled.
    autoUpdateBoolean-Sets whether auto-updating of the NVD CVE/CPE data is enabled. It +is not recommended that this be turned to false. Default is true.
    User property is: autoupdate.
    autoconfAnalyzerEnabledBoolean-Sets whether or not the autoconf Analyzer should be used.
    User property is: autoconfAnalyzerEnabled.
    centralAnalyzerEnabledbooleanBoolean -Whether or not the Central Analyzer is enabled.
    Default value is: true.
    User property is: centralAnalyzerEnabled.
    Whether or not the Central Analyzer is enabled.
    User property is: centralAnalyzerEnabled.
    cmakeAnalyzerEnabledBoolean-Sets whether or not the CMake Analyzer should be used.
    User property is: cmakeAnalyzerEnabled.
    composerAnalyzerEnabledBoolean-Sets whether or not the PHP Composer Lock File Analyzer should be +used.
    User property is: composerAnalyzerEnabled.
    cveValidForHoursInteger-Optionally skip excessive CVE update checks for a designated +duration in hours.
    User property is: cveValidForHours.
    dataDirectory String
    databaseDriverName
    databaseDriverPath
    databasePassword
    databaseUser
    externalReport
    jarAnalyzerEnabledbooleanBoolean -Whether or not the Jar Analyzer is enabled.
    Default value is: true.
    User property is: jarAnalyzerEnabled.
    Whether or not the Jar Analyzer is enabled.
    User property is: jarAnalyzerEnabled.
    mavenSettings
    mavenSettingsProxyId
    nexusAnalyzerEnabledbooleanBoolean -Whether or not the Nexus Analyzer is enabled.
    Default value is: true.
    User property is: nexusAnalyzerEnabled.
    Whether or not the Nexus Analyzer is enabled.
    User property is: nexusAnalyzerEnabled.
    nexusUrl
    nexusUsesProxybooleanBoolean -Whether or not the configured proxy is used to connect to Nexus.
    Default value is: true.
    User property is: nexusUsesProxy.
    Whether or not the configured proxy is used to connect to Nexus.
    User property is: nexusUsesProxy.
    nodeAnalyzerEnabledBoolean-Sets whether or not the Node.js Analyzer should be used.
    User property is: nodeAnalyzerEnabled.
    nuspecAnalyzerEnabledbooleanBoolean -Whether or not the .NET Nuspec Analyzer is enabled.
    Default value is: true.
    User property is: nuspecAnalyzerEnabled.
    Whether or not the .NET Nuspec Analyzer is enabled.
    User property is: nuspecAnalyzerEnabled.
    opensslAnalyzerEnabledBoolean-Sets whether or not the openssl Analyzer should be used.
    User property is: opensslAnalyzerEnabled.
    pathToMono String
    proxyUrl
    pyDistributionAnalyzerEnabledBoolean-Sets whether the Python Distribution Analyzer will be used.
    User property is: pyDistributionAnalyzerEnabled.
    pyPackageAnalyzerEnabledBoolean-Sets whether the Python Package Analyzer will be used.
    User property is: pyPackageAnalyzerEnabled.
    rubygemsAnalyzerEnabledBoolean-Sets whether the Ruby Gemspec Analyzer will be used.
    User property is: rubygemsAnalyzerEnabled.
    showSummaryskipboolean-Skip Dependency Check altogether.
    Default value is: false.
    User property is: dependency-check.skip.
    skipProvidedScope boolean
    skipRuntimeScope
    skipTestScope
    suppressionFile
    zipExtensions0 0 100%1.163

    +0.484

    Note: failures are anticipated and checked for with assertions while errors are unanticipated.


    Package List

    @@ -302,7 +295,7 @@ function toggleDisplay(elementId) { 0 0 100% -1.163
    +0.484

    Note: package statistics are not computed recursively, they only sum up all of its testsuites numbers.

    org.owasp.dependencycheck.maven

    @@ -324,7 +317,7 @@ function toggleDisplay(elementId) { 0 0 100% -1.163

    +0.484

    Test Cases

    [Summary] [Package List] [Test Cases]

    @@ -333,8 +326,8 @@ function toggleDisplay(elementId) { - -
    testScanArtifacts1.163

    +testScanArtifacts +0.484
    diff --git a/dependency-check-maven/taglist.html b/dependency-check-maven/taglist.html index 23b4f60f2..b5183264b 100644 --- a/dependency-check-maven/taglist.html +++ b/dependency-check-maven/taglist.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Tag List report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • @@ -194,13 +194,6 @@ Checkstyle
  • - -
  • - - - - PMD -
  • @@ -214,7 +207,7 @@ -
    +
    @@ -229,7 +222,7 @@
    - + built with maven @@ -267,7 +260,7 @@ Line fix logging -999 +982 org.owasp.dependencycheck.maven.BaseDependencyCheckMojoTest Line diff --git a/dependency-check-maven/team-list.html b/dependency-check-maven/team-list.html index a10e5b351..591a38a96 100644 --- a/dependency-check-maven/team-list.html +++ b/dependency-check-maven/team-list.html @@ -1,13 +1,13 @@ - + dependency-check-maven – Project Team @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -154,7 +154,7 @@ - +
  • @@ -172,7 +172,7 @@ -
    +
    @@ -187,7 +187,7 @@
    -
    + built with maven diff --git a/dependency-check-maven/update-only-mojo.html b/dependency-check-maven/update-only-mojo.html index 067d57bbe..23ef431f5 100644 --- a/dependency-check-maven/update-only-mojo.html +++ b/dependency-check-maven/update-only-mojo.html @@ -1,13 +1,13 @@ - + dependency-check-maven – dependency-check:update-only @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -105,7 +105,7 @@ Project Information - +
  • @@ -123,7 +123,7 @@ -
    +
    @@ -138,7 +138,7 @@
    -
    + built with maven @@ -163,7 +163,7 @@

    Full name:

    -

    org.owasp:dependency-check-maven:1.3.1:update-only

    +

    org.owasp:dependency-check-maven:1.3.2:update-only

    Description:

    @@ -201,18 +201,6 @@ have any known published vulnerabilities. -
    autoUpdate - -boolean - -- - -Sets whether auto-updating of the NVD CVE/CPE data is enabled. It -is not recommended that this be turned to false. Default is true.
    Default value is: true.
    User property is: autoupdate. - - - - dataFileName String @@ -222,7 +210,7 @@ is not recommended that this be turned to false. Default is true.
    Defaul Sets whether or not the external report format should be used.
    Default value is: dependency-check.ser.
    User property is: metaFileName. - + failBuildOnCVSS @@ -235,7 +223,7 @@ specified level is identified. The default is 11 which means since the CVSS scores are 0-10, by default the build will never fail.
    Default value is: 11.
    User property is: failBuildOnCVSS. - + format @@ -248,7 +236,7 @@ configuration option has no affect if using this within the Site plug-in unless the externalReport is set to true. Default is HTML.
    Default value is: HTML.
    User property is: format. - + outputDirectory @@ -259,7 +247,7 @@ plug-in unless the externalReport is set to true. Default is HTML.
    Defau The output directory. This generally maps to "target".
    Default value is: ${project.build.directory}.
    - + reportOutputDirectory @@ -293,44 +281,90 @@ Dependency-Check report. This generally maps to "target/site".
    aggregate -boolean +Boolean - -Deprecated. use the aggregate goal instead
    Default value is: false.
    User property is: aggregate. +Deprecated. use the aggregate goal instead
    User property is: aggregate. archiveAnalyzerEnabled -boolean +Boolean - -Whether or not the Archive Analyzer is enabled.
    Default value is: true.
    User property is: archiveAnalyzerEnabled. +Whether or not the Archive Analyzer is enabled.
    User property is: archiveAnalyzerEnabled. assemblyAnalyzerEnabled -boolean +Boolean - -Whether or not the .NET Assembly Analyzer is enabled.
    Default value is: true.
    User property is: assemblyAnalyzerEnabled. +Whether or not the .NET Assembly Analyzer is enabled.
    User property is: assemblyAnalyzerEnabled. + + + + +autoUpdate + +Boolean + +- + +Sets whether auto-updating of the NVD CVE/CPE data is enabled. It +is not recommended that this be turned to false. Default is true.
    User property is: autoupdate. + + + + +autoconfAnalyzerEnabled + +Boolean + +- + +Sets whether or not the autoconf Analyzer should be used.
    User property is: autoconfAnalyzerEnabled. centralAnalyzerEnabled -boolean +Boolean - -Whether or not the Central Analyzer is enabled.
    Default value is: true.
    User property is: centralAnalyzerEnabled. +Whether or not the Central Analyzer is enabled.
    User property is: centralAnalyzerEnabled. + + + + +cmakeAnalyzerEnabled + +Boolean + +- + +Sets whether or not the CMake Analyzer should be used.
    User property is: cmakeAnalyzerEnabled. + + + + +composerAnalyzerEnabled + +Boolean + +- + +Sets whether or not the PHP Composer Lock File Analyzer should be +used.
    User property is: composerAnalyzerEnabled. @@ -401,6 +435,18 @@ Dependency-Check report. This generally maps to "target/site".
    +cveValidForHours + +Integer + +- + +Optionally skip excessive CVE update checks for a designated +duration in hours.
    User property is: cveValidForHours. + + + + dataDirectory String @@ -410,7 +456,7 @@ Dependency-Check report. This generally maps to "target/site".
    The data directory, hold DC SQL DB.
    User property is: dataDirectory. - + databaseDriverName @@ -421,7 +467,7 @@ Dependency-Check report. This generally maps to "target/site".
    The database driver name. An example would be org.h2.Driver.
    User property is: databaseDriverName. - + databaseDriverPath @@ -432,7 +478,7 @@ Dependency-Check report. This generally maps to "target/site".
    The path to the database driver if it is not on the class path.
    User property is: databaseDriverPath. - + databasePassword @@ -443,7 +489,7 @@ Dependency-Check report. This generally maps to "target/site".
    The password to use when connecting to the database.
    User property is: databasePassword. - + databaseUser @@ -454,7 +500,7 @@ Dependency-Check report. This generally maps to "target/site".
    The database user name.
    User property is: databaseUser. - + externalReport @@ -465,18 +511,18 @@ Dependency-Check report. This generally maps to "target/site".
    Deprecated. the internal report is no longer supported
    User property is: externalReport. - + jarAnalyzerEnabled -boolean +Boolean - -Whether or not the Jar Analyzer is enabled.
    Default value is: true.
    User property is: jarAnalyzerEnabled. +Whether or not the Jar Analyzer is enabled.
    User property is: jarAnalyzerEnabled. - + mavenSettings @@ -487,7 +533,7 @@ Dependency-Check report. This generally maps to "target/site".
    The Maven settings.
    Default value is: ${settings}.
    User property is: mavenSettings. - + mavenSettingsProxyId @@ -498,18 +544,18 @@ Dependency-Check report. This generally maps to "target/site".
    The maven settings proxy id.
    User property is: mavenSettingsProxyId. - + nexusAnalyzerEnabled -boolean +Boolean - -Whether or not the Nexus Analyzer is enabled.
    Default value is: true.
    User property is: nexusAnalyzerEnabled. +Whether or not the Nexus Analyzer is enabled.
    User property is: nexusAnalyzerEnabled. - + nexusUrl @@ -521,30 +567,52 @@ Dependency-Check report. This generally maps to "target/site".
    User property is: nexusUrl. - + nexusUsesProxy -boolean +Boolean - -Whether or not the configured proxy is used to connect to Nexus.
    Default value is: true.
    User property is: nexusUsesProxy. +Whether or not the configured proxy is used to connect to Nexus.
    User property is: nexusUsesProxy. + + + + +nodeAnalyzerEnabled + +Boolean + +- + +Sets whether or not the Node.js Analyzer should be used.
    User property is: nodeAnalyzerEnabled. nuspecAnalyzerEnabled -boolean +Boolean - -Whether or not the .NET Nuspec Analyzer is enabled.
    Default value is: true.
    User property is: nuspecAnalyzerEnabled. +Whether or not the .NET Nuspec Analyzer is enabled.
    User property is: nuspecAnalyzerEnabled. +opensslAnalyzerEnabled + +Boolean + +- + +Sets whether or not the openssl Analyzer should be used.
    User property is: opensslAnalyzerEnabled. + + + + pathToMono String @@ -554,7 +622,7 @@ Dependency-Check report. This generally maps to "target/site".
    The path to mono for .NET Assembly analysis on non-windows systems.
    User property is: pathToMono. - + proxyUrl @@ -565,6 +633,39 @@ Dependency-Check report. This generally maps to "target/site".
    Deprecated. Please use mavenSettings instead
    User property is: proxyUrl. + + +pyDistributionAnalyzerEnabled + +Boolean + +- + +Sets whether the Python Distribution Analyzer will be used.
    User property is: pyDistributionAnalyzerEnabled. + + + + +pyPackageAnalyzerEnabled + +Boolean + +- + +Sets whether the Python Package Analyzer will be used.
    User property is: pyPackageAnalyzerEnabled. + + + + +rubygemsAnalyzerEnabled + +Boolean + +- + +Sets whether the Ruby Gemspec Analyzer will be used.
    User property is: rubygemsAnalyzerEnabled. + + showSummary @@ -578,6 +679,17 @@ Dependency-Check report. This generally maps to "target/site".
    +skip + +boolean + +- + +Skip Dependency Check altogether.
    Default value is: false.
    User property is: dependency-check.skip. + + + + skipProvidedScope boolean @@ -587,7 +699,7 @@ Dependency-Check report. This generally maps to "target/site".
    Skip Analysis for Provided Scope Dependencies.
    Default value is: false.
    User property is: skipProvidedScope. - + skipRuntimeScope @@ -598,7 +710,7 @@ Dependency-Check report. This generally maps to "target/site".
    Skip Analysis for Runtime Scope Dependencies.
    Default value is: false.
    User property is: skipRuntimeScope. - + skipTestScope @@ -609,7 +721,7 @@ Dependency-Check report. This generally maps to "target/site".
    Skip Analysis for Test Scope Dependencies.
    Default value is: true.
    User property is: skipTestScope. - + suppressionFile @@ -620,7 +732,7 @@ Dependency-Check report. This generally maps to "target/site".
    The path to the suppression file.
    User property is: suppressionFile. - + zipExtensions @@ -645,13 +757,11 @@ to jar, zip, ....
    User property is: zipExtensions.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: aggregate
    • - -
    • Default: false

    archiveAnalyzerEnabled:

    @@ -659,13 +769,11 @@ to jar, zip, ....
    User property is: zipExtensions.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: archiveAnalyzerEnabled
    • - -
    • Default: true

    assemblyAnalyzerEnabled:

    @@ -673,13 +781,11 @@ to jar, zip, ....
    User property is: zipExtensions.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: assemblyAnalyzerEnabled
    • - -
    • Default: true

    autoUpdate:

    @@ -688,13 +794,23 @@ is not recommended that this be turned to false. Default is true.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • -
    • Required: Yes
    • +
    • Required: No
    • User Property: autoupdate
    • +

    +

    autoconfAnalyzerEnabled:

    + +
    Sets whether or not the autoconf Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: autoconfAnalyzerEnabled

    centralAnalyzerEnabled:

    @@ -702,13 +818,36 @@ is not recommended that this be turned to false. Default is true.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: centralAnalyzerEnabled
    • +

    +

    cmakeAnalyzerEnabled:

    + +
    Sets whether or not the CMake Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: cmakeAnalyzerEnabled
    • +

    +

    composerAnalyzerEnabled:

    + +
    Sets whether or not the PHP Composer Lock File Analyzer should be +used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: composerAnalyzerEnabled

    connectionString:

    @@ -782,6 +921,19 @@ is not recommended that this be turned to false. Default is true.
  • User Property: cveUrl20Modified

  • +

    cveValidForHours:

    + +
    Optionally skip excessive CVE update checks for a designated +duration in hours.
    + +
      + +
    • Type: java.lang.Integer
    • + +
    • Required: No
    • + +
    • User Property: cveValidForHours
    • +

    dataDirectory:

    The data directory, hold DC SQL DB.
    @@ -908,13 +1060,11 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: jarAnalyzerEnabled
    • - -
    • Default: true

    mavenSettings:

    @@ -948,13 +1098,11 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: nexusAnalyzerEnabled
    • - -
    • Default: true

    nexusUrl:

    @@ -975,13 +1123,23 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: nexusUsesProxy
    • +

    +

    nodeAnalyzerEnabled:

    + +
    Sets whether or not the Node.js Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: nodeAnalyzerEnabled

    nuspecAnalyzerEnabled:

    @@ -989,13 +1147,23 @@ plug-in unless the externalReport is set to true. Default is HTML.
      -
    • Type: boolean
    • +
    • Type: java.lang.Boolean
    • Required: No
    • User Property: nuspecAnalyzerEnabled
    • +

    +

    opensslAnalyzerEnabled:

    + +
    Sets whether or not the openssl Analyzer should be used.
    + +
      -
    • Default: true
    • +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: opensslAnalyzerEnabled

    outputDirectory:

    @@ -1035,6 +1203,30 @@ plug-in unless the externalReport is set to true. Default is HTML.
  • User Property: proxyUrl

  • +

    pyDistributionAnalyzerEnabled:

    + +
    Sets whether the Python Distribution Analyzer will be used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: pyDistributionAnalyzerEnabled
    • +

    +

    pyPackageAnalyzerEnabled:

    + +
    Sets whether the Python Package Analyzer will be used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: pyPackageAnalyzerEnabled
    • +

    reportOutputDirectory:

    Specifies the destination directory for the generated @@ -1048,6 +1240,18 @@ Dependency-Check report. This generally maps to "target/site".
  • User Property: project.reporting.outputDirectory

  • +

    rubygemsAnalyzerEnabled:

    + +
    Sets whether the Ruby Gemspec Analyzer will be used.
    + +
      + +
    • Type: java.lang.Boolean
    • + +
    • Required: No
    • + +
    • User Property: rubygemsAnalyzerEnabled
    • +

    showSummary:

    Flag indicating whether or not to show a summary in the output.
    @@ -1062,6 +1266,20 @@ Dependency-Check report. This generally maps to "target/site".
  • Default: true

  • +

    skip:

    + +
    Skip Dependency Check altogether.
    + +
      + +
    • Type: boolean
    • + +
    • Required: No
    • + +
    • User Property: dependency-check.skip
    • + +
    • Default: false
    • +

    skipProvidedScope:

    Skip Analysis for Provided Scope Dependencies.
    diff --git a/dependency-check-maven/xref-test/index.html b/dependency-check-maven/xref-test/index.html index 173cde10c..3efa14183 100644 --- a/dependency-check-maven/xref-test/index.html +++ b/dependency-check-maven/xref-test/index.html @@ -4,7 +4,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference + Dependency-Check Maven Plugin 1.3.2 Reference diff --git a/dependency-check-maven/xref-test/org/owasp/dependencycheck/maven/BaseDependencyCheckMojoTest.html b/dependency-check-maven/xref-test/org/owasp/dependencycheck/maven/BaseDependencyCheckMojoTest.html index 5fcca2c24..5c23d8a1c 100644 --- a/dependency-check-maven/xref-test/org/owasp/dependencycheck/maven/BaseDependencyCheckMojoTest.html +++ b/dependency-check-maven/xref-test/org/owasp/dependencycheck/maven/BaseDependencyCheckMojoTest.html @@ -59,7 +59,7 @@ 51 */ 52 public boolean canRun() { 53 String version = System.getProperty("java.version"); -54 int length = version.indexOf(".", version.indexOf(".") + 1); +54 int length = version.indexOf('.', version.indexOf('.') + 1); 55 version = version.substring(0, length); 56 57 double v = Double.parseDouble(version); diff --git a/dependency-check-maven/xref-test/org/owasp/dependencycheck/maven/package-frame.html b/dependency-check-maven/xref-test/org/owasp/dependencycheck/maven/package-frame.html index e8a2d5d59..3bb8b1ea4 100644 --- a/dependency-check-maven/xref-test/org/owasp/dependencycheck/maven/package-frame.html +++ b/dependency-check-maven/xref-test/org/owasp/dependencycheck/maven/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference Package org.owasp.dependencycheck.maven + Dependency-Check Maven Plugin 1.3.2 Reference Package org.owasp.dependencycheck.maven diff --git a/dependency-check-maven/xref-test/org/owasp/dependencycheck/maven/package-summary.html b/dependency-check-maven/xref-test/org/owasp/dependencycheck/maven/package-summary.html index 418b762b0..616c808f8 100644 --- a/dependency-check-maven/xref-test/org/owasp/dependencycheck/maven/package-summary.html +++ b/dependency-check-maven/xref-test/org/owasp/dependencycheck/maven/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference Package org.owasp.dependencycheck.maven + Dependency-Check Maven Plugin 1.3.2 Reference Package org.owasp.dependencycheck.maven diff --git a/dependency-check-maven/xref-test/overview-frame.html b/dependency-check-maven/xref-test/overview-frame.html index 622f6ad4b..f690ed256 100644 --- a/dependency-check-maven/xref-test/overview-frame.html +++ b/dependency-check-maven/xref-test/overview-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference + Dependency-Check Maven Plugin 1.3.2 Reference diff --git a/dependency-check-maven/xref-test/overview-summary.html b/dependency-check-maven/xref-test/overview-summary.html index 5b48c4a3b..88fe436b8 100644 --- a/dependency-check-maven/xref-test/overview-summary.html +++ b/dependency-check-maven/xref-test/overview-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference + Dependency-Check Maven Plugin 1.3.2 Reference @@ -24,7 +24,7 @@ -

    Dependency-Check Maven Plugin 1.3.1 Reference

    +

    Dependency-Check Maven Plugin 1.3.2 Reference

    diff --git a/dependency-check-maven/xref/index.html b/dependency-check-maven/xref/index.html index 173cde10c..3efa14183 100644 --- a/dependency-check-maven/xref/index.html +++ b/dependency-check-maven/xref/index.html @@ -4,7 +4,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference + Dependency-Check Maven Plugin 1.3.2 Reference diff --git a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/AggregateMojo.html b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/AggregateMojo.html index a5a5d2d50..da2f14555 100644 --- a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/AggregateMojo.html +++ b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/AggregateMojo.html @@ -37,258 +37,268 @@ 29import org.apache.maven.plugin.MojoFailureException; 30import org.apache.maven.plugins.annotations.LifecyclePhase; 31import org.apache.maven.plugins.annotations.Mojo; -32import org.apache.maven.plugins.annotations.ResolutionScope; -33import org.apache.maven.project.MavenProject; -34import org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzer; -35import org.owasp.dependencycheck.analyzer.exception.AnalysisException; -36import org.owasp.dependencycheck.data.nvdcve.DatabaseException; -37import org.owasp.dependencycheck.dependency.Dependency; -38import org.owasp.dependencycheck.utils.Settings; -39 -40/** -41 * Maven Plugin that checks project dependencies and the dependencies of all child modules to see if they have any known published -42 * vulnerabilities. -43 * -44 * @author Jeremy Long -45 */ -46 @Mojo( -47 name = "aggregate", -48 defaultPhase = LifecyclePhase.COMPILE, -49/*aggregator = true,*/ -50 threadSafe = true, -51 requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, -52 requiresOnline = true -53 ) -54publicclassAggregateMojoextendsBaseDependencyCheckMojo { -55 -56/** -57 * Executes the aggregate dependency-check goal. This runs dependency-check and generates the subsequent reports. -58 * -59 * @throws MojoExecutionException thrown if there is ane exception running the mojo -60 * @throws MojoFailureException thrown if dependency-check is configured to fail the build -61 */ -62 @Override -63publicvoid runCheck() throws MojoExecutionException, MojoFailureException { -64finalEngine engine = generateDataFile(); -65 -66if (getProject() == getReactorProjects().get(getReactorProjects().size() - 1)) { -67 -68//ensure that the .ser file was created for each. -69for (MavenProject current : getReactorProjects()) { -70final File dataFile = getDataFile(current); -71if (dataFile == null) { //dc was never run on this project. write the ser to the target. -72 getLog().error(String.format("Module '%s' did not execute dependency-check; an attempt will be made to perform " -73 + "the check but dependencies may be missed resulting in false negatives.", current.getName())); -74 generateDataFile(engine, current); -75 } -76 } -77 -78for (MavenProject current : getReactorProjects()) { -79 List<Dependency> dependencies = readDataFile(current); -80if (dependencies == null) { -81 dependencies = new ArrayList<Dependency>(); -82 } -83final Set<MavenProject> childProjects = getDescendants(current); -84for (MavenProject reportOn : childProjects) { -85final List<Dependency> childDeps = readDataFile(reportOn); -86if (childDeps != null && !childDeps.isEmpty()) { -87if (getLog().isDebugEnabled()) { -88 getLog().debug(String.format("Adding %d dependencies from %s", childDeps.size(), reportOn.getName())); -89 } -90 dependencies.addAll(childDeps); -91 } else { -92if (getLog().isDebugEnabled()) { -93 getLog().debug(String.format("No dependencies read for %s", reportOn.getName())); -94 } -95 } -96 } -97 engine.getDependencies().clear(); -98 engine.getDependencies().addAll(dependencies); -99final DependencyBundlingAnalyzer bundler = new DependencyBundlingAnalyzer(); -100try { -101if (getLog().isDebugEnabled()) { -102 getLog().debug(String.format("Dependency count pre-bundler: %s", engine.getDependencies().size())); -103 } -104 bundler.analyze(null, engine); -105if (getLog().isDebugEnabled()) { -106 getLog().debug(String.format("Dependency count post-bundler: %s", engine.getDependencies().size())); -107 } -108 } catch (AnalysisException ex) { -109 getLog().warn("An error occured grouping the dependencies; duplicate entries may exist in the report", ex); -110 getLog().debug("Bundling Exception", ex); -111 } -112 -113 File outputDir = getCorrectOutputDirectory(current); -114if (outputDir == null) { -115//in some regards we shouldn't be writting this, but we are anyway. -116//we shouldn't write this because nothing is configured to generate this report. -117 outputDir = new File(current.getBuild().getDirectory()); -118 } -119 writeReports(engine, current, outputDir); -120 } -121 } -122 engine.cleanup(); -123 Settings.cleanup(); -124 } -125 -126/** -127 * Returns a set containing all the descendant projects of the given project. -128 * -129 * @param project the project for which all descendants will be returned -130 * @return the set of descendant projects -131 */ -132protected Set<MavenProject> getDescendants(MavenProject project) { -133if (project == null) { -134return Collections.emptySet(); -135 } -136final Set<MavenProject> descendants = new HashSet<MavenProject>(); -137int size = 0; -138if (getLog().isDebugEnabled()) { -139 getLog().debug(String.format("Collecting descendants of %s", project.getName())); -140 } -141for (String m : project.getModules()) { -142for (MavenProject mod : getReactorProjects()) { -143try { -144 File mpp = new File(project.getBasedir(), m); -145 mpp = mpp.getCanonicalFile(); -146if (mpp.compareTo(mod.getBasedir()) == 0 && descendants.add(mod)) { -147if (getLog().isDebugEnabled()) { -148 getLog().debug(String.format("Decendent module %s added", mod.getName())); -149 } -150 } -151 } catch (IOException ex) { -152if (getLog().isDebugEnabled()) { -153 getLog().debug("Unable to determine module path", ex); -154 } -155 } -156 } -157 } -158do { -159 size = descendants.size(); -160for (MavenProject p : getReactorProjects()) { -161if (project.equals(p.getParent()) || descendants.contains(p.getParent())) { -162if (descendants.add(p)) { -163if (getLog().isDebugEnabled()) { -164 getLog().debug(String.format("Decendent %s added", p.getName())); -165 } +32import org.apache.maven.plugins.annotations.Parameter; +33import org.apache.maven.plugins.annotations.ResolutionScope; +34import org.apache.maven.project.MavenProject; +35import org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzer; +36import org.owasp.dependencycheck.analyzer.exception.AnalysisException; +37import org.owasp.dependencycheck.data.nvdcve.DatabaseException; +38import org.owasp.dependencycheck.dependency.Dependency; +39import org.owasp.dependencycheck.utils.Settings; +40 +41/** +42 * Maven Plugin that checks project dependencies and the dependencies of all child modules to see if they have any known published +43 * vulnerabilities. +44 * +45 * @author Jeremy Long +46 */ +47 @Mojo( +48 name = "aggregate", +49 defaultPhase = LifecyclePhase.VERIFY, +50/*aggregator = true,*/ +51 threadSafe = true, +52 requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, +53 requiresOnline = true +54 ) +55publicclassAggregateMojoextendsBaseDependencyCheckMojo { +56 +57/** +58 * Executes the aggregate dependency-check goal. This runs dependency-check and generates the subsequent reports. +59 * +60 * @throws MojoExecutionException thrown if there is ane exception running the mojo +61 * @throws MojoFailureException thrown if dependency-check is configured to fail the build +62 */ +63 @Override +64publicvoid runCheck() throws MojoExecutionException, MojoFailureException { +65finalEngine engine = generateDataFile(); +66 +67if (getProject() == getReactorProjects().get(getReactorProjects().size() - 1)) { +68 +69//ensure that the .ser file was created for each. +70for (MavenProject current : getReactorProjects()) { +71final File dataFile = getDataFile(current); +72if (dataFile == null) { //dc was never run on this project. write the ser to the target. +73 getLog().error(String.format("Module '%s' did not execute dependency-check; an attempt will be made to perform " +74 + "the check but dependencies may be missed resulting in false negatives.", current.getName())); +75 generateDataFile(engine, current); +76 } +77 } +78 +79for (MavenProject current : getReactorProjects()) { +80 List<Dependency> dependencies = readDataFile(current); +81if (dependencies == null) { +82 dependencies = new ArrayList<Dependency>(); +83 } +84final Set<MavenProject> childProjects = getDescendants(current); +85for (MavenProject reportOn : childProjects) { +86final List<Dependency> childDeps = readDataFile(reportOn); +87if (childDeps != null && !childDeps.isEmpty()) { +88if (getLog().isDebugEnabled()) { +89 getLog().debug(String.format("Adding %d dependencies from %s", childDeps.size(), reportOn.getName())); +90 } +91 dependencies.addAll(childDeps); +92 } else { +93if (getLog().isDebugEnabled()) { +94 getLog().debug(String.format("No dependencies read for %s", reportOn.getName())); +95 } +96 } +97 } +98 engine.getDependencies().clear(); +99 engine.getDependencies().addAll(dependencies); +100final DependencyBundlingAnalyzer bundler = new DependencyBundlingAnalyzer(); +101try { +102if (getLog().isDebugEnabled()) { +103 getLog().debug(String.format("Dependency count pre-bundler: %s", engine.getDependencies().size())); +104 } +105 bundler.analyze(null, engine); +106if (getLog().isDebugEnabled()) { +107 getLog().debug(String.format("Dependency count post-bundler: %s", engine.getDependencies().size())); +108 } +109 } catch (AnalysisException ex) { +110 getLog().warn("An error occured grouping the dependencies; duplicate entries may exist in the report", ex); +111 getLog().debug("Bundling Exception", ex); +112 } +113 +114 File outputDir = getCorrectOutputDirectory(current); +115if (outputDir == null) { +116//in some regards we shouldn't be writting this, but we are anyway. +117//we shouldn't write this because nothing is configured to generate this report. +118 outputDir = new File(current.getBuild().getDirectory()); +119 } +120 writeReports(engine, current, outputDir); +121 } +122 } +123 engine.cleanup(); +124 Settings.cleanup(); +125 } +126 +127/** +128 * Returns a set containing all the descendant projects of the given project. +129 * +130 * @param project the project for which all descendants will be returned +131 * @return the set of descendant projects +132 */ +133protected Set<MavenProject> getDescendants(MavenProject project) { +134if (project == null) { +135return Collections.emptySet(); +136 } +137final Set<MavenProject> descendants = new HashSet<MavenProject>(); +138int size = 0; +139if (getLog().isDebugEnabled()) { +140 getLog().debug(String.format("Collecting descendants of %s", project.getName())); +141 } +142for (String m : project.getModules()) { +143for (MavenProject mod : getReactorProjects()) { +144try { +145 File mpp = new File(project.getBasedir(), m); +146 mpp = mpp.getCanonicalFile(); +147if (mpp.compareTo(mod.getBasedir()) == 0 && descendants.add(mod) +148 && getLog().isDebugEnabled()) { +149 getLog().debug(String.format("Decendent module %s added", mod.getName())); +150 +151 } +152 } catch (IOException ex) { +153if (getLog().isDebugEnabled()) { +154 getLog().debug("Unable to determine module path", ex); +155 } +156 } +157 } +158 } +159do { +160 size = descendants.size(); +161for (MavenProject p : getReactorProjects()) { +162if (project.equals(p.getParent()) || descendants.contains(p.getParent())) { +163if (descendants.add(p) && getLog().isDebugEnabled()) { +164 getLog().debug(String.format("Decendent %s added", p.getName())); +165166 } 167for (MavenProject modTest : getReactorProjects()) { 168if (p.getModules() != null && p.getModules().contains(modTest.getName()) -169 && descendants.add(modTest)) { -170if (getLog().isDebugEnabled()) { -171 getLog().debug(String.format("Decendent %s added", modTest.getName())); -172 } -173 } -174 } -175 } +169 && descendants.add(modTest) +170 && getLog().isDebugEnabled()) { +171 getLog().debug(String.format("Decendent %s added", modTest.getName())); +172 } +173 } +174 } +175final Set<MavenProject> addedDescendants = new HashSet<MavenProject>(); 176for (MavenProject dec : descendants) { 177for (String mod : dec.getModules()) { 178try { 179 File mpp = new File(dec.getBasedir(), mod); 180 mpp = mpp.getCanonicalFile(); -181if (mpp.compareTo(p.getBasedir()) == 0 && descendants.add(p)) { -182if (getLog().isDebugEnabled()) { -183 getLog().debug(String.format("Decendent module %s added", p.getName())); -184 } -185 } -186 } catch (IOException ex) { -187if (getLog().isDebugEnabled()) { -188 getLog().debug("Unable to determine module path", ex); -189 } -190 } -191 } -192 } -193 } -194 } while (size != 0 && size != descendants.size()); -195if (getLog().isDebugEnabled()) { -196 getLog().debug(String.format("%s has %d children", project, descendants.size())); -197 } -198return descendants; -199 } -200 -201/** -202 * Test if the project has pom packaging -203 * -204 * @param mavenProject Project to test -205 * @return <code>true</code> if it has a pom packaging; otherwise <code>false</code> -206 */ -207protectedboolean isMultiModule(MavenProject mavenProject) { -208return"pom".equals(mavenProject.getPackaging()); -209 } -210 -211/** -212 * Initilizes the engine, runs a scan, and writes the serialized dependencies to disk. -213 * -214 * @return the Engine used to execute dependency-check -215 * @throws MojoExecutionException thrown if there is an exception running the mojo -216 * @throws MojoFailureException thrown if dependency-check is configured to fail the build if severe CVEs are identified. -217 */ -218protectedEngine generateDataFile() throws MojoExecutionException, MojoFailureException { -219finalEngine engine; -220try { -221 engine = initializeEngine(); -222 } catch (DatabaseException ex) { -223if (getLog().isDebugEnabled()) { -224 getLog().debug("Database connection error", ex); -225 } -226thrownew MojoExecutionException("An exception occured connecting to the local database. Please see the log file for more details.", ex); -227 } -228return generateDataFile(engine, getProject()); -229 } -230 -231/** -232 * Runs dependency-check's Engine and writes the serialized dependencies to disk. -233 * -234 * @param engine the Engine to use when scanning. -235 * @param project the project to scan and generate the data file for -236 * @return the Engine used to execute dependency-check -237 * @throws MojoExecutionException thrown if there is an exception running the mojo -238 * @throws MojoFailureException thrown if dependency-check is configured to fail the build if severe CVEs are identified. -239 */ -240protectedEngine generateDataFile(Engine engine, MavenProject project) throws MojoExecutionException, MojoFailureException { -241if (getLog().isDebugEnabled()) { -242 getLog().debug(String.format("Begin Scanning: %s", project.getName())); -243 } -244 engine.getDependencies().clear(); -245 engine.resetFileTypeAnalyzers(); -246 scanArtifacts(project, engine); -247 engine.analyzeDependencies(); -248final File target = new File(project.getBuild().getDirectory()); -249 writeDataFile(project, target, engine.getDependencies()); -250 showSummary(project, engine.getDependencies()); -251 checkForFailure(engine.getDependencies()); -252return engine; -253 } -254 -255 @Override -256publicboolean canGenerateReport() { -257returntrue; //aggregate always returns true for now - we can look at a more complicated/acurate solution later -258 } -259 -260/** -261 * Returns the report name. -262 * -263 * @param locale the location -264 * @return the report name +181if (mpp.compareTo(p.getBasedir()) == 0) { +182 addedDescendants.add(p); +183 } +184 } catch (IOException ex) { +185if (getLog().isDebugEnabled()) { +186 getLog().debug("Unable to determine module path", ex); +187 } +188 } +189 } +190 } +191for (MavenProject addedDescendant : addedDescendants) { +192if (descendants.add(addedDescendant) && getLog().isDebugEnabled()) { +193 getLog().debug(String.format("Decendent module %s added", addedDescendant.getName())); +194 } +195 } +196 } +197 } while (size != 0 && size != descendants.size()); +198if (getLog().isDebugEnabled()) { +199 getLog().debug(String.format("%s has %d children", project, descendants.size())); +200 } +201return descendants; +202 } +203 +204/** +205 * Test if the project has pom packaging +206 * +207 * @param mavenProject Project to test +208 * @return <code>true</code> if it has a pom packaging; otherwise <code>false</code> +209 */ +210protectedboolean isMultiModule(MavenProject mavenProject) { +211return"pom".equals(mavenProject.getPackaging()); +212 } +213 +214/** +215 * Initilizes the engine, runs a scan, and writes the serialized dependencies to disk. +216 * +217 * @return the Engine used to execute dependency-check +218 * @throws MojoExecutionException thrown if there is an exception running the mojo +219 * @throws MojoFailureException thrown if dependency-check is configured to fail the build if severe CVEs are identified. +220 */ +221protectedEngine generateDataFile() throws MojoExecutionException, MojoFailureException { +222finalEngine engine; +223try { +224 engine = initializeEngine(); +225 } catch (DatabaseException ex) { +226if (getLog().isDebugEnabled()) { +227 getLog().debug("Database connection error", ex); +228 } +229thrownew MojoExecutionException("An exception occured connecting to the local database. Please see the log file for more details.", ex); +230 } +231return generateDataFile(engine, getProject()); +232 } +233 +234/** +235 * Runs dependency-check's Engine and writes the serialized dependencies to disk. +236 * +237 * @param engine the Engine to use when scanning. +238 * @param project the project to scan and generate the data file for +239 * @return the Engine used to execute dependency-check +240 * @throws MojoExecutionException thrown if there is an exception running the mojo +241 * @throws MojoFailureException thrown if dependency-check is configured to fail the build if severe CVEs are identified. +242 */ +243protectedEngine generateDataFile(Engine engine, MavenProject project) throws MojoExecutionException, MojoFailureException { +244if (getLog().isDebugEnabled()) { +245 getLog().debug(String.format("Begin Scanning: %s", project.getName())); +246 } +247 engine.getDependencies().clear(); +248 engine.resetFileTypeAnalyzers(); +249 scanArtifacts(project, engine); +250 engine.analyzeDependencies(); +251final File target = new File(project.getBuild().getDirectory()); +252 writeDataFile(project, target, engine.getDependencies()); +253 showSummary(project, engine.getDependencies()); +254 checkForFailure(engine.getDependencies()); +255return engine; +256 } +257 +258 @Override +259publicboolean canGenerateReport() { +260returntrue; //aggregate always returns true for now - we can look at a more complicated/acurate solution later +261 } +262 +263/** +264 * The name of the report in the site.265 */ -266 @Override -267public String getName(Locale locale) { -268return"dependency-check:aggregate"; -269 } -270 -271/** -272 * Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page. -273 * -274 * @param locale The Locale to get the description for -275 * @return the description -276 */ -277 @Override -278public String getDescription(Locale locale) { -279return"Generates an aggregate report of all child Maven projects providing details on any " -280 + "published vulnerabilities within project dependencies. This report is a best " -281 + "effort and may contain false positives and false negatives."; -282 } -283 } +266 @SuppressWarnings("CanBeFinal") +267 @Parameter(property = "name", defaultValue = "dependency-check:aggregate", required = true) +268private String name = "dependency-check:aggregate"; +269 +270/** +271 * Returns the report name. +272 * +273 * @param locale the location +274 * @return the report name +275 */ +276 @Override +277public String getName(Locale locale) { +278return name; +279 } +280 +281/** +282 * Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page. +283 * +284 * @param locale The Locale to get the description for +285 * @return the description +286 */ +287 @Override +288public String getDescription(Locale locale) { +289return"Generates an aggregate report of all child Maven projects providing details on any " +290 + "published vulnerabilities within project dependencies. This report is a best " +291 + "effort and may contain false positives and false negatives."; +292 } +293 }
    diff --git a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.html b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.html index dfb427b4b..a538a14b4 100644 --- a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.html +++ b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.html @@ -34,995 +34,978 @@ 26import java.io.InputStream; 27import java.io.ObjectInputStream; 28import java.io.ObjectOutputStream; -29import java.io.OutputStream; -30import java.util.List; -31import java.util.Locale; -32import org.apache.maven.artifact.Artifact; -33import org.apache.maven.doxia.sink.Sink; -34import org.apache.maven.plugin.AbstractMojo; -35import org.apache.maven.plugin.MojoExecutionException; -36import org.apache.maven.plugin.MojoFailureException; -37import org.apache.maven.plugins.annotations.Parameter; -38import org.apache.maven.project.MavenProject; -39import org.apache.maven.reporting.MavenReport; -40import org.apache.maven.reporting.MavenReportException; -41import org.apache.maven.settings.Proxy; -42import org.owasp.dependencycheck.data.nexus.MavenArtifact; -43import org.owasp.dependencycheck.data.nvdcve.CveDB; -44import org.owasp.dependencycheck.data.nvdcve.DatabaseException; -45import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties; -46import org.owasp.dependencycheck.dependency.Confidence; -47import org.owasp.dependencycheck.dependency.Dependency; -48import org.owasp.dependencycheck.dependency.Identifier; -49import org.owasp.dependencycheck.dependency.Vulnerability; -50import org.owasp.dependencycheck.reporting.ReportGenerator; -51import org.owasp.dependencycheck.utils.Settings; -52 -53/** -54 * -55 * @author Jeremy Long -56 */ -57publicabstractclassBaseDependencyCheckMojoextends AbstractMojo implements MavenReport { -58 -59//<editor-fold defaultstate="collapsed" desc="Private fields"> -60/** -61 * The properties file location. -62 */ -63privatestaticfinal String PROPERTIES_FILE = "mojo.properties"; -64/** -65 * System specific new line character. -66 */ -67privatestaticfinal String NEW_LINE = System.getProperty("line.separator", "\n").intern(); -68/** -69 * Sets whether or not the external report format should be used. -70 */ -71 @Parameter(property = "metaFileName", defaultValue = "dependency-check.ser", required = true) -72private String dataFileName; -73 -74//</editor-fold> -75// <editor-fold defaultstate="collapsed" desc="Maven bound parameters and components"> -76/** -77 * The Maven Project Object. -78 */ -79 @Parameter(property = "project", required = true, readonly = true) -80private MavenProject project; -81/** -82 * List of Maven project of the current build -83 */ -84 @Parameter(readonly = true, required = true, property = "reactorProjects") -85private List<MavenProject> reactorProjects; -86 -87/** -88 * The output directory. This generally maps to "target". -89 */ -90 @Parameter(defaultValue = "${project.build.directory}", required = true) -91private File outputDirectory; -92/** -93 * Specifies the destination directory for the generated Dependency-Check report. This generally maps to "target/site". -94 */ -95 @Parameter(property = "project.reporting.outputDirectory", required = true) -96private File reportOutputDirectory; -97/** -98 * Specifies if the build should be failed if a CVSS score above a specified level is identified. The default is 11 which -99 * means since the CVSS scores are 0-10, by default the build will never fail. -100 */ -101 @SuppressWarnings("CanBeFinal") -102 @Parameter(property = "failBuildOnCVSS", defaultValue = "11", required = true) -103privatefloat failBuildOnCVSS = 11; -104/** -105 * Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not recommended that this be turned to false. Default -106 * is true. -107 */ -108 @SuppressWarnings("CanBeFinal") -109 @Parameter(property = "autoupdate", defaultValue = "true", required = true) -110privateboolean autoUpdate = true; -111/** -112 * Generate aggregate reports in multi-module projects. -113 * -114 * @deprecated use the aggregate goal instead -115 */ -116 @Parameter(property = "aggregate", defaultValue = "false") -117 @Deprecated -118privateboolean aggregate; -119/** -120 * The report format to be generated (HTML, XML, VULN, ALL). This configuration option has no affect if using this within the -121 * Site plug-in unless the externalReport is set to true. Default is HTML. -122 */ -123 @SuppressWarnings("CanBeFinal") -124 @Parameter(property = "format", defaultValue = "HTML", required = true) -125private String format = "HTML"; -126/** -127 * The Maven settings. -128 */ -129 @Parameter(property = "mavenSettings", defaultValue = "${settings}", required = false) -130private org.apache.maven.settings.Settings mavenSettings; -131 -132/** -133 * The maven settings proxy id. -134 */ -135 @SuppressWarnings("CanBeFinal") -136 @Parameter(property = "mavenSettingsProxyId", required = false) -137private String mavenSettingsProxyId; -138 -139/** -140 * The Connection Timeout. -141 */ -142 @SuppressWarnings("CanBeFinal") -143 @Parameter(property = "connectionTimeout", defaultValue = "", required = false) -144private String connectionTimeout = null; -145/** -146 * The path to the suppression file. -147 */ -148 @SuppressWarnings("CanBeFinal") -149 @Parameter(property = "suppressionFile", defaultValue = "", required = false) -150private String suppressionFile = null; -151/** -152 * Flag indicating whether or not to show a summary in the output. -153 */ -154 @SuppressWarnings("CanBeFinal") -155 @Parameter(property = "showSummary", defaultValue = "true", required = false) -156privateboolean showSummary = true; -157 -158/** -159 * Whether or not the Jar Analyzer is enabled. -160 */ -161 @SuppressWarnings("CanBeFinal") -162 @Parameter(property = "jarAnalyzerEnabled", defaultValue = "true", required = false) -163privateboolean jarAnalyzerEnabled = true; -164 -165/** -166 * Whether or not the Archive Analyzer is enabled. -167 */ -168 @SuppressWarnings("CanBeFinal") -169 @Parameter(property = "archiveAnalyzerEnabled", defaultValue = "true", required = false) -170privateboolean archiveAnalyzerEnabled = true; -171 -172/** -173 * Whether or not the .NET Assembly Analyzer is enabled. -174 */ -175 @SuppressWarnings("CanBeFinal") -176 @Parameter(property = "assemblyAnalyzerEnabled", defaultValue = "true", required = false) -177privateboolean assemblyAnalyzerEnabled = true; -178 -179/** -180 * Whether or not the .NET Nuspec Analyzer is enabled. -181 */ -182 @SuppressWarnings("CanBeFinal") -183 @Parameter(property = "nuspecAnalyzerEnabled", defaultValue = "true", required = false) -184privateboolean nuspecAnalyzerEnabled = true; -185 +29import java.util.List; +30import java.util.Locale; +31import org.apache.maven.artifact.Artifact; +32import org.apache.maven.doxia.sink.Sink; +33import org.apache.maven.plugin.AbstractMojo; +34import org.apache.maven.plugin.MojoExecutionException; +35import org.apache.maven.plugin.MojoFailureException; +36import org.apache.maven.plugins.annotations.Parameter; +37import org.apache.maven.project.MavenProject; +38import org.apache.maven.reporting.MavenReport; +39import org.apache.maven.reporting.MavenReportException; +40import org.apache.maven.settings.Proxy; +41import org.owasp.dependencycheck.data.nexus.MavenArtifact; +42import org.owasp.dependencycheck.data.nvdcve.CveDB; +43import org.owasp.dependencycheck.data.nvdcve.DatabaseException; +44import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties; +45import org.owasp.dependencycheck.dependency.Confidence; +46import org.owasp.dependencycheck.dependency.Dependency; +47import org.owasp.dependencycheck.dependency.Identifier; +48import org.owasp.dependencycheck.dependency.Vulnerability; +49import org.owasp.dependencycheck.reporting.ReportGenerator; +50import org.owasp.dependencycheck.utils.Settings; +51 +52/** +53 * +54 * @author Jeremy Long +55 */ +56publicabstractclassBaseDependencyCheckMojoextends AbstractMojo implements MavenReport { +57 +58//<editor-fold defaultstate="collapsed" desc="Private fields"> +59/** +60 * The properties file location. +61 */ +62privatestaticfinal String PROPERTIES_FILE = "mojo.properties"; +63/** +64 * System specific new line character. +65 */ +66privatestaticfinal String NEW_LINE = System.getProperty("line.separator", "\n").intern(); +67/** +68 * Sets whether or not the external report format should be used. +69 */ +70 @Parameter(property = "metaFileName", defaultValue = "dependency-check.ser", required = true) +71private String dataFileName; +72 +73//</editor-fold> +74// <editor-fold defaultstate="collapsed" desc="Maven bound parameters and components"> +75/** +76 * The Maven Project Object. +77 */ +78 @Parameter(property = "project", required = true, readonly = true) +79private MavenProject project; +80/** +81 * List of Maven project of the current build +82 */ +83 @Parameter(readonly = true, required = true, property = "reactorProjects") +84private List<MavenProject> reactorProjects; +85 +86/** +87 * The output directory. This generally maps to "target". +88 */ +89 @Parameter(defaultValue = "${project.build.directory}", required = true) +90private File outputDirectory; +91/** +92 * Specifies the destination directory for the generated Dependency-Check report. This generally maps to "target/site". +93 */ +94 @Parameter(property = "project.reporting.outputDirectory", required = true) +95private File reportOutputDirectory; +96/** +97 * Specifies if the build should be failed if a CVSS score above a specified level is identified. The default is 11 which +98 * means since the CVSS scores are 0-10, by default the build will never fail. +99 */ +100 @SuppressWarnings("CanBeFinal") +101 @Parameter(property = "failBuildOnCVSS", defaultValue = "11", required = true) +102privatefloat failBuildOnCVSS = 11; +103/** +104 * Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not recommended that this be turned to false. Default +105 * is true. +106 */ +107 @SuppressWarnings("CanBeFinal") +108 @Parameter(property = "autoupdate") +109private Boolean autoUpdate; +110/** +111 * Generate aggregate reports in multi-module projects. +112 * +113 * @deprecated use the aggregate goal instead +114 */ +115 @Parameter(property = "aggregate") +116 @Deprecated +117private Boolean aggregate; +118/** +119 * The report format to be generated (HTML, XML, VULN, ALL). This configuration option has no affect if using this within the +120 * Site plug-in unless the externalReport is set to true. Default is HTML. +121 */ +122 @SuppressWarnings("CanBeFinal") +123 @Parameter(property = "format", defaultValue = "HTML", required = true) +124private String format = "HTML"; +125/** +126 * The Maven settings. +127 */ +128 @Parameter(property = "mavenSettings", defaultValue = "${settings}", required = false) +129private org.apache.maven.settings.Settings mavenSettings; +130 +131/** +132 * The maven settings proxy id. +133 */ +134 @SuppressWarnings("CanBeFinal") +135 @Parameter(property = "mavenSettingsProxyId", required = false) +136private String mavenSettingsProxyId; +137 +138/** +139 * The Connection Timeout. +140 */ +141 @Parameter(property = "connectionTimeout", defaultValue = "", required = false) +142private String connectionTimeout; +143/** +144 * The path to the suppression file. +145 */ +146 @Parameter(property = "suppressionFile", defaultValue = "", required = false) +147private String suppressionFile; +148/** +149 * Flag indicating whether or not to show a summary in the output. +150 */ +151 @Parameter(property = "showSummary", defaultValue = "true", required = false) +152privateboolean showSummary = true; +153 +154/** +155 * Whether or not the Jar Analyzer is enabled. +156 */ +157 @Parameter(property = "jarAnalyzerEnabled", required = false) +158private Boolean jarAnalyzerEnabled; +159 +160/** +161 * Whether or not the Archive Analyzer is enabled. +162 */ +163 @Parameter(property = "archiveAnalyzerEnabled", required = false) +164private Boolean archiveAnalyzerEnabled; +165 +166/** +167 * Sets whether the Python Distribution Analyzer will be used. +168 */ +169 @Parameter(property = "pyDistributionAnalyzerEnabled", required = false) +170private Boolean pyDistributionAnalyzerEnabled; +171/** +172 * Sets whether the Python Package Analyzer will be used. +173 */ +174 @Parameter(property = "pyPackageAnalyzerEnabled", required = false) +175private Boolean pyPackageAnalyzerEnabled; +176/** +177 * Sets whether the Ruby Gemspec Analyzer will be used. +178 */ +179 @Parameter(property = "rubygemsAnalyzerEnabled", required = false) +180private Boolean rubygemsAnalyzerEnabled; +181/** +182 * Sets whether or not the openssl Analyzer should be used. +183 */ +184 @Parameter(property = "opensslAnalyzerEnabled", required = false) +185private Boolean opensslAnalyzerEnabled; 186/** -187 * Whether or not the Central Analyzer is enabled. +187 * Sets whether or not the CMake Analyzer should be used.188 */ -189 @SuppressWarnings("CanBeFinal") -190 @Parameter(property = "centralAnalyzerEnabled", defaultValue = "true", required = false) -191privateboolean centralAnalyzerEnabled = true; -192 -193/** -194 * Whether or not the Nexus Analyzer is enabled. -195 */ -196 @SuppressWarnings("CanBeFinal") -197 @Parameter(property = "nexusAnalyzerEnabled", defaultValue = "true", required = false) -198privateboolean nexusAnalyzerEnabled = true; -199 -200/** -201 * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local). -202 */ -203 @Parameter(property = "nexusUrl", defaultValue = "", required = false) -204private String nexusUrl; -205/** -206 * Whether or not the configured proxy is used to connect to Nexus. -207 */ -208 @Parameter(property = "nexusUsesProxy", defaultValue = "true", required = false) -209privateboolean nexusUsesProxy = true; -210/** -211 * The database connection string. -212 */ -213 @Parameter(property = "connectionString", defaultValue = "", required = false) -214private String connectionString; -215 -216/** -217 * Returns the connection string. -218 * -219 * @return the connection string -220 */ -221protected String getConnectionString() { -222return connectionString; -223 } -224/** -225 * The database driver name. An example would be org.h2.Driver. -226 */ -227 @Parameter(property = "databaseDriverName", defaultValue = "", required = false) -228private String databaseDriverName; -229/** -230 * The path to the database driver if it is not on the class path. -231 */ -232 @Parameter(property = "databaseDriverPath", defaultValue = "", required = false) -233private String databaseDriverPath; -234/** -235 * The database user name. -236 */ -237 @Parameter(property = "databaseUser", defaultValue = "", required = false) -238private String databaseUser; -239/** -240 * The password to use when connecting to the database. -241 */ -242 @Parameter(property = "databasePassword", defaultValue = "", required = false) -243private String databasePassword; -244/** -245 * A comma-separated list of file extensions to add to analysis next to jar, zip, .... -246 */ -247 @Parameter(property = "zipExtensions", required = false) -248private String zipExtensions; -249/** -250 * Skip Analysis for Test Scope Dependencies. +189 @Parameter(property = "cmakeAnalyzerEnabled", required = false) +190private Boolean cmakeAnalyzerEnabled; +191/** +192 * Sets whether or not the autoconf Analyzer should be used. +193 */ +194 @Parameter(property = "autoconfAnalyzerEnabled", required = false) +195private Boolean autoconfAnalyzerEnabled; +196/** +197 * Sets whether or not the PHP Composer Lock File Analyzer should be used. +198 */ +199 @Parameter(property = "composerAnalyzerEnabled", required = false) +200private Boolean composerAnalyzerEnabled; +201/** +202 * Sets whether or not the Node.js Analyzer should be used. +203 */ +204 @Parameter(property = "nodeAnalyzerEnabled", required = false) +205private Boolean nodeAnalyzerEnabled; +206 +207/** +208 * Whether or not the .NET Assembly Analyzer is enabled. +209 */ +210 @Parameter(property = "assemblyAnalyzerEnabled", required = false) +211private Boolean assemblyAnalyzerEnabled; +212 +213/** +214 * Whether or not the .NET Nuspec Analyzer is enabled. +215 */ +216 @Parameter(property = "nuspecAnalyzerEnabled", required = false) +217private Boolean nuspecAnalyzerEnabled; +218 +219/** +220 * Whether or not the Central Analyzer is enabled. +221 */ +222 @Parameter(property = "centralAnalyzerEnabled", required = false) +223private Boolean centralAnalyzerEnabled; +224 +225/** +226 * Whether or not the Nexus Analyzer is enabled. +227 */ +228 @Parameter(property = "nexusAnalyzerEnabled", required = false) +229private Boolean nexusAnalyzerEnabled; +230 +231/** +232 * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local). +233 */ +234 @Parameter(property = "nexusUrl", required = false) +235private String nexusUrl; +236/** +237 * Whether or not the configured proxy is used to connect to Nexus. +238 */ +239 @Parameter(property = "nexusUsesProxy", required = false) +240private Boolean nexusUsesProxy; +241/** +242 * The database connection string. +243 */ +244 @Parameter(property = "connectionString", defaultValue = "", required = false) +245private String connectionString; +246 +247/** +248 * Returns the connection string. +249 * +250 * @return the connection string251 */ -252 @SuppressWarnings("CanBeFinal") -253 @Parameter(property = "skipTestScope", defaultValue = "true", required = false) -254privateboolean skipTestScope = true; +252protected String getConnectionString() { +253return connectionString; +254 } 255/** -256 * Skip Analysis for Runtime Scope Dependencies. +256 * The database driver name. An example would be org.h2.Driver.257 */ -258 @SuppressWarnings("CanBeFinal") -259 @Parameter(property = "skipRuntimeScope", defaultValue = "false", required = false) -260privateboolean skipRuntimeScope = false; -261/** -262 * Skip Analysis for Provided Scope Dependencies. -263 */ -264 @SuppressWarnings("CanBeFinal") -265 @Parameter(property = "skipProvidedScope", defaultValue = "false", required = false) -266privateboolean skipProvidedScope = false; -267/** -268 * The data directory, hold DC SQL DB. -269 */ -270 @Parameter(property = "dataDirectory", defaultValue = "", required = false) -271private String dataDirectory; -272/** -273 * Data Mirror URL for CVE 1.2. -274 */ -275 @Parameter(property = "cveUrl12Modified", defaultValue = "", required = false) -276private String cveUrl12Modified; -277/** -278 * Data Mirror URL for CVE 2.0. -279 */ -280 @Parameter(property = "cveUrl20Modified", defaultValue = "", required = false) -281private String cveUrl20Modified; -282/** -283 * Base Data Mirror URL for CVE 1.2. -284 */ -285 @Parameter(property = "cveUrl12Base", defaultValue = "", required = false) -286private String cveUrl12Base; -287/** -288 * Data Mirror URL for CVE 2.0. -289 */ -290 @Parameter(property = "cveUrl20Base", defaultValue = "", required = false) -291private String cveUrl20Base; -292 -293/** -294 * The path to mono for .NET Assembly analysis on non-windows systems. -295 */ -296 @Parameter(property = "pathToMono", defaultValue = "", required = false) -297private String pathToMono; -298 -299/** -300 * The Proxy URL. -301 * -302 * @deprecated Please use mavenSettings instead -303 */ -304 @SuppressWarnings("CanBeFinal") -305 @Parameter(property = "proxyUrl", defaultValue = "", required = false) -306 @Deprecated -307private String proxyUrl = null; -308/** -309 * Sets whether or not the external report format should be used. -310 * -311 * @deprecated the internal report is no longer supported -312 */ -313 @SuppressWarnings("CanBeFinal") -314 @Parameter(property = "externalReport") -315 @Deprecated -316private String externalReport = null; -317// </editor-fold> -318//<editor-fold defaultstate="collapsed" desc="Base Maven implementation"> -319 -320/** -321 * Executes dependency-check. -322 * -323 * @throws MojoExecutionException thrown if there is an exception executing the mojo -324 * @throws MojoFailureException thrown if dependency-check failed the build -325 */ -326 @Override -327publicvoid execute() throws MojoExecutionException, MojoFailureException { -328 validateAggregate(); -329 project.setContextValue(getOutputDirectoryContextKey(), this.outputDirectory); -330 runCheck(); -331 } -332 -333/** -334 * Checks if the aggregate configuration parameter has been set to true. If it has a MojoExecutionException is thrown because -335 * the aggregate configuration parameter is no longer supported. -336 * -337 * @throws MojoExecutionException thrown if aggregate is set to true -338 */ -339privatevoid validateAggregate() throws MojoExecutionException { -340if (aggregate) { -341final String msg = "Aggregate configuration detected - as of dependency-check 1.2.8 this no longer supported. " -342 + "Please use the aggregate goal instead."; -343thrownew MojoExecutionException(msg); -344 } -345 } -346 -347/** -348 * Generates the Dependency-Check Site Report. -349 * -350 * @param sink the sink to write the report to -351 * @param locale the locale to use when generating the report -352 * @throws MavenReportException if a maven report exception occurs -353 * @deprecated use {@link #generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)} instead. +258 @Parameter(property = "databaseDriverName", defaultValue = "", required = false) +259private String databaseDriverName; +260/** +261 * The path to the database driver if it is not on the class path. +262 */ +263 @Parameter(property = "databaseDriverPath", defaultValue = "", required = false) +264private String databaseDriverPath; +265/** +266 * The database user name. +267 */ +268 @Parameter(property = "databaseUser", defaultValue = "", required = false) +269private String databaseUser; +270/** +271 * The password to use when connecting to the database. +272 */ +273 @Parameter(property = "databasePassword", defaultValue = "", required = false) +274private String databasePassword; +275/** +276 * A comma-separated list of file extensions to add to analysis next to jar, zip, .... +277 */ +278 @Parameter(property = "zipExtensions", required = false) +279private String zipExtensions; +280/** +281 * Skip Dependency Check altogether. +282 */ +283 @SuppressWarnings("CanBeFinal") +284 @Parameter(property = "dependency-check.skip", defaultValue = "false", required = false) +285privateboolean skip = false; +286/** +287 * Skip Analysis for Test Scope Dependencies. +288 */ +289 @SuppressWarnings("CanBeFinal") +290 @Parameter(property = "skipTestScope", defaultValue = "true", required = false) +291privateboolean skipTestScope = true; +292/** +293 * Skip Analysis for Runtime Scope Dependencies. +294 */ +295 @SuppressWarnings("CanBeFinal") +296 @Parameter(property = "skipRuntimeScope", defaultValue = "false", required = false) +297privateboolean skipRuntimeScope = false; +298/** +299 * Skip Analysis for Provided Scope Dependencies. +300 */ +301 @SuppressWarnings("CanBeFinal") +302 @Parameter(property = "skipProvidedScope", defaultValue = "false", required = false) +303privateboolean skipProvidedScope = false; +304/** +305 * The data directory, hold DC SQL DB. +306 */ +307 @Parameter(property = "dataDirectory", defaultValue = "", required = false) +308private String dataDirectory; +309/** +310 * Data Mirror URL for CVE 1.2. +311 */ +312 @Parameter(property = "cveUrl12Modified", defaultValue = "", required = false) +313private String cveUrl12Modified; +314/** +315 * Data Mirror URL for CVE 2.0. +316 */ +317 @Parameter(property = "cveUrl20Modified", defaultValue = "", required = false) +318private String cveUrl20Modified; +319/** +320 * Base Data Mirror URL for CVE 1.2. +321 */ +322 @Parameter(property = "cveUrl12Base", defaultValue = "", required = false) +323private String cveUrl12Base; +324/** +325 * Data Mirror URL for CVE 2.0. +326 */ +327 @Parameter(property = "cveUrl20Base", defaultValue = "", required = false) +328private String cveUrl20Base; +329/** +330 * Optionally skip excessive CVE update checks for a designated duration in hours. +331 */ +332 @Parameter(property = "cveValidForHours", defaultValue = "", required = false) +333private Integer cveValidForHours; +334 +335/** +336 * The path to mono for .NET Assembly analysis on non-windows systems. +337 */ +338 @Parameter(property = "pathToMono", defaultValue = "", required = false) +339private String pathToMono; +340 +341/** +342 * The Proxy URL. +343 * +344 * @deprecated Please use mavenSettings instead +345 */ +346 @SuppressWarnings("CanBeFinal") +347 @Parameter(property = "proxyUrl", defaultValue = "", required = false) +348 @Deprecated +349private String proxyUrl = null; +350/** +351 * Sets whether or not the external report format should be used. +352 * +353 * @deprecated the internal report is no longer supported354 */ -355 @Override -356 @Deprecated -357publicfinalvoid generate(@SuppressWarnings("deprecation") org.codehaus.doxia.sink.Sink sink, Locale locale) throws MavenReportException { -358 generate((Sink) sink, locale); -359 } -360 -361/** -362 * Generates the Dependency-Check Site Report. -363 * -364 * @param sink the sink to write the report to -365 * @param locale the locale to use when generating the report -366 * @throws MavenReportException if a maven report exception occurs +355 @SuppressWarnings("CanBeFinal") +356 @Parameter(property = "externalReport") +357 @Deprecated +358private String externalReport = null; +359// </editor-fold> +360//<editor-fold defaultstate="collapsed" desc="Base Maven implementation"> +361 +362/** +363 * Executes dependency-check. +364 * +365 * @throws MojoExecutionException thrown if there is an exception executing the mojo +366 * @throws MojoFailureException thrown if dependency-check failed the build367 */ -368publicvoid generate(Sink sink, Locale locale) throws MavenReportException { -369try { -370 validateAggregate(); -371 } catch (MojoExecutionException ex) { -372thrownew MavenReportException(ex.getMessage()); -373 } -374 project.setContextValue(getOutputDirectoryContextKey(), getReportOutputDirectory()); -375try { -376 runCheck(); -377 } catch (MojoExecutionException ex) { -378thrownew MavenReportException(ex.getMessage(), ex); -379 } catch (MojoFailureException ex) { -380 getLog().warn("Vulnerabilities were identifies that exceed the CVSS threshold for failing the build"); -381 } -382 } -383 -384/** -385 * Returns the correct output directory depending on if a site is being executed or not. -386 * -387 * @return the directory to write the report(s) -388 * @throws MojoExecutionException thrown if there is an error loading the file path -389 */ -390protected File getCorrectOutputDirectory() throws MojoExecutionException { -391return getCorrectOutputDirectory(this.project); -392 } -393 -394/** -395 * Returns the correct output directory depending on if a site is being executed or not. -396 * -397 * @param current the Maven project to get the output directory from -398 * @return the directory to write the report(s) -399 */ -400protected File getCorrectOutputDirectory(MavenProject current) { -401final Object obj = current.getContextValue(getOutputDirectoryContextKey()); -402if (obj != null && obj instanceof File) { -403return (File) obj; -404 } -405 File target = new File(current.getBuild().getDirectory()); -406if (target.getParentFile() != null && "target".equals(target.getParentFile().getName())) { -407 target = target.getParentFile(); -408 } -409return target; -410 } -411 -412/** -413 * Returns the correct output directory depending on if a site is being executed or not. -414 * -415 * @param current the Maven project to get the output directory from -416 * @return the directory to write the report(s) -417 */ -418protected File getDataFile(MavenProject current) { -419if (getLog().isDebugEnabled()) { -420 getLog().debug(String.format("Getting data filefor %s using key '%s'", current.getName(), getDataFileContextKey())); -421 } -422final Object obj = current.getContextValue(getDataFileContextKey()); -423if (obj != null) { -424if (obj instanceof String) { -425final File f = new File((String) obj); -426return f; -427 } -428 } else { -429if (getLog().isDebugEnabled()) { -430 getLog().debug("Context value not found"); -431 } -432 } -433returnnull; -434 } -435 -436/** -437 * Scans the project's artifacts and adds them to the engine's dependency list. -438 * -439 * @param project the project to scan the dependencies of -440 * @param engine the engine to use to scan the dependencies -441 */ -442protectedvoid scanArtifacts(MavenProject project, Engine engine) { -443for (Artifact a : project.getArtifacts()) { -444if (excludeFromScan(a)) { -445continue; -446 } -447final List<Dependency> deps = engine.scan(a.getFile().getAbsoluteFile()); -448if (deps != null) { -449if (deps.size() == 1) { -450final Dependency d = deps.get(0); -451if (d != null) { -452final MavenArtifact ma = new MavenArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion()); -453 d.addAsEvidence("pom", ma, Confidence.HIGHEST); -454 d.addProjectReference(project.getName()); -455if (getLog().isDebugEnabled()) { -456 getLog().debug(String.format("Adding project reference %s on dependency %s", project.getName(), -457 d.getDisplayFileName())); -458 } -459 } -460 } else { -461if (getLog().isDebugEnabled()) { -462final String msg = String.format("More then 1 dependency was identified in first pass scan of '%s:%s:%s'", -463 a.getGroupId(), a.getArtifactId(), a.getVersion()); -464 getLog().debug(msg); -465 } -466 } -467 } -468 } -469 } -470 -471/** -472 * Executes the dependency-check scan and generates the necassary report. -473 * -474 * @throws MojoExecutionException thrown if there is an exception running the scan -475 * @throws MojoFailureException thrown if dependency-check is configured to fail the build -476 */ -477publicabstractvoid runCheck() throws MojoExecutionException, MojoFailureException; -478 -479/** -480 * Sets the Reporting output directory. -481 * -482 * @param directory the output directory -483 */ -484 @Override -485publicvoid setReportOutputDirectory(File directory) { -486 reportOutputDirectory = directory; -487 } -488 -489/** -490 * Returns the report output directory. -491 * -492 * @return the report output directory -493 */ -494 @Override -495public File getReportOutputDirectory() { -496return reportOutputDirectory; -497 } -498 -499/** -500 * Returns the output directory. -501 * -502 * @return the output directory -503 */ -504public File getOutputDirectory() { -505return outputDirectory; -506 } -507 -508/** -509 * Returns whether this is an external report. This method always returns true. -510 * -511 * @return <code>true</code> -512 */ -513 @Override -514publicfinalboolean isExternalReport() { -515returntrue; -516 } -517 -518/** -519 * Returns the output name. -520 * -521 * @return the output name +368 @Override +369publicvoid execute() throws MojoExecutionException, MojoFailureException { +370if (skip) { +371 getLog().info("Skipping " + getName(Locale.US)); +372 } else { +373 validateAggregate(); +374 project.setContextValue(getOutputDirectoryContextKey(), this.outputDirectory); +375 runCheck(); +376 } +377 } +378 +379/** +380 * Checks if the aggregate configuration parameter has been set to true. If it has a MojoExecutionException is thrown because +381 * the aggregate configuration parameter is no longer supported. +382 * +383 * @throws MojoExecutionException thrown if aggregate is set to true +384 */ +385privatevoid validateAggregate() throws MojoExecutionException { +386if (aggregate != null && aggregate) { +387final String msg = "Aggregate configuration detected - as of dependency-check 1.2.8 this no longer supported. " +388 + "Please use the aggregate goal instead."; +389thrownew MojoExecutionException(msg); +390 } +391 } +392 +393/** +394 * Generates the Dependency-Check Site Report. +395 * +396 * @param sink the sink to write the report to +397 * @param locale the locale to use when generating the report +398 * @throws MavenReportException if a maven report exception occurs +399 * @deprecated use {@link #generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)} instead. +400 */ +401 @Override +402 @Deprecated +403publicfinalvoid generate(@SuppressWarnings("deprecation") org.codehaus.doxia.sink.Sink sink, Locale locale) throws MavenReportException { +404 generate((Sink) sink, locale); +405 } +406 +407/** +408 * Generates the Dependency-Check Site Report. +409 * +410 * @param sink the sink to write the report to +411 * @param locale the locale to use when generating the report +412 * @throws MavenReportException if a maven report exception occurs +413 */ +414publicvoid generate(Sink sink, Locale locale) throws MavenReportException { +415try { +416 validateAggregate(); +417 } catch (MojoExecutionException ex) { +418thrownew MavenReportException(ex.getMessage()); +419 } +420 project.setContextValue(getOutputDirectoryContextKey(), getReportOutputDirectory()); +421try { +422 runCheck(); +423 } catch (MojoExecutionException ex) { +424thrownew MavenReportException(ex.getMessage(), ex); +425 } catch (MojoFailureException ex) { +426 getLog().warn("Vulnerabilities were identifies that exceed the CVSS threshold for failing the build"); +427 } +428 } +429 +430/** +431 * Returns the correct output directory depending on if a site is being executed or not. +432 * +433 * @return the directory to write the report(s) +434 * @throws MojoExecutionException thrown if there is an error loading the file path +435 */ +436protected File getCorrectOutputDirectory() throws MojoExecutionException { +437return getCorrectOutputDirectory(this.project); +438 } +439 +440/** +441 * Returns the correct output directory depending on if a site is being executed or not. +442 * +443 * @param current the Maven project to get the output directory from +444 * @return the directory to write the report(s) +445 */ +446protected File getCorrectOutputDirectory(MavenProject current) { +447final Object obj = current.getContextValue(getOutputDirectoryContextKey()); +448if (obj != null && obj instanceof File) { +449return (File) obj; +450 } +451 File target = new File(current.getBuild().getDirectory()); +452if (target.getParentFile() != null && "target".equals(target.getParentFile().getName())) { +453 target = target.getParentFile(); +454 } +455return target; +456 } +457 +458/** +459 * Returns the correct output directory depending on if a site is being executed or not. +460 * +461 * @param current the Maven project to get the output directory from +462 * @return the directory to write the report(s) +463 */ +464protected File getDataFile(MavenProject current) { +465if (getLog().isDebugEnabled()) { +466 getLog().debug(String.format("Getting data filefor %s using key '%s'", current.getName(), getDataFileContextKey())); +467 } +468final Object obj = current.getContextValue(getDataFileContextKey()); +469if (obj != null) { +470if (obj instanceof String) { +471final File f = new File((String) obj); +472return f; +473 } +474 } else { +475if (getLog().isDebugEnabled()) { +476 getLog().debug("Context value not found"); +477 } +478 } +479returnnull; +480 } +481 +482/** +483 * Scans the project's artifacts and adds them to the engine's dependency list. +484 * +485 * @param project the project to scan the dependencies of +486 * @param engine the engine to use to scan the dependencies +487 */ +488protectedvoid scanArtifacts(MavenProject project, Engine engine) { +489for (Artifact a : project.getArtifacts()) { +490if (excludeFromScan(a)) { +491continue; +492 } +493final List<Dependency> deps = engine.scan(a.getFile().getAbsoluteFile()); +494if (deps != null) { +495if (deps.size() == 1) { +496final Dependency d = deps.get(0); +497if (d != null) { +498final MavenArtifact ma = new MavenArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion()); +499 d.addAsEvidence("pom", ma, Confidence.HIGHEST); +500 d.addProjectReference(project.getName()); +501if (getLog().isDebugEnabled()) { +502 getLog().debug(String.format("Adding project reference %s on dependency %s", project.getName(), +503 d.getDisplayFileName())); +504 } +505 } +506 } else { +507if (getLog().isDebugEnabled()) { +508final String msg = String.format("More then 1 dependency was identified in first pass scan of '%s:%s:%s'", +509 a.getGroupId(), a.getArtifactId(), a.getVersion()); +510 getLog().debug(msg); +511 } +512 } +513 } +514 } +515 } +516 +517/** +518 * Executes the dependency-check scan and generates the necassary report. +519 * +520 * @throws MojoExecutionException thrown if there is an exception running the scan +521 * @throws MojoFailureException thrown if dependency-check is configured to fail the build522 */ -523 @Override -524public String getOutputName() { -525if ("HTML".equalsIgnoreCase(this.format) || "ALL".equalsIgnoreCase(this.format)) { -526return"dependency-check-report"; -527 } elseif ("XML".equalsIgnoreCase(this.format)) { -528return"dependency-check-report.xml#"; -529 } elseif ("VULN".equalsIgnoreCase(this.format)) { -530return"dependency-check-vulnerability"; -531 } else { -532 getLog().warn("Unknown report format used during site generation."); -533return"dependency-check-report"; -534 } -535 } -536 -537/** -538 * Returns the category name. -539 * -540 * @return the category name -541 */ -542 @Override -543public String getCategoryName() { -544return MavenReport.CATEGORY_PROJECT_REPORTS; -545 } -546//</editor-fold> -547 -548/** -549 * Initializes a new <code>Engine</code> that can be used for scanning. -550 * -551 * @return a newly instantiated <code>Engine</code> -552 * @throws DatabaseException thrown if there is a database exception -553 */ -554protectedEngine initializeEngine() throws DatabaseException { -555 populateSettings(); -556returnnewEngine(this.project, -557this.reactorProjects); -558 } -559 -560/** -561 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties -562 * required to change the proxy url, port, and connection timeout. -563 */ -564protectedvoid populateSettings() { -565 Settings.initialize(); -566 InputStream mojoProperties = null; -567try { -568 mojoProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE); -569 Settings.mergeProperties(mojoProperties); -570 } catch (IOException ex) { -571 getLog().warn("Unable to load the dependency-check ant task.properties file."); -572if (getLog().isDebugEnabled()) { -573 getLog().debug("", ex); -574 } -575 } finally { -576if (mojoProperties != null) { -577try { -578 mojoProperties.close(); -579 } catch (IOException ex) { -580if (getLog().isDebugEnabled()) { -581 getLog().debug("", ex); -582 } -583 } -584 } -585 } -586 -587 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); -588if (externalReport != null) { -589 getLog().warn("The 'externalReport' option was set; this configuration option has been removed. " -590 + "Please update the dependency-check-maven plugin's configuration"); -591 } -592 -593if (proxyUrl != null && !proxyUrl.isEmpty()) { -594 getLog().warn("Deprecated configuration detected, proxyUrl will be ignored; use the maven settings " + "to configure the proxy instead"); -595 } -596final Proxy proxy = getMavenProxy(); -597if (proxy != null) { -598 Settings.setString(Settings.KEYS.PROXY_SERVER, proxy.getHost()); -599 Settings.setString(Settings.KEYS.PROXY_PORT, Integer.toString(proxy.getPort())); -600final String userName = proxy.getUsername(); -601final String password = proxy.getPassword(); -602if (userName != null) { -603 Settings.setString(Settings.KEYS.PROXY_USERNAME, userName); -604 } -605if (password != null) { -606 Settings.setString(Settings.KEYS.PROXY_PASSWORD, password); -607 } -608 -609 } -610 -611if (connectionTimeout != null && !connectionTimeout.isEmpty()) { -612 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); -613 } -614if (suppressionFile != null && !suppressionFile.isEmpty()) { -615 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); -616 } -617 -618//File Type Analyzer Settings -619//JAR ANALYZER -620 Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled); -621//NUSPEC ANALYZER -622 Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled); -623//NEXUS ANALYZER -624 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); -625//NEXUS ANALYZER -626 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); -627if (nexusUrl != null && !nexusUrl.isEmpty()) { -628 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); -629 } -630 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy); -631//ARCHIVE ANALYZER -632 Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled); -633if (zipExtensions != null && !zipExtensions.isEmpty()) { -634 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); -635 } -636//ASSEMBLY ANALYZER -637 Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled); -638if (pathToMono != null && !pathToMono.isEmpty()) { -639 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); -640 } -641 -642//Database configuration -643if (databaseDriverName != null && !databaseDriverName.isEmpty()) { -644 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); -645 } -646if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) { -647 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); -648 } -649if (connectionString != null && !connectionString.isEmpty()) { -650 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString); -651 } -652if (databaseUser != null && !databaseUser.isEmpty()) { -653 Settings.setString(Settings.KEYS.DB_USER, databaseUser); -654 } -655if (databasePassword != null && !databasePassword.isEmpty()) { -656 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword); -657 } -658// Data Directory -659if (dataDirectory != null && !dataDirectory.isEmpty()) { -660 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory); -661 } -662 -663// Scope Exclusion -664 Settings.setBoolean(Settings.KEYS.SKIP_TEST_SCOPE, skipTestScope); -665 Settings.setBoolean(Settings.KEYS.SKIP_RUNTIME_SCOPE, skipRuntimeScope); -666 Settings.setBoolean(Settings.KEYS.SKIP_PROVIDED_SCOPE, skipProvidedScope); -667 -668// CVE Data Mirroring -669if (cveUrl12Modified != null && !cveUrl12Modified.isEmpty()) { -670 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); -671 } -672if (cveUrl20Modified != null && !cveUrl20Modified.isEmpty()) { -673 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); -674 } -675if (cveUrl12Base != null && !cveUrl12Base.isEmpty()) { -676 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); -677 } -678if (cveUrl20Base != null && !cveUrl20Base.isEmpty()) { -679 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); -680 } -681 } +523publicabstractvoid runCheck() throws MojoExecutionException, MojoFailureException; +524 +525/** +526 * Sets the Reporting output directory. +527 * +528 * @param directory the output directory +529 */ +530 @Override +531publicvoid setReportOutputDirectory(File directory) { +532 reportOutputDirectory = directory; +533 } +534 +535/** +536 * Returns the report output directory. +537 * +538 * @return the report output directory +539 */ +540 @Override +541public File getReportOutputDirectory() { +542return reportOutputDirectory; +543 } +544 +545/** +546 * Returns the output directory. +547 * +548 * @return the output directory +549 */ +550public File getOutputDirectory() { +551return outputDirectory; +552 } +553 +554/** +555 * Returns whether this is an external report. This method always returns true. +556 * +557 * @return <code>true</code> +558 */ +559 @Override +560publicfinalboolean isExternalReport() { +561returntrue; +562 } +563 +564/** +565 * Returns the output name. +566 * +567 * @return the output name +568 */ +569 @Override +570public String getOutputName() { +571if ("HTML".equalsIgnoreCase(this.format) || "ALL".equalsIgnoreCase(this.format)) { +572return"dependency-check-report"; +573 } elseif ("XML".equalsIgnoreCase(this.format)) { +574return"dependency-check-report.xml#"; +575 } elseif ("VULN".equalsIgnoreCase(this.format)) { +576return"dependency-check-vulnerability"; +577 } else { +578 getLog().warn("Unknown report format used during site generation."); +579return"dependency-check-report"; +580 } +581 } +582 +583/** +584 * Returns the category name. +585 * +586 * @return the category name +587 */ +588 @Override +589public String getCategoryName() { +590return MavenReport.CATEGORY_PROJECT_REPORTS; +591 } +592//</editor-fold> +593 +594/** +595 * Initializes a new <code>Engine</code> that can be used for scanning. +596 * +597 * @return a newly instantiated <code>Engine</code> +598 * @throws DatabaseException thrown if there is a database exception +599 */ +600protectedEngine initializeEngine() throws DatabaseException { +601 populateSettings(); +602returnnewEngine(this.project, +603this.reactorProjects); +604 } +605 +606/** +607 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties +608 * required to change the proxy url, port, and connection timeout. +609 */ +610protectedvoid populateSettings() { +611 Settings.initialize(); +612 InputStream mojoProperties = null; +613try { +614 mojoProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE); +615 Settings.mergeProperties(mojoProperties); +616 } catch (IOException ex) { +617 getLog().warn("Unable to load the dependency-check ant task.properties file."); +618if (getLog().isDebugEnabled()) { +619 getLog().debug("", ex); +620 } +621 } finally { +622if (mojoProperties != null) { +623try { +624 mojoProperties.close(); +625 } catch (IOException ex) { +626if (getLog().isDebugEnabled()) { +627 getLog().debug("", ex); +628 } +629 } +630 } +631 } +632 Settings.setBooleanIfNotNull(Settings.KEYS.AUTO_UPDATE, autoUpdate); +633 +634if (externalReport != null) { +635 getLog().warn("The 'externalReport' option was set; this configuration option has been removed. " +636 + "Please update the dependency-check-maven plugin's configuration"); +637 } +638 +639if (proxyUrl != null && !proxyUrl.isEmpty()) { +640 getLog().warn("Deprecated configuration detected, proxyUrl will be ignored; use the maven settings " + "to configure the proxy instead"); +641 } +642final Proxy proxy = getMavenProxy(); +643if (proxy != null) { +644 Settings.setString(Settings.KEYS.PROXY_SERVER, proxy.getHost()); +645 Settings.setString(Settings.KEYS.PROXY_PORT, Integer.toString(proxy.getPort())); +646final String userName = proxy.getUsername(); +647final String password = proxy.getPassword(); +648 Settings.setStringIfNotNull(Settings.KEYS.PROXY_USERNAME, userName); +649 Settings.setStringIfNotNull(Settings.KEYS.PROXY_PASSWORD, password); +650 } +651 +652 Settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); +653 Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); +654 +655//File Type Analyzer Settings +656 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled); +657 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled); +658 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); +659 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); +660 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); +661 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy); +662 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled); +663 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled); +664 Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); +665 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); +666 +667 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, pyDistributionAnalyzerEnabled); +668 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, pyPackageAnalyzerEnabled); +669 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, rubygemsAnalyzerEnabled); +670 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, opensslAnalyzerEnabled); +671 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CMAKE_ENABLED, cmakeAnalyzerEnabled); +672 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, autoconfAnalyzerEnabled); +673 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, composerAnalyzerEnabled); +674 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, nodeAnalyzerEnabled); +675 +676//Database configuration +677 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); +678 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); +679 Settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString); +680 Settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser); +681 Settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword); 682 -683/** -684 * Returns the maven proxy. -685 * -686 * @return the maven proxy -687 */ -688private Proxy getMavenProxy() { -689if (mavenSettings != null) { -690final List<Proxy> proxies = mavenSettings.getProxies(); -691if (proxies != null && !proxies.isEmpty()) { -692if (mavenSettingsProxyId != null) { -693for (Proxy proxy : proxies) { -694if (mavenSettingsProxyId.equalsIgnoreCase(proxy.getId())) { -695return proxy; -696 } -697 } -698 } elseif (proxies.size() == 1) { -699return proxies.get(0); -700 } else { -701 getLog().warn("Multiple proxy definitions exist in the Maven settings. In the dependency-check " -702 + "configuration set the mavenSettingsProxyId so that the correct proxy will be used."); -703thrownew IllegalStateException("Ambiguous proxy definition"); -704 } -705 } -706 } -707returnnull; -708 } -709 -710/** -711 * Tests is the artifact should be included in the scan (i.e. is the dependency in a scope that is being scanned). -712 * -713 * @param a the Artifact to test -714 * @return <code>true</code> if the artifact is in an excluded scope; otherwise <code>false</code> -715 */ -716protectedboolean excludeFromScan(Artifact a) { -717if (skipTestScope && Artifact.SCOPE_TEST.equals(a.getScope())) { -718returntrue; -719 } -720if (skipProvidedScope && Artifact.SCOPE_PROVIDED.equals(a.getScope())) { -721returntrue; -722 } -723if (skipRuntimeScope && !Artifact.SCOPE_RUNTIME.equals(a.getScope())) { -724returntrue; -725 } -726return false; -727 } -728 -729/** -730 * Returns a reference to the current project. This method is used instead of auto-binding the project via component -731 * annotation in concrete implementations of this. If the child has a <code>@Component MavenProject project;</code> defined -732 * then the abstract class (i.e. this class) will not have access to the current project (just the way Maven works with the -733 * binding). -734 * -735 * @return returns a reference to the current project -736 */ -737protected MavenProject getProject() { -738return project; -739 } -740 -741/** -742 * Returns the list of Maven Projects in this build. -743 * -744 * @return the list of Maven Projects in this build -745 */ -746protected List<MavenProject> getReactorProjects() { -747return reactorProjects; -748 } -749 -750/** -751 * Returns the report format. -752 * -753 * @return the report format -754 */ -755protected String getFormat() { -756return format; -757 } -758 -759/** -760 * Generates the reports for a given dependency-check engine. -761 * -762 * @param engine a dependency-check engine -763 * @param p the maven project -764 * @param outputDir the directory path to write the report(s). -765 */ -766protectedvoid writeReports(Engine engine, MavenProject p, File outputDir) { -767 DatabaseProperties prop = null; -768 CveDB cve = null; -769try { -770 cve = new CveDB(); -771 cve.open(); -772 prop = cve.getDatabaseProperties(); -773 } catch (DatabaseException ex) { -774if (getLog().isDebugEnabled()) { -775 getLog().debug("Unable to retrieve DB Properties", ex); -776 } -777 } finally { -778if (cve != null) { -779 cve.close(); -780 } -781 } -782final ReportGenerator r = new ReportGenerator(p.getName(), engine.getDependencies(), engine.getAnalyzers(), prop); -783try { -784 r.generateReports(outputDir.getAbsolutePath(), format); -785 } catch (IOException ex) { -786 getLog().error( -787"Unexpected exception occurred during analysis; please see the verbose error log for more details."); -788if (getLog().isDebugEnabled()) { -789 getLog().debug("", ex); +683 Settings.setStringIfNotEmpty(Settings.KEYS.DATA_DIRECTORY, dataDirectory); +684 +685 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); +686 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); +687 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); +688 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); +689 Settings.setIntIfNotNull(Settings.KEYS.CVE_CHECK_VALID_FOR_HOURS, cveValidForHours); +690 +691 } +692 +693/** +694 * Returns the maven proxy. +695 * +696 * @return the maven proxy +697 */ +698private Proxy getMavenProxy() { +699if (mavenSettings != null) { +700final List<Proxy> proxies = mavenSettings.getProxies(); +701if (proxies != null && !proxies.isEmpty()) { +702if (mavenSettingsProxyId != null) { +703for (Proxy proxy : proxies) { +704if (mavenSettingsProxyId.equalsIgnoreCase(proxy.getId())) { +705return proxy; +706 } +707 } +708 } elseif (proxies.size() == 1) { +709return proxies.get(0); +710 } else { +711 getLog().warn("Multiple proxy definitions exist in the Maven settings. In the dependency-check " +712 + "configuration set the mavenSettingsProxyId so that the correct proxy will be used."); +713thrownew IllegalStateException("Ambiguous proxy definition"); +714 } +715 } +716 } +717returnnull; +718 } +719 +720/** +721 * Tests is the artifact should be included in the scan (i.e. is the dependency in a scope that is being scanned). +722 * +723 * @param a the Artifact to test +724 * @return <code>true</code> if the artifact is in an excluded scope; otherwise <code>false</code> +725 */ +726protectedboolean excludeFromScan(Artifact a) { +727if (skipTestScope && Artifact.SCOPE_TEST.equals(a.getScope())) { +728returntrue; +729 } +730if (skipProvidedScope && Artifact.SCOPE_PROVIDED.equals(a.getScope())) { +731returntrue; +732 } +733if (skipRuntimeScope && !Artifact.SCOPE_RUNTIME.equals(a.getScope())) { +734returntrue; +735 } +736return false; +737 } +738 +739/** +740 * Returns a reference to the current project. This method is used instead of auto-binding the project via component +741 * annotation in concrete implementations of this. If the child has a <code>@Component MavenProject project;</code> defined +742 * then the abstract class (i.e. this class) will not have access to the current project (just the way Maven works with the +743 * binding). +744 * +745 * @return returns a reference to the current project +746 */ +747protected MavenProject getProject() { +748return project; +749 } +750 +751/** +752 * Returns the list of Maven Projects in this build. +753 * +754 * @return the list of Maven Projects in this build +755 */ +756protected List<MavenProject> getReactorProjects() { +757return reactorProjects; +758 } +759 +760/** +761 * Returns the report format. +762 * +763 * @return the report format +764 */ +765protected String getFormat() { +766return format; +767 } +768 +769/** +770 * Generates the reports for a given dependency-check engine. +771 * +772 * @param engine a dependency-check engine +773 * @param p the maven project +774 * @param outputDir the directory path to write the report(s). +775 */ +776protectedvoid writeReports(Engine engine, MavenProject p, File outputDir) { +777 DatabaseProperties prop = null; +778 CveDB cve = null; +779try { +780 cve = new CveDB(); +781 cve.open(); +782 prop = cve.getDatabaseProperties(); +783 } catch (DatabaseException ex) { +784if (getLog().isDebugEnabled()) { +785 getLog().debug("Unable to retrieve DB Properties", ex); +786 } +787 } finally { +788if (cve != null) { +789 cve.close(); 790 } -791 } catch (Throwable ex) { -792 getLog().error( -793"Unexpected exception occurred during analysis; please see the verbose error log for more details."); -794if (getLog().isDebugEnabled()) { -795 getLog().debug("", ex); -796 } -797 } -798 } -799 -800//<editor-fold defaultstate="collapsed" desc="Methods to fail build or show summary"> -801/** -802 * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the -803 * configuration. -804 * -805 * @param dependencies the list of dependency objects -806 * @throws MojoFailureException thrown if a CVSS score is found that is higher then the threshold set -807 */ -808protectedvoid checkForFailure(List<Dependency> dependencies) throws MojoFailureException { -809if (failBuildOnCVSS <= 10) { -810final StringBuilder ids = new StringBuilder(); -811for (Dependency d : dependencies) { -812boolean addName = true; -813for (Vulnerability v : d.getVulnerabilities()) { -814if (v.getCvssScore() >= failBuildOnCVSS) { -815if (addName) { -816 addName = false; -817 ids.append(NEW_LINE).append(d.getFileName()).append(": "); -818 ids.append(v.getName()); -819 } else { -820 ids.append(", ").append(v.getName()); -821 } -822 } -823 } -824 } -825if (ids.length() > 0) { -826final String msg = String.format("%n%nDependency-Check Failure:%n" -827 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" -828 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); -829thrownew MojoFailureException(msg); -830 } -831 } -832 } -833 -834/** -835 * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. -836 * -837 * @param mp the Maven project for which the summary is shown -838 * @param dependencies a list of dependency objects -839 */ -840protectedvoid showSummary(MavenProject mp, List<Dependency> dependencies) { -841if (showSummary) { -842final StringBuilder summary = new StringBuilder(); -843for (Dependency d : dependencies) { -844boolean firstEntry = true; -845final StringBuilder ids = new StringBuilder(); -846for (Vulnerability v : d.getVulnerabilities()) { -847if (firstEntry) { -848 firstEntry = false; -849 } else { -850 ids.append(", "); -851 } -852 ids.append(v.getName()); -853 } -854if (ids.length() > 0) { -855 summary.append(d.getFileName()).append(" ("); -856 firstEntry = true; -857for (Identifier id : d.getIdentifiers()) { -858if (firstEntry) { -859 firstEntry = false; -860 } else { -861 summary.append(", "); -862 } -863 summary.append(id.getValue()); -864 } -865 summary.append(") : ").append(ids).append(NEW_LINE); -866 } -867 } -868if (summary.length() > 0) { -869final String msg = String.format("%n%n" + "One or more dependencies were identified with known vulnerabilities in %s:%n%n%s" -870 + "%n%nSee the dependency-check report for more details.%n%n", mp.getName(), summary.toString()); -871 getLog().warn(msg); -872 } -873 } -874 } -875 -876//</editor-fold> -877//<editor-fold defaultstate="collapsed" desc="Methods to read/write the serialized data file"> -878/** -879 * Returns the key used to store the path to the data file that is saved by <code>writeDataFile()</code>. This key is used in -880 * the <code>MavenProject.(set|get)ContextValue</code>. -881 * -882 * @return the key used to store the path to the data file -883 */ -884protected String getDataFileContextKey() { -885return"dependency-check-path-" + dataFileName; -886 } -887 +791 } +792final ReportGenerator r = new ReportGenerator(p.getName(), engine.getDependencies(), engine.getAnalyzers(), prop); +793try { +794 r.generateReports(outputDir.getAbsolutePath(), format); +795 } catch (IOException ex) { +796 getLog().error( +797"Unexpected exception occurred during analysis; please see the verbose error log for more details."); +798if (getLog().isDebugEnabled()) { +799 getLog().debug("", ex); +800 } +801 } catch (Throwable ex) { +802 getLog().error( +803"Unexpected exception occurred during analysis; please see the verbose error log for more details."); +804if (getLog().isDebugEnabled()) { +805 getLog().debug("", ex); +806 } +807 } +808 } +809 +810//<editor-fold defaultstate="collapsed" desc="Methods to fail build or show summary"> +811/** +812 * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the +813 * configuration. +814 * +815 * @param dependencies the list of dependency objects +816 * @throws MojoFailureException thrown if a CVSS score is found that is higher then the threshold set +817 */ +818protectedvoid checkForFailure(List<Dependency> dependencies) throws MojoFailureException { +819if (failBuildOnCVSS <= 10) { +820final StringBuilder ids = new StringBuilder(); +821for (Dependency d : dependencies) { +822boolean addName = true; +823for (Vulnerability v : d.getVulnerabilities()) { +824if (v.getCvssScore() >= failBuildOnCVSS) { +825if (addName) { +826 addName = false; +827 ids.append(NEW_LINE).append(d.getFileName()).append(": "); +828 ids.append(v.getName()); +829 } else { +830 ids.append(", ").append(v.getName()); +831 } +832 } +833 } +834 } +835if (ids.length() > 0) { +836final String msg = String.format("%n%nDependency-Check Failure:%n" +837 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" +838 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); +839thrownew MojoFailureException(msg); +840 } +841 } +842 } +843 +844/** +845 * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. +846 * +847 * @param mp the Maven project for which the summary is shown +848 * @param dependencies a list of dependency objects +849 */ +850protectedvoid showSummary(MavenProject mp, List<Dependency> dependencies) { +851if (showSummary) { +852final StringBuilder summary = new StringBuilder(); +853for (Dependency d : dependencies) { +854boolean firstEntry = true; +855final StringBuilder ids = new StringBuilder(); +856for (Vulnerability v : d.getVulnerabilities()) { +857if (firstEntry) { +858 firstEntry = false; +859 } else { +860 ids.append(", "); +861 } +862 ids.append(v.getName()); +863 } +864if (ids.length() > 0) { +865 summary.append(d.getFileName()).append(" ("); +866 firstEntry = true; +867for (Identifier id : d.getIdentifiers()) { +868if (firstEntry) { +869 firstEntry = false; +870 } else { +871 summary.append(", "); +872 } +873 summary.append(id.getValue()); +874 } +875 summary.append(") : ").append(ids).append(NEW_LINE); +876 } +877 } +878if (summary.length() > 0) { +879final String msg = String.format("%n%n" + "One or more dependencies were identified with known vulnerabilities in %s:%n%n%s" +880 + "%n%nSee the dependency-check report for more details.%n%n", mp.getName(), summary.toString()); +881 getLog().warn(msg); +882 } +883 } +884 } +885 +886//</editor-fold> +887//<editor-fold defaultstate="collapsed" desc="Methods to read/write the serialized data file">888/** -889 * Returns the key used to store the path to the output directory. When generating the report in the -890 * <code>executeAggregateReport()</code> the output directory should be obtained by using this key. +889 * Returns the key used to store the path to the data file that is saved by <code>writeDataFile()</code>. This key is used in +890 * the <code>MavenProject.(set|get)ContextValue</code>.891 * -892 * @return the key used to store the path to the output directory +892 * @return the key used to store the path to the data file893 */ -894protected String getOutputDirectoryContextKey() { -895return"dependency-output-dir-" + dataFileName; +894protected String getDataFileContextKey() { +895return"dependency-check-path-" + dataFileName; 896 } 897898/** -899 * Writes the scan data to disk. This is used to serialize the scan data between the "check" and "aggregate" phase. -900 * -901 * @param mp the mMven project for which the data file was created -902 * @param writeTo the directory to write the data file -903 * @param dependencies the list of dependencies to serialize -904 */ -905protectedvoid writeDataFile(MavenProject mp, File writeTo, List<Dependency> dependencies) { -906 File file; -907//check to see if this was already written out -908if (mp.getContextValue(this.getDataFileContextKey()) == null) { -909if (writeTo == null) { -910 file = new File(mp.getBuild().getDirectory()); -911 file = new File(file, dataFileName); -912 } else { -913 file = new File(writeTo, dataFileName); -914 } -915final File parent = file.getParentFile(); -916if (!parent.isDirectory() && parent.mkdirs()) { -917 getLog().error(String.format("Directory '%s' does not exist and cannot be created; unable to write data file.", -918 parent.getAbsolutePath())); -919 } -920 -921 OutputStream os = null; -922 OutputStream bos = null; -923 ObjectOutputStream out = null; -924try { -925if (dependencies != null) { -926 os = new FileOutputStream(file); -927 bos = new BufferedOutputStream(os); -928 out = new ObjectOutputStream(bos); -929 out.writeObject(dependencies); -930 out.flush(); -931 -932//call reset to prevent resource leaks per -933//https://www.securecoding.cert.org/confluence/display/java/SER10-J.+Avoid+memory+and+resource+leaks+during+serialization -934 out.reset(); -935 } -936if (getLog().isDebugEnabled()) { -937 getLog().debug(String.format("Serialized data file written to '%s' for %s, referenced by key %s", -938 file.getAbsolutePath(), mp.getName(), this.getDataFileContextKey())); -939 } -940 mp.setContextValue(this.getDataFileContextKey(), file.getAbsolutePath()); -941 } catch (IOException ex) { -942 getLog().warn("Unable to create data file used for report aggregation; " -943 + "if report aggregation is being used the results may be incomplete."); -944if (getLog().isDebugEnabled()) { -945 getLog().debug(ex.getMessage(), ex); -946 } -947 } finally { -948if (out != null) { -949try { -950 out.close(); -951 } catch (IOException ex) { -952if (getLog().isDebugEnabled()) { -953 getLog().debug("ignore", ex); -954 } -955 } -956 } -957if (bos != null) { -958try { -959 bos.close(); -960 } catch (IOException ex) { -961if (getLog().isDebugEnabled()) { -962 getLog().debug("ignore", ex); -963 } -964 } -965 } -966if (os != null) { -967try { -968 os.close(); -969 } catch (IOException ex) { -970if (getLog().isDebugEnabled()) { -971 getLog().debug("ignore", ex); -972 } -973 } -974 } -975 } -976 } -977 } -978 -979/** -980 * Reads the serialized scan data from disk. This is used to serialize the scan data between the "check" and "aggregate" -981 * phase. -982 * -983 * @param project the Maven project to read the data file from -984 * @return a <code>Engine</code> object populated with dependencies if the serialized data file exists; otherwise -985 * <code>null</code> is returned -986 */ -987protected List<Dependency> readDataFile(MavenProject project) { -988final Object oPath = project.getContextValue(this.getDataFileContextKey()); -989if (oPath == null) { -990returnnull; -991 } -992 List<Dependency> ret = null; -993final String path = (String) oPath; -994 ObjectInputStream ois = null; -995try { -996 ois = new ObjectInputStream(new FileInputStream(path)); -997 ret = (List<Dependency>) ois.readObject(); -998 } catch (FileNotFoundException ex) { -999//TODO fix logging -1000 getLog().error("", ex); -1001 } catch (IOException ex) { -1002 getLog().error("", ex); -1003 } catch (ClassNotFoundException ex) { -1004 getLog().error("", ex); -1005 } finally { -1006if (ois != null) { -1007try { -1008 ois.close(); -1009 } catch (IOException ex) { -1010 getLog().error("", ex); -1011 } -1012 } -1013 } -1014return ret; -1015 } -1016//</editor-fold> -1017 } +899 * Returns the key used to store the path to the output directory. When generating the report in the +900 * <code>executeAggregateReport()</code> the output directory should be obtained by using this key. +901 * +902 * @return the key used to store the path to the output directory +903 */ +904protected String getOutputDirectoryContextKey() { +905return"dependency-output-dir-" + dataFileName; +906 } +907 +908/** +909 * Writes the scan data to disk. This is used to serialize the scan data between the "check" and "aggregate" phase. +910 * +911 * @param mp the mMven project for which the data file was created +912 * @param writeTo the directory to write the data file +913 * @param dependencies the list of dependencies to serialize +914 */ +915protectedvoid writeDataFile(MavenProject mp, File writeTo, List<Dependency> dependencies) { +916 File file; +917//check to see if this was already written out +918if (mp.getContextValue(this.getDataFileContextKey()) == null) { +919if (writeTo == null) { +920 file = new File(mp.getBuild().getDirectory()); +921 file = new File(file, dataFileName); +922 } else { +923 file = new File(writeTo, dataFileName); +924 } +925final File parent = file.getParentFile(); +926if (!parent.isDirectory() && parent.mkdirs()) { +927 getLog().error(String.format("Directory '%s' does not exist and cannot be created; unable to write data file.", +928 parent.getAbsolutePath())); +929 } +930 +931 ObjectOutputStream out = null; +932try { +933if (dependencies != null) { +934 out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file))); +935 out.writeObject(dependencies); +936 } +937if (getLog().isDebugEnabled()) { +938 getLog().debug(String.format("Serialized data file written to '%s' for %s, referenced by key %s", +939 file.getAbsolutePath(), mp.getName(), this.getDataFileContextKey())); +940 } +941 mp.setContextValue(this.getDataFileContextKey(), file.getAbsolutePath()); +942 } catch (IOException ex) { +943 getLog().warn("Unable to create data file used for report aggregation; " +944 + "if report aggregation is being used the results may be incomplete."); +945if (getLog().isDebugEnabled()) { +946 getLog().debug(ex.getMessage(), ex); +947 } +948 } finally { +949if (out != null) { +950try { +951 out.close(); +952 } catch (IOException ex) { +953if (getLog().isDebugEnabled()) { +954 getLog().debug("ignore", ex); +955 } +956 } +957 } +958 } +959 } +960 } +961 +962/** +963 * Reads the serialized scan data from disk. This is used to serialize the scan data between the "check" and "aggregate" +964 * phase. +965 * +966 * @param project the Maven project to read the data file from +967 * @return a <code>Engine</code> object populated with dependencies if the serialized data file exists; otherwise +968 * <code>null</code> is returned +969 */ +970protected List<Dependency> readDataFile(MavenProject project) { +971final Object oPath = project.getContextValue(this.getDataFileContextKey()); +972if (oPath == null) { +973returnnull; +974 } +975 List<Dependency> ret = null; +976final String path = (String) oPath; +977 ObjectInputStream ois = null; +978try { +979 ois = new ObjectInputStream(new FileInputStream(path)); +980 ret = (List<Dependency>) ois.readObject(); +981 } catch (FileNotFoundException ex) { +982//TODO fix logging +983 getLog().error("", ex); +984 } catch (IOException ex) { +985 getLog().error("", ex); +986 } catch (ClassNotFoundException ex) { +987 getLog().error("", ex); +988 } finally { +989if (ois != null) { +990try { +991 ois.close(); +992 } catch (IOException ex) { +993 getLog().error("", ex); +994 } +995 } +996 } +997return ret; +998 } +999//</editor-fold> +1000 }
    diff --git a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/CheckMojo.html b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/CheckMojo.html index 042b0fcbb..18fc06e0a 100644 --- a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/CheckMojo.html +++ b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/CheckMojo.html @@ -31,96 +31,104 @@ 23import org.apache.maven.plugin.MojoFailureException; 24import org.apache.maven.plugins.annotations.LifecyclePhase; 25import org.apache.maven.plugins.annotations.Mojo; -26import org.apache.maven.plugins.annotations.ResolutionScope; -27import org.owasp.dependencycheck.data.nvdcve.DatabaseException; -28import org.owasp.dependencycheck.utils.Settings; -29 -30/** -31 * Maven Plugin that checks the project dependencies to see if they have any known published vulnerabilities. -32 * -33 * @author Jeremy Long -34 */ -35 @Mojo( -36 name = "check", -37 defaultPhase = LifecyclePhase.COMPILE, -38 threadSafe = true, -39 requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, -40 requiresOnline = true -41 ) -42publicclassCheckMojoextendsBaseDependencyCheckMojo { -43 -44/** -45 * Returns whether or not a the report can be generated. -46 * -47 * @return <code>true</code> if the report can be generated; otherwise <code>false</code> -48 */ -49 @Override -50publicboolean canGenerateReport() { -51boolean isCapable = false; -52for (Artifact a : getProject().getArtifacts()) { -53if (!excludeFromScan(a)) { -54 isCapable = true; -55break; -56 } -57 } -58return isCapable; -59 } -60 -61/** -62 * Executes the dependency-check engine on the project's dependencies and generates the report. -63 * -64 * @throws MojoExecutionException thrown if there is an exception executing the goal -65 * @throws MojoFailureException thrown if dependency-check is configured to fail the build -66 */ -67 @Override -68publicvoid runCheck() throws MojoExecutionException, MojoFailureException { -69finalEngine engine; -70try { -71 engine = initializeEngine(); -72 } catch (DatabaseException ex) { -73if (getLog().isDebugEnabled()) { -74 getLog().debug("Database connection error", ex); -75 } -76thrownew MojoExecutionException("An exception occured connecting to the local database. Please see the log file for more details.", ex); -77 } -78 scanArtifacts(getProject(), engine); -79if (engine.getDependencies().isEmpty()) { -80 getLog().info("No dependencies were identified that could be analyzed by dependency-check"); -81 } else { -82 engine.analyzeDependencies(); -83 writeReports(engine, getProject(), getCorrectOutputDirectory()); -84 writeDataFile(getProject(), null, engine.getDependencies()); -85 showSummary(getProject(), engine.getDependencies()); -86 checkForFailure(engine.getDependencies()); -87 } -88 engine.cleanup(); -89 Settings.cleanup(); -90 } -91 -92/** -93 * Returns the report name. -94 * -95 * @param locale the location -96 * @return the report name -97 */ -98 @Override -99public String getName(Locale locale) { -100return"dependency-check"; -101 } -102 -103/** -104 * Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page. -105 * -106 * @param locale The Locale to get the description for -107 * @return the description -108 */ -109 @Override -110public String getDescription(Locale locale) { -111return"Generates a report providing details on any published vulnerabilities within project dependencies. " -112 + "This report is a best effort and may contain false positives and false negatives."; -113 } -114 -115 } +26import org.apache.maven.plugins.annotations.Parameter; +27import org.apache.maven.plugins.annotations.ResolutionScope; +28import org.owasp.dependencycheck.data.nvdcve.DatabaseException; +29import org.owasp.dependencycheck.utils.Settings; +30 +31/** +32 * Maven Plugin that checks the project dependencies to see if they have any known published vulnerabilities. +33 * +34 * @author Jeremy Long +35 */ +36 @Mojo( +37 name = "check", +38 defaultPhase = LifecyclePhase.VERIFY, +39 threadSafe = true, +40 requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, +41 requiresOnline = true +42 ) +43publicclassCheckMojoextendsBaseDependencyCheckMojo { +44 +45/** +46 * Returns whether or not a the report can be generated. +47 * +48 * @return <code>true</code> if the report can be generated; otherwise <code>false</code> +49 */ +50 @Override +51publicboolean canGenerateReport() { +52boolean isCapable = false; +53for (Artifact a : getProject().getArtifacts()) { +54if (!excludeFromScan(a)) { +55 isCapable = true; +56break; +57 } +58 } +59return isCapable; +60 } +61 +62/** +63 * Executes the dependency-check engine on the project's dependencies and generates the report. +64 * +65 * @throws MojoExecutionException thrown if there is an exception executing the goal +66 * @throws MojoFailureException thrown if dependency-check is configured to fail the build +67 */ +68 @Override +69publicvoid runCheck() throws MojoExecutionException, MojoFailureException { +70finalEngine engine; +71try { +72 engine = initializeEngine(); +73 } catch (DatabaseException ex) { +74if (getLog().isDebugEnabled()) { +75 getLog().debug("Database connection error", ex); +76 } +77thrownew MojoExecutionException("An exception occured connecting to the local database. Please see the log file for more details.", ex); +78 } +79 scanArtifacts(getProject(), engine); +80if (engine.getDependencies().isEmpty()) { +81 getLog().info("No dependencies were identified that could be analyzed by dependency-check"); +82 } else { +83 engine.analyzeDependencies(); +84 writeReports(engine, getProject(), getCorrectOutputDirectory()); +85 writeDataFile(getProject(), null, engine.getDependencies()); +86 showSummary(getProject(), engine.getDependencies()); +87 checkForFailure(engine.getDependencies()); +88 } +89 engine.cleanup(); +90 Settings.cleanup(); +91 } +92 +93/** +94 * The name of the report in the site. +95 */ +96 @SuppressWarnings("CanBeFinal") +97 @Parameter(property = "name", defaultValue = "dependency-check", required = true) +98private String name = "dependency-check"; +99 +100/** +101 * Returns the report name. +102 * +103 * @param locale the location +104 * @return the report name +105 */ +106 @Override +107public String getName(Locale locale) { +108return name; +109 } +110 +111/** +112 * Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page. +113 * +114 * @param locale The Locale to get the description for +115 * @return the description +116 */ +117 @Override +118public String getDescription(Locale locale) { +119return"Generates a report providing details on any published vulnerabilities within project dependencies. " +120 + "This report is a best effort and may contain false positives and false negatives."; +121 } +122 +123 }
    diff --git a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/package-frame.html b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/package-frame.html index 076f20efc..8cb387dcb 100644 --- a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/package-frame.html +++ b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference Package org.owasp.dependencycheck.maven + Dependency-Check Maven Plugin 1.3.2 Reference Package org.owasp.dependencycheck.maven diff --git a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/package-summary.html b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/package-summary.html index cf3980d19..d536e5276 100644 --- a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/package-summary.html +++ b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference Package org.owasp.dependencycheck.maven + Dependency-Check Maven Plugin 1.3.2 Reference Package org.owasp.dependencycheck.maven diff --git a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/slf4j/package-frame.html b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/slf4j/package-frame.html index 9dbb5d984..08b16089b 100644 --- a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/slf4j/package-frame.html +++ b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/slf4j/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference Package org.owasp.dependencycheck.maven.slf4j + Dependency-Check Maven Plugin 1.3.2 Reference Package org.owasp.dependencycheck.maven.slf4j diff --git a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/slf4j/package-summary.html b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/slf4j/package-summary.html index 79ca54e39..1d8933f0e 100644 --- a/dependency-check-maven/xref/org/owasp/dependencycheck/maven/slf4j/package-summary.html +++ b/dependency-check-maven/xref/org/owasp/dependencycheck/maven/slf4j/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference Package org.owasp.dependencycheck.maven.slf4j + Dependency-Check Maven Plugin 1.3.2 Reference Package org.owasp.dependencycheck.maven.slf4j diff --git a/dependency-check-maven/xref/org/slf4j/impl/package-frame.html b/dependency-check-maven/xref/org/slf4j/impl/package-frame.html index 8b8ae8534..754ccf8a6 100644 --- a/dependency-check-maven/xref/org/slf4j/impl/package-frame.html +++ b/dependency-check-maven/xref/org/slf4j/impl/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference Package org.slf4j.impl + Dependency-Check Maven Plugin 1.3.2 Reference Package org.slf4j.impl diff --git a/dependency-check-maven/xref/org/slf4j/impl/package-summary.html b/dependency-check-maven/xref/org/slf4j/impl/package-summary.html index ed9926ea8..ca2b1c345 100644 --- a/dependency-check-maven/xref/org/slf4j/impl/package-summary.html +++ b/dependency-check-maven/xref/org/slf4j/impl/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference Package org.slf4j.impl + Dependency-Check Maven Plugin 1.3.2 Reference Package org.slf4j.impl diff --git a/dependency-check-maven/xref/overview-frame.html b/dependency-check-maven/xref/overview-frame.html index ddfd138b4..a01c2d634 100644 --- a/dependency-check-maven/xref/overview-frame.html +++ b/dependency-check-maven/xref/overview-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference + Dependency-Check Maven Plugin 1.3.2 Reference diff --git a/dependency-check-maven/xref/overview-summary.html b/dependency-check-maven/xref/overview-summary.html index 88323336e..3cd82921b 100644 --- a/dependency-check-maven/xref/overview-summary.html +++ b/dependency-check-maven/xref/overview-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Maven Plugin 1.3.1 Reference + Dependency-Check Maven Plugin 1.3.2 Reference @@ -24,7 +24,7 @@ -

    Dependency-Check Maven Plugin 1.3.1 Reference

    +

    Dependency-Check Maven Plugin 1.3.2 Reference

    diff --git a/dependency-check-utils/apidocs/allclasses-frame.html b/dependency-check-utils/apidocs/allclasses-frame.html index 60ca4f003..33867c2d5 100644 --- a/dependency-check-utils/apidocs/allclasses-frame.html +++ b/dependency-check-utils/apidocs/allclasses-frame.html @@ -2,10 +2,10 @@ - + -All Classes (Dependency-Check Utils 1.3.1 API) - +All Classes (Dependency-Check Utils 1.3.2 API) + diff --git a/dependency-check-utils/apidocs/allclasses-noframe.html b/dependency-check-utils/apidocs/allclasses-noframe.html index 01660a6b9..02a8c034e 100644 --- a/dependency-check-utils/apidocs/allclasses-noframe.html +++ b/dependency-check-utils/apidocs/allclasses-noframe.html @@ -2,10 +2,10 @@ - + -All Classes (Dependency-Check Utils 1.3.1 API) - +All Classes (Dependency-Check Utils 1.3.2 API) + diff --git a/dependency-check-utils/apidocs/constant-values.html b/dependency-check-utils/apidocs/constant-values.html index fcd08ebf1..df2f84247 100644 --- a/dependency-check-utils/apidocs/constant-values.html +++ b/dependency-check-utils/apidocs/constant-values.html @@ -2,16 +2,16 @@ - + -Constant Field Values (Dependency-Check Utils 1.3.1 API) - +Constant Field Values (Dependency-Check Utils 1.3.2 API) + @@ -119,6 +119,20 @@ + + + + + + + + + + @@ -161,19 +175,19 @@ - - - - - + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - + + + + + + + + @@ -189,14 +201,14 @@ extends - - @@ -273,133 +285,139 @@ extends + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +
    "analyzer.autoconf.enabled"
    + +public static final StringANALYZER_BUNDLE_AUDIT_ENABLED"analyzer.bundle.audit.enabled"
    + +public static final StringANALYZER_BUNDLE_AUDIT_PATH"analyzer.bundle.audit.path"
    public static final String"analyzer.nexus.enabled"
    - -public static final StringANALYZER_NEXUS_PROXY"analyzer.nexus.proxy"
    public static final String ANALYZER_NEXUS_URL "analyzer.nexus.url"
    + +public static final StringANALYZER_NEXUS_USES_PROXY"analyzer.nexus.proxy"
    @@ -259,187 +273,173 @@ "cpe.url"
    + +public static final StringCVE_CHECK_VALID_FOR_HOURS"cve.check.validforhours"
    public static final String CVE_META_URL "cve.url.meta"
    public static final String CVE_MODIFIED_12_URL "cve.url-1.2.modified"
    public static final String CVE_MODIFIED_20_URL "cve.url-2.0.modified"
    public static final String CVE_MODIFIED_VALID_FOR_DAYS "cve.url.modified.validfordays"
    public static final String CVE_SCHEMA_1_2 "cve.url-1.2.base"
    public static final String CVE_SCHEMA_2_0 "cve.url-2.0.base"
    public static final String CVE_START_YEAR "cve.startyear"
    public static final String DATA_DIRECTORY "data.directory"
    public static final String DB_CONNECTION_STRING "data.connection_string"
    public static final String DB_DRIVER_NAME "data.driver_name"
    public static final String DB_DRIVER_PATH "data.driver_path"
    public static final String DB_FILE_NAME "data.file_name"
    public static final String DB_PASSWORD "data.password"
    public static final String DB_USER "data.user"
    public static final String DB_VERSION "data.version"
    public static final String DOWNLOADER_QUICK_QUERY_TIMESTAMP "downloader.quick.query.timestamp"
    public static final String ENGINE_VERSION_CHECK_URL "engine.version.url"
    public static final String MAX_DOWNLOAD_THREAD_POOL_SIZE "max.download.threads"
    public static final String PROXY_PASSWORD "proxy.password"
    public static final String PROXY_PORT "proxy.port"
    public static final String PROXY_SERVER "proxy.server"
    public static final String PROXY_URL "proxy.server"
    public static final String PROXY_USERNAME "proxy.username"
    - -public static final StringSKIP_PROVIDED_SCOPE"skip.provided.scope"
    - -public static final StringSKIP_RUNTIME_SCOPE"skip.runtime.scope"
    - -public static final StringSKIP_TEST_SCOPE"skip.test.scope"
    @@ -538,6 +538,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/deprecated-list.html b/dependency-check-utils/apidocs/deprecated-list.html index ee1a08def..ce0612330 100644 --- a/dependency-check-utils/apidocs/deprecated-list.html +++ b/dependency-check-utils/apidocs/deprecated-list.html @@ -2,16 +2,16 @@ - + -Deprecated List (Dependency-Check Utils 1.3.1 API) - +Deprecated List (Dependency-Check Utils 1.3.2 API) + @@ -134,6 +134,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/help-doc.html b/dependency-check-utils/apidocs/help-doc.html index c7fb5df0c..ccc37c587 100644 --- a/dependency-check-utils/apidocs/help-doc.html +++ b/dependency-check-utils/apidocs/help-doc.html @@ -2,16 +2,16 @@ - + -API Help (Dependency-Check Utils 1.3.1 API) - +API Help (Dependency-Check Utils 1.3.2 API) + @@ -211,6 +211,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/index-all.html b/dependency-check-utils/apidocs/index-all.html index 38ef057b2..47c9aa225 100644 --- a/dependency-check-utils/apidocs/index-all.html +++ b/dependency-check-utils/apidocs/index-all.html @@ -2,16 +2,16 @@ - + -Index (Dependency-Check Utils 1.3.1 API) - +Index (Dependency-Check Utils 1.3.2 API) + @@ -92,6 +92,14 @@
    The properties key for whether the Autoconf analyzer is enabled.
    +
    ANALYZER_BUNDLE_AUDIT_ENABLED - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    +
    +
    The properties key for whether the Ruby Bundler Audit analyzer is enabled.
    +
    +
    ANALYZER_BUNDLE_AUDIT_PATH - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    +
    +
    The path to bundle-audit, if available.
    +
    ANALYZER_CENTRAL_ENABLED - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    The properties key for whether the Central analyzer is enabled.
    @@ -116,14 +124,14 @@
    The properties key for whether the Nexus analyzer is enabled.
    -
    ANALYZER_NEXUS_PROXY - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    -
    -
    The properties key for using the proxy to reach Nexus.
    -
    ANALYZER_NEXUS_URL - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    The properties key for the Nexus search URL.
    +
    ANALYZER_NEXUS_USES_PROXY - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    +
    +
    The properties key for using the proxy to reach Nexus.
    +
    ANALYZER_NODE_PACKAGE_ENABLED - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    The properties key for whether the node.js package analyzer is enabled.
    @@ -198,6 +206,10 @@
    Utility method to create an HttpURLConnection.
    +
    CVE_CHECK_VALID_FOR_HOURS - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    +
    +
    The properties key to control the skipping of the check for CVE updates.
    +
    CVE_META_URL - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    The properties key for the URL to retrieve the "meta" data from about the CVE entries.
    @@ -553,14 +565,34 @@
    Sets a property value.
    +
    setBooleanIfNotNull(String, Boolean) - Static method in class org.owasp.dependencycheck.utils.Settings
    +
    +
    Sets a property value only if the value is not null.
    +
    setInstance(Settings) - Static method in class org.owasp.dependencycheck.utils.Settings
    Sets the instance of the Settings object to use in this thread.
    +
    setInt(String, int) - Static method in class org.owasp.dependencycheck.utils.Settings
    +
    +
    Sets a property value.
    +
    +
    setIntIfNotNull(String, Integer) - Static method in class org.owasp.dependencycheck.utils.Settings
    +
    +
    Sets a property value only if the value is not null.
    +
    setString(String, String) - Static method in class org.owasp.dependencycheck.utils.Settings
    Sets a property value.
    +
    setStringIfNotEmpty(String, String) - Static method in class org.owasp.dependencycheck.utils.Settings
    +
    +
    Sets a property value only if the value is not null and not empty.
    +
    +
    setStringIfNotNull(String, String) - Static method in class org.owasp.dependencycheck.utils.Settings
    +
    +
    Sets a property value only if the value is not null.
    +
    Settings - Class in org.owasp.dependencycheck.utils
    A simple settings container that wraps the dependencycheck.properties file.
    @@ -569,18 +601,6 @@
    The collection of keys used within the properties file.
    -
    SKIP_PROVIDED_SCOPE - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    -
    -
    The properties key for whether Provided Scope dependencies should be skipped.
    -
    -
    SKIP_RUNTIME_SCOPE - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    -
    -
    The properties key for whether Runtime Scope dependencies should be skipped.
    -
    -
    SKIP_TEST_SCOPE - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    -
    -
    The properties key for whether Test Scope dependencies should be skipped.
    -
    SUPPRESSION_FILE - Static variable in class org.owasp.dependencycheck.utils.Settings.KEYS
    The key for a list of suppression files.
    @@ -697,6 +717,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/index.html b/dependency-check-utils/apidocs/index.html index 4011ba655..48d4bb230 100644 --- a/dependency-check-utils/apidocs/index.html +++ b/dependency-check-utils/apidocs/index.html @@ -2,9 +2,9 @@ - + -Dependency-Check Utils 1.3.1 API +Dependency-Check Utils 1.3.2 API @@ -304,6 +304,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/DownloadFailedException.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/DownloadFailedException.html index aaf2717dd..e3e78726b 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/DownloadFailedException.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/DownloadFailedException.html @@ -2,16 +2,16 @@ - + -DownloadFailedException (Dependency-Check Utils 1.3.1 API) - +DownloadFailedException (Dependency-Check Utils 1.3.2 API) + @@ -306,6 +306,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/Downloader.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/Downloader.html index 303431f72..fb5d96d56 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/Downloader.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/Downloader.html @@ -2,16 +2,16 @@ - + -Downloader (Dependency-Check Utils 1.3.1 API) - +Downloader (Dependency-Check Utils 1.3.2 API) + @@ -297,6 +297,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/ExtractionException.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/ExtractionException.html index 752fb2b7c..203626c01 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/ExtractionException.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/ExtractionException.html @@ -2,16 +2,16 @@ - + -ExtractionException (Dependency-Check Utils 1.3.1 API) - +ExtractionException (Dependency-Check Utils 1.3.2 API) + @@ -306,6 +306,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/FileUtils.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/FileUtils.html index b0a1063df..a0841ebb2 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/FileUtils.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/FileUtils.html @@ -2,16 +2,16 @@ - + -FileUtils (Dependency-Check Utils 1.3.1 API) - +FileUtils (Dependency-Check Utils 1.3.2 API) + @@ -283,6 +283,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/InvalidSettingException.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/InvalidSettingException.html index 1059e09c6..0d9a750ab 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/InvalidSettingException.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/InvalidSettingException.html @@ -2,16 +2,16 @@ - + -InvalidSettingException (Dependency-Check Utils 1.3.1 API) - +InvalidSettingException (Dependency-Check Utils 1.3.2 API) + @@ -306,6 +306,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/Settings.KEYS.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/Settings.KEYS.html index 4e18abd9b..86af80721 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/Settings.KEYS.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/Settings.KEYS.html @@ -2,16 +2,16 @@ - + -Settings.KEYS (Dependency-Check Utils 1.3.1 API) - +Settings.KEYS (Dependency-Check Utils 1.3.2 API) + @@ -153,6 +153,18 @@ extends
    static StringANALYZER_BUNDLE_AUDIT_ENABLED +
    The properties key for whether the Ruby Bundler Audit analyzer is enabled.
    +
    static StringANALYZER_BUNDLE_AUDIT_PATH +
    The path to bundle-audit, if available.
    +
    static String ANALYZER_CENTRAL_ENABLED
    The properties key for whether the Central analyzer is enabled.
    static StringANALYZER_NEXUS_PROXY -
    The properties key for using the proxy to reach Nexus.
    +
    ANALYZER_NEXUS_URL +
    The properties key for the Nexus search URL.
    static StringANALYZER_NEXUS_URL -
    The properties key for the Nexus search URL.
    +
    ANALYZER_NEXUS_USES_PROXY +
    The properties key for using the proxy to reach Nexus.
    static StringCVE_CHECK_VALID_FOR_HOURS +
    The properties key to control the skipping of the check for CVE updates.
    +
    static String CVE_META_URL
    The properties key for the URL to retrieve the "meta" data from about the CVE entries.
    static String CVE_MODIFIED_12_URL
    The properties key for the URL to retrieve the recently modified and added CVE entries (last 8 days) using the 1.2 schema.
    static String CVE_MODIFIED_20_URL
    The properties key for the URL to retrieve the recently modified and added CVE entries (last 8 days) using the 2.0 schema.
    static String CVE_MODIFIED_VALID_FOR_DAYS
    The properties key for the URL to retrieve the recently modified and added CVE entries (last 8 days).
    static String CVE_SCHEMA_1_2
    The properties key for the CVE schema version 1.2.
    static String CVE_SCHEMA_2_0
    The properties key for the CVE schema version 2.0.
    static String CVE_START_YEAR
    The properties key for the telling us how many cve.url.* URLs exists.
    static String DATA_DIRECTORY
    The base path to use for the data directory (for embedded db).
    static String DB_CONNECTION_STRING
    The database connection string.
    static String DB_DRIVER_NAME
    The database driver class name.
    static String DB_DRIVER_PATH
    The database driver class name.
    static String DB_FILE_NAME
    The database file name.
    static String DB_PASSWORD
    The password to authenticate to the database.
    static String DB_USER
    The username to use when connecting to the database.
    static String DB_VERSION
    The database schema version.
    static String DOWNLOADER_QUICK_QUERY_TIMESTAMP
    The HTTP request method for query last modified date.
    static String ENGINE_VERSION_CHECK_URL
    The key to obtain the URL to retrieve the current release version from.
    static String MAX_DOWNLOAD_THREAD_POOL_SIZE
    The maximum number of threads to allocate when downloading files.
    static String PROXY_PASSWORD
    The properties key for the proxy password.
    static String PROXY_PORT
    The properties key for the proxy port - this must be an integer value.
    static String PROXY_SERVER
    The properties key for the proxy server.
    static String PROXY_URL
    Deprecated.  @@ -407,30 +425,12 @@ extends +
    static String PROXY_USERNAME
    The properties key for the proxy username.
    static StringSKIP_PROVIDED_SCOPE -
    The properties key for whether Provided Scope dependencies should be skipped.
    -
    static StringSKIP_RUNTIME_SCOPE -
    The properties key for whether Runtime Scope dependencies should be skipped.
    -
    static StringSKIP_TEST_SCOPE -
    The properties key for whether Test Scope dependencies should be skipped.
    -
    static String SUPPRESSION_FILE @@ -681,6 +681,17 @@ extends See Also:
    Constant Field Values
    + + + +
      +
    • +

      CVE_CHECK_VALID_FOR_HOURS

      +
      public static final String CVE_CHECK_VALID_FOR_HOURS
      +
      The properties key to control the skipping of the check for CVE updates.
      +
      See Also:
      Constant Field Values
      +
    • +
    @@ -937,6 +948,17 @@ public static final See Also:
    Constant Field Values
    + + + +
      +
    • +

      ANALYZER_BUNDLE_AUDIT_ENABLED

      +
      public static final String ANALYZER_BUNDLE_AUDIT_ENABLED
      +
      The properties key for whether the Ruby Bundler Audit analyzer is enabled.
      +
      See Also:
      Constant Field Values
      +
    • +
    @@ -981,15 +1003,15 @@ public static final See Also:
    Constant Field Values
    - +
    • -

      ANALYZER_NEXUS_PROXY

      -
      public static final String ANALYZER_NEXUS_PROXY
      +

      ANALYZER_NEXUS_USES_PROXY

      +
      public static final String ANALYZER_NEXUS_USES_PROXY
      The properties key for using the proxy to reach Nexus.
      -
      See Also:
      Constant Field Values
      +
      See Also:
      Constant Field Values
    @@ -1036,6 +1058,17 @@ public static final See Also:
    Constant Field Values
    + + + +
      +
    • +

      ANALYZER_BUNDLE_AUDIT_PATH

      +
      public static final String ANALYZER_BUNDLE_AUDIT_PATH
      +
      The path to bundle-audit, if available.
      +
      See Also:
      Constant Field Values
      +
    • +
    @@ -1047,39 +1080,6 @@ public static final See Also:
    Constant Field Values
    - - - -
      -
    • -

      SKIP_TEST_SCOPE

      -
      public static final String SKIP_TEST_SCOPE
      -
      The properties key for whether Test Scope dependencies should be skipped.
      -
      See Also:
      Constant Field Values
      -
    • -
    - - - -
      -
    • -

      SKIP_RUNTIME_SCOPE

      -
      public static final String SKIP_RUNTIME_SCOPE
      -
      The properties key for whether Runtime Scope dependencies should be skipped.
      -
      See Also:
      Constant Field Values
      -
    • -
    - - - -
      -
    • -

      SKIP_PROVIDED_SCOPE

      -
      public static final String SKIP_PROVIDED_SCOPE
      -
      The properties key for whether Provided Scope dependencies should be skipped.
      -
      See Also:
      Constant Field Values
      -
    • -
    @@ -1212,6 +1212,6 @@ public static final Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/Settings.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/Settings.html index a4957da1b..eb06268a6 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/Settings.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/Settings.html @@ -2,16 +2,16 @@ - + -Settings (Dependency-Check Utils 1.3.1 API) - +Settings (Dependency-Check Utils 1.3.2 API) + @@ -280,17 +280,52 @@ extends
    static voidsetInstance(Settings instance) -
    Sets the instance of the Settings object to use in this thread.
    +
    setBooleanIfNotNull(String key, + Boolean value) +
    Sets a property value only if the value is not null.
    static voidsetInstance(Settings instance) +
    Sets the instance of the Settings object to use in this thread.
    +
    static voidsetInt(String key, + int value) +
    Sets a property value.
    +
    static voidsetIntIfNotNull(String key, + Integer value) +
    Sets a property value only if the value is not null.
    +
    static void setString(String key, String value)
    Sets a property value.
    static voidsetStringIfNotEmpty(String key, + String value) +
    Sets a property value only if the value is not null and not empty.
    +
    static voidsetStringIfNotNull(String key, + String value) +
    Sets a property value only if the value is not null.
    +
    + + + +
      +
    • +

      setStringIfNotNull

      +
      public static void setStringIfNotNull(String key,
      +                      String value)
      +
      Sets a property value only if the value is not null.
      +
      Parameters:
      key - the key for the property
      value - the value for the property
      +
    • +
    + + + +
      +
    • +

      setStringIfNotEmpty

      +
      public static void setStringIfNotEmpty(String key,
      +                       String value)
      +
      Sets a property value only if the value is not null and not empty.
      +
      Parameters:
      key - the key for the property
      value - the value for the property
      +
    • +
    @@ -403,6 +462,42 @@ extends Parameters:
    key - the key for the property
    value - the value for the property
    +
    + + +
      +
    • +

      setBooleanIfNotNull

      +
      public static void setBooleanIfNotNull(String key,
      +                       Boolean value)
      +
      Sets a property value only if the value is not null.
      +
      Parameters:
      key - the key for the property
      value - the value for the property
      +
    • +
    + + + +
      +
    • +

      setInt

      +
      public static void setInt(String key,
      +          int value)
      +
      Sets a property value.
      +
      Parameters:
      key - the key for the property
      value - the value for the property
      +
    • +
    + + + +
      +
    • +

      setIntIfNotNull

      +
      public static void setIntIfNotNull(String key,
      +                   Integer value)
      +
      Sets a property value only if the value is not null.
      +
      Parameters:
      key - the key for the property
      value - the value for the property
      +
    • +
    @@ -727,6 +822,6 @@ extends Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/URLConnectionFactory.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/URLConnectionFactory.html index 54bd5766a..c6d413ad3 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/URLConnectionFactory.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/URLConnectionFactory.html @@ -2,16 +2,16 @@ - + -URLConnectionFactory (Dependency-Check Utils 1.3.1 API) - +URLConnectionFactory (Dependency-Check Utils 1.3.2 API) + @@ -254,6 +254,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/URLConnectionFailureException.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/URLConnectionFailureException.html index 4872f9209..d22fefd6a 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/URLConnectionFailureException.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/URLConnectionFailureException.html @@ -2,16 +2,16 @@ - + -URLConnectionFailureException (Dependency-Check Utils 1.3.1 API) - +URLConnectionFailureException (Dependency-Check Utils 1.3.2 API) + @@ -306,6 +306,6 @@ extends
    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Checksum.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Checksum.html index b3dad209f..a3bd6cd3f 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Checksum.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Checksum.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.utils.Checksum (Dependency-Check Utils 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.utils.Checksum (Dependency-Check Utils 1.3.2 API) + @@ -110,6 +110,6 @@
    -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/DownloadFailedException.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/DownloadFailedException.html index e5f41e2d1..4831b12e1 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/DownloadFailedException.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/DownloadFailedException.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.utils.DownloadFailedException (Dependency-Check Utils 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.utils.DownloadFailedException (Dependency-Check Utils 1.3.2 API) + @@ -159,6 +159,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Downloader.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Downloader.html index b1adf06df..ed8b843ed 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Downloader.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Downloader.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.utils.Downloader (Dependency-Check Utils 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.utils.Downloader (Dependency-Check Utils 1.3.2 API) + @@ -110,6 +110,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/ExtractionException.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/ExtractionException.html index fa71f02b8..c312bb58a 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/ExtractionException.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/ExtractionException.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.utils.ExtractionException (Dependency-Check Utils 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.utils.ExtractionException (Dependency-Check Utils 1.3.2 API) + @@ -110,6 +110,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/FileUtils.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/FileUtils.html index 0d891f613..403b312dc 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/FileUtils.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/FileUtils.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.utils.FileUtils (Dependency-Check Utils 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.utils.FileUtils (Dependency-Check Utils 1.3.2 API) + @@ -110,6 +110,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/InvalidSettingException.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/InvalidSettingException.html index f1664cf51..5bce9e7bf 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/InvalidSettingException.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/InvalidSettingException.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.utils.InvalidSettingException (Dependency-Check Utils 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.utils.InvalidSettingException (Dependency-Check Utils 1.3.2 API) + @@ -163,6 +163,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Settings.KEYS.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Settings.KEYS.html index 620fd6069..40f6c1c32 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Settings.KEYS.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Settings.KEYS.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.utils.Settings.KEYS (Dependency-Check Utils 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.utils.Settings.KEYS (Dependency-Check Utils 1.3.2 API) + @@ -110,6 +110,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Settings.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Settings.html index ae7097914..f896b2c39 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Settings.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/Settings.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.utils.Settings (Dependency-Check Utils 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.utils.Settings (Dependency-Check Utils 1.3.2 API) + @@ -152,6 +152,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/URLConnectionFactory.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/URLConnectionFactory.html index 31cd8e14f..ea59f8600 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/URLConnectionFactory.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/URLConnectionFactory.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.utils.URLConnectionFactory (Dependency-Check Utils 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.utils.URLConnectionFactory (Dependency-Check Utils 1.3.2 API) + @@ -110,6 +110,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/URLConnectionFailureException.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/URLConnectionFailureException.html index 59456c55c..0ab7b7aa7 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/URLConnectionFailureException.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/class-use/URLConnectionFailureException.html @@ -2,16 +2,16 @@ - + -Uses of Class org.owasp.dependencycheck.utils.URLConnectionFailureException (Dependency-Check Utils 1.3.1 API) - +Uses of Class org.owasp.dependencycheck.utils.URLConnectionFailureException (Dependency-Check Utils 1.3.2 API) + @@ -144,6 +144,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-frame.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-frame.html index 44ae89356..81528d6f1 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-frame.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-frame.html @@ -2,10 +2,10 @@ - + -org.owasp.dependencycheck.utils (Dependency-Check Utils 1.3.1 API) - +org.owasp.dependencycheck.utils (Dependency-Check Utils 1.3.2 API) + diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-summary.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-summary.html index 5c62eccfe..5f7f546f0 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-summary.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-summary.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.utils (Dependency-Check Utils 1.3.1 API) - +org.owasp.dependencycheck.utils (Dependency-Check Utils 1.3.2 API) + @@ -204,6 +204,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-tree.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-tree.html index fe9cc4818..8b5437a35 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-tree.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-tree.html @@ -2,16 +2,16 @@ - + -org.owasp.dependencycheck.utils Class Hierarchy (Dependency-Check Utils 1.3.1 API) - +org.owasp.dependencycheck.utils Class Hierarchy (Dependency-Check Utils 1.3.2 API) + @@ -140,6 +140,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-use.html b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-use.html index cadaad8e9..cd0fcf4a7 100644 --- a/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-use.html +++ b/dependency-check-utils/apidocs/org/owasp/dependencycheck/utils/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.owasp.dependencycheck.utils (Dependency-Check Utils 1.3.1 API) - +Uses of Package org.owasp.dependencycheck.utils (Dependency-Check Utils 1.3.2 API) + @@ -145,6 +145,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/overview-tree.html b/dependency-check-utils/apidocs/overview-tree.html index 47d82a342..455ab545c 100644 --- a/dependency-check-utils/apidocs/overview-tree.html +++ b/dependency-check-utils/apidocs/overview-tree.html @@ -2,16 +2,16 @@ - + -Class Hierarchy (Dependency-Check Utils 1.3.1 API) - +Class Hierarchy (Dependency-Check Utils 1.3.2 API) + @@ -144,6 +144,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/apidocs/serialized-form.html b/dependency-check-utils/apidocs/serialized-form.html index 5cc9e2e33..7fe369ac3 100644 --- a/dependency-check-utils/apidocs/serialized-form.html +++ b/dependency-check-utils/apidocs/serialized-form.html @@ -2,16 +2,16 @@ - + -Serialized Form (Dependency-Check Utils 1.3.1 API) - +Serialized Form (Dependency-Check Utils 1.3.2 API) + @@ -154,6 +154,6 @@ -

    Copyright© 2012-15 Jeremy Long. All Rights Reserved.

    +

    Copyright? 2012-15 Jeremy Long. All Rights Reserved.

    diff --git a/dependency-check-utils/checkstyle.html b/dependency-check-utils/checkstyle.html index e3f3f1e32..adf1282d9 100644 --- a/dependency-check-utils/checkstyle.html +++ b/dependency-check-utils/checkstyle.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Checkstyle Results @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -218,7 +218,7 @@

    Checkstyle Results

    -

    The following document contains the results of Checkstyle 6.2 with C:\Users\jeremy\Projects\DependencyCheck\dependency-check-utils/../src/main/config/checkstyle-checks.xml ruleset. rss feed

    +

    The following document contains the results of Checkstyle 6.11.2 with C:\Users\jeremy\Projects\DependencyCheck\dependency-check-utils/../src/main/config/checkstyle-checks.xml ruleset. rss feed

    Summary

    diff --git a/dependency-check-utils/cobertura/frame-sourcefiles-org.owasp.dependencycheck.utils.html b/dependency-check-utils/cobertura/frame-sourcefiles-org.owasp.dependencycheck.utils.html index d670b708e..a53ce8dad 100644 --- a/dependency-check-utils/cobertura/frame-sourcefiles-org.owasp.dependencycheck.utils.html +++ b/dependency-check-utils/cobertura/frame-sourcefiles-org.owasp.dependencycheck.utils.html @@ -27,13 +27,13 @@ org.owasp.dependencycheck.utils - + - + diff --git a/dependency-check-utils/cobertura/frame-sourcefiles.html b/dependency-check-utils/cobertura/frame-sourcefiles.html index 12a95e8ec..f506efee5 100644 --- a/dependency-check-utils/cobertura/frame-sourcefiles.html +++ b/dependency-check-utils/cobertura/frame-sourcefiles.html @@ -27,13 +27,13 @@ All Packages - + - + diff --git a/dependency-check-utils/cobertura/frame-summary-org.owasp.dependencycheck.utils.html b/dependency-check-utils/cobertura/frame-summary-org.owasp.dependencycheck.utils.html index f893671d9..12bd6d804 100644 --- a/dependency-check-utils/cobertura/frame-summary-org.owasp.dependencycheck.utils.html +++ b/dependency-check-utils/cobertura/frame-summary-org.owasp.dependencycheck.utils.html @@ -16,7 +16,7 @@
    ExtractionException (0%)
    FileUtils (39%)FileUtils (31%)
    InvalidSettingException (25%)
    Settings (45%)Settings (44%)
    URLConnectionFactory (0%)ExtractionException (0%)
    FileUtils (39%)FileUtils (31%)
    InvalidSettingException (25%)
    Settings (45%)Settings (44%)
    URLConnectionFactory (0%)
    - +
    Package # Classes Line Coverage Branch Coverage Complexity
    org.owasp.dependencycheck.utils11
    28%
    129/445
    23%
    30/130
    2.923
    org.owasp.dependencycheck.utils11
    27%
    122/438
    24%
    34/138
    2.8
    - + diff --git a/dependency-check-utils/cobertura/frame-summary.html b/dependency-check-utils/cobertura/frame-summary.html index 11197e07f..35a77a4b8 100644 --- a/dependency-check-utils/cobertura/frame-summary.html +++ b/dependency-check-utils/cobertura/frame-summary.html @@ -16,8 +16,8 @@ - - + +
    Package # Classes Line Coverage Branch Coverage Complexity
    All Packages11
    28%
    129/445
    23%
    30/130
    2.923
    org.owasp.dependencycheck.utils11
    28%
    129/445
    23%
    30/130
    2.923
    All Packages11
    27%
    122/438
    24%
    34/138
    2.8
    org.owasp.dependencycheck.utils11
    27%
    122/438
    24%
    34/138
    2.8
    - + diff --git a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.Checksum.html b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.Checksum.html index 3218518f4..77ab26d69 100644 --- a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.Checksum.html +++ b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.Checksum.html @@ -133,159 +133,145 @@  59  
          */
     60   -
         @SuppressWarnings("empty-statement")
    -  61  
         public static byte[] getChecksum(String algorithm, File file) throws NoSuchAlgorithmException, IOException {
    -  62  5
             MessageDigest digest = MessageDigest.getInstance(algorithm);
    -  63  4
             FileInputStream fis = null;
    -  64   +  61  5
             MessageDigest digest = MessageDigest.getInstance(algorithm);
    +  62  4
             FileInputStream fis = null;
    +  63  
             try {
    -  65  4
                 fis = new FileInputStream(file);
    -  66  3
                 FileChannel ch = fis.getChannel();
    -  67  3
                 long remainingToRead = file.length();
    -  68  3
                 long start = 0;
    -  69  6
                 while (remainingToRead > 0) {
    -  70   +  64  4
                 fis = new FileInputStream(file);
    +  65  3
                 FileChannel ch = fis.getChannel();
    +  66  3
                 long remainingToRead = file.length();
    +  67  3
                 long start = 0;
    +  68  6
                 while (remainingToRead > 0) {
    +  69  
                     long amountToRead;
    -  71  3
                     if (remainingToRead > Integer.MAX_VALUE) {
    -  72  0
                         remainingToRead -= Integer.MAX_VALUE;
    -  73  0
                         amountToRead = Integer.MAX_VALUE;
    -  74   +  70  3
                     if (remainingToRead > Integer.MAX_VALUE) {
    +  71  0
                         remainingToRead -= Integer.MAX_VALUE;
    +  72  0
                         amountToRead = Integer.MAX_VALUE;
    +  73  
                     } else {
    -  75  3
                         amountToRead = remainingToRead;
    -  76  3
                         remainingToRead = 0;
    -  77   +  74  3
                         amountToRead = remainingToRead;
    +  75  3
                         remainingToRead = 0;
    +  76  
                     }
    -  78  3
                     MappedByteBuffer byteBuffer = ch.map(FileChannel.MapMode.READ_ONLY, start, amountToRead);
    -  79  3
                     digest.update(byteBuffer);
    -  80  3
                     start += amountToRead;
    -  81  3
                 }
    -  82   -
     
    -  83   -
     //            BufferedInputStream bis = new BufferedInputStream(fis);
    -  84   -
     //            DigestInputStream dis = new DigestInputStream(bis, digest);
    -  85   -
     //            //yes, we are reading in a buffer for performance reasons - 1 byte at a time is SLOW
    -  86   -
     //            byte[] buffer = new byte[8192];
    -  87   -
     //            while (dis.read(buffer) != -1);
    -  88   +  77  3
                     MappedByteBuffer byteBuffer = ch.map(FileChannel.MapMode.READ_ONLY, start, amountToRead);
    +  78  3
                     digest.update(byteBuffer);
    +  79  3
                     start += amountToRead;
    +  80  3
                 }
    +  81  
             } finally {
    -  89  4
                 if (fis != null) {
    -  90   +  82  4
                 if (fis != null) {
    +  83  
                     try {
    -  91  3
                         fis.close();
    -  92  0
                     } catch (IOException ex) {
    -  93  0
                         LOGGER.trace("Error closing file '{}'.", file.getName(), ex);
    -  94  4
                     }
    -  95   +  84  3
                         fis.close();
    +  85  0
                     } catch (IOException ex) {
    +  86  0
                         LOGGER.trace("Error closing file '{}'.", file.getName(), ex);
    +  87  4
                     }
    +  88  
                 }
    -  96   +  89  
             }
    -  97  3
             return digest.digest();
    -  98   +  90  3
             return digest.digest();
    +  91  
         }
    -  99   +  92  
     
    -  100   +  93  
         /**
    -  101   +  94  
          * Calculates the MD5 checksum of a specified file.
    -  102   +  95  
          *
    -  103   +  96  
          * @param file the file to generate the MD5 checksum
    -  104   +  97  
          * @return the hex representation of the MD5 hash
    -  105   +  98  
          * @throws IOException when the file passed in does not exist
    -  106   +  99  
          * @throws NoSuchAlgorithmException when the MD5 algorithm is not available
    -  107   +  100  
          */
    -  108   +  101  
         public static String getMD5Checksum(File file) throws IOException, NoSuchAlgorithmException {
    -  109  1
             byte[] b = getChecksum("MD5", file);
    -  110  1
             return getHex(b);
    -  111   +  102  1
             byte[] b = getChecksum("MD5", file);
    +  103  1
             return getHex(b);
    +  104  
         }
    -  112   +  105  
     
    -  113   +  106  
         /**
    -  114   +  107  
          * Calculates the SHA1 checksum of a specified file.
    -  115   +  108  
          *
    -  116   +  109  
          * @param file the file to generate the MD5 checksum
    -  117   +  110  
          * @return the hex representation of the SHA1 hash
    -  118   +  111  
          * @throws IOException when the file passed in does not exist
    -  119   +  112  
          * @throws NoSuchAlgorithmException when the SHA1 algorithm is not available
    +  113   +
          */
    +  114   +
         public static String getSHA1Checksum(File file) throws IOException, NoSuchAlgorithmException {
    +  115  1
             byte[] b = getChecksum("SHA1", file);
    +  116  1
             return getHex(b);
    +  117   +
         }
    +  118   +
         /**
    +  119   +
          * Hex code characters used in getHex.
     120  
          */
     121   -
         public static String getSHA1Checksum(File file) throws IOException, NoSuchAlgorithmException {
    -  122  1
             byte[] b = getChecksum("SHA1", file);
    -  123  1
             return getHex(b);
    -  124   -
         }
    -  125   -
         /**
    -  126   -
          * Hex code characters used in getHex.
    -  127   -
          */
    -  128  
         private static final String HEXES = "0123456789abcdef";
    -  129   +  122  
     
    -  130   +  123  
         /**
    -  131   +  124  
          * <p>
    -  132   +  125  
          * Converts a byte array into a hex string.</p>
    -  133   +  126  
          *
    -  134   +  127  
          * <p>
    -  135   +  128  
          * This method was copied from <a
    -  136   +  129  
          * href="http://www.rgagnon.com/javadetails/java-0596.html">http://www.rgagnon.com/javadetails/java-0596.html</a></p>
    -  137   +  130  
          *
    -  138   +  131  
          * @param raw a byte array
    -  139   +  132  
          * @return the hex representation of the byte array
    -  140   +  133  
          */
    -  141   +  134  
         public static String getHex(byte[] raw) {
    -  142  3
             if (raw == null) {
    -  143  0
                 return null;
    -  144   +  135  3
             if (raw == null) {
    +  136  0
                 return null;
    +  137  
             }
    -  145  3
             final StringBuilder hex = new StringBuilder(2 * raw.length);
    -  146  56
             for (final byte b : raw) {
    -  147  53
                 hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt(b & 0x0F));
    -  148   +  138  3
             final StringBuilder hex = new StringBuilder(2 * raw.length);
    +  139  56
             for (final byte b : raw) {
    +  140  53
                 hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt(b & 0x0F));
    +  141  
             }
    -  149  3
             return hex.toString();
    -  150   +  142  3
             return hex.toString();
    +  143  
         }
    -  151   +  144  
     }
    - + diff --git a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.DownloadFailedException.html b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.DownloadFailedException.html index c5dbca55d..b434e7fe7 100644 --- a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.DownloadFailedException.html +++ b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.DownloadFailedException.html @@ -147,6 +147,6 @@
     }
    - + diff --git a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.Downloader.html b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.Downloader.html index 985374644..42921cd35 100644 --- a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.Downloader.html +++ b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.Downloader.html @@ -504,6 +504,6 @@
     }
    - + diff --git a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.ExtractionException.html b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.ExtractionException.html index 05962d850..c3ef8029e 100644 --- a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.ExtractionException.html +++ b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.ExtractionException.html @@ -147,6 +147,6 @@
     }
    - + diff --git a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.FileUtils.html b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.FileUtils.html index 48daa1fa0..67c3fa369 100644 --- a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.FileUtils.html +++ b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.FileUtils.html @@ -12,7 +12,7 @@
     
    - +
    Classes in this File Line Coverage Branch Coverage Complexity
    FileUtils
    39%
    9/23
    25%
    2/8
    2.2
    FileUtils
    31%
    6/19
    40%
    4/10
    2.4
     
    @@ -56,176 +56,172 @@  19  
     
     20   -
     import org.slf4j.Logger;
    +
     import org.apache.commons.io.FilenameUtils;
     21   -
     import org.slf4j.LoggerFactory;
    +
     import org.slf4j.Logger;
     22   -
     
    +
     import org.slf4j.LoggerFactory;
     23   -
     import java.io.File;
    +
     
     24   -
     import java.io.IOException;
    +
     import java.io.File;
     25   -
     import java.util.UUID;
    +
     import java.io.IOException;
     26   -
     
    +
     import java.util.UUID;
     27   -
     /**
    +
     
     28   -
      * A collection of utilities for processing information about files.
    +
     /**
     29   -
      *
    +
      * A collection of utilities for processing information about files.
     30   -
      * @author Jeremy Long
    +
      *
     31   -
      */
    +
      * @author Jeremy Long
     32   -
     public final class FileUtils {
    +
      */
     33   -
     
    +
     public final class FileUtils {
     34   -
         /**
    +
     
     35   -
          * The logger.
    +
         /**
     36   +
          * The logger.
    +  37  
          */
    -  37  1
         private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class);
    -  38   -
         /**
    +  38  1
         private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class);
     39   -
          * Bit bucket for non-Windows systems
    +
         /**
     40   -
          */
    +
          * Bit bucket for non-Windows systems
     41   -
         private static final String BIT_BUCKET_UNIX = "/dev/null";
    +
          */
     42   -
     
    +
         private static final String BIT_BUCKET_UNIX = "/dev/null";
     43   -
         /**
    +
     
     44   -
          * Bit bucket for Windows systems (yes, only one 'L')
    +
         /**
     45   -
          */
    +
          * Bit bucket for Windows systems (yes, only one 'L')
     46   -
         private static final String BIT_BUCKET_WIN = "NUL";
    +
          */
     47   -
     
    +
         private static final String BIT_BUCKET_WIN = "NUL";
     48   -
         /**
    +
     
     49   -
          * Private constructor for a utility class.
    +
         /**
     50   +
          * Private constructor for a utility class.
    +  51  
          */
    -  51  0
         private FileUtils() {
    -  52  0
         }
    -  53   -
     
    +  52  0
         private FileUtils() {
    +  53  0
         }
     54   -
         /**
    +
     
     55   -
          * Returns the (lowercase) file extension for a specified file.
    +
         /**
     56   -
          *
    +
          * Returns the (lowercase) file extension for a specified file.
     57   -
          * @param fileName the file name to retrieve the file extension from.
    +
          *
     58   -
          * @return the file extension.
    +
          * @param fileName the file name to retrieve the file extension from.
     59   -
          */
    +
          * @return the file extension.
     60   +
          */
    +  61  
         public static String getFileExtension(String fileName) {
    -  61  2
             String ret = null;
    -  62  2
             final int pos = fileName.lastIndexOf(".");
    -  63  2
             if (pos >= 0) {
    -  64  2
                 ret = fileName.substring(pos + 1, fileName.length()).toLowerCase();
    +  62  3
             final String fileExt = FilenameUtils.getExtension(fileName);
    +  63  3
             return null == fileExt || fileExt.isEmpty() ? null : fileExt.toLowerCase();
    +  64   +
         }
     65   -
             }
    -  66  2
             return ret;
    +
     
    +  66   +
         /**
     67   -
         }
    -  68   -
     
    -  69   -
         /**
    -  70  
          * Deletes a file. If the File is a directory it will recursively delete the contents.
    -  71   +  68  
          *
    -  72   +  69  
          * @param file the File to delete
    -  73   +  70  
          * @return true if the file was deleted successfully, otherwise false
    -  74   +  71  
          */
    -  75   +  72  
         public static boolean delete(File file) {
    -  76  3
             boolean success = true;
    -  77  3
             if (!org.apache.commons.io.FileUtils.deleteQuietly(file)) {
    -  78  0
                 success = false;
    -  79  0
                 LOGGER.debug("Failed to delete file: {}; attempting to delete on exit.", file.getPath());
    -  80  0
                 file.deleteOnExit();
    +  73  3
             final boolean success = org.apache.commons.io.FileUtils.deleteQuietly(file);
    +  74  3
             if (!success) {
    +  75  0
                 LOGGER.debug("Failed to delete file: {}; attempting to delete on exit.", file.getPath());
    +  76  0
                 file.deleteOnExit();
    +  77   +
             }
    +  78  3
             return success;
    +  79   +
         }
    +  80   +
     
     81   -
             }
    -  82  3
             return success;
    -  83   -
         }
    -  84   -
     
    -  85  
         /**
    -  86   +  82  
          * Generates a new temporary file name that is guaranteed to be unique.
    -  87   +  83  
          *
    -  88   +  84  
          * @param prefix the prefix for the file name to generate
    -  89   +  85  
          * @param extension the extension of the generated file name
    -  90   +  86  
          * @return a temporary File
    -  91   +  87  
          * @throws java.io.IOException thrown if the temporary folder could not be created
    -  92   +  88  
          */
    -  93   +  89  
         public static File getTempFile(String prefix, String extension) throws IOException {
    -  94  0
             final File dir = Settings.getTempDirectory();
    -  95  0
             final String tempFileName = String.format("%s%s.%s", prefix, UUID.randomUUID().toString(), extension);
    -  96  0
             final File tempFile = new File(dir, tempFileName);
    -  97  0
             if (tempFile.exists()) {
    -  98  0
                 return getTempFile(prefix, extension);
    -  99   +  90  0
             final File dir = Settings.getTempDirectory();
    +  91  0
             final String tempFileName = String.format("%s%s.%s", prefix, UUID.randomUUID().toString(), extension);
    +  92  0
             final File tempFile = new File(dir, tempFileName);
    +  93  0
             if (tempFile.exists()) {
    +  94  0
                 return getTempFile(prefix, extension);
    +  95  
             }
    -  100  0
             return tempFile;
    -  101   +  96  0
             return tempFile;
    +  97  
         }
    -  102   +  98  
     
    -  103   +  99  
         /**
    -  104   +  100  
          * Return the bit bucket for the OS. '/dev/null' for Unix and 'NUL' for Windows
    -  105   +  101  
          *
    -  106   +  102  
          * @return a String containing the bit bucket
    -  107   +  103  
          */
    -  108   +  104  
         public static String getBitBucket() {
    -  109  0
             if (System.getProperty("os.name").startsWith("Windows")) {
    -  110  0
                 return BIT_BUCKET_WIN;
    -  111   +  105  0
             if (System.getProperty("os.name").startsWith("Windows")) {
    +  106  0
                 return BIT_BUCKET_WIN;
    +  107  
             } else {
    -  112  0
                 return BIT_BUCKET_UNIX;
    -  113   +  108  0
                 return BIT_BUCKET_UNIX;
    +  109  
             }
    -  114   +  110  
         }
    -  115   +  111  
     }
    - + diff --git a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.InvalidSettingException.html b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.InvalidSettingException.html index 803cea09e..9724068b7 100644 --- a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.InvalidSettingException.html +++ b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.InvalidSettingException.html @@ -147,6 +147,6 @@
     }
    - + diff --git a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.Settings.html b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.Settings.html index d7c355f05..a633997f6 100644 --- a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.Settings.html +++ b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.Settings.html @@ -12,8 +12,8 @@
     
    - - + +
    Classes in this File Line Coverage Branch Coverage Complexity
    Settings
    46%
    82/178
    35%
    20/56
    2.964
    Settings$KEYS
    0%
    0/2
    N/A
    2.964
    Settings
    44%
    78/175
    35%
    22/62
    2.667
    Settings$KEYS
    0%
    0/2
    N/A
    2.667
     
    @@ -257,1217 +257,1286 @@  120  
             /**
     121   -
              * The properties key for the telling us how many cve.url.* URLs exists. This is used in combination with CVE_BASE_URL to
    +
              * The properties key to control the skipping of the check for CVE updates.
     122   -
              * be able to retrieve the URLs for all of the files that make up the NVD CVE listing.
    -  123  
              */
    +  123   +
             public static final String CVE_CHECK_VALID_FOR_HOURS = "cve.check.validforhours";
     124   -
             public static final String CVE_START_YEAR = "cve.startyear";
    -  125  
             /**
    +  125   +
              * The properties key for the telling us how many cve.url.* URLs exists. This is used in combination with CVE_BASE_URL to
     126   -
              * The properties key for the CVE schema version 1.2.
    +
              * be able to retrieve the URLs for all of the files that make up the NVD CVE listing.
     127  
              */
     128   -
             public static final String CVE_SCHEMA_1_2 = "cve.url-1.2.base";
    +
             public static final String CVE_START_YEAR = "cve.startyear";
     129  
             /**
     130   -
              * The properties key for the CVE schema version 2.0.
    +
              * The properties key for the CVE schema version 1.2.
     131  
              */
     132   -
             public static final String CVE_SCHEMA_2_0 = "cve.url-2.0.base";
    +
             public static final String CVE_SCHEMA_1_2 = "cve.url-1.2.base";
     133  
             /**
     134   -
              * The properties key that indicates how often the CPE data needs to be updated.
    +
              * The properties key for the CVE schema version 2.0.
     135  
              */
     136   -
             public static final String CPE_MODIFIED_VALID_FOR_DAYS = "cpe.validfordays";
    +
             public static final String CVE_SCHEMA_2_0 = "cve.url-2.0.base";
     137  
             /**
     138   -
              * The properties key for the URL to retrieve the CPE.
    +
              * The properties key that indicates how often the CPE data needs to be updated.
     139  
              */
     140   -
             public static final String CPE_URL = "cpe.url";
    +
             public static final String CPE_MODIFIED_VALID_FOR_DAYS = "cpe.validfordays";
     141  
             /**
     142   -
              * The properties key for the proxy server.
    +
              * The properties key for the URL to retrieve the CPE.
     143   -
              *
    +
              */
     144   -
              * @deprecated use {@link org.owasp.dependencycheck.utils.Settings.KEYS#PROXY_SERVER} instead.
    +
             public static final String CPE_URL = "cpe.url";
     145   -
              */
    -  146   -
             @Deprecated
    -  147   -
             public static final String PROXY_URL = "proxy.server";
    -  148  
             /**
    -  149   +  146  
              * The properties key for the proxy server.
    -  150   +  147   +
              *
    +  148   +
              * @deprecated use {@link org.owasp.dependencycheck.utils.Settings.KEYS#PROXY_SERVER} instead.
    +  149  
              */
    +  150   +
             @Deprecated
     151   -
             public static final String PROXY_SERVER = "proxy.server";
    +
             public static final String PROXY_URL = "proxy.server";
     152  
             /**
     153   -
              * The properties key for the proxy port - this must be an integer value.
    +
              * The properties key for the proxy server.
     154  
              */
     155   -
             public static final String PROXY_PORT = "proxy.port";
    +
             public static final String PROXY_SERVER = "proxy.server";
     156  
             /**
     157   -
              * The properties key for the proxy username.
    +
              * The properties key for the proxy port - this must be an integer value.
     158  
              */
     159   -
             public static final String PROXY_USERNAME = "proxy.username";
    +
             public static final String PROXY_PORT = "proxy.port";
     160  
             /**
     161   -
              * The properties key for the proxy password.
    +
              * The properties key for the proxy username.
     162  
              */
     163   -
             public static final String PROXY_PASSWORD = "proxy.password";
    +
             public static final String PROXY_USERNAME = "proxy.username";
     164  
             /**
     165   -
              * The properties key for the connection timeout.
    +
              * The properties key for the proxy password.
     166  
              */
     167   -
             public static final String CONNECTION_TIMEOUT = "connection.timeout";
    +
             public static final String PROXY_PASSWORD = "proxy.password";
     168  
             /**
     169   -
              * The location of the temporary directory.
    +
              * The properties key for the connection timeout.
     170  
              */
     171   -
             public static final String TEMP_DIRECTORY = "temp.directory";
    +
             public static final String CONNECTION_TIMEOUT = "connection.timeout";
     172  
             /**
     173   -
              * The maximum number of threads to allocate when downloading files.
    +
              * The location of the temporary directory.
     174  
              */
     175   -
             public static final String MAX_DOWNLOAD_THREAD_POOL_SIZE = "max.download.threads";
    +
             public static final String TEMP_DIRECTORY = "temp.directory";
     176  
             /**
     177   -
              * The key for a list of suppression files.
    +
              * The maximum number of threads to allocate when downloading files.
     178  
              */
     179   -
             public static final String SUPPRESSION_FILE = "suppression.file";
    +
             public static final String MAX_DOWNLOAD_THREAD_POOL_SIZE = "max.download.threads";
     180  
             /**
     181   -
              * The properties key for whether the Jar Analyzer is enabled.
    +
              * The key for a list of suppression files.
     182  
              */
     183   -
             public static final String ANALYZER_JAR_ENABLED = "analyzer.jar.enabled";
    +
             public static final String SUPPRESSION_FILE = "suppression.file";
     184  
             /**
     185   -
              * The properties key for whether the Archive analyzer is enabled.
    +
              * The properties key for whether the Jar Analyzer is enabled.
     186  
              */
     187   -
             public static final String ANALYZER_ARCHIVE_ENABLED = "analyzer.archive.enabled";
    +
             public static final String ANALYZER_JAR_ENABLED = "analyzer.jar.enabled";
     188  
             /**
     189   -
              * The properties key for whether the node.js package analyzer is enabled.
    +
              * The properties key for whether the Archive analyzer is enabled.
     190  
              */
     191   -
             public static final String ANALYZER_NODE_PACKAGE_ENABLED = "analyzer.node.package.enabled";
    +
             public static final String ANALYZER_ARCHIVE_ENABLED = "analyzer.archive.enabled";
     192  
             /**
     193   -
              * The properties key for whether the composer lock file analyzer is enabled.
    +
              * The properties key for whether the node.js package analyzer is enabled.
     194  
              */
     195   -
             public static final String ANALYZER_COMPOSER_LOCK_ENABLED = "analyzer.composer.lock.enabled";
    +
             public static final String ANALYZER_NODE_PACKAGE_ENABLED = "analyzer.node.package.enabled";
     196  
             /**
     197   -
              * The properties key for whether the Python Distribution analyzer is enabled.
    +
              * The properties key for whether the composer lock file analyzer is enabled.
     198  
              */
     199   -
             public static final String ANALYZER_PYTHON_DISTRIBUTION_ENABLED = "analyzer.python.distribution.enabled";
    +
             public static final String ANALYZER_COMPOSER_LOCK_ENABLED = "analyzer.composer.lock.enabled";
     200  
             /**
     201   -
              * The properties key for whether the Python Package analyzer is enabled.
    +
              * The properties key for whether the Python Distribution analyzer is enabled.
     202  
              */
     203   -
             public static final String ANALYZER_PYTHON_PACKAGE_ENABLED = "analyzer.python.package.enabled";
    +
             public static final String ANALYZER_PYTHON_DISTRIBUTION_ENABLED = "analyzer.python.distribution.enabled";
     204  
             /**
     205   -
              * The properties key for whether the Ruby Gemspec Analyzer is enabled.
    +
              * The properties key for whether the Python Package analyzer is enabled.
     206  
              */
     207   -
             public static final String ANALYZER_RUBY_GEMSPEC_ENABLED = "analyzer.ruby.gemspec.enabled";
    +
             public static final String ANALYZER_PYTHON_PACKAGE_ENABLED = "analyzer.python.package.enabled";
     208  
             /**
     209   -
              * The properties key for whether the Autoconf analyzer is enabled.
    +
              * The properties key for whether the Ruby Gemspec Analyzer is enabled.
     210  
              */
     211   -
             public static final String ANALYZER_AUTOCONF_ENABLED = "analyzer.autoconf.enabled";
    +
             public static final String ANALYZER_RUBY_GEMSPEC_ENABLED = "analyzer.ruby.gemspec.enabled";
     212  
             /**
     213   -
              * The properties key for whether the CMake analyzer is enabled.
    +
              * The properties key for whether the Autoconf analyzer is enabled.
     214  
              */
     215   -
             public static final String ANALYZER_CMAKE_ENABLED = "analyzer.cmake.enabled";
    +
             public static final String ANALYZER_AUTOCONF_ENABLED = "analyzer.autoconf.enabled";
     216  
             /**
     217   -
              * The properties key for whether the .NET Assembly analyzer is enabled.
    +
              * The properties key for whether the CMake analyzer is enabled.
     218  
              */
     219   -
             public static final String ANALYZER_ASSEMBLY_ENABLED = "analyzer.assembly.enabled";
    +
             public static final String ANALYZER_CMAKE_ENABLED = "analyzer.cmake.enabled";
     220  
             /**
     221   -
              * The properties key for whether the .NET Nuspec analyzer is enabled.
    +
              * The properties key for whether the Ruby Bundler Audit analyzer is enabled.
     222  
              */
     223   -
             public static final String ANALYZER_NUSPEC_ENABLED = "analyzer.nuspec.enabled";
    +
             public static final String ANALYZER_BUNDLE_AUDIT_ENABLED = "analyzer.bundle.audit.enabled";
     224  
             /**
     225   -
              * The properties key for whether the Nexus analyzer is enabled.
    +
              * The properties key for whether the .NET Assembly analyzer is enabled.
     226  
              */
     227   -
             public static final String ANALYZER_NEXUS_ENABLED = "analyzer.nexus.enabled";
    +
             public static final String ANALYZER_ASSEMBLY_ENABLED = "analyzer.assembly.enabled";
     228  
             /**
     229   -
              * The properties key for the Nexus search URL.
    +
              * The properties key for whether the .NET Nuspec analyzer is enabled.
     230  
              */
     231   -
             public static final String ANALYZER_NEXUS_URL = "analyzer.nexus.url";
    +
             public static final String ANALYZER_NUSPEC_ENABLED = "analyzer.nuspec.enabled";
     232  
             /**
     233   -
              * The properties key for using the proxy to reach Nexus.
    +
              * The properties key for whether the Nexus analyzer is enabled.
     234  
              */
     235   -
             public static final String ANALYZER_NEXUS_PROXY = "analyzer.nexus.proxy";
    +
             public static final String ANALYZER_NEXUS_ENABLED = "analyzer.nexus.enabled";
     236  
             /**
     237   -
              * The properties key for whether the Central analyzer is enabled.
    +
              * The properties key for the Nexus search URL.
     238  
              */
     239   -
             public static final String ANALYZER_CENTRAL_ENABLED = "analyzer.central.enabled";
    +
             public static final String ANALYZER_NEXUS_URL = "analyzer.nexus.url";
     240  
             /**
     241   -
              * The properties key for whether the OpenSSL analyzer is enabled.
    +
              * The properties key for using the proxy to reach Nexus.
     242  
              */
     243   -
             public static final String ANALYZER_OPENSSL_ENABLED = "analyzer.openssl.enabled";
    +
             public static final String ANALYZER_NEXUS_USES_PROXY = "analyzer.nexus.proxy";
     244  
             /**
     245   -
              * The properties key for the Central search URL.
    +
              * The properties key for whether the Central analyzer is enabled.
     246  
              */
     247   -
             public static final String ANALYZER_CENTRAL_URL = "analyzer.central.url";
    +
             public static final String ANALYZER_CENTRAL_ENABLED = "analyzer.central.enabled";
     248  
             /**
     249   -
              * The path to mono, if available.
    +
              * The properties key for whether the OpenSSL analyzer is enabled.
     250  
              */
     251   -
             public static final String ANALYZER_ASSEMBLY_MONO_PATH = "analyzer.assembly.mono.path";
    +
             public static final String ANALYZER_OPENSSL_ENABLED = "analyzer.openssl.enabled";
     252  
             /**
     253   -
              * The additional configured zip file extensions, if available.
    +
              * The properties key for the Central search URL.
     254  
              */
     255   -
             public static final String ADDITIONAL_ZIP_EXTENSIONS = "extensions.zip";
    +
             public static final String ANALYZER_CENTRAL_URL = "analyzer.central.url";
     256  
             /**
     257   -
              * The properties key for whether Test Scope dependencies should be skipped.
    +
              * The path to mono, if available.
     258  
              */
     259   -
             public static final String SKIP_TEST_SCOPE = "skip.test.scope";
    +
             public static final String ANALYZER_ASSEMBLY_MONO_PATH = "analyzer.assembly.mono.path";
     260  
             /**
     261   -
              * The properties key for whether Runtime Scope dependencies should be skipped.
    +
              * The path to bundle-audit, if available.
     262  
              */
     263   -
             public static final String SKIP_RUNTIME_SCOPE = "skip.runtime.scope";
    +
             public static final String ANALYZER_BUNDLE_AUDIT_PATH = "analyzer.bundle.audit.path";
     264  
             /**
     265   -
              * The properties key for whether Provided Scope dependencies should be skipped.
    +
              * The additional configured zip file extensions, if available.
     266  
              */
     267   -
             public static final String SKIP_PROVIDED_SCOPE = "skip.provided.scope";
    +
             public static final String ADDITIONAL_ZIP_EXTENSIONS = "extensions.zip";
     268   -
     
    +
             /**
     269   -
             /**
    -  270  
              * The key to obtain the path to the VFEED data file.
    +  270   +
              */
     271   -
              */
    -  272  
             public static final String VFEED_DATA_FILE = "vfeed.data_file";
    +  272   +
             /**
     273   -
             /**
    -  274  
              * The key to obtain the VFEED connection string.
    +  274   +
              */
     275   -
              */
    -  276  
             public static final String VFEED_CONNECTION_STRING = "vfeed.connection_string";
    +  276   +
     
     277   -
     
    +
             /**
     278   -
             /**
    -  279  
              * The key to obtain the base download URL for the VFeed data file.
    +  279   +
              */
     280   -
              */
    -  281  
             public static final String VFEED_DOWNLOAD_URL = "vfeed.download_url";
    +  281   +
             /**
     282   -
             /**
    -  283  
              * The key to obtain the download file name for the VFeed data.
    +  283   +
              */
     284   -
              */
    -  285  
             public static final String VFEED_DOWNLOAD_FILE = "vfeed.download_file";
    +  285   +
             /**
     286   -
             /**
    -  287  
              * The key to obtain the VFeed update status.
    +  287   +
              */
     288   -
              */
    -  289  
             public static final String VFEED_UPDATE_STATUS = "vfeed.update_status";
    +  289   +
     
     290   -
     
    -  291  
             /**
    -  292   +  291  
              * The HTTP request method for query last modified date.
    -  293   +  292  
              */
    -  294   +  293  
             public static final String DOWNLOADER_QUICK_QUERY_TIMESTAMP = "downloader.quick.query.timestamp";
    +  294   +
         }
     295   -
         }
    -  296  
         //</editor-fold>
    +  296   +
     
     297   -
     
    +
         /**
     298   -
         /**
    -  299  
          * The logger.
    -  300   +  299  
          */
    -  301  1
         private static final Logger LOGGER = LoggerFactory.getLogger(Settings.class);
    +  300  1
         private static final Logger LOGGER = LoggerFactory.getLogger(Settings.class);
    +  301   +
         /**
     302   -
         /**
    -  303  
          * The properties file location.
    +  303   +
          */
     304   -
          */
    -  305  
         private static final String PROPERTIES_FILE = "dependencycheck.properties";
    +  305   +
         /**
     306   -
         /**
    -  307  
          * Thread local settings.
    -  308   +  307  
          */
    -  309  1
         private static ThreadLocal<Settings> localSettings = new ThreadLocal<Settings>();
    +  308  1
         private static ThreadLocal<Settings> localSettings = new ThreadLocal<Settings>();
    +  309   +
         /**
     310   -
         /**
    -  311  
          * The properties.
    -  312   +  311  
          */
    -  313  2
         private Properties props = null;
    +  312  2
         private Properties props = null;
    +  313   +
     
     314   -
     
    +
         /**
     315   -
         /**
    -  316  
          * Private constructor for the Settings class. This class loads the properties files.
    +  316   +
          *
     317   -
          *
    +
          * @param propertiesFilePath the path to the base properties file to load
     318   -
          * @param propertiesFilePath the path to the base properties file to load
    -  319  
          */
    -  320  2
         private Settings(String propertiesFilePath) {
    -  321  2
             InputStream in = null;
    -  322  2
             props = new Properties();
    -  323   +  319  2
         private Settings(String propertiesFilePath) {
    +  320  2
             InputStream in = null;
    +  321  2
             props = new Properties();
    +  322  
             try {
    -  324  2
                 in = this.getClass().getClassLoader().getResourceAsStream(propertiesFilePath);
    -  325  2
                 props.load(in);
    -  326  0
             } catch (IOException ex) {
    -  327  0
                 LOGGER.error("Unable to load default settings.");
    -  328  0
                 LOGGER.debug("", ex);
    -  329   +  323  2
                 in = this.getClass().getClassLoader().getResourceAsStream(propertiesFilePath);
    +  324  2
                 props.load(in);
    +  325  0
             } catch (IOException ex) {
    +  326  0
                 LOGGER.error("Unable to load default settings.");
    +  327  0
                 LOGGER.debug("", ex);
    +  328  
             } finally {
    -  330  2
                 if (in != null) {
    -  331   +  329  2
                 if (in != null) {
    +  330  
                     try {
    -  332  2
                         in.close();
    -  333  0
                     } catch (IOException ex) {
    -  334  0
                         LOGGER.trace("", ex);
    -  335  2
                     }
    +  331  2
                         in.close();
    +  332  0
                     } catch (IOException ex) {
    +  333  0
                         LOGGER.trace("", ex);
    +  334  2
                     }
    +  335   +
                 }
     336   -
                 }
    -  337  
             }
    -  338  2
             logProperties("Properties loaded", props);
    -  339  2
         }
    +  337  2
             logProperties("Properties loaded", props);
    +  338  2
         }
    +  339   +
     
     340   -
     
    +
         /**
     341   -
         /**
    +
          * Initializes the thread local settings object. Note, to use the settings object you must call this method. However, you must
     342   -
          * Initializes the thread local settings object. Note, to use the settings object you must call this method. However, you must
    +
          * also call Settings.cleanup() to properly release resources.
     343   -
          * also call Settings.cleanup() to properly release resources.
    +
          */
     344   -
          */
    -  345  
         public static void initialize() {
    -  346  2
             localSettings.set(new Settings(PROPERTIES_FILE));
    -  347  2
         }
    +  345  2
             localSettings.set(new Settings(PROPERTIES_FILE));
    +  346  2
         }
    +  347   +
     
     348   -
     
    +
         /**
     349   -
         /**
    -  350  
          * Initializes the thread local settings object. Note, to use the settings object you must call this method. However, you must
    -  351   +  350  
          * also call Settings.cleanup() to properly release resources.
    +  351   +
          *
     352   -
          *
    -  353  
          * @param propertiesFilePath the path to the base properties file to load
    +  353   +
          */
     354   -
          */
    -  355  
         public static void initialize(String propertiesFilePath) {
    -  356  0
             localSettings.set(new Settings(propertiesFilePath));
    -  357  0
         }
    +  355  0
             localSettings.set(new Settings(propertiesFilePath));
    +  356  0
         }
    +  357   +
     
     358   -
     
    +
         /**
     359   -
         /**
    +
          * Cleans up resources to prevent memory leaks.
     360   -
          * Cleans up resources to prevent memory leaks.
    +
          *
     361   -
          *
    +
          */
     362   -
          */
    -  363  
         public static void cleanup() {
    -  364  0
             cleanup(true);
    -  365  0
         }
    +  363  0
             cleanup(true);
    +  364  0
         }
    +  365   +
     
     366   -
     
    +
         /**
     367   -
         /**
    -  368  
          * Cleans up resources to prevent memory leaks.
    +  368   +
          *
     369   -
          *
    -  370  
          * @param deleteTemporary flag indicating whether any temporary directories generated should be removed
    +  370   +
          */
     371   -
          */
    -  372  
         public static void cleanup(boolean deleteTemporary) {
    -  373  2
             if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) {
    -  374  2
                 FileUtils.delete(tempDirectory);
    -  375  2
                 if (tempDirectory.exists()) {
    -  376   +  372  2
             if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) {
    +  373  2
                 FileUtils.delete(tempDirectory);
    +  374  2
                 if (tempDirectory.exists()) {
    +  375  
                     try {
    -  377  0
                         Thread.sleep(2000);
    -  378  0
                     } catch (InterruptedException ex) {
    -  379  0
                         LOGGER.trace("ignore", ex);
    -  380  0
                     }
    -  381  0
                     FileUtils.delete(tempDirectory);
    +  376  0
                         Thread.sleep(2000);
    +  377  0
                     } catch (InterruptedException ex) {
    +  378  0
                         LOGGER.trace("ignore", ex);
    +  379  0
                     }
    +  380  0
                     FileUtils.delete(tempDirectory);
    +  381   +
                 }
     382   -
                 }
    +
             }
     383   -
             }
    -  384  
             try {
    -  385  2
                 localSettings.remove();
    -  386  0
             } catch (Throwable ex) {
    -  387  0
                 LOGGER.debug("Error cleaning up Settings", ex);
    -  388  2
             }
    -  389  2
         }
    +  384  2
                 localSettings.remove();
    +  385  0
             } catch (Throwable ex) {
    +  386  0
                 LOGGER.debug("Error cleaning up Settings", ex);
    +  387  2
             }
    +  388  2
         }
    +  389   +
     
     390   -
     
    +
         /**
     391   -
         /**
    -  392  
          * Gets the underlying instance of the Settings object.
    +  392   +
          *
     393   -
          *
    -  394  
          * @return the Settings object
    +  394   +
          */
     395   -
          */
    -  396  
         public static Settings getInstance() {
    -  397  0
             return localSettings.get();
    -  398   +  396  0
             return localSettings.get();
    +  397  
         }
    +  398   +
     
     399   -
     
    +
         /**
     400   -
         /**
    -  401  
          * Sets the instance of the Settings object to use in this thread.
    +  401   +
          *
     402   -
          *
    -  403  
          * @param instance the instance of the settings object to use in this thread
    +  403   +
          */
     404   -
          */
    -  405  
         public static void setInstance(Settings instance) {
    -  406  0
             localSettings.set(instance);
    -  407  0
         }
    +  405  0
             localSettings.set(instance);
    +  406  0
         }
    +  407   +
     
     408   -
     
    +
         /**
     409   -
         /**
    -  410  
          * Logs the properties. This will not log any properties that contain 'password' in the key.
    +  410   +
          *
     411   -
          *
    -  412  
          * @param header the header to print with the log message
    -  413   +  412  
          * @param properties the properties to log
    +  413   +
          */
     414   -
          */
    -  415  
         private static void logProperties(String header, Properties properties) {
    -  416  3
             if (LOGGER.isDebugEnabled()) {
    -  417  0
                 final StringWriter sw = new StringWriter();
    -  418  0
                 PrintWriter pw = null;
    -  419   +  415  3
             if (LOGGER.isDebugEnabled()) {
    +  416  0
                 final StringWriter sw = new StringWriter();
    +  417  0
                 PrintWriter pw = null;
    +  418  
                 try {
    -  420  0
                     pw = new PrintWriter(sw);
    -  421  0
                     pw.format("%s:%n%n", header);
    -  422  0
                     final Enumeration<?> e = properties.propertyNames();
    -  423  0
                     while (e.hasMoreElements()) {
    -  424  0
                         final String key = (String) e.nextElement();
    -  425  0
                         if (key.contains("password")) {
    -  426  0
                             pw.format("%s='*****'%n", key);
    -  427   +  419  0
                     pw = new PrintWriter(sw);
    +  420  0
                     pw.format("%s:%n%n", header);
    +  421  0
                     final Enumeration<?> e = properties.propertyNames();
    +  422  0
                     while (e.hasMoreElements()) {
    +  423  0
                         final String key = (String) e.nextElement();
    +  424  0
                         if (key.contains("password")) {
    +  425  0
                             pw.format("%s='*****'%n", key);
    +  426  
                         } else {
    -  428  0
                             final String value = properties.getProperty(key);
    -  429  0
                             if (value != null) {
    -  430  0
                                 pw.format("%s='%s'%n", key, value);
    -  431   +  427  0
                             final String value = properties.getProperty(key);
    +  428  0
                             if (value != null) {
    +  429  0
                                 pw.format("%s='%s'%n", key, value);
    +  430  
                             }
    -  432   +  431  
                         }
    -  433  0
                     }
    -  434  0
                     pw.flush();
    -  435  0
                     LOGGER.debug(sw.toString());
    -  436   +  432  0
                     }
    +  433  0
                     pw.flush();
    +  434  0
                     LOGGER.debug(sw.toString());
    +  435  
                 } finally {
    -  437  0
                     if (pw != null) {
    -  438  0
                         pw.close();
    -  439   +  436  0
                     if (pw != null) {
    +  437  0
                         pw.close();
    +  438  
                     }
    +  439   +
                 }
     440   -
                 }
    +
     
     441   -
     
    -  442  
             }
    -  443  3
         }
    +  442  3
         }
    +  443   +
     
     444   -
     
    +
         /**
     445   -
         /**
    +
          * Sets a property value.
     446   -
          * Sets a property value.
    +
          *
     447   -
          *
    +
          * @param key the key for the property
     448   -
          * @param key the key for the property
    +
          * @param value the value for the property
     449   -
          * @param value the value for the property
    +
          */
     450   -
          */
    -  451  
         public static void setString(String key, String value) {
    -  452  5
             localSettings.get().props.setProperty(key, value);
    -  453  5
             LOGGER.debug("Setting: {}='{}'", key, value);
    -  454  5
         }
    +  451  7
             localSettings.get().props.setProperty(key, value);
    +  452  7
             LOGGER.debug("Setting: {}='{}'", key, value);
    +  453  7
         }
    +  454   +
     
     455   -
     
    +
         /**
     456   -
         /**
    +
          * Sets a property value only if the value is not null.
     457   -
          * Sets a property value.
    +
          *
     458   -
          *
    -  459  
          * @param key the key for the property
    -  460   +  459  
          * @param value the value for the property
    +  460   +
          */
     461   -
          */
    -  462   -
         public static void setBoolean(String key, boolean value) {
    -  463  0
             if (value) {
    -  464  0
                 localSettings.get().props.setProperty(key, Boolean.TRUE.toString());
    -  465   -
             } else {
    -  466  0
                 localSettings.get().props.setProperty(key, Boolean.FALSE.toString());
    +
         public static void setStringIfNotNull(String key, String value) {
    +  462  1
             if (null != value) {
    +  463  0
                 setString(key, value);
    +  464   +
             }
    +  465  1
         }
    +  466   +
     
     467   -
             }
    -  468  0
             LOGGER.debug("Setting: {}='{}'", key, value);
    -  469  0
         }
    +
         /**
    +  468   +
          * Sets a property value only if the value is not null and not empty.
    +  469   +
          *
     470   -
     
    +
          * @param key the key for the property
     471   -
         /**
    +
          * @param value the value for the property
     472   -
          * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties
    +
          */
     473   -
          * file.<br/><br/>
    -  474   -
          * Note: even if using this method - system properties will be loaded before properties loaded from files.
    -  475   -
          *
    +
         public static void setStringIfNotEmpty(String key, String value) {
    +  474  1
             if (null != value && !value.isEmpty()) {
    +  475  0
                 setString(key, value);
     476   -
          * @param filePath the path to the properties file to merge.
    -  477   -
          * @throws FileNotFoundException is thrown when the filePath points to a non-existent file
    +
             }
    +  477  1
         }
     478   -
          * @throws IOException is thrown when there is an exception loading/merging the properties
    +
     
     479   -
          */
    +
         /**
     480   -
         public static void mergeProperties(File filePath) throws FileNotFoundException, IOException {
    -  481  0
             FileInputStream fis = null;
    +
          * Sets a property value.
    +  481   +
          *
     482   -
             try {
    -  483  0
                 fis = new FileInputStream(filePath);
    -  484  0
                 mergeProperties(fis);
    +
          * @param key the key for the property
    +  483   +
          * @param value the value for the property
    +  484   +
          */
     485   -
             } finally {
    -  486  0
                 if (fis != null) {
    -  487   -
                     try {
    -  488  0
                         fis.close();
    -  489  0
                     } catch (IOException ex) {
    -  490  0
                         LOGGER.trace("close error", ex);
    -  491  0
                     }
    +
         public static void setBoolean(String key, boolean value) {
    +  486  0
             setString(key, Boolean.toString(value));
    +  487  0
         }
    +  488   +
     
    +  489   +
         /**
    +  490   +
          * Sets a property value only if the value is not null.
    +  491   +
          *
     492   -
                 }
    +
          * @param key the key for the property
     493   -
             }
    -  494  0
         }
    +
          * @param value the value for the property
    +  494   +
          */
     495   -
     
    -  496   -
         /**
    -  497   -
          * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties
    +
         public static void setBooleanIfNotNull(String key, Boolean value) {
    +  496  0
             if (null != value) {
    +  497  0
                 setBoolean(key, value);
     498   -
          * file.<br/><br/>
    -  499   -
          * Note: even if using this method - system properties will be loaded before properties loaded from files.
    -  500   -
          *
    -  501   -
          * @param filePath the path to the properties file to merge.
    -  502   -
          * @throws FileNotFoundException is thrown when the filePath points to a non-existent file
    -  503   -
          * @throws IOException is thrown when there is an exception loading/merging the properties
    -  504   -
          */
    -  505   -
         public static void mergeProperties(String filePath) throws FileNotFoundException, IOException {
    -  506  1
             FileInputStream fis = null;
    -  507   -
             try {
    -  508  1
                 fis = new FileInputStream(filePath);
    -  509  1
                 mergeProperties(fis);
    -  510   -
             } finally {
    -  511  1
                 if (fis != null) {
    -  512   -
                     try {
    -  513  1
                         fis.close();
    -  514  0
                     } catch (IOException ex) {
    -  515  0
                         LOGGER.trace("close error", ex);
    -  516  1
                     }
    -  517   -
                 }
    -  518  
             }
    -  519  1
         }
    -  520   +  499  0
         }
    +  500  
     
    +  501   +
         /**
    +  502   +
          * Sets a property value.
    +  503   +
          *
    +  504   +
          * @param key the key for the property
    +  505   +
          * @param value the value for the property
    +  506   +
          */
    +  507   +
         public static void setInt(String key, int value) {
    +  508  0
             localSettings.get().props.setProperty(key, String.valueOf(value));
    +  509  0
             LOGGER.debug("Setting: {}='{}'", key, value);
    +  510  0
         }
    +  511   +
     
    +  512   +
         /**
    +  513   +
          * Sets a property value only if the value is not null.
    +  514   +
          *
    +  515   +
          * @param key the key for the property
    +  516   +
          * @param value the value for the property
    +  517   +
          */
    +  518   +
         public static void setIntIfNotNull(String key, Integer value) {
    +  519  0
             if (null != value) {
    +  520  0
                 setInt(key, value);
     521   -
         /**
    -  522   -
          * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties
    +
             }
    +  522  0
         }
     523   -
          * file.<br/><br/>
    -  524   -
          * Note: even if using this method - system properties will be loaded before properties loaded from files.
    -  525   -
          *
    -  526   -
          * @param stream an Input Stream pointing at a properties file to merge
    -  527   -
          * @throws IOException is thrown when there is an exception loading/merging the properties
    -  528   -
          */
    -  529   -
         public static void mergeProperties(InputStream stream) throws IOException {
    -  530  1
             localSettings.get().props.load(stream);
    -  531  1
             logProperties("Properties updated via merge", localSettings.get().props);
    -  532  1
         }
    -  533  
     
    -  534   +  524  
         /**
    -  535   -
          * Returns a value from the properties file as a File object. If the value was specified as a system property or passed in via
    -  536   -
          * the -Dprop=value argument - this method will return the value from the system properties before the values in the contained
    -  537   -
          * configuration file.
    -  538   +  525   +
          * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties
    +  526   +
          * file.<br/><br/>
    +  527   +
          * Note: even if using this method - system properties will be loaded before properties loaded from files.
    +  528  
          *
    -  539   -
          * @param key the key to lookup within the properties file
    -  540   -
          * @return the property from the properties file converted to a File object
    -  541   +  529   +
          * @param filePath the path to the properties file to merge.
    +  530   +
          * @throws FileNotFoundException is thrown when the filePath points to a non-existent file
    +  531   +
          * @throws IOException is thrown when there is an exception loading/merging the properties
    +  532  
          */
    -  542   -
         public static File getFile(String key) {
    -  543  0
             final String file = getString(key);
    -  544  0
             if (file == null) {
    -  545  0
                 return null;
    +  533   +
         public static void mergeProperties(File filePath) throws FileNotFoundException, IOException {
    +  534  0
             FileInputStream fis = null;
    +  535   +
             try {
    +  536  0
                 fis = new FileInputStream(filePath);
    +  537  0
                 mergeProperties(fis);
    +  538   +
             } finally {
    +  539  0
                 if (fis != null) {
    +  540   +
                     try {
    +  541  0
                         fis.close();
    +  542  0
                     } catch (IOException ex) {
    +  543  0
                         LOGGER.trace("close error", ex);
    +  544  0
                     }
    +  545   +
                 }
     546  
             }
    -  547  0
             return new File(file);
    +  547  0
         }
     548   -
         }
    +
     
     549   -
     
    +
         /**
     550   -
         /**
    +
          * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties
     551   -
          * Returns a value from the properties file as a File object. If the value was specified as a system property or passed in via
    +
          * file.<br/><br/>
     552   -
          * the -Dprop=value argument - this method will return the value from the system properties before the values in the contained
    +
          * Note: even if using this method - system properties will be loaded before properties loaded from files.
     553   -
          * configuration file.
    +
          *
     554   -
          *
    +
          * @param filePath the path to the properties file to merge.
     555   -
          * This method will check the configured base directory and will use this as the base of the file path. Additionally, if the
    +
          * @throws FileNotFoundException is thrown when the filePath points to a non-existent file
     556   -
          * base directory begins with a leading "[JAR]\" sequence with the path to the folder containing the JAR file containing this
    +
          * @throws IOException is thrown when there is an exception loading/merging the properties
     557   -
          * class.
    +
          */
     558   -
          *
    -  559   -
          * @param key the key to lookup within the properties file
    +
         public static void mergeProperties(String filePath) throws FileNotFoundException, IOException {
    +  559  1
             FileInputStream fis = null;
     560   -
          * @return the property from the properties file converted to a File object
    -  561   -
          */
    -  562   -
         protected static File getDataFile(String key) {
    -  563  2
             final String file = getString(key);
    -  564  2
             LOGGER.debug("Settings.getDataFile() - file: '{}'", file);
    -  565  2
             if (file == null) {
    -  566  0
                 return null;
    -  567   +
             try {
    +  561  1
                 fis = new FileInputStream(filePath);
    +  562  1
                 mergeProperties(fis);
    +  563   +
             } finally {
    +  564  1
                 if (fis != null) {
    +  565   +
                     try {
    +  566  1
                         fis.close();
    +  567  0
                     } catch (IOException ex) {
    +  568  0
                         LOGGER.trace("close error", ex);
    +  569  1
                     }
    +  570   +
                 }
    +  571  
             }
    -  568  2
             if (file.startsWith("[JAR]")) {
    -  569  0
                 LOGGER.debug("Settings.getDataFile() - transforming filename");
    -  570  0
                 final File jarPath = getJarPath();
    -  571  0
                 LOGGER.debug("Settings.getDataFile() - jar file: '{}'", jarPath.toString());
    -  572  0
                 final File retVal = new File(jarPath, file.substring(6));
    -  573  0
                 LOGGER.debug("Settings.getDataFile() - returning: '{}'", retVal.toString());
    -  574  0
                 return retVal;
    +  572  1
         }
    +  573   +
     
    +  574   +
         /**
     575   -
             }
    -  576  2
             return new File(file);
    +
          * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties
    +  576   +
          * file.<br/><br/>
     577   -
         }
    +
          * Note: even if using this method - system properties will be loaded before properties loaded from files.
     578   -
     
    +
          *
     579   -
         /**
    +
          * @param stream an Input Stream pointing at a properties file to merge
     580   -
          * Attempts to retrieve the folder containing the Jar file containing the Settings class.
    +
          * @throws IOException is thrown when there is an exception loading/merging the properties
     581   -
          *
    +
          */
     582   -
          * @return a File object
    -  583   -
          */
    -  584   -
         private static File getJarPath() {
    -  585  0
             final String jarPath = Settings.class.getProtectionDomain().getCodeSource().getLocation().getPath();
    -  586  0
             String decodedPath = ".";
    +
         public static void mergeProperties(InputStream stream) throws IOException {
    +  583  1
             localSettings.get().props.load(stream);
    +  584  1
             logProperties("Properties updated via merge", localSettings.get().props);
    +  585  1
         }
    +  586   +
     
     587   -
             try {
    -  588  0
                 decodedPath = URLDecoder.decode(jarPath, "UTF-8");
    -  589  0
             } catch (UnsupportedEncodingException ex) {
    -  590  0
                 LOGGER.trace("", ex);
    -  591  0
             }
    +
         /**
    +  588   +
          * Returns a value from the properties file as a File object. If the value was specified as a system property or passed in via
    +  589   +
          * the -Dprop=value argument - this method will return the value from the system properties before the values in the contained
    +  590   +
          * configuration file.
    +  591   +
          *
     592   -
     
    -  593  0
             final File path = new File(decodedPath);
    -  594  0
             if (path.getName().toLowerCase().endsWith(".jar")) {
    -  595  0
                 return path.getParentFile();
    -  596   -
             } else {
    -  597  0
                 return new File(".");
    -  598   -
             }
    +
          * @param key the key to lookup within the properties file
    +  593   +
          * @return the property from the properties file converted to a File object
    +  594   +
          */
    +  595   +
         public static File getFile(String key) {
    +  596  0
             final String file = getString(key);
    +  597  0
             if (file == null) {
    +  598  0
                 return null;
     599   -
         }
    -  600   -
     
    -  601   -
         /**
    -  602   -
          * Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value
    -  603   -
          * argument - this method will return the value from the system properties before the values in the contained configuration
    -  604   -
          * file.
    -  605   -
          *
    -  606   -
          * @param key the key to lookup within the properties file
    -  607   -
          * @param defaultValue the default value for the requested property
    -  608   -
          * @return the property from the properties file
    -  609   -
          */
    -  610   -
         public static String getString(String key, String defaultValue) {
    -  611  4
             final String str = System.getProperty(key, localSettings.get().props.getProperty(key, defaultValue));
    -  612  4
             return str;
    -  613   -
         }
    -  614   -
     
    -  615   -
         /**
    -  616   -
          * A reference to the temporary directory; used incase it needs to be deleted during cleanup.
    -  617   -
          */
    -  618  1
         private static File tempDirectory = null;
    -  619   -
     
    -  620   -
         /**
    -  621   -
          * Returns the temporary directory.
    -  622   -
          *
    -  623   -
          * @return the temporary directory
    -  624   -
          * @throws java.io.IOException thrown if the temporary directory does not exist and cannot be created
    -  625   -
          */
    -  626   -
         public static File getTempDirectory() throws IOException {
    -  627  2
             final File tmpDir = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")), "dctemp");
    -  628  2
             if (!tmpDir.exists() && !tmpDir.mkdirs()) {
    -  629  0
                 final String msg = String.format("Unable to make a temporary folder '%s'", tmpDir.getPath());
    -  630  0
                 throw new IOException(msg);
    -  631  
             }
    -  632  2
             tempDirectory = tmpDir;
    -  633  2
             return tmpDir;
    +  600  0
             return new File(file);
    +  601   +
         }
    +  602   +
     
    +  603   +
         /**
    +  604   +
          * Returns a value from the properties file as a File object. If the value was specified as a system property or passed in via
    +  605   +
          * the -Dprop=value argument - this method will return the value from the system properties before the values in the contained
    +  606   +
          * configuration file.
    +  607   +
          *
    +  608   +
          * This method will check the configured base directory and will use this as the base of the file path. Additionally, if the
    +  609   +
          * base directory begins with a leading "[JAR]\" sequence with the path to the folder containing the JAR file containing this
    +  610   +
          * class.
    +  611   +
          *
    +  612   +
          * @param key the key to lookup within the properties file
    +  613   +
          * @return the property from the properties file converted to a File object
    +  614   +
          */
    +  615   +
         protected static File getDataFile(String key) {
    +  616  2
             final String file = getString(key);
    +  617  2
             LOGGER.debug("Settings.getDataFile() - file: '{}'", file);
    +  618  2
             if (file == null) {
    +  619  0
                 return null;
    +  620   +
             }
    +  621  2
             if (file.startsWith("[JAR]")) {
    +  622  0
                 LOGGER.debug("Settings.getDataFile() - transforming filename");
    +  623  0
                 final File jarPath = getJarPath();
    +  624  0
                 LOGGER.debug("Settings.getDataFile() - jar file: '{}'", jarPath.toString());
    +  625  0
                 final File retVal = new File(jarPath, file.substring(6));
    +  626  0
                 LOGGER.debug("Settings.getDataFile() - returning: '{}'", retVal.toString());
    +  627  0
                 return retVal;
    +  628   +
             }
    +  629  2
             return new File(file);
    +  630   +
         }
    +  631   +
     
    +  632   +
         /**
    +  633   +
          * Attempts to retrieve the folder containing the Jar file containing the Settings class.
     634   -
         }
    +
          *
     635   -
     
    +
          * @return a File object
     636   -
         /**
    +
          */
     637   -
          * Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value
    -  638   -
          * argument - this method will return the value from the system properties before the values in the contained configuration
    -  639   -
          * file.
    +
         private static File getJarPath() {
    +  638  0
             final String jarPath = Settings.class.getProtectionDomain().getCodeSource().getLocation().getPath();
    +  639  0
             String decodedPath = ".";
     640   -
          *
    -  641   -
          * @param key the key to lookup within the properties file
    -  642   -
          * @return the property from the properties file
    -  643   -
          */
    -  644   -
         public static String getString(String key) {
    -  645  16
             return System.getProperty(key, localSettings.get().props.getProperty(key));
    -  646   -
         }
    -  647   +
             try {
    +  641  0
                 decodedPath = URLDecoder.decode(jarPath, "UTF-8");
    +  642  0
             } catch (UnsupportedEncodingException ex) {
    +  643  0
                 LOGGER.trace("", ex);
    +  644  0
             }
    +  645  
     
    -  648   -
         /**
    +  646  0
             final File path = new File(decodedPath);
    +  647  0
             if (path.getName().toLowerCase().endsWith(".jar")) {
    +  648  0
                 return path.getParentFile();
     649   -
          * Removes a property from the local properties collection. This is mainly used in test cases.
    -  650   -
          *
    +
             } else {
    +  650  0
                 return new File(".");
     651   -
          * @param key the property key to remove
    +
             }
     652   -
          */
    +
         }
     653   -
         public static void removeProperty(String key) {
    -  654  1
             localSettings.get().props.remove(key);
    -  655  1
         }
    +
     
    +  654   +
         /**
    +  655   +
          * Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value
     656   -
     
    +
          * argument - this method will return the value from the system properties before the values in the contained configuration
     657   -
         /**
    +
          * file.
     658   -
          * Returns an int value from the properties file. If the value was specified as a system property or passed in via the
    +
          *
     659   -
          * -Dprop=value argument - this method will return the value from the system properties before the values in the contained
    +
          * @param key the key to lookup within the properties file
     660   -
          * configuration file.
    +
          * @param defaultValue the default value for the requested property
     661   -
          *
    +
          * @return the property from the properties file
     662   -
          * @param key the key to lookup within the properties file
    +
          */
     663   -
          * @return the property from the properties file
    -  664   -
          * @throws InvalidSettingException is thrown if there is an error retrieving the setting
    -  665   -
          */
    +
         public static String getString(String key, String defaultValue) {
    +  664  5
             final String str = System.getProperty(key, localSettings.get().props.getProperty(key, defaultValue));
    +  665  5
             return str;
     666   -
         public static int getInt(String key) throws InvalidSettingException {
    +
         }
     667   -
             int value;
    +
     
     668   -
             try {
    -  669  1
                 value = Integer.parseInt(Settings.getString(key));
    -  670  0
             } catch (NumberFormatException ex) {
    -  671  0
                 throw new InvalidSettingException("Could not convert property '" + key + "' to an int.", ex);
    -  672  1
             }
    -  673  1
             return value;
    -  674   -
         }
    -  675   -
     
    -  676  
         /**
    -  677   -
          * Returns an int value from the properties file. If the value was specified as a system property or passed in via the
    -  678   -
          * -Dprop=value argument - this method will return the value from the system properties before the values in the contained
    -  679   -
          * configuration file.
    -  680   -
          *
    -  681   -
          * @param key the key to lookup within the properties file
    -  682   -
          * @param defaultValue the default value to return
    -  683   -
          * @return the property from the properties file or the defaultValue if the property does not exist or cannot be converted to
    -  684   -
          * an integer
    -  685   +  669   +
          * A reference to the temporary directory; used incase it needs to be deleted during cleanup.
    +  670  
          */
    -  686   -
         public static int getInt(String key, int defaultValue) {
    -  687   -
             int value;
    -  688   -
             try {
    -  689  0
                 value = Integer.parseInt(Settings.getString(key));
    -  690  0
             } catch (NumberFormatException ex) {
    -  691  0
                 LOGGER.trace("Could not convert property '{}' to an int.", key, ex);
    -  692  0
                 value = defaultValue;
    -  693  0
             }
    -  694  0
             return value;
    -  695   -
         }
    -  696   +  671  1
         private static File tempDirectory = null;
    +  672  
     
    -  697   +  673  
         /**
    -  698   -
          * Returns a long value from the properties file. If the value was specified as a system property or passed in via the
    -  699   -
          * -Dprop=value argument - this method will return the value from the system properties before the values in the contained
    -  700   -
          * configuration file.
    -  701   +  674   +
          * Returns the temporary directory.
    +  675  
          *
    -  702   +  676   +
          * @return the temporary directory
    +  677   +
          * @throws java.io.IOException thrown if the temporary directory does not exist and cannot be created
    +  678   +
          */
    +  679   +
         public static File getTempDirectory() throws IOException {
    +  680  2
             final File tmpDir = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")), "dctemp");
    +  681  2
             if (!tmpDir.exists() && !tmpDir.mkdirs()) {
    +  682  0
                 final String msg = String.format("Unable to make a temporary folder '%s'", tmpDir.getPath());
    +  683  0
                 throw new IOException(msg);
    +  684   +
             }
    +  685  2
             tempDirectory = tmpDir;
    +  686  2
             return tmpDir;
    +  687   +
         }
    +  688   +
     
    +  689   +
         /**
    +  690   +
          * Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value
    +  691   +
          * argument - this method will return the value from the system properties before the values in the contained configuration
    +  692   +
          * file.
    +  693   +
          *
    +  694  
          * @param key the key to lookup within the properties file
    -  703   +  695  
          * @return the property from the properties file
    +  696   +
          */
    +  697   +
         public static String getString(String key) {
    +  698  17
             return System.getProperty(key, localSettings.get().props.getProperty(key));
    +  699   +
         }
    +  700   +
     
    +  701   +
         /**
    +  702   +
          * Removes a property from the local properties collection. This is mainly used in test cases.
    +  703   +
          *
     704   -
          * @throws InvalidSettingException is thrown if there is an error retrieving the setting
    +
          * @param key the property key to remove
     705  
          */
     706   -
         public static long getLong(String key) throws InvalidSettingException {
    -  707   -
             long value;
    -  708   -
             try {
    -  709  1
                 value = Long.parseLong(Settings.getString(key));
    -  710  0
             } catch (NumberFormatException ex) {
    -  711  0
                 throw new InvalidSettingException("Could not convert property '" + key + "' to an int.", ex);
    -  712  1
             }
    -  713  1
             return value;
    +
         public static void removeProperty(String key) {
    +  707  1
             localSettings.get().props.remove(key);
    +  708  1
         }
    +  709   +
     
    +  710   +
         /**
    +  711   +
          * Returns an int value from the properties file. If the value was specified as a system property or passed in via the
    +  712   +
          * -Dprop=value argument - this method will return the value from the system properties before the values in the contained
    +  713   +
          * configuration file.
     714   -
         }
    +
          *
     715   -
     
    +
          * @param key the key to lookup within the properties file
     716   -
         /**
    +
          * @return the property from the properties file
     717   -
          * Returns a boolean value from the properties file. If the value was specified as a system property or passed in via the
    +
          * @throws InvalidSettingException is thrown if there is an error retrieving the setting
     718   -
          * <code>-Dprop=value</code> argument this method will return the value from the system properties before the values in the
    +
          */
     719   -
          * contained configuration file.
    +
         public static int getInt(String key) throws InvalidSettingException {
     720   -
          *
    -  721   -
          * @param key the key to lookup within the properties file
    -  722   -
          * @return the property from the properties file
    -  723   -
          * @throws InvalidSettingException is thrown if there is an error retrieving the setting
    +
             try {
    +  721  1
                 return Integer.parseInt(Settings.getString(key));
    +  722  0
             } catch (NumberFormatException ex) {
    +  723  0
                 throw new InvalidSettingException("Could not convert property '" + key + "' to an int.", ex);
     724   -
          */
    +
             }
     725   -
         public static boolean getBoolean(String key) throws InvalidSettingException {
    +
         }
     726   -
             boolean value;
    +
     
     727   -
             try {
    -  728  1
                 value = Boolean.parseBoolean(Settings.getString(key));
    -  729  0
             } catch (NumberFormatException ex) {
    -  730  0
                 throw new InvalidSettingException("Could not convert property '" + key + "' to an int.", ex);
    -  731  1
             }
    -  732  1
             return value;
    -  733   -
         }
    -  734   -
     
    -  735  
         /**
    -  736   -
          * Returns a boolean value from the properties file. If the value was specified as a system property or passed in via the
    -  737   -
          * <code>-Dprop=value</code> argument this method will return the value from the system properties before the values in the
    -  738   -
          * contained configuration file.
    -  739   +  728   +
          * Returns an int value from the properties file. If the value was specified as a system property or passed in via the
    +  729   +
          * -Dprop=value argument - this method will return the value from the system properties before the values in the contained
    +  730   +
          * configuration file.
    +  731  
          *
    -  740   +  732  
          * @param key the key to lookup within the properties file
    -  741   -
          * @param defaultValue the default value to return if the setting does not exist
    -  742   -
          * @return the property from the properties file
    -  743   -
          * @throws InvalidSettingException is thrown if there is an error retrieving the setting
    -  744   +  733   +
          * @param defaultValue the default value to return
    +  734   +
          * @return the property from the properties file or the defaultValue if the property does not exist or cannot be converted to
    +  735   +
          * an integer
    +  736  
          */
    -  745   -
         public static boolean getBoolean(String key, boolean defaultValue) throws InvalidSettingException {
    -  746   -
             boolean value;
    -  747   +  737   +
         public static int getInt(String key, int defaultValue) {
    +  738   +
             int value;
    +  739  
             try {
    -  748  1
                 final String strValue = Settings.getString(key);
    -  749  1
                 if (strValue == null) {
    -  750  1
                     return defaultValue;
    +  740  0
                 value = Integer.parseInt(Settings.getString(key));
    +  741  0
             } catch (NumberFormatException ex) {
    +  742  0
                 LOGGER.trace("Could not convert property '{}' to an int.", key, ex);
    +  743  0
                 value = defaultValue;
    +  744  0
             }
    +  745  0
             return value;
    +  746   +
         }
    +  747   +
     
    +  748   +
         /**
    +  749   +
          * Returns a long value from the properties file. If the value was specified as a system property or passed in via the
    +  750   +
          * -Dprop=value argument - this method will return the value from the system properties before the values in the contained
     751   -
                 }
    -  752  0
                 value = Boolean.parseBoolean(strValue);
    -  753  0
             } catch (NumberFormatException ex) {
    -  754  0
                 throw new InvalidSettingException("Could not convert property '" + key + "' to an int.", ex);
    -  755  0
             }
    -  756  0
             return value;
    +
          * configuration file.
    +  752   +
          *
    +  753   +
          * @param key the key to lookup within the properties file
    +  754   +
          * @return the property from the properties file
    +  755   +
          * @throws InvalidSettingException is thrown if there is an error retrieving the setting
    +  756   +
          */
     757   -
         }
    +
         public static long getLong(String key) throws InvalidSettingException {
     758   -
     
    -  759   -
         /**
    -  760   -
          * Returns a connection string from the configured properties. If the connection string contains a %s, this method will
    -  761   -
          * determine the 'data' directory and replace the %s with the path to the data directory. If the data directory does not
    +
             try {
    +  759  1
                 return Long.parseLong(Settings.getString(key));
    +  760  0
             } catch (NumberFormatException ex) {
    +  761  0
                 throw new InvalidSettingException("Could not convert property '" + key + "' to a long.", ex);
     762   -
          * exists it will be created.
    +
             }
     763   -
          *
    +
         }
     764   -
          * @param connectionStringKey the property file key for the connection string
    -  765   -
          * @param dbFileNameKey the settings key for the db filename
    -  766   -
          * @return the connection string
    -  767   -
          * @throws IOException thrown the data directory cannot be created
    -  768   -
          * @throws InvalidSettingException thrown if there is an invalid setting
    -  769   -
          */
    -  770   -
         public static String getConnectionString(String connectionStringKey, String dbFileNameKey)
    -  771   -
                 throws IOException, InvalidSettingException {
    -  772  2
             final String connStr = Settings.getString(connectionStringKey);
    -  773  2
             if (connStr == null) {
    -  774  1
                 final String msg = String.format("Invalid properties file; %s is missing.", connectionStringKey);
    -  775  1
                 throw new InvalidSettingException(msg);
    -  776   -
             }
    -  777  1
             if (connStr.contains("%s")) {
    -  778  1
                 final File directory = getDataDirectory();
    -  779  1
                 String fileName = null;
    -  780  1
                 if (dbFileNameKey != null) {
    -  781  1
                     fileName = Settings.getString(dbFileNameKey);
    -  782   -
                 }
    -  783  1
                 if (fileName == null) {
    -  784  0
                     final String msg = String.format("Invalid properties file to get a file based connection string; '%s' must be defined.",
    -  785   -
                             dbFileNameKey);
    -  786  0
                     throw new InvalidSettingException(msg);
    -  787   -
                 }
    -  788  1
                 if (connStr.startsWith("jdbc:h2:file:") && fileName.endsWith(".h2.db")) {
    -  789  1
                     fileName = fileName.substring(0, fileName.length() - 6);
    -  790   -
                 }
    -  791   -
                 // yes, for H2 this path won't actually exists - but this is sufficient to get the value needed
    -  792  1
                 final File dbFile = new File(directory, fileName);
    -  793  1
                 final String cString = String.format(connStr, dbFile.getCanonicalPath());
    -  794  1
                 LOGGER.debug("Connection String: '{}'", cString);
    -  795  1
                 return cString;
    -  796   -
             }
    -  797  0
             return connStr;
    -  798   -
         }
    -  799  
     
    -  800   +  765  
         /**
    -  801   -
          * Retrieves the directory that the JAR file exists in so that we can ensure we always use a common data directory for the
    -  802   -
          * embedded H2 database. This is public solely for some unit tests; otherwise this should be private.
    -  803   +  766   +
          * Returns a boolean value from the properties file. If the value was specified as a system property or passed in via the
    +  767   +
          * <code>-Dprop=value</code> argument this method will return the value from the system properties before the values in the
    +  768   +
          * contained configuration file.
    +  769  
          *
    -  804   -
          * @return the data directory to store data files
    -  805   -
          * @throws IOException is thrown if an IOException occurs of course...
    -  806   +  770   +
          * @param key the key to lookup within the properties file
    +  771   +
          * @return the property from the properties file
    +  772   +
          * @throws InvalidSettingException is thrown if there is an error retrieving the setting
    +  773  
          */
    -  807   -
         public static File getDataDirectory() throws IOException {
    -  808  1
             final File path = Settings.getDataFile(Settings.KEYS.DATA_DIRECTORY);
    -  809  1
             if (path.exists() || path.mkdirs()) {
    -  810  1
                 return path;
    -  811   -
             }
    -  812  0
             throw new IOException(String.format("Unable to create the data directory '%s'", path.getAbsolutePath()));
    -  813   +  774   +
         public static boolean getBoolean(String key) throws InvalidSettingException {
    +  775  1
             return Boolean.parseBoolean(Settings.getString(key));
    +  776  
         }
    -  814   +  777   +
     
    +  778   +
         /**
    +  779   +
          * Returns a boolean value from the properties file. If the value was specified as a system property or passed in via the
    +  780   +
          * <code>-Dprop=value</code> argument this method will return the value from the system properties before the values in the
    +  781   +
          * contained configuration file.
    +  782   +
          *
    +  783   +
          * @param key the key to lookup within the properties file
    +  784   +
          * @param defaultValue the default value to return if the setting does not exist
    +  785   +
          * @return the property from the properties file
    +  786   +
          * @throws InvalidSettingException is thrown if there is an error retrieving the setting
    +  787   +
          */
    +  788   +
         public static boolean getBoolean(String key, boolean defaultValue) throws InvalidSettingException {
    +  789  1
             return Boolean.parseBoolean(Settings.getString(key, Boolean.toString(defaultValue)));
    +  790   +
         }
    +  791   +
     
    +  792   +
         /**
    +  793   +
          * Returns a connection string from the configured properties. If the connection string contains a %s, this method will
    +  794   +
          * determine the 'data' directory and replace the %s with the path to the data directory. If the data directory does not
    +  795   +
          * exists it will be created.
    +  796   +
          *
    +  797   +
          * @param connectionStringKey the property file key for the connection string
    +  798   +
          * @param dbFileNameKey the settings key for the db filename
    +  799   +
          * @return the connection string
    +  800   +
          * @throws IOException thrown the data directory cannot be created
    +  801   +
          * @throws InvalidSettingException thrown if there is an invalid setting
    +  802   +
          */
    +  803   +
         public static String getConnectionString(String connectionStringKey, String dbFileNameKey)
    +  804   +
                 throws IOException, InvalidSettingException {
    +  805  2
             final String connStr = Settings.getString(connectionStringKey);
    +  806  2
             if (connStr == null) {
    +  807  1
                 final String msg = String.format("Invalid properties file; %s is missing.", connectionStringKey);
    +  808  1
                 throw new InvalidSettingException(msg);
    +  809   +
             }
    +  810  1
             if (connStr.contains("%s")) {
    +  811  1
                 final File directory = getDataDirectory();
    +  812  1
                 String fileName = null;
    +  813  1
                 if (dbFileNameKey != null) {
    +  814  1
                     fileName = Settings.getString(dbFileNameKey);
    +  815   +
                 }
    +  816  1
                 if (fileName == null) {
    +  817  0
                     final String msg = String.format("Invalid properties file to get a file based connection string; '%s' must be defined.",
    +  818   +
                             dbFileNameKey);
    +  819  0
                     throw new InvalidSettingException(msg);
    +  820   +
                 }
    +  821  1
                 if (connStr.startsWith("jdbc:h2:file:") && fileName.endsWith(".h2.db")) {
    +  822  1
                     fileName = fileName.substring(0, fileName.length() - 6);
    +  823   +
                 }
    +  824   +
                 // yes, for H2 this path won't actually exists - but this is sufficient to get the value needed
    +  825  1
                 final File dbFile = new File(directory, fileName);
    +  826  1
                 final String cString = String.format(connStr, dbFile.getCanonicalPath());
    +  827  1
                 LOGGER.debug("Connection String: '{}'", cString);
    +  828  1
                 return cString;
    +  829   +
             }
    +  830  0
             return connStr;
    +  831   +
         }
    +  832   +
     
    +  833   +
         /**
    +  834   +
          * Retrieves the directory that the JAR file exists in so that we can ensure we always use a common data directory for the
    +  835   +
          * embedded H2 database. This is public solely for some unit tests; otherwise this should be private.
    +  836   +
          *
    +  837   +
          * @return the data directory to store data files
    +  838   +
          * @throws IOException is thrown if an IOException occurs of course...
    +  839   +
          */
    +  840   +
         public static File getDataDirectory() throws IOException {
    +  841  1
             final File path = Settings.getDataFile(Settings.KEYS.DATA_DIRECTORY);
    +  842  1
             if (path.exists() || path.mkdirs()) {
    +  843  1
                 return path;
    +  844   +
             }
    +  845  0
             throw new IOException(String.format("Unable to create the data directory '%s'", path.getAbsolutePath()));
    +  846   +
         }
    +  847  
     }
    - + diff --git a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.URLConnectionFactory.html b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.URLConnectionFactory.html index 0af374b13..d680ea22b 100644 --- a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.URLConnectionFactory.html +++ b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.URLConnectionFactory.html @@ -123,106 +123,104 @@  53  
         public static HttpURLConnection createHttpURLConnection(URL url) throws URLConnectionFailureException {
     54  0
             HttpURLConnection conn = null;
    -  55   -
             Proxy proxy;
    -  56  0
             final String proxyUrl = Settings.getString(Settings.KEYS.PROXY_SERVER);
    -  57   +  55  0
             final String proxyUrl = Settings.getString(Settings.KEYS.PROXY_SERVER);
    +  56  
             try {
    -  58  0
                 if (proxyUrl != null) {
    -  59  0
                     final int proxyPort = Settings.getInt(Settings.KEYS.PROXY_PORT);
    -  60  0
                     final SocketAddress address = new InetSocketAddress(proxyUrl, proxyPort);
    -  61   +  57  0
                 if (proxyUrl != null) {
    +  58  0
                     final int proxyPort = Settings.getInt(Settings.KEYS.PROXY_PORT);
    +  59  0
                     final SocketAddress address = new InetSocketAddress(proxyUrl, proxyPort);
    +  60  
     
    -  62  0
                     final String username = Settings.getString(Settings.KEYS.PROXY_USERNAME);
    -  63  0
                     final String password = Settings.getString(Settings.KEYS.PROXY_PASSWORD);
    -  64  0
                     if (username != null && password != null) {
    -  65  0
                         final Authenticator auth = new Authenticator() {
    -  66   +  61  0
                     final String username = Settings.getString(Settings.KEYS.PROXY_USERNAME);
    +  62  0
                     final String password = Settings.getString(Settings.KEYS.PROXY_PASSWORD);
    +  63  0
                     if (username != null && password != null) {
    +  64  0
                         final Authenticator auth = new Authenticator() {
    +  65  
                             @Override
    -  67   +  66  
                             public PasswordAuthentication getPasswordAuthentication() {
    -  68  0
                                 if (getRequestorType().equals(Authenticator.RequestorType.PROXY)) {
    -  69  0
                                     return new PasswordAuthentication(username, password.toCharArray());
    -  70   +  67  0
                                 if (getRequestorType().equals(Authenticator.RequestorType.PROXY)) {
    +  68  0
                                     return new PasswordAuthentication(username, password.toCharArray());
    +  69  
                                 }
    -  71  0
                                 return super.getPasswordAuthentication();
    -  72   +  70  0
                                 return super.getPasswordAuthentication();
    +  71  
                             }
    -  73   +  72  
                         };
    -  74  0
                         Authenticator.setDefault(auth);
    -  75   +  73  0
                         Authenticator.setDefault(auth);
    +  74  
                     }
    -  76   +  75  
     
    -  77  0
                     proxy = new Proxy(Proxy.Type.HTTP, address);
    -  78  0
                     conn = (HttpURLConnection) url.openConnection(proxy);
    -  79  0
                 } else {
    -  80  0
                     conn = (HttpURLConnection) url.openConnection();
    -  81   +  76  0
                     final Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
    +  77  0
                     conn = (HttpURLConnection) url.openConnection(proxy);
    +  78  0
                 } else {
    +  79  0
                     conn = (HttpURLConnection) url.openConnection();
    +  80  
                 }
    -  82  0
                 final int timeout = Settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000);
    -  83  0
                 conn.setConnectTimeout(timeout);
    -  84  0
                 conn.setInstanceFollowRedirects(true);
    -  85  0
             } catch (IOException ex) {
    -  86  0
                 if (conn != null) {
    -  87   +  81  0
                 final int timeout = Settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000);
    +  82  0
                 conn.setConnectTimeout(timeout);
    +  83  0
                 conn.setInstanceFollowRedirects(true);
    +  84  0
             } catch (IOException ex) {
    +  85  0
                 if (conn != null) {
    +  86  
                     try {
    -  88  0
                         conn.disconnect();
    -  89   +  87  0
                         conn.disconnect();
    +  88  
                     } finally {
    -  90  0
                         conn = null;
    -  91  0
                     }
    -  92   +  89  0
                         conn = null;
    +  90  0
                     }
    +  91  
                 }
    -  93  0
                 throw new URLConnectionFailureException("Error getting connection.", ex);
    -  94  0
             }
    -  95  0
             return conn;
    +  92  0
                 throw new URLConnectionFailureException("Error getting connection.", ex);
    +  93  0
             }
    +  94  0
             return conn;
    +  95   +
         }
     96   -
         }
    -  97  
     
    -  98   +  97  
         /**
    -  99   +  98  
          * Utility method to create an HttpURLConnection. The use of a proxy here is optional as there may be cases where a proxy is
    -  100   +  99  
          * configured but we don't want to use it (for example, if there's an internal repository configured)
    -  101   +  100  
          *
    -  102   +  101  
          * @param url the URL to connect to
    -  103   +  102  
          * @param proxy whether to use the proxy (if configured)
    -  104   +  103  
          * @return a newly constructed HttpURLConnection
    -  105   +  104  
          * @throws URLConnectionFailureException thrown if there is an exception
    -  106   +  105  
          */
    -  107   +  106  
         public static HttpURLConnection createHttpURLConnection(URL url, boolean proxy) throws URLConnectionFailureException {
    -  108  0
             if (proxy) {
    -  109  0
                 return createHttpURLConnection(url);
    -  110   +  107  0
             if (proxy) {
    +  108  0
                 return createHttpURLConnection(url);
    +  109  
             }
    -  111  0
             HttpURLConnection conn = null;
    -  112   +  110  0
             HttpURLConnection conn = null;
    +  111  
             try {
    -  113  0
                 conn = (HttpURLConnection) url.openConnection();
    -  114  0
                 final int timeout = Settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000);
    -  115  0
                 conn.setConnectTimeout(timeout);
    -  116  0
                 conn.setInstanceFollowRedirects(true);
    -  117  0
             } catch (IOException ioe) {
    -  118  0
                 throw new URLConnectionFailureException("Error getting connection.", ioe);
    -  119  0
             }
    -  120  0
             return conn;
    -  121   +  112  0
                 conn = (HttpURLConnection) url.openConnection();
    +  113  0
                 final int timeout = Settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000);
    +  114  0
                 conn.setConnectTimeout(timeout);
    +  115  0
                 conn.setInstanceFollowRedirects(true);
    +  116  0
             } catch (IOException ioe) {
    +  117  0
                 throw new URLConnectionFailureException("Error getting connection.", ioe);
    +  118  0
             }
    +  119  0
             return conn;
    +  120  
         }
    -  122   +  121  
     }
    - + diff --git a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.URLConnectionFailureException.html b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.URLConnectionFailureException.html index 3e3f92ff9..75ac12617 100644 --- a/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.URLConnectionFailureException.html +++ b/dependency-check-utils/cobertura/org.owasp.dependencycheck.utils.URLConnectionFailureException.html @@ -147,6 +147,6 @@
     }
    - + diff --git a/dependency-check-utils/dependency-analysis.html b/dependency-check-utils/dependency-analysis.html index 70a5d9237..863af3fb4 100644 --- a/dependency-check-utils/dependency-analysis.html +++ b/dependency-check-utils/dependency-analysis.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Dependencies Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -240,7 +240,7 @@ org.slf4j slf4j-api -1.7.12 +1.7.13 compile jar @@ -248,7 +248,7 @@ com.google.code.findbugs annotations -3.0.0 +3.0.1u2 provided jar diff --git a/dependency-check-utils/dependency-updates-report.html b/dependency-check-utils/dependency-updates-report.html index aae4f3504..93d583271 100644 --- a/dependency-check-utils/dependency-updates-report.html +++ b/dependency-check-utils/dependency-updates-report.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Dependency Updates Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -223,7 +223,7 @@ # of dependencies using the latest version available -25 +22 # of dependencies where the next version available is smaller than an incremental version update @@ -231,7 +231,7 @@ # of dependencies where the next version available is an incremental version update -0 +3 # of dependencies where the next version available is a minor version update @@ -283,7 +283,7 @@ com.google.code.findbugs annotations -3.0.0 +3.0.1u2 jar @@ -448,7 +448,7 @@ 4.8.0 5.0.0 - + org.apache.maven maven-core 3.3.3 @@ -456,11 +456,11 @@ jar - +3.3.9 - + org.apache.maven maven-plugin-api 3.3.3 @@ -468,11 +468,11 @@ jar - +3.3.9 - + org.apache.maven maven-settings 3.3.3 @@ -480,7 +480,7 @@ jar - +3.3.9 @@ -571,7 +571,7 @@ org.jmockit jmockit -1.19 +1.20 test jar @@ -595,7 +595,7 @@ org.slf4j slf4j-api -1.7.12 +1.7.13 jar @@ -607,7 +607,7 @@ org.slf4j slf4j-simple -1.7.12 +1.7.13 jar @@ -695,7 +695,7 @@ annotations Current Version -3.0.0 +3.0.1u2 Scope @@ -731,7 +731,7 @@ jar Newer versions -1.4.177 Next Minor
    1.4.178
    1.4.179
    1.4.180
    1.4.181
    1.4.182
    1.4.183
    1.4.184
    1.4.185
    1.4.186
    1.4.187
    1.4.188
    1.4.189 Latest Minor
    +1.4.177 Next Minor
    1.4.178
    1.4.179
    1.4.180
    1.4.181
    1.4.182
    1.4.183
    1.4.184
    1.4.185
    1.4.186
    1.4.187
    1.4.188
    1.4.189
    1.4.190 Latest Minor

    com.sun.mail:mailapi

    @@ -950,7 +950,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-core

    @@ -977,7 +977,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-queryparser

    @@ -1004,7 +1004,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-test-framework

    @@ -1031,13 +1031,13 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.maven:maven-core

    - + @@ -1055,13 +1055,16 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven:maven-plugin-api

    - + @@ -1079,13 +1082,16 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven:maven-settings

    - + @@ -1103,7 +1109,10 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven.plugin-testing:maven-plugin-testing-harness

    @@ -1286,7 +1295,7 @@ - + @@ -1334,7 +1343,7 @@ - + @@ -1358,7 +1367,7 @@ - + diff --git a/dependency-check-utils/findbugs.html b/dependency-check-utils/findbugs.html index 221666570..bdb78e126 100644 --- a/dependency-check-utils/findbugs.html +++ b/dependency-check-utils/findbugs.html @@ -1,13 +1,13 @@ - + dependency-check-ant – FindBugs Bug Detector Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-utils/index.html b/dependency-check-utils/index.html index 9d849309e..4a7f0f569 100644 --- a/dependency-check-utils/index.html +++ b/dependency-check-utils/index.html @@ -1,13 +1,13 @@ - + dependency-check-ant – About @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-utils/integration.html b/dependency-check-utils/integration.html index 4d2a79c8a..433ad63a5 100644 --- a/dependency-check-utils/integration.html +++ b/dependency-check-utils/integration.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Continuous Integration @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-utils/issue-tracking.html b/dependency-check-utils/issue-tracking.html index 40caf2e5b..2b5bbfdf0 100644 --- a/dependency-check-utils/issue-tracking.html +++ b/dependency-check-utils/issue-tracking.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Issue Tracking @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-utils/license.html b/dependency-check-utils/license.html index 44654531e..3666cd753 100644 --- a/dependency-check-utils/license.html +++ b/dependency-check-utils/license.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Project License @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-utils/mail-lists.html b/dependency-check-utils/mail-lists.html index 1eb73a444..0d70d3f6b 100644 --- a/dependency-check-utils/mail-lists.html +++ b/dependency-check-utils/mail-lists.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Project Mailing Lists @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-utils/plugin-updates-report.html b/dependency-check-utils/plugin-updates-report.html index 15d9ea78f..e9c70c217 100644 --- a/dependency-check-utils/plugin-updates-report.html +++ b/dependency-check-utils/plugin-updates-report.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Plugin Updates Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -235,7 +235,7 @@ - + @@ -271,7 +271,7 @@ - + @@ -331,7 +331,7 @@ - + @@ -368,16 +368,26 @@ + + + + + + + + + + - + - + @@ -387,7 +397,7 @@ - + @@ -397,6 +407,16 @@ + + + + + + + + + + @@ -472,7 +492,7 @@ -
    jmockit
    Current Version1.19
    1.20
    Scope test
    slf4j-api
    Current Version1.7.12
    1.7.13
    Scope
    slf4j-simple
    Current Version1.7.12
    1.7.13
    Scope
    # of plugins where the next version available is a minor version update0
    2
    # of plugins where the next version available is a major version update org.apache.maven.plugins maven-assembly-plugin2.5.52.6 org.apache.maven.plugins maven-failsafe-plugin2.18.12.19
    org.apache.maven.pluginsmaven-javadoc-plugin2.9.12.10
    org.apache.maven.plugins maven-release-plugin2.5.22.5.3
    org.apache.maven.plugins maven-resources-plugin
    org.apache.maven.plugins maven-site-plugin
    org.apache.maven.pluginsmaven-source-plugin2.2.12.3
    org.apache.maven.pluginsmaven-assembly-plugin
    Current Version2.5.5
    +2.6

    Plugin org.apache.maven.plugins:maven-clean-plugin

    @@ -562,7 +582,7 @@ -
    maven-failsafe-plugin
    Current Version2.18.1
    +2.19

    Plugin org.apache.maven.plugins:maven-gpg-plugin

    @@ -609,6 +629,24 @@
    Current Version 2.6
    +

    Plugin org.apache.maven.plugins:maven-javadoc-plugin

    + + + + + + + + + + + + + + + +
    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-javadoc-plugin
    Current Version2.9.1
    Newer versions2.10 Next Minor
    2.10.1
    2.10.2
    2.10.3 Latest Minor
    +

    Plugin org.apache.maven.plugins:maven-release-plugin

    @@ -622,7 +660,7 @@ -
    maven-release-plugin
    Current Version2.5.2
    +2.5.3

    Plugin org.apache.maven.plugins:maven-resources-plugin

    @@ -654,6 +692,24 @@
    Current Version 3.4
    +

    Plugin org.apache.maven.plugins:maven-source-plugin

    + + + + + + + + + + + + + + + +
    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-source-plugin
    Current Version2.2.1
    Newer versions2.3 Next Minor
    2.4 Latest Minor
    +

    Plugin org.apache.maven.plugins:maven-surefire-plugin

    diff --git a/dependency-check-utils/project-info.html b/dependency-check-utils/project-info.html index 91ffcc10d..13408c614 100644 --- a/dependency-check-utils/project-info.html +++ b/dependency-check-utils/project-info.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Project Information @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-utils/project-reports.html b/dependency-check-utils/project-reports.html index e789a8b02..e258e7e26 100644 --- a/dependency-check-utils/project-reports.html +++ b/dependency-check-utils/project-reports.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Generated Reports @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-utils/project-summary.html b/dependency-check-utils/project-summary.html index 7d537d687..b64f5901f 100644 --- a/dependency-check-utils/project-summary.html +++ b/dependency-check-utils/project-summary.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Project Summary @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -231,7 +231,7 @@ - + diff --git a/dependency-check-utils/source-repository.html b/dependency-check-utils/source-repository.html index 5c3919602..cb075c378 100644 --- a/dependency-check-utils/source-repository.html +++ b/dependency-check-utils/source-repository.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Source Repository @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-utils/surefire-report.html b/dependency-check-utils/surefire-report.html index 58ef1fbaf..5f13dd34d 100644 --- a/dependency-check-utils/surefire-report.html +++ b/dependency-check-utils/surefire-report.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Surefire Report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -247,7 +247,7 @@ function toggleDisplay(elementId) { - + @@ -268,7 +268,7 @@ function toggleDisplay(elementId) { - + @@ -295,7 +295,7 @@ function toggleDisplay(elementId) { - + @@ -313,11 +313,11 @@ function toggleDisplay(elementId) { - + - + @@ -331,96 +331,104 @@ function toggleDisplay(elementId) {
    dependency-check-utils
    Version1.3.1
    1.3.2
    Type jar
    Success Rate Time
    2123 0 0 0Time
    org.owasp.dependencycheck.utils2123 0 0 00 0 100%0.297
    0.296
    DownloaderTest0 0 100%0.062
    0.063
    SettingsTest1214 0 0 0
    - - + + - + - + - - + + - + - +
    testGetChecksum_NoSuchAlgorithm0.281
    testGetChecksum_NoSuchAlgorithm0.296
    testGetChecksumtestGetChecksum 0
    testGetMD5ChecksumtestGetMD5Checksum 0
    testGetChecksum_FileNotFound0.016
    testGetChecksum_FileNotFound0
    testGetHextestGetHex 0
    testGetSHA1ChecksumtestGetSHA1Checksum 0

    DownloaderTest

    - +
    testGetLastModified_filetestGetLastModified_file 0

    FileUtilsTest

    - + - -
    testGetFileExtensiontestGetFileExtension 0
    testDelete0.062
    +testDelete +0.063

    SettingsTest

    - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + +
    testMergeProperties_StringtestSetStringIfNotNull 0
    testGetDataFiletestSetStringIfNotEmpty 0
    testGetLongtestMergeProperties_String 0
    testGetBooleantestGetDataFile 0
    testRemovePropertytestGetLong 0
    testGetTempDirectorytestGetBoolean 0
    testSetStringtestRemoveProperty 0
    testGetInttestGetTempDirectory 0
    testGetString_StringtestSetString 0
    testGetStringtestGetInt 0
    testGetConnectionStringtestGetString_String 0
    testGetString_String_StringtestGetString0
    testGetConnectionString0
    testGetString_String_String 0

    diff --git a/dependency-check-utils/taglist.html b/dependency-check-utils/taglist.html index 1536745d7..f27527be6 100644 --- a/dependency-check-utils/taglist.html +++ b/dependency-check-utils/taglist.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Tag List report @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-utils/team-list.html b/dependency-check-utils/team-list.html index 5c48b0081..2392b570b 100644 --- a/dependency-check-utils/team-list.html +++ b/dependency-check-utils/team-list.html @@ -1,13 +1,13 @@ - + dependency-check-ant – Project Team @@ -54,7 +54,7 @@
  • - + /
  • @@ -67,9 +67,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • diff --git a/dependency-check-utils/xref-test/index.html b/dependency-check-utils/xref-test/index.html index e270b270a..c50d83add 100644 --- a/dependency-check-utils/xref-test/index.html +++ b/dependency-check-utils/xref-test/index.html @@ -4,7 +4,7 @@ - Dependency-Check Utils 1.3.1 Reference + Dependency-Check Utils 1.3.2 Reference diff --git a/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/FileUtilsTest.html b/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/FileUtilsTest.html index a0af37610..a042cf34d 100644 --- a/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/FileUtilsTest.html +++ b/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/FileUtilsTest.html @@ -43,8 +43,8 @@ 35 */ 36 @Test 37 public void testGetFileExtension() { -38 String[] fileName = {"something-0.9.5.jar", "lib2-1.1.js"}; -39 String[] expResult = {"jar", "js"}; +38 String[] fileName = {"something-0.9.5.jar", "lib2-1.1.js", "dir.tmp/noext"}; +39 String[] expResult = {"jar", "js", null}; 40 41 for (int i = 0; i < fileName.length; i++) { 42 String result = FileUtils.getFileExtension(fileName[i]); diff --git a/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/SettingsTest.html b/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/SettingsTest.html index 029c1b6b3..56f95f8e6 100644 --- a/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/SettingsTest.html +++ b/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/SettingsTest.html @@ -86,111 +86,137 @@ 78 } 79 80 /** -81 * Test of getString method, of class Settings. +81 * Test of setStringIfNotNull method, of class Settings. 82 */ 83 @Test -84 public void testGetString_String_String() { -85 String key = "key That Doesn't Exist"; -86 String defaultValue = "blue bunny"; -87 String expResult = "blue bunny"; -88 String result = Settings.getString(key); -89 Assert.assertTrue(result == null); -90 result = Settings.getString(key, defaultValue); -91 Assert.assertEquals(expResult, result); -92 } -93 -94 /** -95 * Test of getString method, of class Settings. -96 */ -97 @Test -98 public void testGetString_String() { -99 String key = Settings.KEYS.CONNECTION_TIMEOUT; -100 String result = Settings.getString(key); -101 Assert.assertTrue(result == null); -102 } -103 -104 /** -105 * Test of getInt method, of class Settings. -106 */ -107 @Test -108 public void testGetInt() throws InvalidSettingException { -109 String key = "SomeNumber"; -110 int expResult = 85; -111 Settings.setString(key, "85"); -112 int result = Settings.getInt(key); -113 Assert.assertEquals(expResult, result); -114 } -115 -116 /** -117 * Test of getLong method, of class Settings. -118 */ -119 @Test -120 public void testGetLong() throws InvalidSettingException { -121 String key = "SomeNumber"; -122 long expResult = 300L; -123 Settings.setString(key, "300"); -124 long result = Settings.getLong(key); -125 Assert.assertEquals(expResult, result); -126 } -127 -128 /** -129 * Test of getBoolean method, of class Settings. -130 */ -131 @Test -132 public void testGetBoolean() throws InvalidSettingException { -133 String key = "SomeBoolean"; -134 Settings.setString(key, "false"); -135 boolean expResult = false; -136 boolean result = Settings.getBoolean(key); -137 Assert.assertEquals(expResult, result); -138 -139 key = "something that does not exist"; -140 expResult = true; -141 result = Settings.getBoolean(key, true); -142 Assert.assertEquals(expResult, result); -143 } -144 -145 /** -146 * Test of removeProperty method, of class Settings. -147 */ -148 @Test -149 public void testRemoveProperty() { -150 String key = "SomeKey"; -151 String value = "value"; -152 String dfault = "default"; -153 Settings.setString(key, value); -154 String ret = Settings.getString(key); -155 Assert.assertEquals(value, ret); -156 Settings.removeProperty(key); -157 ret = Settings.getString(key, dfault); -158 Assert.assertEquals(dfault, ret); -159 } -160 -161 /** -162 * Test of getConnectionString. -163 */ -164 @Test -165 public void testGetConnectionString() throws Exception { -166 String value = Settings.getConnectionString(Settings.KEYS.DB_CONNECTION_STRING, Settings.KEYS.DB_FILE_NAME); -167 Assert.assertNotNull(value); -168 String msg = null; -169 try { -170 value = Settings.getConnectionString("invalidKey", null); -171 } catch (InvalidSettingException e) { -172 msg = e.getMessage(); -173 } -174 Assert.assertNotNull(msg); -175 } -176 -177 /** -178 * Test of getTempDirectory. -179 */ -180 @Test -181 public void testGetTempDirectory() throws Exception { -182 File tmp = Settings.getTempDirectory(); -183 Assert.assertTrue(tmp.exists()); -184 } -185 } +84 public void testSetStringIfNotNull() { +85 String key = "nullableProperty"; +86 String value = "someValue"; +87 Settings.setString(key, value); +88 Settings.setStringIfNotNull(key, null); // NO-OP +89 String expResults = Settings.getString(key); +90 Assert.assertEquals(expResults, value); +91 } +92 +93 /** +94 * Test of setStringIfNotNull method, of class Settings. +95 */ +96 @Test +97 public void testSetStringIfNotEmpty() { +98 String key = "optionalProperty"; +99 String value = "someValue"; +100 Settings.setString(key, value); +101 Settings.setStringIfNotEmpty(key, ""); // NO-OP +102 String expResults = Settings.getString(key); +103 Assert.assertEquals(expResults, value); +104 } +105 +106 /** +107 * Test of getString method, of class Settings. +108 */ +109 @Test +110 public void testGetString_String_String() { +111 String key = "key That Doesn't Exist"; +112 String defaultValue = "blue bunny"; +113 String expResult = "blue bunny"; +114 String result = Settings.getString(key); +115 Assert.assertTrue(result == null); +116 result = Settings.getString(key, defaultValue); +117 Assert.assertEquals(expResult, result); +118 } +119 +120 /** +121 * Test of getString method, of class Settings. +122 */ +123 @Test +124 public void testGetString_String() { +125 String key = Settings.KEYS.CONNECTION_TIMEOUT; +126 String result = Settings.getString(key); +127 Assert.assertTrue(result == null); +128 } +129 +130 /** +131 * Test of getInt method, of class Settings. +132 */ +133 @Test +134 public void testGetInt() throws InvalidSettingException { +135 String key = "SomeNumber"; +136 int expResult = 85; +137 Settings.setString(key, "85"); +138 int result = Settings.getInt(key); +139 Assert.assertEquals(expResult, result); +140 } +141 +142 /** +143 * Test of getLong method, of class Settings. +144 */ +145 @Test +146 public void testGetLong() throws InvalidSettingException { +147 String key = "SomeNumber"; +148 long expResult = 300L; +149 Settings.setString(key, "300"); +150 long result = Settings.getLong(key); +151 Assert.assertEquals(expResult, result); +152 } +153 +154 /** +155 * Test of getBoolean method, of class Settings. +156 */ +157 @Test +158 public void testGetBoolean() throws InvalidSettingException { +159 String key = "SomeBoolean"; +160 Settings.setString(key, "false"); +161 boolean expResult = false; +162 boolean result = Settings.getBoolean(key); +163 Assert.assertEquals(expResult, result); +164 +165 key = "something that does not exist"; +166 expResult = true; +167 result = Settings.getBoolean(key, true); +168 Assert.assertEquals(expResult, result); +169 } +170 +171 /** +172 * Test of removeProperty method, of class Settings. +173 */ +174 @Test +175 public void testRemoveProperty() { +176 String key = "SomeKey"; +177 String value = "value"; +178 String dfault = "default"; +179 Settings.setString(key, value); +180 String ret = Settings.getString(key); +181 Assert.assertEquals(value, ret); +182 Settings.removeProperty(key); +183 ret = Settings.getString(key, dfault); +184 Assert.assertEquals(dfault, ret); +185 } +186 +187 /** +188 * Test of getConnectionString. +189 */ +190 @Test +191 public void testGetConnectionString() throws Exception { +192 String value = Settings.getConnectionString(Settings.KEYS.DB_CONNECTION_STRING, Settings.KEYS.DB_FILE_NAME); +193 Assert.assertNotNull(value); +194 String msg = null; +195 try { +196 value = Settings.getConnectionString("invalidKey", null); +197 } catch (InvalidSettingException e) { +198 msg = e.getMessage(); +199 } +200 Assert.assertNotNull(msg); +201 } +202 +203 /** +204 * Test of getTempDirectory. +205 */ +206 @Test +207 public void testGetTempDirectory() throws Exception { +208 File tmp = Settings.getTempDirectory(); +209 Assert.assertTrue(tmp.exists()); +210 } +211 }
    diff --git a/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/package-frame.html b/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/package-frame.html index dda62703d..44acc27a8 100644 --- a/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/package-frame.html +++ b/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Utils 1.3.1 Reference Package org.owasp.dependencycheck.utils + Dependency-Check Utils 1.3.2 Reference Package org.owasp.dependencycheck.utils diff --git a/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/package-summary.html b/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/package-summary.html index 919257a95..92cfc6f7c 100644 --- a/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/package-summary.html +++ b/dependency-check-utils/xref-test/org/owasp/dependencycheck/utils/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Utils 1.3.1 Reference Package org.owasp.dependencycheck.utils + Dependency-Check Utils 1.3.2 Reference Package org.owasp.dependencycheck.utils diff --git a/dependency-check-utils/xref-test/overview-frame.html b/dependency-check-utils/xref-test/overview-frame.html index 40f60c443..39c444df6 100644 --- a/dependency-check-utils/xref-test/overview-frame.html +++ b/dependency-check-utils/xref-test/overview-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Utils 1.3.1 Reference + Dependency-Check Utils 1.3.2 Reference diff --git a/dependency-check-utils/xref-test/overview-summary.html b/dependency-check-utils/xref-test/overview-summary.html index d5a57b949..7535dfe4f 100644 --- a/dependency-check-utils/xref-test/overview-summary.html +++ b/dependency-check-utils/xref-test/overview-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Utils 1.3.1 Reference + Dependency-Check Utils 1.3.2 Reference @@ -24,7 +24,7 @@ -

    Dependency-Check Utils 1.3.1 Reference

    +

    Dependency-Check Utils 1.3.2 Reference

    diff --git a/dependency-check-utils/xref/index.html b/dependency-check-utils/xref/index.html index e270b270a..c50d83add 100644 --- a/dependency-check-utils/xref/index.html +++ b/dependency-check-utils/xref/index.html @@ -4,7 +4,7 @@ - Dependency-Check Utils 1.3.1 Reference + Dependency-Check Utils 1.3.2 Reference diff --git a/dependency-check-utils/xref/org/owasp/dependencycheck/utils/Checksum.html b/dependency-check-utils/xref/org/owasp/dependencycheck/utils/Checksum.html index a36e67a35..71f8cd52b 100644 --- a/dependency-check-utils/xref/org/owasp/dependencycheck/utils/Checksum.html +++ b/dependency-check-utils/xref/org/owasp/dependencycheck/utils/Checksum.html @@ -65,98 +65,91 @@ 57 * @throws IOException when the file does not exist58 * @throws NoSuchAlgorithmException when an algorithm is specified that does not exist59 */ -60 @SuppressWarnings("empty-statement") -61publicstatic byte[] getChecksum(String algorithm, File file) throws NoSuchAlgorithmException, IOException { -62 MessageDigest digest = MessageDigest.getInstance(algorithm); -63 FileInputStream fis = null; -64try { -65 fis = new FileInputStream(file); -66 FileChannel ch = fis.getChannel(); -67long remainingToRead = file.length(); -68long start = 0; -69while (remainingToRead > 0) { -70long amountToRead; -71if (remainingToRead > Integer.MAX_VALUE) { -72 remainingToRead -= Integer.MAX_VALUE; -73 amountToRead = Integer.MAX_VALUE; -74 } else { -75 amountToRead = remainingToRead; -76 remainingToRead = 0; -77 } -78 MappedByteBuffer byteBuffer = ch.map(FileChannel.MapMode.READ_ONLY, start, amountToRead); -79 digest.update(byteBuffer); -80 start += amountToRead; -81 } -82 -83// BufferedInputStream bis = new BufferedInputStream(fis); -84// DigestInputStream dis = new DigestInputStream(bis, digest); -85// //yes, we are reading in a buffer for performance reasons - 1 byte at a time is SLOW -86// byte[] buffer = new byte[8192]; -87// while (dis.read(buffer) != -1); -88 } finally { -89if (fis != null) { -90try { -91 fis.close(); -92 } catch (IOException ex) { -93 LOGGER.trace("Error closing file '{}'.", file.getName(), ex); -94 } -95 } -96 } -97return digest.digest(); -98 } -99 -100/** -101 * Calculates the MD5 checksum of a specified file. -102 * -103 * @param file the file to generate the MD5 checksum -104 * @return the hex representation of the MD5 hash -105 * @throws IOException when the file passed in does not exist -106 * @throws NoSuchAlgorithmException when the MD5 algorithm is not available -107 */ -108publicstatic String getMD5Checksum(File file) throws IOException, NoSuchAlgorithmException { -109 byte[] b = getChecksum("MD5", file); -110return getHex(b); -111 } -112 -113/** -114 * Calculates the SHA1 checksum of a specified file. -115 * -116 * @param file the file to generate the MD5 checksum -117 * @return the hex representation of the SHA1 hash -118 * @throws IOException when the file passed in does not exist -119 * @throws NoSuchAlgorithmException when the SHA1 algorithm is not available +60publicstatic byte[] getChecksum(String algorithm, File file) throws NoSuchAlgorithmException, IOException { +61 MessageDigest digest = MessageDigest.getInstance(algorithm); +62 FileInputStream fis = null; +63try { +64 fis = new FileInputStream(file); +65 FileChannel ch = fis.getChannel(); +66long remainingToRead = file.length(); +67long start = 0; +68while (remainingToRead > 0) { +69long amountToRead; +70if (remainingToRead > Integer.MAX_VALUE) { +71 remainingToRead -= Integer.MAX_VALUE; +72 amountToRead = Integer.MAX_VALUE; +73 } else { +74 amountToRead = remainingToRead; +75 remainingToRead = 0; +76 } +77 MappedByteBuffer byteBuffer = ch.map(FileChannel.MapMode.READ_ONLY, start, amountToRead); +78 digest.update(byteBuffer); +79 start += amountToRead; +80 } +81 } finally { +82if (fis != null) { +83try { +84 fis.close(); +85 } catch (IOException ex) { +86 LOGGER.trace("Error closing file '{}'.", file.getName(), ex); +87 } +88 } +89 } +90return digest.digest(); +91 } +92 +93/** +94 * Calculates the MD5 checksum of a specified file. +95 * +96 * @param file the file to generate the MD5 checksum +97 * @return the hex representation of the MD5 hash +98 * @throws IOException when the file passed in does not exist +99 * @throws NoSuchAlgorithmException when the MD5 algorithm is not available +100 */ +101publicstatic String getMD5Checksum(File file) throws IOException, NoSuchAlgorithmException { +102 byte[] b = getChecksum("MD5", file); +103return getHex(b); +104 } +105 +106/** +107 * Calculates the SHA1 checksum of a specified file. +108 * +109 * @param file the file to generate the MD5 checksum +110 * @return the hex representation of the SHA1 hash +111 * @throws IOException when the file passed in does not exist +112 * @throws NoSuchAlgorithmException when the SHA1 algorithm is not available +113 */ +114publicstatic String getSHA1Checksum(File file) throws IOException, NoSuchAlgorithmException { +115 byte[] b = getChecksum("SHA1", file); +116return getHex(b); +117 } +118/** +119 * Hex code characters used in getHex.120 */ -121publicstatic String getSHA1Checksum(File file) throws IOException, NoSuchAlgorithmException { -122 byte[] b = getChecksum("SHA1", file); -123return getHex(b); -124 } -125/** -126 * Hex code characters used in getHex. -127 */ -128privatestaticfinal String HEXES = "0123456789abcdef"; -129 -130/** -131 * <p> -132 * Converts a byte array into a hex string.</p> -133 * -134 * <p> -135 * This method was copied from <a -136 * href="http://www.rgagnon.com/javadetails/java-0596.html">http://www.rgagnon.com/javadetails/java-0596.html</a></p> -137 * -138 * @param raw a byte array -139 * @return the hex representation of the byte array -140 */ -141publicstatic String getHex(byte[] raw) { -142if (raw == null) { -143returnnull; -144 } -145final StringBuilder hex = new StringBuilder(2 * raw.length); -146for (final byte b : raw) { -147 hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt(b & 0x0F)); -148 } -149return hex.toString(); -150 } -151 } +121privatestaticfinal String HEXES = "0123456789abcdef"; +122 +123/** +124 * <p> +125 * Converts a byte array into a hex string.</p> +126 * +127 * <p> +128 * This method was copied from <a +129 * href="http://www.rgagnon.com/javadetails/java-0596.html">http://www.rgagnon.com/javadetails/java-0596.html</a></p> +130 * +131 * @param raw a byte array +132 * @return the hex representation of the byte array +133 */ +134publicstatic String getHex(byte[] raw) { +135if (raw == null) { +136returnnull; +137 } +138final StringBuilder hex = new StringBuilder(2 * raw.length); +139for (final byte b : raw) { +140 hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt(b & 0x0F)); +141 } +142return hex.toString(); +143 } +144 }
    diff --git a/dependency-check-utils/xref/org/owasp/dependencycheck/utils/FileUtils.html b/dependency-check-utils/xref/org/owasp/dependencycheck/utils/FileUtils.html index 1af7b1149..db32f77a0 100644 --- a/dependency-check-utils/xref/org/owasp/dependencycheck/utils/FileUtils.html +++ b/dependency-check-utils/xref/org/owasp/dependencycheck/utils/FileUtils.html @@ -25,102 +25,98 @@ 17 */18package org.owasp.dependencycheck.utils; 19 -20import org.slf4j.Logger; -21import org.slf4j.LoggerFactory; -22 -23import java.io.File; -24import java.io.IOException; -25import java.util.UUID; -26 -27/** -28 * A collection of utilities for processing information about files. -29 * -30 * @author Jeremy Long -31 */ -32publicfinalclassFileUtils { -33 -34/** -35 * The logger. -36 */ -37privatestaticfinal Logger LOGGER = LoggerFactory.getLogger(FileUtils.class); -38/** -39 * Bit bucket for non-Windows systems -40 */ -41privatestaticfinal String BIT_BUCKET_UNIX = "/dev/null"; -42 -43/** -44 * Bit bucket for Windows systems (yes, only one 'L') -45 */ -46privatestaticfinal String BIT_BUCKET_WIN = "NUL"; -47 -48/** -49 * Private constructor for a utility class. -50 */ -51privateFileUtils() { -52 } -53 -54/** -55 * Returns the (lowercase) file extension for a specified file. -56 * -57 * @param fileName the file name to retrieve the file extension from. -58 * @return the file extension. -59 */ -60publicstatic String getFileExtension(String fileName) { -61 String ret = null; -62finalint pos = fileName.lastIndexOf("."); -63if (pos >= 0) { -64 ret = fileName.substring(pos + 1, fileName.length()).toLowerCase(); -65 } -66return ret; -67 } -68 -69/** -70 * Deletes a file. If the File is a directory it will recursively delete the contents. -71 * -72 * @param file the File to delete -73 * @return true if the file was deleted successfully, otherwise false -74 */ -75publicstaticboolean delete(File file) { -76boolean success = true; -77if (!org.apache.commons.io.FileUtils.deleteQuietly(file)) { -78 success = false; -79 LOGGER.debug("Failed to delete file: {}; attempting to delete on exit.", file.getPath()); -80 file.deleteOnExit(); -81 } -82return success; -83 } -84 -85/** -86 * Generates a new temporary file name that is guaranteed to be unique. -87 * -88 * @param prefix the prefix for the file name to generate -89 * @param extension the extension of the generated file name -90 * @return a temporary File -91 * @throws java.io.IOException thrown if the temporary folder could not be created -92 */ -93publicstatic File getTempFile(String prefix, String extension) throws IOException { -94final File dir = Settings.getTempDirectory(); -95final String tempFileName = String.format("%s%s.%s", prefix, UUID.randomUUID().toString(), extension); -96final File tempFile = new File(dir, tempFileName); -97if (tempFile.exists()) { -98return getTempFile(prefix, extension); -99 } -100return tempFile; -101 } -102 -103/** -104 * Return the bit bucket for the OS. '/dev/null' for Unix and 'NUL' for Windows -105 * -106 * @return a String containing the bit bucket -107 */ -108publicstatic String getBitBucket() { -109if (System.getProperty("os.name").startsWith("Windows")) { -110return BIT_BUCKET_WIN; -111 } else { -112return BIT_BUCKET_UNIX; -113 } -114 } -115 } +20import org.apache.commons.io.FilenameUtils; +21import org.slf4j.Logger; +22import org.slf4j.LoggerFactory; +23 +24import java.io.File; +25import java.io.IOException; +26import java.util.UUID; +27 +28/** +29 * A collection of utilities for processing information about files. +30 * +31 * @author Jeremy Long +32 */ +33publicfinalclassFileUtils { +34 +35/** +36 * The logger. +37 */ +38privatestaticfinal Logger LOGGER = LoggerFactory.getLogger(FileUtils.class); +39/** +40 * Bit bucket for non-Windows systems +41 */ +42privatestaticfinal String BIT_BUCKET_UNIX = "/dev/null"; +43 +44/** +45 * Bit bucket for Windows systems (yes, only one 'L') +46 */ +47privatestaticfinal String BIT_BUCKET_WIN = "NUL"; +48 +49/** +50 * Private constructor for a utility class. +51 */ +52privateFileUtils() { +53 } +54 +55/** +56 * Returns the (lowercase) file extension for a specified file. +57 * +58 * @param fileName the file name to retrieve the file extension from. +59 * @return the file extension. +60 */ +61publicstatic String getFileExtension(String fileName) { +62final String fileExt = FilenameUtils.getExtension(fileName); +63returnnull == fileExt || fileExt.isEmpty() ? null : fileExt.toLowerCase(); +64 } +65 +66/** +67 * Deletes a file. If the File is a directory it will recursively delete the contents. +68 * +69 * @param file the File to delete +70 * @return true if the file was deleted successfully, otherwise false +71 */ +72publicstaticboolean delete(File file) { +73finalboolean success = org.apache.commons.io.FileUtils.deleteQuietly(file); +74if (!success) { +75 LOGGER.debug("Failed to delete file: {}; attempting to delete on exit.", file.getPath()); +76 file.deleteOnExit(); +77 } +78return success; +79 } +80 +81/** +82 * Generates a new temporary file name that is guaranteed to be unique. +83 * +84 * @param prefix the prefix for the file name to generate +85 * @param extension the extension of the generated file name +86 * @return a temporary File +87 * @throws java.io.IOException thrown if the temporary folder could not be created +88 */ +89publicstatic File getTempFile(String prefix, String extension) throws IOException { +90final File dir = Settings.getTempDirectory(); +91final String tempFileName = String.format("%s%s.%s", prefix, UUID.randomUUID().toString(), extension); +92final File tempFile = new File(dir, tempFileName); +93if (tempFile.exists()) { +94return getTempFile(prefix, extension); +95 } +96return tempFile; +97 } +98 +99/** +100 * Return the bit bucket for the OS. '/dev/null' for Unix and 'NUL' for Windows +101 * +102 * @return a String containing the bit bucket +103 */ +104publicstatic String getBitBucket() { +105if (System.getProperty("os.name").startsWith("Windows")) { +106return BIT_BUCKET_WIN; +107 } else { +108return BIT_BUCKET_UNIX; +109 } +110 } +111 }
    diff --git a/dependency-check-utils/xref/org/owasp/dependencycheck/utils/Settings.html b/dependency-check-utils/xref/org/owasp/dependencycheck/utils/Settings.html index 4d0fdc90e..740d2eaef 100644 --- a/dependency-check-utils/xref/org/owasp/dependencycheck/utils/Settings.html +++ b/dependency-check-utils/xref/org/owasp/dependencycheck/utils/Settings.html @@ -126,700 +126,733 @@ 118 */119publicstaticfinal String CVE_MODIFIED_VALID_FOR_DAYS = "cve.url.modified.validfordays"; 120/** -121 * The properties key for the telling us how many cve.url.* URLs exists. This is used in combination with CVE_BASE_URL to -122 * be able to retrieve the URLs for all of the files that make up the NVD CVE listing. -123 */ -124publicstaticfinal String CVE_START_YEAR = "cve.startyear"; -125/** -126 * The properties key for the CVE schema version 1.2. +121 * The properties key to control the skipping of the check for CVE updates. +122 */ +123publicstaticfinal String CVE_CHECK_VALID_FOR_HOURS = "cve.check.validforhours"; +124/** +125 * The properties key for the telling us how many cve.url.* URLs exists. This is used in combination with CVE_BASE_URL to +126 * be able to retrieve the URLs for all of the files that make up the NVD CVE listing.127 */ -128publicstaticfinal String CVE_SCHEMA_1_2 = "cve.url-1.2.base"; +128publicstaticfinal String CVE_START_YEAR = "cve.startyear"; 129/** -130 * The properties key for the CVE schema version 2.0. +130 * The properties key for the CVE schema version 1.2.131 */ -132publicstaticfinal String CVE_SCHEMA_2_0 = "cve.url-2.0.base"; +132publicstaticfinal String CVE_SCHEMA_1_2 = "cve.url-1.2.base"; 133/** -134 * The properties key that indicates how often the CPE data needs to be updated. +134 * The properties key for the CVE schema version 2.0.135 */ -136publicstaticfinal String CPE_MODIFIED_VALID_FOR_DAYS = "cpe.validfordays"; +136publicstaticfinal String CVE_SCHEMA_2_0 = "cve.url-2.0.base"; 137/** -138 * The properties key for the URL to retrieve the CPE. +138 * The properties key that indicates how often the CPE data needs to be updated.139 */ -140publicstaticfinal String CPE_URL = "cpe.url"; +140publicstaticfinal String CPE_MODIFIED_VALID_FOR_DAYS = "cpe.validfordays"; 141/** -142 * The properties key for the proxy server. -143 * -144 * @deprecated use {@link org.owasp.dependencycheck.utils.Settings.KEYS#PROXY_SERVER} instead. -145 */ -146 @Deprecated -147publicstaticfinal String PROXY_URL = "proxy.server"; -148/** -149 * The properties key for the proxy server. -150 */ -151publicstaticfinal String PROXY_SERVER = "proxy.server"; +142 * The properties key for the URL to retrieve the CPE. +143 */ +144publicstaticfinal String CPE_URL = "cpe.url"; +145/** +146 * The properties key for the proxy server. +147 * +148 * @deprecated use {@link org.owasp.dependencycheck.utils.Settings.KEYS#PROXY_SERVER} instead. +149 */ +150 @Deprecated +151publicstaticfinal String PROXY_URL = "proxy.server"; 152/** -153 * The properties key for the proxy port - this must be an integer value. +153 * The properties key for the proxy server.154 */ -155publicstaticfinal String PROXY_PORT = "proxy.port"; +155publicstaticfinal String PROXY_SERVER = "proxy.server"; 156/** -157 * The properties key for the proxy username. +157 * The properties key for the proxy port - this must be an integer value.158 */ -159publicstaticfinal String PROXY_USERNAME = "proxy.username"; +159publicstaticfinal String PROXY_PORT = "proxy.port"; 160/** -161 * The properties key for the proxy password. +161 * The properties key for the proxy username.162 */ -163publicstaticfinal String PROXY_PASSWORD = "proxy.password"; +163publicstaticfinal String PROXY_USERNAME = "proxy.username"; 164/** -165 * The properties key for the connection timeout. +165 * The properties key for the proxy password.166 */ -167publicstaticfinal String CONNECTION_TIMEOUT = "connection.timeout"; +167publicstaticfinal String PROXY_PASSWORD = "proxy.password"; 168/** -169 * The location of the temporary directory. +169 * The properties key for the connection timeout.170 */ -171publicstaticfinal String TEMP_DIRECTORY = "temp.directory"; +171publicstaticfinal String CONNECTION_TIMEOUT = "connection.timeout"; 172/** -173 * The maximum number of threads to allocate when downloading files. +173 * The location of the temporary directory.174 */ -175publicstaticfinal String MAX_DOWNLOAD_THREAD_POOL_SIZE = "max.download.threads"; +175publicstaticfinal String TEMP_DIRECTORY = "temp.directory"; 176/** -177 * The key for a list of suppression files. +177 * The maximum number of threads to allocate when downloading files.178 */ -179publicstaticfinal String SUPPRESSION_FILE = "suppression.file"; +179publicstaticfinal String MAX_DOWNLOAD_THREAD_POOL_SIZE = "max.download.threads"; 180/** -181 * The properties key for whether the Jar Analyzer is enabled. +181 * The key for a list of suppression files.182 */ -183publicstaticfinal String ANALYZER_JAR_ENABLED = "analyzer.jar.enabled"; +183publicstaticfinal String SUPPRESSION_FILE = "suppression.file"; 184/** -185 * The properties key for whether the Archive analyzer is enabled. +185 * The properties key for whether the Jar Analyzer is enabled.186 */ -187publicstaticfinal String ANALYZER_ARCHIVE_ENABLED = "analyzer.archive.enabled"; +187publicstaticfinal String ANALYZER_JAR_ENABLED = "analyzer.jar.enabled"; 188/** -189 * The properties key for whether the node.js package analyzer is enabled. +189 * The properties key for whether the Archive analyzer is enabled.190 */ -191publicstaticfinal String ANALYZER_NODE_PACKAGE_ENABLED = "analyzer.node.package.enabled"; +191publicstaticfinal String ANALYZER_ARCHIVE_ENABLED = "analyzer.archive.enabled"; 192/** -193 * The properties key for whether the composer lock file analyzer is enabled. +193 * The properties key for whether the node.js package analyzer is enabled.194 */ -195publicstaticfinal String ANALYZER_COMPOSER_LOCK_ENABLED = "analyzer.composer.lock.enabled"; +195publicstaticfinal String ANALYZER_NODE_PACKAGE_ENABLED = "analyzer.node.package.enabled"; 196/** -197 * The properties key for whether the Python Distribution analyzer is enabled. +197 * The properties key for whether the composer lock file analyzer is enabled.198 */ -199publicstaticfinal String ANALYZER_PYTHON_DISTRIBUTION_ENABLED = "analyzer.python.distribution.enabled"; +199publicstaticfinal String ANALYZER_COMPOSER_LOCK_ENABLED = "analyzer.composer.lock.enabled"; 200/** -201 * The properties key for whether the Python Package analyzer is enabled. +201 * The properties key for whether the Python Distribution analyzer is enabled.202 */ -203publicstaticfinal String ANALYZER_PYTHON_PACKAGE_ENABLED = "analyzer.python.package.enabled"; +203publicstaticfinal String ANALYZER_PYTHON_DISTRIBUTION_ENABLED = "analyzer.python.distribution.enabled"; 204/** -205 * The properties key for whether the Ruby Gemspec Analyzer is enabled. +205 * The properties key for whether the Python Package analyzer is enabled.206 */ -207publicstaticfinal String ANALYZER_RUBY_GEMSPEC_ENABLED = "analyzer.ruby.gemspec.enabled"; +207publicstaticfinal String ANALYZER_PYTHON_PACKAGE_ENABLED = "analyzer.python.package.enabled"; 208/** -209 * The properties key for whether the Autoconf analyzer is enabled. +209 * The properties key for whether the Ruby Gemspec Analyzer is enabled.210 */ -211publicstaticfinal String ANALYZER_AUTOCONF_ENABLED = "analyzer.autoconf.enabled"; +211publicstaticfinal String ANALYZER_RUBY_GEMSPEC_ENABLED = "analyzer.ruby.gemspec.enabled"; 212/** -213 * The properties key for whether the CMake analyzer is enabled. +213 * The properties key for whether the Autoconf analyzer is enabled.214 */ -215publicstaticfinal String ANALYZER_CMAKE_ENABLED = "analyzer.cmake.enabled"; +215publicstaticfinal String ANALYZER_AUTOCONF_ENABLED = "analyzer.autoconf.enabled"; 216/** -217 * The properties key for whether the .NET Assembly analyzer is enabled. +217 * The properties key for whether the CMake analyzer is enabled.218 */ -219publicstaticfinal String ANALYZER_ASSEMBLY_ENABLED = "analyzer.assembly.enabled"; +219publicstaticfinal String ANALYZER_CMAKE_ENABLED = "analyzer.cmake.enabled"; 220/** -221 * The properties key for whether the .NET Nuspec analyzer is enabled. +221 * The properties key for whether the Ruby Bundler Audit analyzer is enabled.222 */ -223publicstaticfinal String ANALYZER_NUSPEC_ENABLED = "analyzer.nuspec.enabled"; +223publicstaticfinal String ANALYZER_BUNDLE_AUDIT_ENABLED = "analyzer.bundle.audit.enabled"; 224/** -225 * The properties key for whether the Nexus analyzer is enabled. +225 * The properties key for whether the .NET Assembly analyzer is enabled.226 */ -227publicstaticfinal String ANALYZER_NEXUS_ENABLED = "analyzer.nexus.enabled"; +227publicstaticfinal String ANALYZER_ASSEMBLY_ENABLED = "analyzer.assembly.enabled"; 228/** -229 * The properties key for the Nexus search URL. +229 * The properties key for whether the .NET Nuspec analyzer is enabled.230 */ -231publicstaticfinal String ANALYZER_NEXUS_URL = "analyzer.nexus.url"; +231publicstaticfinal String ANALYZER_NUSPEC_ENABLED = "analyzer.nuspec.enabled"; 232/** -233 * The properties key for using the proxy to reach Nexus. +233 * The properties key for whether the Nexus analyzer is enabled.234 */ -235publicstaticfinal String ANALYZER_NEXUS_PROXY = "analyzer.nexus.proxy"; +235publicstaticfinal String ANALYZER_NEXUS_ENABLED = "analyzer.nexus.enabled"; 236/** -237 * The properties key for whether the Central analyzer is enabled. +237 * The properties key for the Nexus search URL.238 */ -239publicstaticfinal String ANALYZER_CENTRAL_ENABLED = "analyzer.central.enabled"; +239publicstaticfinal String ANALYZER_NEXUS_URL = "analyzer.nexus.url"; 240/** -241 * The properties key for whether the OpenSSL analyzer is enabled. +241 * The properties key for using the proxy to reach Nexus.242 */ -243publicstaticfinal String ANALYZER_OPENSSL_ENABLED = "analyzer.openssl.enabled"; +243publicstaticfinal String ANALYZER_NEXUS_USES_PROXY = "analyzer.nexus.proxy"; 244/** -245 * The properties key for the Central search URL. +245 * The properties key for whether the Central analyzer is enabled.246 */ -247publicstaticfinal String ANALYZER_CENTRAL_URL = "analyzer.central.url"; +247publicstaticfinal String ANALYZER_CENTRAL_ENABLED = "analyzer.central.enabled"; 248/** -249 * The path to mono, if available. +249 * The properties key for whether the OpenSSL analyzer is enabled.250 */ -251publicstaticfinal String ANALYZER_ASSEMBLY_MONO_PATH = "analyzer.assembly.mono.path"; +251publicstaticfinal String ANALYZER_OPENSSL_ENABLED = "analyzer.openssl.enabled"; 252/** -253 * The additional configured zip file extensions, if available. +253 * The properties key for the Central search URL.254 */ -255publicstaticfinal String ADDITIONAL_ZIP_EXTENSIONS = "extensions.zip"; +255publicstaticfinal String ANALYZER_CENTRAL_URL = "analyzer.central.url"; 256/** -257 * The properties key for whether Test Scope dependencies should be skipped. +257 * The path to mono, if available.258 */ -259publicstaticfinal String SKIP_TEST_SCOPE = "skip.test.scope"; +259publicstaticfinal String ANALYZER_ASSEMBLY_MONO_PATH = "analyzer.assembly.mono.path"; 260/** -261 * The properties key for whether Runtime Scope dependencies should be skipped. +261 * The path to bundle-audit, if available.262 */ -263publicstaticfinal String SKIP_RUNTIME_SCOPE = "skip.runtime.scope"; +263publicstaticfinal String ANALYZER_BUNDLE_AUDIT_PATH = "analyzer.bundle.audit.path"; 264/** -265 * The properties key for whether Provided Scope dependencies should be skipped. +265 * The additional configured zip file extensions, if available.266 */ -267publicstaticfinal String SKIP_PROVIDED_SCOPE = "skip.provided.scope"; -268 -269/** -270 * The key to obtain the path to the VFEED data file. -271 */ -272publicstaticfinal String VFEED_DATA_FILE = "vfeed.data_file"; -273/** -274 * The key to obtain the VFEED connection string. -275 */ -276publicstaticfinal String VFEED_CONNECTION_STRING = "vfeed.connection_string"; -277 -278/** -279 * The key to obtain the base download URL for the VFeed data file. -280 */ -281publicstaticfinal String VFEED_DOWNLOAD_URL = "vfeed.download_url"; -282/** -283 * The key to obtain the download file name for the VFeed data. -284 */ -285publicstaticfinal String VFEED_DOWNLOAD_FILE = "vfeed.download_file"; -286/** -287 * The key to obtain the VFeed update status. -288 */ -289publicstaticfinal String VFEED_UPDATE_STATUS = "vfeed.update_status"; -290 -291/** -292 * The HTTP request method for query last modified date. -293 */ -294publicstaticfinal String DOWNLOADER_QUICK_QUERY_TIMESTAMP = "downloader.quick.query.timestamp"; -295 } -296//</editor-fold> -297 -298/** -299 * The logger. -300 */ -301privatestaticfinal Logger LOGGER = LoggerFactory.getLogger(Settings.class); -302/** -303 * The properties file location. -304 */ -305privatestaticfinal String PROPERTIES_FILE = "dependencycheck.properties"; -306/** -307 * Thread local settings. -308 */ -309privatestatic ThreadLocal<Settings> localSettings = new ThreadLocal<Settings>(); -310/** -311 * The properties. -312 */ -313private Properties props = null; -314 -315/** -316 * Private constructor for the Settings class. This class loads the properties files. -317 * -318 * @param propertiesFilePath the path to the base properties file to load -319 */ -320privateSettings(String propertiesFilePath) { -321 InputStream in = null; -322 props = new Properties(); -323try { -324 in = this.getClass().getClassLoader().getResourceAsStream(propertiesFilePath); -325 props.load(in); -326 } catch (IOException ex) { -327 LOGGER.error("Unable to load default settings."); -328 LOGGER.debug("", ex); -329 } finally { -330if (in != null) { -331try { -332 in.close(); -333 } catch (IOException ex) { -334 LOGGER.trace("", ex); -335 } -336 } -337 } -338 logProperties("Properties loaded", props); -339 } -340 -341/** -342 * Initializes the thread local settings object. Note, to use the settings object you must call this method. However, you must -343 * also call Settings.cleanup() to properly release resources. -344 */ -345publicstaticvoid initialize() { -346 localSettings.set(newSettings(PROPERTIES_FILE)); -347 } -348 -349/** -350 * Initializes the thread local settings object. Note, to use the settings object you must call this method. However, you must -351 * also call Settings.cleanup() to properly release resources. -352 * -353 * @param propertiesFilePath the path to the base properties file to load -354 */ -355publicstaticvoid initialize(String propertiesFilePath) { -356 localSettings.set(newSettings(propertiesFilePath)); -357 } -358 -359/** -360 * Cleans up resources to prevent memory leaks. -361 * -362 */ -363publicstaticvoid cleanup() { -364 cleanup(true); -365 } -366 -367/** -368 * Cleans up resources to prevent memory leaks. -369 * -370 * @param deleteTemporary flag indicating whether any temporary directories generated should be removed -371 */ -372publicstaticvoid cleanup(boolean deleteTemporary) { -373if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) { -374 FileUtils.delete(tempDirectory); -375if (tempDirectory.exists()) { -376try { -377 Thread.sleep(2000); -378 } catch (InterruptedException ex) { -379 LOGGER.trace("ignore", ex); -380 } -381 FileUtils.delete(tempDirectory); -382 } -383 } -384try { -385 localSettings.remove(); -386 } catch (Throwable ex) { -387 LOGGER.debug("Error cleaning up Settings", ex); -388 } -389 } -390 -391/** -392 * Gets the underlying instance of the Settings object. -393 * -394 * @return the Settings object -395 */ -396publicstaticSettings getInstance() { -397return localSettings.get(); -398 } -399 -400/** -401 * Sets the instance of the Settings object to use in this thread. -402 * -403 * @param instance the instance of the settings object to use in this thread -404 */ -405publicstaticvoid setInstance(Settings instance) { -406 localSettings.set(instance); -407 } -408 -409/** -410 * Logs the properties. This will not log any properties that contain 'password' in the key. -411 * -412 * @param header the header to print with the log message -413 * @param properties the properties to log -414 */ -415privatestaticvoid logProperties(String header, Properties properties) { -416if (LOGGER.isDebugEnabled()) { -417final StringWriter sw = new StringWriter(); -418 PrintWriter pw = null; -419try { -420 pw = new PrintWriter(sw); -421 pw.format("%s:%n%n", header); -422final Enumeration<?> e = properties.propertyNames(); -423while (e.hasMoreElements()) { -424final String key = (String) e.nextElement(); -425if (key.contains("password")) { -426 pw.format("%s='*****'%n", key); -427 } else { -428final String value = properties.getProperty(key); -429if (value != null) { -430 pw.format("%s='%s'%n", key, value); -431 } -432 } -433 } -434 pw.flush(); -435 LOGGER.debug(sw.toString()); -436 } finally { -437if (pw != null) { -438 pw.close(); -439 } -440 } -441 -442 } -443 } -444 -445/** -446 * Sets a property value. -447 * -448 * @param key the key for the property -449 * @param value the value for the property -450 */ -451publicstaticvoid setString(String key, String value) { -452 localSettings.get().props.setProperty(key, value); -453 LOGGER.debug("Setting: {}='{}'", key, value); -454 } -455 -456/** -457 * Sets a property value. -458 * -459 * @param key the key for the property -460 * @param value the value for the property -461 */ -462publicstaticvoid setBoolean(String key, boolean value) { -463if (value) { -464 localSettings.get().props.setProperty(key, Boolean.TRUE.toString()); -465 } else { -466 localSettings.get().props.setProperty(key, Boolean.FALSE.toString()); -467 } -468 LOGGER.debug("Setting: {}='{}'", key, value); -469 } -470 -471/** -472 * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties -473 * file.<br/><br/> -474 * Note: even if using this method - system properties will be loaded before properties loaded from files. -475 * -476 * @param filePath the path to the properties file to merge. -477 * @throws FileNotFoundException is thrown when the filePath points to a non-existent file -478 * @throws IOException is thrown when there is an exception loading/merging the properties -479 */ -480publicstaticvoid mergeProperties(File filePath) throws FileNotFoundException, IOException { -481 FileInputStream fis = null; -482try { -483 fis = new FileInputStream(filePath); -484 mergeProperties(fis); -485 } finally { -486if (fis != null) { -487try { -488 fis.close(); -489 } catch (IOException ex) { -490 LOGGER.trace("close error", ex); -491 } -492 } -493 } -494 } -495 -496/** -497 * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties -498 * file.<br/><br/> -499 * Note: even if using this method - system properties will be loaded before properties loaded from files. -500 * -501 * @param filePath the path to the properties file to merge. -502 * @throws FileNotFoundException is thrown when the filePath points to a non-existent file -503 * @throws IOException is thrown when there is an exception loading/merging the properties -504 */ -505publicstaticvoid mergeProperties(String filePath) throws FileNotFoundException, IOException { -506 FileInputStream fis = null; -507try { -508 fis = new FileInputStream(filePath); -509 mergeProperties(fis); -510 } finally { -511if (fis != null) { -512try { -513 fis.close(); -514 } catch (IOException ex) { -515 LOGGER.trace("close error", ex); -516 } -517 } -518 } -519 } -520 -521/** -522 * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties -523 * file.<br/><br/> -524 * Note: even if using this method - system properties will be loaded before properties loaded from files. -525 * -526 * @param stream an Input Stream pointing at a properties file to merge -527 * @throws IOException is thrown when there is an exception loading/merging the properties -528 */ -529publicstaticvoid mergeProperties(InputStream stream) throws IOException { -530 localSettings.get().props.load(stream); -531 logProperties("Properties updated via merge", localSettings.get().props); -532 } -533 -534/** -535 * Returns a value from the properties file as a File object. If the value was specified as a system property or passed in via -536 * the -Dprop=value argument - this method will return the value from the system properties before the values in the contained -537 * configuration file. -538 * -539 * @param key the key to lookup within the properties file -540 * @return the property from the properties file converted to a File object -541 */ -542publicstatic File getFile(String key) { -543final String file = getString(key); -544if (file == null) { -545returnnull; +267publicstaticfinal String ADDITIONAL_ZIP_EXTENSIONS = "extensions.zip"; +268/** +269 * The key to obtain the path to the VFEED data file. +270 */ +271publicstaticfinal String VFEED_DATA_FILE = "vfeed.data_file"; +272/** +273 * The key to obtain the VFEED connection string. +274 */ +275publicstaticfinal String VFEED_CONNECTION_STRING = "vfeed.connection_string"; +276 +277/** +278 * The key to obtain the base download URL for the VFeed data file. +279 */ +280publicstaticfinal String VFEED_DOWNLOAD_URL = "vfeed.download_url"; +281/** +282 * The key to obtain the download file name for the VFeed data. +283 */ +284publicstaticfinal String VFEED_DOWNLOAD_FILE = "vfeed.download_file"; +285/** +286 * The key to obtain the VFeed update status. +287 */ +288publicstaticfinal String VFEED_UPDATE_STATUS = "vfeed.update_status"; +289 +290/** +291 * The HTTP request method for query last modified date. +292 */ +293publicstaticfinal String DOWNLOADER_QUICK_QUERY_TIMESTAMP = "downloader.quick.query.timestamp"; +294 } +295//</editor-fold> +296 +297/** +298 * The logger. +299 */ +300privatestaticfinal Logger LOGGER = LoggerFactory.getLogger(Settings.class); +301/** +302 * The properties file location. +303 */ +304privatestaticfinal String PROPERTIES_FILE = "dependencycheck.properties"; +305/** +306 * Thread local settings. +307 */ +308privatestatic ThreadLocal<Settings> localSettings = new ThreadLocal<Settings>(); +309/** +310 * The properties. +311 */ +312private Properties props = null; +313 +314/** +315 * Private constructor for the Settings class. This class loads the properties files. +316 * +317 * @param propertiesFilePath the path to the base properties file to load +318 */ +319privateSettings(String propertiesFilePath) { +320 InputStream in = null; +321 props = new Properties(); +322try { +323 in = this.getClass().getClassLoader().getResourceAsStream(propertiesFilePath); +324 props.load(in); +325 } catch (IOException ex) { +326 LOGGER.error("Unable to load default settings."); +327 LOGGER.debug("", ex); +328 } finally { +329if (in != null) { +330try { +331 in.close(); +332 } catch (IOException ex) { +333 LOGGER.trace("", ex); +334 } +335 } +336 } +337 logProperties("Properties loaded", props); +338 } +339 +340/** +341 * Initializes the thread local settings object. Note, to use the settings object you must call this method. However, you must +342 * also call Settings.cleanup() to properly release resources. +343 */ +344publicstaticvoid initialize() { +345 localSettings.set(newSettings(PROPERTIES_FILE)); +346 } +347 +348/** +349 * Initializes the thread local settings object. Note, to use the settings object you must call this method. However, you must +350 * also call Settings.cleanup() to properly release resources. +351 * +352 * @param propertiesFilePath the path to the base properties file to load +353 */ +354publicstaticvoid initialize(String propertiesFilePath) { +355 localSettings.set(newSettings(propertiesFilePath)); +356 } +357 +358/** +359 * Cleans up resources to prevent memory leaks. +360 * +361 */ +362publicstaticvoid cleanup() { +363 cleanup(true); +364 } +365 +366/** +367 * Cleans up resources to prevent memory leaks. +368 * +369 * @param deleteTemporary flag indicating whether any temporary directories generated should be removed +370 */ +371publicstaticvoid cleanup(boolean deleteTemporary) { +372if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) { +373 FileUtils.delete(tempDirectory); +374if (tempDirectory.exists()) { +375try { +376 Thread.sleep(2000); +377 } catch (InterruptedException ex) { +378 LOGGER.trace("ignore", ex); +379 } +380 FileUtils.delete(tempDirectory); +381 } +382 } +383try { +384 localSettings.remove(); +385 } catch (Throwable ex) { +386 LOGGER.debug("Error cleaning up Settings", ex); +387 } +388 } +389 +390/** +391 * Gets the underlying instance of the Settings object. +392 * +393 * @return the Settings object +394 */ +395publicstaticSettings getInstance() { +396return localSettings.get(); +397 } +398 +399/** +400 * Sets the instance of the Settings object to use in this thread. +401 * +402 * @param instance the instance of the settings object to use in this thread +403 */ +404publicstaticvoid setInstance(Settings instance) { +405 localSettings.set(instance); +406 } +407 +408/** +409 * Logs the properties. This will not log any properties that contain 'password' in the key. +410 * +411 * @param header the header to print with the log message +412 * @param properties the properties to log +413 */ +414privatestaticvoid logProperties(String header, Properties properties) { +415if (LOGGER.isDebugEnabled()) { +416final StringWriter sw = new StringWriter(); +417 PrintWriter pw = null; +418try { +419 pw = new PrintWriter(sw); +420 pw.format("%s:%n%n", header); +421final Enumeration<?> e = properties.propertyNames(); +422while (e.hasMoreElements()) { +423final String key = (String) e.nextElement(); +424if (key.contains("password")) { +425 pw.format("%s='*****'%n", key); +426 } else { +427final String value = properties.getProperty(key); +428if (value != null) { +429 pw.format("%s='%s'%n", key, value); +430 } +431 } +432 } +433 pw.flush(); +434 LOGGER.debug(sw.toString()); +435 } finally { +436if (pw != null) { +437 pw.close(); +438 } +439 } +440 +441 } +442 } +443 +444/** +445 * Sets a property value. +446 * +447 * @param key the key for the property +448 * @param value the value for the property +449 */ +450publicstaticvoid setString(String key, String value) { +451 localSettings.get().props.setProperty(key, value); +452 LOGGER.debug("Setting: {}='{}'", key, value); +453 } +454 +455/** +456 * Sets a property value only if the value is not null. +457 * +458 * @param key the key for the property +459 * @param value the value for the property +460 */ +461publicstaticvoid setStringIfNotNull(String key, String value) { +462if (null != value) { +463 setString(key, value); +464 } +465 } +466 +467/** +468 * Sets a property value only if the value is not null and not empty. +469 * +470 * @param key the key for the property +471 * @param value the value for the property +472 */ +473publicstaticvoid setStringIfNotEmpty(String key, String value) { +474if (null != value && !value.isEmpty()) { +475 setString(key, value); +476 } +477 } +478 +479/** +480 * Sets a property value. +481 * +482 * @param key the key for the property +483 * @param value the value for the property +484 */ +485publicstaticvoid setBoolean(String key, boolean value) { +486 setString(key, Boolean.toString(value)); +487 } +488 +489/** +490 * Sets a property value only if the value is not null. +491 * +492 * @param key the key for the property +493 * @param value the value for the property +494 */ +495publicstaticvoid setBooleanIfNotNull(String key, Boolean value) { +496if (null != value) { +497 setBoolean(key, value); +498 } +499 } +500 +501/** +502 * Sets a property value. +503 * +504 * @param key the key for the property +505 * @param value the value for the property +506 */ +507publicstaticvoid setInt(String key, int value) { +508 localSettings.get().props.setProperty(key, String.valueOf(value)); +509 LOGGER.debug("Setting: {}='{}'", key, value); +510 } +511 +512/** +513 * Sets a property value only if the value is not null. +514 * +515 * @param key the key for the property +516 * @param value the value for the property +517 */ +518publicstaticvoid setIntIfNotNull(String key, Integer value) { +519if (null != value) { +520 setInt(key, value); +521 } +522 } +523 +524/** +525 * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties +526 * file.<br/><br/> +527 * Note: even if using this method - system properties will be loaded before properties loaded from files. +528 * +529 * @param filePath the path to the properties file to merge. +530 * @throws FileNotFoundException is thrown when the filePath points to a non-existent file +531 * @throws IOException is thrown when there is an exception loading/merging the properties +532 */ +533publicstaticvoid mergeProperties(File filePath) throws FileNotFoundException, IOException { +534 FileInputStream fis = null; +535try { +536 fis = new FileInputStream(filePath); +537 mergeProperties(fis); +538 } finally { +539if (fis != null) { +540try { +541 fis.close(); +542 } catch (IOException ex) { +543 LOGGER.trace("close error", ex); +544 } +545 } 546 } -547returnnew File(file); -548 } -549 -550/** -551 * Returns a value from the properties file as a File object. If the value was specified as a system property or passed in via -552 * the -Dprop=value argument - this method will return the value from the system properties before the values in the contained -553 * configuration file. -554 * -555 * This method will check the configured base directory and will use this as the base of the file path. Additionally, if the -556 * base directory begins with a leading "[JAR]\" sequence with the path to the folder containing the JAR file containing this -557 * class. -558 * -559 * @param key the key to lookup within the properties file -560 * @return the property from the properties file converted to a File object -561 */ -562protectedstatic File getDataFile(String key) { -563final String file = getString(key); -564 LOGGER.debug("Settings.getDataFile() - file: '{}'", file); -565if (file == null) { -566returnnull; -567 } -568if (file.startsWith("[JAR]")) { -569 LOGGER.debug("Settings.getDataFile() - transforming filename"); -570final File jarPath = getJarPath(); -571 LOGGER.debug("Settings.getDataFile() - jar file: '{}'", jarPath.toString()); -572final File retVal = new File(jarPath, file.substring(6)); -573 LOGGER.debug("Settings.getDataFile() - returning: '{}'", retVal.toString()); -574return retVal; -575 } -576returnnew File(file); -577 } -578 -579/** -580 * Attempts to retrieve the folder containing the Jar file containing the Settings class. -581 * -582 * @return a File object -583 */ -584privatestatic File getJarPath() { -585final String jarPath = Settings.class.getProtectionDomain().getCodeSource().getLocation().getPath(); -586 String decodedPath = "."; -587try { -588 decodedPath = URLDecoder.decode(jarPath, "UTF-8"); -589 } catch (UnsupportedEncodingException ex) { -590 LOGGER.trace("", ex); -591 } -592 -593final File path = new File(decodedPath); -594if (path.getName().toLowerCase().endsWith(".jar")) { -595return path.getParentFile(); -596 } else { -597returnnew File("."); -598 } -599 } -600 -601/** -602 * Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value -603 * argument - this method will return the value from the system properties before the values in the contained configuration -604 * file. -605 * -606 * @param key the key to lookup within the properties file -607 * @param defaultValue the default value for the requested property -608 * @return the property from the properties file -609 */ -610publicstatic String getString(String key, String defaultValue) { -611final String str = System.getProperty(key, localSettings.get().props.getProperty(key, defaultValue)); -612return str; -613 } -614 -615/** -616 * A reference to the temporary directory; used incase it needs to be deleted during cleanup. -617 */ -618privatestatic File tempDirectory = null; -619 -620/** -621 * Returns the temporary directory. -622 * -623 * @return the temporary directory -624 * @throws java.io.IOException thrown if the temporary directory does not exist and cannot be created -625 */ -626publicstatic File getTempDirectory() throws IOException { -627final File tmpDir = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")), "dctemp"); -628if (!tmpDir.exists() && !tmpDir.mkdirs()) { -629final String msg = String.format("Unable to make a temporary folder '%s'", tmpDir.getPath()); -630thrownew IOException(msg); -631 } -632 tempDirectory = tmpDir; -633return tmpDir; -634 } -635 -636/** -637 * Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value -638 * argument - this method will return the value from the system properties before the values in the contained configuration -639 * file. -640 * -641 * @param key the key to lookup within the properties file -642 * @return the property from the properties file -643 */ -644publicstatic String getString(String key) { -645return System.getProperty(key, localSettings.get().props.getProperty(key)); -646 } -647 -648/** -649 * Removes a property from the local properties collection. This is mainly used in test cases. -650 * -651 * @param key the property key to remove -652 */ -653publicstaticvoid removeProperty(String key) { -654 localSettings.get().props.remove(key); -655 } -656 -657/** -658 * Returns an int value from the properties file. If the value was specified as a system property or passed in via the -659 * -Dprop=value argument - this method will return the value from the system properties before the values in the contained -660 * configuration file. -661 * -662 * @param key the key to lookup within the properties file -663 * @return the property from the properties file -664 * @throws InvalidSettingException is thrown if there is an error retrieving the setting -665 */ -666publicstaticint getInt(String key) throws InvalidSettingException { -667int value; -668try { -669 value = Integer.parseInt(Settings.getString(key)); -670 } catch (NumberFormatException ex) { -671thrownewInvalidSettingException("Could not convert property '" + key + "' to an int.", ex); -672 } -673return value; -674 } -675 -676/** -677 * Returns an int value from the properties file. If the value was specified as a system property or passed in via the -678 * -Dprop=value argument - this method will return the value from the system properties before the values in the contained -679 * configuration file. -680 * -681 * @param key the key to lookup within the properties file -682 * @param defaultValue the default value to return -683 * @return the property from the properties file or the defaultValue if the property does not exist or cannot be converted to -684 * an integer -685 */ -686publicstaticint getInt(String key, int defaultValue) { -687int value; -688try { -689 value = Integer.parseInt(Settings.getString(key)); -690 } catch (NumberFormatException ex) { -691 LOGGER.trace("Could not convert property '{}' to an int.", key, ex); -692 value = defaultValue; -693 } -694return value; -695 } -696 -697/** -698 * Returns a long value from the properties file. If the value was specified as a system property or passed in via the -699 * -Dprop=value argument - this method will return the value from the system properties before the values in the contained -700 * configuration file. -701 * -702 * @param key the key to lookup within the properties file -703 * @return the property from the properties file -704 * @throws InvalidSettingException is thrown if there is an error retrieving the setting +547 } +548 +549/** +550 * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties +551 * file.<br/><br/> +552 * Note: even if using this method - system properties will be loaded before properties loaded from files. +553 * +554 * @param filePath the path to the properties file to merge. +555 * @throws FileNotFoundException is thrown when the filePath points to a non-existent file +556 * @throws IOException is thrown when there is an exception loading/merging the properties +557 */ +558publicstaticvoid mergeProperties(String filePath) throws FileNotFoundException, IOException { +559 FileInputStream fis = null; +560try { +561 fis = new FileInputStream(filePath); +562 mergeProperties(fis); +563 } finally { +564if (fis != null) { +565try { +566 fis.close(); +567 } catch (IOException ex) { +568 LOGGER.trace("close error", ex); +569 } +570 } +571 } +572 } +573 +574/** +575 * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties +576 * file.<br/><br/> +577 * Note: even if using this method - system properties will be loaded before properties loaded from files. +578 * +579 * @param stream an Input Stream pointing at a properties file to merge +580 * @throws IOException is thrown when there is an exception loading/merging the properties +581 */ +582publicstaticvoid mergeProperties(InputStream stream) throws IOException { +583 localSettings.get().props.load(stream); +584 logProperties("Properties updated via merge", localSettings.get().props); +585 } +586 +587/** +588 * Returns a value from the properties file as a File object. If the value was specified as a system property or passed in via +589 * the -Dprop=value argument - this method will return the value from the system properties before the values in the contained +590 * configuration file. +591 * +592 * @param key the key to lookup within the properties file +593 * @return the property from the properties file converted to a File object +594 */ +595publicstatic File getFile(String key) { +596final String file = getString(key); +597if (file == null) { +598returnnull; +599 } +600returnnew File(file); +601 } +602 +603/** +604 * Returns a value from the properties file as a File object. If the value was specified as a system property or passed in via +605 * the -Dprop=value argument - this method will return the value from the system properties before the values in the contained +606 * configuration file. +607 * +608 * This method will check the configured base directory and will use this as the base of the file path. Additionally, if the +609 * base directory begins with a leading "[JAR]\" sequence with the path to the folder containing the JAR file containing this +610 * class. +611 * +612 * @param key the key to lookup within the properties file +613 * @return the property from the properties file converted to a File object +614 */ +615protectedstatic File getDataFile(String key) { +616final String file = getString(key); +617 LOGGER.debug("Settings.getDataFile() - file: '{}'", file); +618if (file == null) { +619returnnull; +620 } +621if (file.startsWith("[JAR]")) { +622 LOGGER.debug("Settings.getDataFile() - transforming filename"); +623final File jarPath = getJarPath(); +624 LOGGER.debug("Settings.getDataFile() - jar file: '{}'", jarPath.toString()); +625final File retVal = new File(jarPath, file.substring(6)); +626 LOGGER.debug("Settings.getDataFile() - returning: '{}'", retVal.toString()); +627return retVal; +628 } +629returnnew File(file); +630 } +631 +632/** +633 * Attempts to retrieve the folder containing the Jar file containing the Settings class. +634 * +635 * @return a File object +636 */ +637privatestatic File getJarPath() { +638final String jarPath = Settings.class.getProtectionDomain().getCodeSource().getLocation().getPath(); +639 String decodedPath = "."; +640try { +641 decodedPath = URLDecoder.decode(jarPath, "UTF-8"); +642 } catch (UnsupportedEncodingException ex) { +643 LOGGER.trace("", ex); +644 } +645 +646final File path = new File(decodedPath); +647if (path.getName().toLowerCase().endsWith(".jar")) { +648return path.getParentFile(); +649 } else { +650returnnew File("."); +651 } +652 } +653 +654/** +655 * Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value +656 * argument - this method will return the value from the system properties before the values in the contained configuration +657 * file. +658 * +659 * @param key the key to lookup within the properties file +660 * @param defaultValue the default value for the requested property +661 * @return the property from the properties file +662 */ +663publicstatic String getString(String key, String defaultValue) { +664final String str = System.getProperty(key, localSettings.get().props.getProperty(key, defaultValue)); +665return str; +666 } +667 +668/** +669 * A reference to the temporary directory; used incase it needs to be deleted during cleanup. +670 */ +671privatestatic File tempDirectory = null; +672 +673/** +674 * Returns the temporary directory. +675 * +676 * @return the temporary directory +677 * @throws java.io.IOException thrown if the temporary directory does not exist and cannot be created +678 */ +679publicstatic File getTempDirectory() throws IOException { +680final File tmpDir = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")), "dctemp"); +681if (!tmpDir.exists() && !tmpDir.mkdirs()) { +682final String msg = String.format("Unable to make a temporary folder '%s'", tmpDir.getPath()); +683thrownew IOException(msg); +684 } +685 tempDirectory = tmpDir; +686return tmpDir; +687 } +688 +689/** +690 * Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value +691 * argument - this method will return the value from the system properties before the values in the contained configuration +692 * file. +693 * +694 * @param key the key to lookup within the properties file +695 * @return the property from the properties file +696 */ +697publicstatic String getString(String key) { +698return System.getProperty(key, localSettings.get().props.getProperty(key)); +699 } +700 +701/** +702 * Removes a property from the local properties collection. This is mainly used in test cases. +703 * +704 * @param key the property key to remove705 */ -706publicstaticlong getLong(String key) throws InvalidSettingException { -707long value; -708try { -709 value = Long.parseLong(Settings.getString(key)); -710 } catch (NumberFormatException ex) { -711thrownewInvalidSettingException("Could not convert property '" + key + "' to an int.", ex); -712 } -713return value; -714 } -715 -716/** -717 * Returns a boolean value from the properties file. If the value was specified as a system property or passed in via the -718 * <code>-Dprop=value</code> argument this method will return the value from the system properties before the values in the -719 * contained configuration file. -720 * -721 * @param key the key to lookup within the properties file -722 * @return the property from the properties file -723 * @throws InvalidSettingException is thrown if there is an error retrieving the setting -724 */ -725publicstaticboolean getBoolean(String key) throws InvalidSettingException { -726boolean value; -727try { -728 value = Boolean.parseBoolean(Settings.getString(key)); -729 } catch (NumberFormatException ex) { -730thrownewInvalidSettingException("Could not convert property '" + key + "' to an int.", ex); -731 } -732return value; -733 } -734 -735/** -736 * Returns a boolean value from the properties file. If the value was specified as a system property or passed in via the -737 * <code>-Dprop=value</code> argument this method will return the value from the system properties before the values in the -738 * contained configuration file. -739 * -740 * @param key the key to lookup within the properties file -741 * @param defaultValue the default value to return if the setting does not exist -742 * @return the property from the properties file -743 * @throws InvalidSettingException is thrown if there is an error retrieving the setting -744 */ -745publicstaticboolean getBoolean(String key, boolean defaultValue) throws InvalidSettingException { -746boolean value; -747try { -748final String strValue = Settings.getString(key); -749if (strValue == null) { -750return defaultValue; -751 } -752 value = Boolean.parseBoolean(strValue); -753 } catch (NumberFormatException ex) { -754thrownewInvalidSettingException("Could not convert property '" + key + "' to an int.", ex); -755 } -756return value; -757 } -758 -759/** -760 * Returns a connection string from the configured properties. If the connection string contains a %s, this method will -761 * determine the 'data' directory and replace the %s with the path to the data directory. If the data directory does not -762 * exists it will be created. -763 * -764 * @param connectionStringKey the property file key for the connection string -765 * @param dbFileNameKey the settings key for the db filename -766 * @return the connection string -767 * @throws IOException thrown the data directory cannot be created -768 * @throws InvalidSettingException thrown if there is an invalid setting -769 */ -770publicstatic String getConnectionString(String connectionStringKey, String dbFileNameKey) -771throws IOException, InvalidSettingException { -772final String connStr = Settings.getString(connectionStringKey); -773if (connStr == null) { -774final String msg = String.format("Invalid properties file; %s is missing.", connectionStringKey); -775thrownewInvalidSettingException(msg); -776 } -777if (connStr.contains("%s")) { -778final File directory = getDataDirectory(); -779 String fileName = null; -780if (dbFileNameKey != null) { -781 fileName = Settings.getString(dbFileNameKey); -782 } -783if (fileName == null) { -784final String msg = String.format("Invalid properties file to get a file based connection string; '%s' must be defined.", -785 dbFileNameKey); -786thrownewInvalidSettingException(msg); -787 } -788if (connStr.startsWith("jdbc:h2:file:") && fileName.endsWith(".h2.db")) { -789 fileName = fileName.substring(0, fileName.length() - 6); -790 } -791// yes, for H2 this path won't actually exists - but this is sufficient to get the value needed -792final File dbFile = new File(directory, fileName); -793final String cString = String.format(connStr, dbFile.getCanonicalPath()); -794 LOGGER.debug("Connection String: '{}'", cString); -795return cString; -796 } -797return connStr; -798 } -799 -800/** -801 * Retrieves the directory that the JAR file exists in so that we can ensure we always use a common data directory for the -802 * embedded H2 database. This is public solely for some unit tests; otherwise this should be private. -803 * -804 * @return the data directory to store data files -805 * @throws IOException is thrown if an IOException occurs of course... -806 */ -807publicstatic File getDataDirectory() throws IOException { -808final File path = Settings.getDataFile(Settings.KEYS.DATA_DIRECTORY); -809if (path.exists() || path.mkdirs()) { -810return path; -811 } -812thrownew IOException(String.format("Unable to create the data directory '%s'", path.getAbsolutePath())); -813 } -814 } +706publicstaticvoid removeProperty(String key) { +707 localSettings.get().props.remove(key); +708 } +709 +710/** +711 * Returns an int value from the properties file. If the value was specified as a system property or passed in via the +712 * -Dprop=value argument - this method will return the value from the system properties before the values in the contained +713 * configuration file. +714 * +715 * @param key the key to lookup within the properties file +716 * @return the property from the properties file +717 * @throws InvalidSettingException is thrown if there is an error retrieving the setting +718 */ +719publicstaticint getInt(String key) throws InvalidSettingException { +720try { +721return Integer.parseInt(Settings.getString(key)); +722 } catch (NumberFormatException ex) { +723thrownewInvalidSettingException("Could not convert property '" + key + "' to an int.", ex); +724 } +725 } +726 +727/** +728 * Returns an int value from the properties file. If the value was specified as a system property or passed in via the +729 * -Dprop=value argument - this method will return the value from the system properties before the values in the contained +730 * configuration file. +731 * +732 * @param key the key to lookup within the properties file +733 * @param defaultValue the default value to return +734 * @return the property from the properties file or the defaultValue if the property does not exist or cannot be converted to +735 * an integer +736 */ +737publicstaticint getInt(String key, int defaultValue) { +738int value; +739try { +740 value = Integer.parseInt(Settings.getString(key)); +741 } catch (NumberFormatException ex) { +742 LOGGER.trace("Could not convert property '{}' to an int.", key, ex); +743 value = defaultValue; +744 } +745return value; +746 } +747 +748/** +749 * Returns a long value from the properties file. If the value was specified as a system property or passed in via the +750 * -Dprop=value argument - this method will return the value from the system properties before the values in the contained +751 * configuration file. +752 * +753 * @param key the key to lookup within the properties file +754 * @return the property from the properties file +755 * @throws InvalidSettingException is thrown if there is an error retrieving the setting +756 */ +757publicstaticlong getLong(String key) throws InvalidSettingException { +758try { +759return Long.parseLong(Settings.getString(key)); +760 } catch (NumberFormatException ex) { +761thrownewInvalidSettingException("Could not convert property '" + key + "' to a long.", ex); +762 } +763 } +764 +765/** +766 * Returns a boolean value from the properties file. If the value was specified as a system property or passed in via the +767 * <code>-Dprop=value</code> argument this method will return the value from the system properties before the values in the +768 * contained configuration file. +769 * +770 * @param key the key to lookup within the properties file +771 * @return the property from the properties file +772 * @throws InvalidSettingException is thrown if there is an error retrieving the setting +773 */ +774publicstaticboolean getBoolean(String key) throws InvalidSettingException { +775return Boolean.parseBoolean(Settings.getString(key)); +776 } +777 +778/** +779 * Returns a boolean value from the properties file. If the value was specified as a system property or passed in via the +780 * <code>-Dprop=value</code> argument this method will return the value from the system properties before the values in the +781 * contained configuration file. +782 * +783 * @param key the key to lookup within the properties file +784 * @param defaultValue the default value to return if the setting does not exist +785 * @return the property from the properties file +786 * @throws InvalidSettingException is thrown if there is an error retrieving the setting +787 */ +788publicstaticboolean getBoolean(String key, boolean defaultValue) throws InvalidSettingException { +789return Boolean.parseBoolean(Settings.getString(key, Boolean.toString(defaultValue))); +790 } +791 +792/** +793 * Returns a connection string from the configured properties. If the connection string contains a %s, this method will +794 * determine the 'data' directory and replace the %s with the path to the data directory. If the data directory does not +795 * exists it will be created. +796 * +797 * @param connectionStringKey the property file key for the connection string +798 * @param dbFileNameKey the settings key for the db filename +799 * @return the connection string +800 * @throws IOException thrown the data directory cannot be created +801 * @throws InvalidSettingException thrown if there is an invalid setting +802 */ +803publicstatic String getConnectionString(String connectionStringKey, String dbFileNameKey) +804throws IOException, InvalidSettingException { +805final String connStr = Settings.getString(connectionStringKey); +806if (connStr == null) { +807final String msg = String.format("Invalid properties file; %s is missing.", connectionStringKey); +808thrownewInvalidSettingException(msg); +809 } +810if (connStr.contains("%s")) { +811final File directory = getDataDirectory(); +812 String fileName = null; +813if (dbFileNameKey != null) { +814 fileName = Settings.getString(dbFileNameKey); +815 } +816if (fileName == null) { +817final String msg = String.format("Invalid properties file to get a file based connection string; '%s' must be defined.", +818 dbFileNameKey); +819thrownewInvalidSettingException(msg); +820 } +821if (connStr.startsWith("jdbc:h2:file:") && fileName.endsWith(".h2.db")) { +822 fileName = fileName.substring(0, fileName.length() - 6); +823 } +824// yes, for H2 this path won't actually exists - but this is sufficient to get the value needed +825final File dbFile = new File(directory, fileName); +826final String cString = String.format(connStr, dbFile.getCanonicalPath()); +827 LOGGER.debug("Connection String: '{}'", cString); +828return cString; +829 } +830return connStr; +831 } +832 +833/** +834 * Retrieves the directory that the JAR file exists in so that we can ensure we always use a common data directory for the +835 * embedded H2 database. This is public solely for some unit tests; otherwise this should be private. +836 * +837 * @return the data directory to store data files +838 * @throws IOException is thrown if an IOException occurs of course... +839 */ +840publicstatic File getDataDirectory() throws IOException { +841final File path = Settings.getDataFile(Settings.KEYS.DATA_DIRECTORY); +842if (path.exists() || path.mkdirs()) { +843return path; +844 } +845thrownew IOException(String.format("Unable to create the data directory '%s'", path.getAbsolutePath())); +846 } +847 }
    diff --git a/dependency-check-utils/xref/org/owasp/dependencycheck/utils/URLConnectionFactory.html b/dependency-check-utils/xref/org/owasp/dependencycheck/utils/URLConnectionFactory.html index 78c98d3ea..32115a3ee 100644 --- a/dependency-check-utils/xref/org/owasp/dependencycheck/utils/URLConnectionFactory.html +++ b/dependency-check-utils/xref/org/owasp/dependencycheck/utils/URLConnectionFactory.html @@ -60,74 +60,73 @@ 52 @SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE", justification = "Just being extra safe") 53publicstatic HttpURLConnection createHttpURLConnection(URL url) throws URLConnectionFailureException { 54 HttpURLConnection conn = null; -55 Proxy proxy; -56final String proxyUrl = Settings.getString(Settings.KEYS.PROXY_SERVER); -57try { -58if (proxyUrl != null) { -59finalint proxyPort = Settings.getInt(Settings.KEYS.PROXY_PORT); -60final SocketAddress address = new InetSocketAddress(proxyUrl, proxyPort); -61 -62final String username = Settings.getString(Settings.KEYS.PROXY_USERNAME); -63final String password = Settings.getString(Settings.KEYS.PROXY_PASSWORD); -64if (username != null && password != null) { -65final Authenticator auth = new Authenticator() { -66 @Override -67public PasswordAuthentication getPasswordAuthentication() { -68if (getRequestorType().equals(Authenticator.RequestorType.PROXY)) { -69returnnew PasswordAuthentication(username, password.toCharArray()); -70 } -71returnsuper.getPasswordAuthentication(); -72 } -73 }; -74 Authenticator.setDefault(auth); -75 } -76 -77 proxy = new Proxy(Proxy.Type.HTTP, address); -78 conn = (HttpURLConnection) url.openConnection(proxy); -79 } else { -80 conn = (HttpURLConnection) url.openConnection(); -81 } -82finalint timeout = Settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000); -83 conn.setConnectTimeout(timeout); -84 conn.setInstanceFollowRedirects(true); -85 } catch (IOException ex) { -86if (conn != null) { -87try { -88 conn.disconnect(); -89 } finally { -90 conn = null; -91 } -92 } -93thrownewURLConnectionFailureException("Error getting connection.", ex); -94 } -95return conn; -96 } -97 -98/** -99 * Utility method to create an HttpURLConnection. The use of a proxy here is optional as there may be cases where a proxy is -100 * configured but we don't want to use it (for example, if there's an internal repository configured) -101 * -102 * @param url the URL to connect to -103 * @param proxy whether to use the proxy (if configured) -104 * @return a newly constructed HttpURLConnection -105 * @throws URLConnectionFailureException thrown if there is an exception -106 */ -107publicstatic HttpURLConnection createHttpURLConnection(URL url, boolean proxy) throws URLConnectionFailureException { -108if (proxy) { -109return createHttpURLConnection(url); -110 } -111 HttpURLConnection conn = null; -112try { -113 conn = (HttpURLConnection) url.openConnection(); -114finalint timeout = Settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000); -115 conn.setConnectTimeout(timeout); -116 conn.setInstanceFollowRedirects(true); -117 } catch (IOException ioe) { -118thrownewURLConnectionFailureException("Error getting connection.", ioe); -119 } -120return conn; -121 } -122 } +55final String proxyUrl = Settings.getString(Settings.KEYS.PROXY_SERVER); +56try { +57if (proxyUrl != null) { +58finalint proxyPort = Settings.getInt(Settings.KEYS.PROXY_PORT); +59final SocketAddress address = new InetSocketAddress(proxyUrl, proxyPort); +60 +61final String username = Settings.getString(Settings.KEYS.PROXY_USERNAME); +62final String password = Settings.getString(Settings.KEYS.PROXY_PASSWORD); +63if (username != null && password != null) { +64final Authenticator auth = new Authenticator() { +65 @Override +66public PasswordAuthentication getPasswordAuthentication() { +67if (getRequestorType().equals(Authenticator.RequestorType.PROXY)) { +68returnnew PasswordAuthentication(username, password.toCharArray()); +69 } +70returnsuper.getPasswordAuthentication(); +71 } +72 }; +73 Authenticator.setDefault(auth); +74 } +75 +76final Proxy proxy = new Proxy(Proxy.Type.HTTP, address); +77 conn = (HttpURLConnection) url.openConnection(proxy); +78 } else { +79 conn = (HttpURLConnection) url.openConnection(); +80 } +81finalint timeout = Settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000); +82 conn.setConnectTimeout(timeout); +83 conn.setInstanceFollowRedirects(true); +84 } catch (IOException ex) { +85if (conn != null) { +86try { +87 conn.disconnect(); +88 } finally { +89 conn = null; +90 } +91 } +92thrownewURLConnectionFailureException("Error getting connection.", ex); +93 } +94return conn; +95 } +96 +97/** +98 * Utility method to create an HttpURLConnection. The use of a proxy here is optional as there may be cases where a proxy is +99 * configured but we don't want to use it (for example, if there's an internal repository configured) +100 * +101 * @param url the URL to connect to +102 * @param proxy whether to use the proxy (if configured) +103 * @return a newly constructed HttpURLConnection +104 * @throws URLConnectionFailureException thrown if there is an exception +105 */ +106publicstatic HttpURLConnection createHttpURLConnection(URL url, boolean proxy) throws URLConnectionFailureException { +107if (proxy) { +108return createHttpURLConnection(url); +109 } +110 HttpURLConnection conn = null; +111try { +112 conn = (HttpURLConnection) url.openConnection(); +113finalint timeout = Settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000); +114 conn.setConnectTimeout(timeout); +115 conn.setInstanceFollowRedirects(true); +116 } catch (IOException ioe) { +117thrownewURLConnectionFailureException("Error getting connection.", ioe); +118 } +119return conn; +120 } +121 }
    diff --git a/dependency-check-utils/xref/org/owasp/dependencycheck/utils/package-frame.html b/dependency-check-utils/xref/org/owasp/dependencycheck/utils/package-frame.html index bb3d2218f..b4fcbc028 100644 --- a/dependency-check-utils/xref/org/owasp/dependencycheck/utils/package-frame.html +++ b/dependency-check-utils/xref/org/owasp/dependencycheck/utils/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Utils 1.3.1 Reference Package org.owasp.dependencycheck.utils + Dependency-Check Utils 1.3.2 Reference Package org.owasp.dependencycheck.utils diff --git a/dependency-check-utils/xref/org/owasp/dependencycheck/utils/package-summary.html b/dependency-check-utils/xref/org/owasp/dependencycheck/utils/package-summary.html index c661d5917..80a5fb2fb 100644 --- a/dependency-check-utils/xref/org/owasp/dependencycheck/utils/package-summary.html +++ b/dependency-check-utils/xref/org/owasp/dependencycheck/utils/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Utils 1.3.1 Reference Package org.owasp.dependencycheck.utils + Dependency-Check Utils 1.3.2 Reference Package org.owasp.dependencycheck.utils diff --git a/dependency-check-utils/xref/overview-frame.html b/dependency-check-utils/xref/overview-frame.html index 40f60c443..39c444df6 100644 --- a/dependency-check-utils/xref/overview-frame.html +++ b/dependency-check-utils/xref/overview-frame.html @@ -3,7 +3,7 @@ - Dependency-Check Utils 1.3.1 Reference + Dependency-Check Utils 1.3.2 Reference diff --git a/dependency-check-utils/xref/overview-summary.html b/dependency-check-utils/xref/overview-summary.html index d5a57b949..7535dfe4f 100644 --- a/dependency-check-utils/xref/overview-summary.html +++ b/dependency-check-utils/xref/overview-summary.html @@ -3,7 +3,7 @@ - Dependency-Check Utils 1.3.1 Reference + Dependency-Check Utils 1.3.2 Reference @@ -24,7 +24,7 @@ -

    Dependency-Check Utils 1.3.1 Reference

    +

    Dependency-Check Utils 1.3.2 Reference

    diff --git a/dependency-updates-report.html b/dependency-updates-report.html index b8a34e7d6..86bf78a77 100644 --- a/dependency-updates-report.html +++ b/dependency-updates-report.html @@ -1,13 +1,13 @@ - + dependency-check – Dependency Updates Report @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -157,7 +157,7 @@ File Type Analyzers - +
  • @@ -270,7 +270,7 @@
  • - + @@ -278,7 +278,7 @@ - + @@ -330,7 +330,7 @@ - + @@ -495,7 +495,7 @@ - + @@ -503,11 +503,11 @@ - + - + @@ -515,11 +515,11 @@ - + - + @@ -527,7 +527,7 @@ - + @@ -618,7 +618,7 @@ - + @@ -642,7 +642,7 @@ - + @@ -654,7 +654,7 @@ - + @@ -742,7 +742,7 @@ - + @@ -778,7 +778,7 @@ -
    # of dependencies using the latest version available25
    22
    # of dependencies where the next version available is smaller than an incremental version update
    # of dependencies where the next version available is an incremental version update0
    3
    # of dependencies where the next version available is a minor version update com.google.code.findbugs annotations3.0.03.0.1u2 jar4.8.0 5.0.0
    org.apache.maven maven-core 3.3.3 jar 3.3.9
    org.apache.maven maven-plugin-api 3.3.3 jar 3.3.9
    org.apache.maven maven-settings 3.3.3 jar 3.3.9
    org.jmockit jmockit1.191.20 test jar org.slf4j slf4j-api1.7.121.7.13 jar org.slf4j slf4j-simple1.7.121.7.13 jarannotations
    Current Version3.0.0
    3.0.1u2
    Scope
    jar
    Newer versions1.4.177 Next Minor
    1.4.178
    1.4.179
    1.4.180
    1.4.181
    1.4.182
    1.4.183
    1.4.184
    1.4.185
    1.4.186
    1.4.187
    1.4.188
    1.4.189 Latest Minor
    +1.4.177 Next Minor
    1.4.178
    1.4.179
    1.4.180
    1.4.181
    1.4.182
    1.4.183
    1.4.184
    1.4.185
    1.4.186
    1.4.187
    1.4.188
    1.4.189
    1.4.190 Latest Minor

    com.sun.mail:mailapi

    @@ -997,7 +997,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-core

    @@ -1024,7 +1024,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-queryparser

    @@ -1051,7 +1051,7 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.lucene:lucene-test-framework

    @@ -1078,13 +1078,13 @@ -
    jar
    Newer versions4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0 Latest Major
    +4.8.0 Next Minor
    4.8.1
    4.9.0
    4.9.1
    4.10.0
    4.10.1
    4.10.2
    4.10.3
    4.10.4 Latest Minor
    5.0.0 Next Major
    5.1.0
    5.2.0
    5.2.1
    5.3.0
    5.3.1 Latest Major

    org.apache.maven:maven-core

    - + @@ -1102,13 +1102,16 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven:maven-plugin-api

    - + @@ -1126,13 +1129,16 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven:maven-settings

    - + @@ -1150,7 +1156,10 @@ -
    Status No newer versions available.
     There is at least one newer incremental version available. Incremental updates are typically passive.
    Group Id org.apache.maven
    Typejar
    +jar + +Newer versions +3.3.9 Next Incremental

    org.apache.maven.plugin-testing:maven-plugin-testing-harness

    @@ -1333,7 +1342,7 @@ - + @@ -1381,7 +1390,7 @@ - + @@ -1405,7 +1414,7 @@ - + diff --git a/general/internals.html b/general/internals.html index 07d7fbe19..a5758144a 100644 --- a/general/internals.html +++ b/general/internals.html @@ -1,13 +1,13 @@ - + dependency-check – How does dependency-check work? @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -155,7 +155,7 @@ File Type Analyzers - +
  • diff --git a/general/scan_iso.html b/general/scan_iso.html index 5acb97402..40345a967 100644 --- a/general/scan_iso.html +++ b/general/scan_iso.html @@ -1,13 +1,13 @@ - + dependency-check – How to Mount ISO Files for Scanning @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -155,7 +155,7 @@ File Type Analyzers
    - +
  • diff --git a/general/suppression.html b/general/suppression.html index 99f0c4eb7..64d3af162 100644 --- a/general/suppression.html +++ b/general/suppression.html @@ -1,13 +1,13 @@ - + dependency-check – Suppressing False Positives @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -155,7 +155,7 @@ File Type Analyzers
    - +
  • diff --git a/general/thereport.html b/general/thereport.html index a34353dde..d17d99f7d 100644 --- a/general/thereport.html +++ b/general/thereport.html @@ -1,13 +1,13 @@ - + dependency-check – How To Read The Reports @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -155,7 +155,7 @@ File Type Analyzers
    - +
  • diff --git a/images/dc-gradle.svg b/images/dc-gradle.svg new file mode 100644 index 000000000..b518ddd9d --- /dev/null +++ b/images/dc-gradle.svg @@ -0,0 +1,184 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/images/dc-jenkins.svg b/images/dc-jenkins.svg new file mode 100644 index 000000000..28023790f --- /dev/null +++ b/images/dc-jenkins.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/index.html b/index.html index 6ee8c6f98..d94841187 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,13 @@ - + dependency-check – About @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -155,7 +155,7 @@ File Type Analyzers
    - +
  • diff --git a/integration.html b/integration.html index 88d6195a1..9c102d210 100644 --- a/integration.html +++ b/integration.html @@ -1,13 +1,13 @@ - + dependency-check – Continuous Integration @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -157,7 +157,7 @@ File Type Analyzers
    - +
  • diff --git a/issue-tracking.html b/issue-tracking.html index f9d68203e..2b6f03e9d 100644 --- a/issue-tracking.html +++ b/issue-tracking.html @@ -1,13 +1,13 @@ - + dependency-check – Issue Tracking @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -157,7 +157,7 @@ File Type Analyzers
    - +
  • diff --git a/license.html b/license.html index b74eb382a..5fa1abb86 100644 --- a/license.html +++ b/license.html @@ -1,13 +1,13 @@ - + dependency-check – Project License @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -157,7 +157,7 @@ File Type Analyzers
    - +
  • diff --git a/mail-lists.html b/mail-lists.html index dd72854d7..03af682ee 100644 --- a/mail-lists.html +++ b/mail-lists.html @@ -1,13 +1,13 @@ - + dependency-check – Project Mailing Lists @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -157,7 +157,7 @@ File Type Analyzers
    - +
  • diff --git a/modules.html b/modules.html index 7d9bf9adc..5687e54b0 100644 --- a/modules.html +++ b/modules.html @@ -1,13 +1,13 @@ - + dependency-check – Modules @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -157,7 +157,7 @@ File Type Analyzers
    - +
  • Modules @@ -165,51 +165,51 @@
  • - + - dependency-check-cli + CLI
  • - + - dependency-check-ant + Ant Task
  • - + - dependency-check-maven + Maven Plugin +
  • + +
  • + + + + Gradle Plugin +
  • + +
  • + + + + Jenkins Plugin
  • - + - dependency-check-gradle + Core
  • - + - dependency-check-jenkins -
  • - -
  • - - - - dependency-check-core -
  • - -
  • - - - - dependency-check-utils + Utils
  • diff --git a/plugin-updates-report.html b/plugin-updates-report.html index 096761bed..0aa9cee3d 100644 --- a/plugin-updates-report.html +++ b/plugin-updates-report.html @@ -1,13 +1,13 @@ - + dependency-check – Plugin Updates Report @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -157,7 +157,7 @@ File Type Analyzers - +
  • @@ -282,7 +282,7 @@
  • - + @@ -318,7 +318,7 @@ - + @@ -378,7 +378,7 @@ - + @@ -415,16 +415,26 @@ + + + + + + + + + + - + - + @@ -434,7 +444,7 @@ - + @@ -444,6 +454,16 @@ + + + + + + + + + + @@ -519,7 +539,7 @@ -
    jmockit
    Current Version1.19
    1.20
    Scope test
    slf4j-api
    Current Version1.7.12
    1.7.13
    Scope
    slf4j-simple
    Current Version1.7.12
    1.7.13
    Scope
    # of plugins where the next version available is a minor version update0
    2
    # of plugins where the next version available is a major version update org.apache.maven.plugins maven-assembly-plugin2.5.52.6 org.apache.maven.plugins maven-failsafe-plugin2.18.12.19
    org.apache.maven.pluginsmaven-javadoc-plugin2.9.12.10
    org.apache.maven.plugins maven-release-plugin2.5.22.5.3
    org.apache.maven.plugins maven-resources-plugin
    org.apache.maven.plugins maven-site-plugin
    org.apache.maven.pluginsmaven-source-plugin2.2.12.3
    org.apache.maven.pluginsmaven-assembly-plugin
    Current Version2.5.5
    +2.6

    Plugin org.apache.maven.plugins:maven-clean-plugin

    @@ -609,7 +629,7 @@ -
    maven-failsafe-plugin
    Current Version2.18.1
    +2.19

    Plugin org.apache.maven.plugins:maven-gpg-plugin

    @@ -656,6 +676,24 @@
    Current Version 2.6
    +

    Plugin org.apache.maven.plugins:maven-javadoc-plugin

    + + + + + + + + + + + + + + + +
    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-javadoc-plugin
    Current Version2.9.1
    Newer versions2.10 Next Minor
    2.10.1
    2.10.2
    2.10.3 Latest Minor
    +

    Plugin org.apache.maven.plugins:maven-release-plugin

    @@ -669,7 +707,7 @@ -
    maven-release-plugin
    Current Version2.5.2
    +2.5.3

    Plugin org.apache.maven.plugins:maven-resources-plugin

    @@ -701,6 +739,24 @@
    Current Version 3.4
    +

    Plugin org.apache.maven.plugins:maven-source-plugin

    + + + + + + + + + + + + + + + +
    Status There is at least one newer minor version available. Minor updates are sometimes passive.
    Group Idorg.apache.maven.plugins
    Artifact Idmaven-source-plugin
    Current Version2.2.1
    Newer versions2.3 Next Minor
    2.4 Latest Minor
    + diff --git a/related.html b/related.html index 94ca7d5fb..3ee93c4f6 100644 --- a/related.html +++ b/related.html @@ -1,13 +1,13 @@ - + dependency-check – Related Work @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-28
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -155,7 +155,7 @@ File Type Analyzers
    - +
  • diff --git a/source-repository.html b/source-repository.html index 9cd6dfe3c..668bda6c1 100644 --- a/source-repository.html +++ b/source-repository.html @@ -1,13 +1,13 @@ - + dependency-check – Source Repository @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -157,7 +157,7 @@ File Type Analyzers
    - +
  • diff --git a/surefire-report.html b/surefire-report.html index 7da9f81cb..8422a841e 100644 --- a/surefire-report.html +++ b/surefire-report.html @@ -1,13 +1,13 @@ - + dependency-check – Surefire Report @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -157,7 +157,7 @@ File Type Analyzers
    - +
  • diff --git a/team-list.html b/team-list.html index d52b4b1d1..5ad31383d 100644 --- a/team-list.html +++ b/team-list.html @@ -1,13 +1,13 @@ - + dependency-check – Project Team @@ -62,9 +62,9 @@ -
  • | Last Published: 2015-09-20
  • +
  • | Last Published: 2015-11-29
  • - Version: 1.3.1 + Version: 1.3.2
  • @@ -157,7 +157,7 @@ File Type Analyzers
    - +
  • diff --git a/xref-test/allclasses-frame.html b/xref-test/allclasses-frame.html index f07da366c..355bde31f 100644 --- a/xref-test/allclasses-frame.html +++ b/xref-test/allclasses-frame.html @@ -12,9 +12,6 @@
    • - AbstractDatabaseTestCase -
    • -
    • AbstractFileTypeAnalyzerTest
    • @@ -31,6 +28,9 @@
    • ArchiveAnalyzerIntegrationTest +
    • +
    • + ArchiveAnalyzerTest
    • AssemblyAnalyzerTest @@ -39,7 +39,7 @@ AutoconfAnalyzerTest
    • - BaseDBTestCase + BaseDBTestCase
    • BaseDependencyCheckMojoImpl @@ -76,6 +76,9 @@
    • ComposerLockParserTest +
    • +
    • + ConnectionFactoryTest
    • CpeUpdaterIntegrationTest @@ -202,6 +205,9 @@
    • ReportGeneratorIntegrationTest +
    • +
    • + RubyBundleAuditAnalyzerTest
    • RubyGemspecAnalyzerTest diff --git a/xref-test/index.html b/xref-test/index.html index 0613cdfd0..ce1020668 100644 --- a/xref-test/index.html +++ b/xref-test/index.html @@ -4,7 +4,7 @@ - Dependency-Check 1.3.1 Reference + Dependency-Check 1.3.2 Reference diff --git a/xref-test/org/owasp/dependencycheck/BaseDBTestCase.html b/xref-test/org/owasp/dependencycheck/BaseDBTestCase.html new file mode 100644 index 000000000..c4b87b578 --- /dev/null +++ b/xref-test/org/owasp/dependencycheck/BaseDBTestCase.html @@ -0,0 +1,136 @@ + + + +BaseDBTestCase xref + + + +
      +1   /*
      +2    * This file is part of dependency-check-core.
      +3    *
      +4    * Licensed under the Apache License, Version 2.0 (the "License");
      +5    * you may not use this file except in compliance with the License.
      +6    * You may obtain a copy of the License at
      +7    *
      +8    *     http://www.apache.org/licenses/LICENSE-2.0
      +9    *
      +10   * Unless required by applicable law or agreed to in writing, software
      +11   * distributed under the License is distributed on an "AS IS" BASIS,
      +12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      +13   * See the License for the specific language governing permissions and
      +14   * limitations under the License.
      +15   *
      +16   * Copyright (c) 2012 Jeremy Long. All Rights Reserved.
      +17   */
      +18  package org.owasp.dependencycheck;
      +19  
      +20  import java.io.BufferedInputStream;
      +21  import java.io.BufferedOutputStream;
      +22  import java.io.File;
      +23  import java.io.FileInputStream;
      +24  import java.io.FileOutputStream;
      +25  import java.util.zip.ZipEntry;
      +26  import java.util.zip.ZipInputStream;
      +27  import org.junit.Before;
      +28  import org.owasp.dependencycheck.BaseTest;
      +29  import org.owasp.dependencycheck.utils.Settings;
      +30  import org.slf4j.Logger;
      +31  import org.slf4j.LoggerFactory;
      +32  
      +33  /**
      +34   * An abstract database test case that is used to ensure the H2 DB exists prior to performing tests that utilize the data
      +35   * contained within.
      +36   *
      +37   * @author Jeremy Long
      +38   */
      +39  public abstract class BaseDBTestCase extends BaseTest {
      +40  
      +41      protected final static int BUFFER_SIZE = 2048;
      +42  
      +43      private final static Logger LOGGER = LoggerFactory.getLogger(BaseDBTestCase.class);
      +44  
      +45      @Before
      +46      public void setUp() throws Exception {
      +47          ensureDBExists();
      +48      }
      +49  
      +50      public static void ensureDBExists() throws Exception {
      +51  
      +52          java.io.File dataPath = Settings.getDataDirectory();
      +53          String fileName = Settings.getString(Settings.KEYS.DB_FILE_NAME);
      +54          LOGGER.trace("DB file name {}", fileName);
      +55          java.io.File dataFile = new File(dataPath, fileName);
      +56          LOGGER.trace("Ensuring {} exists", dataFile.toString());
      +57          if (!dataPath.exists() || !dataFile.exists()) {
      +58              LOGGER.trace("Extracting database to {}", dataPath.toString());
      +59              dataPath.mkdirs();
      +60              FileInputStream fis = null;
      +61              ZipInputStream zin = null;
      +62              try {
      +63                  File path = new File(BaseDBTestCase.class.getClassLoader().getResource("data.zip").getPath());
      +64                  fis = new FileInputStream(path);
      +65                  zin = new ZipInputStream(new BufferedInputStream(fis));
      +66                  ZipEntry entry;
      +67                  while ((entry = zin.getNextEntry()) != null) {
      +68                      if (entry.isDirectory()) {
      +69                          final File d = new File(dataPath, entry.getName());
      +70                          d.mkdir();
      +71                          continue;
      +72                      }
      +73                      FileOutputStream fos = null;
      +74                      BufferedOutputStream dest = null;
      +75                      try {
      +76                          File o = new File(dataPath, entry.getName());
      +77                          o.createNewFile();
      +78                          fos = new FileOutputStream(o, false);
      +79                          dest = new BufferedOutputStream(fos, BUFFER_SIZE);
      +80                          byte data[] = new byte[BUFFER_SIZE];
      +81                          int count;
      +82                          while ((count = zin.read(data, 0, BUFFER_SIZE)) != -1) {
      +83                              dest.write(data, 0, count);
      +84                          }
      +85                      } catch (Throwable ex) {
      +86                          LOGGER.error("", ex);
      +87                      } finally {
      +88                          try {
      +89                              if (dest != null) {
      +90                                  dest.flush();
      +91                                  dest.close();
      +92                              }
      +93                          } catch (Throwable ex) {
      +94                              LOGGER.trace("", ex);
      +95                          }
      +96                          try {
      +97                              if (fos != null) {
      +98                                  fos.close();
      +99                              }
      +100                         } catch (Throwable ex) {
      +101                             LOGGER.trace("", ex);
      +102                         }
      +103                     }
      +104                 }
      +105             } finally {
      +106                 try {
      +107                     if (zin != null) {
      +108                         zin.close();
      +109                     }
      +110                 } catch (Throwable ex) {
      +111                     LOGGER.trace("", ex);
      +112                 }
      +113                 try {
      +114                     if (fis != null) {
      +115                         fis.close();
      +116                     }
      +117                 } catch (Throwable ex) {
      +118                     LOGGER.trace("", ex);
      +119                 }
      +120             }
      +121         }
      +122     }
      +123 }
      +
      +
      + + + diff --git a/xref-test/org/owasp/dependencycheck/EngineIntegrationTest.html b/xref-test/org/owasp/dependencycheck/EngineIntegrationTest.html index 722c35c25..544712b63 100644 --- a/xref-test/org/owasp/dependencycheck/EngineIntegrationTest.html +++ b/xref-test/org/owasp/dependencycheck/EngineIntegrationTest.html @@ -42,7 +42,7 @@ 34 35 @Before 36 public void setUp() throws Exception { -37 org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase.ensureDBExists(); +37 org.owasp.dependencycheck.BaseDBTestCase.ensureDBExists(); 38 } 39 40 @After diff --git a/xref-test/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzerTest.html b/xref-test/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzerTest.html index d5a3f7804..98347b1c9 100644 --- a/xref-test/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzerTest.html +++ b/xref-test/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzerTest.html @@ -42,7 +42,7 @@ 34 */ 35 @Test 36 public void testNewHashSet() { -37 Set result = AbstractFileTypeAnalyzer.newHashSet("one", "two"); +37 Set<String> result = AbstractFileTypeAnalyzer.newHashSet("one", "two"); 38 assertEquals(2, result.size()); 39 assertTrue(result.contains("one")); 40 assertTrue(result.contains("two")); diff --git a/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerIntegrationTest.html b/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerIntegrationTest.html index 212f17b0a..cafeaa03e 100644 --- a/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerIntegrationTest.html +++ b/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerIntegrationTest.html @@ -32,7 +32,7 @@ 24 import org.junit.Test; 25 import org.owasp.dependencycheck.BaseTest; 26 import org.owasp.dependencycheck.Engine; -27 import org.owasp.dependencycheck.data.cpe.AbstractDatabaseTestCase; +27 import org.owasp.dependencycheck.BaseDBTestCase; 28 import org.owasp.dependencycheck.dependency.Dependency; 29 import org.owasp.dependencycheck.utils.Settings; 30 @@ -40,7 +40,7 @@ 32 * 33 * @author Jeremy Long 34 */ -35 public class ArchiveAnalyzerIntegrationTest extends AbstractDatabaseTestCase { +35 public class ArchiveAnalyzerIntegrationTest extends BaseDBTestCase { 36 37 /** 38 * Test of getSupportedExtensions method, of class ArchiveAnalyzer. diff --git a/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerTest.html b/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerTest.html new file mode 100644 index 000000000..0a64ea030 --- /dev/null +++ b/xref-test/org/owasp/dependencycheck/analyzer/ArchiveAnalyzerTest.html @@ -0,0 +1,93 @@ + + + +ArchiveAnalyzerTest xref + + + +
      +1   /*
      +2    * Copyright 2015 OWASP.
      +3    *
      +4    * Licensed under the Apache License, Version 2.0 (the "License");
      +5    * you may not use this file except in compliance with the License.
      +6    * You may obtain a copy of the License at
      +7    *
      +8    *      http://www.apache.org/licenses/LICENSE-2.0
      +9    *
      +10   * Unless required by applicable law or agreed to in writing, software
      +11   * distributed under the License is distributed on an "AS IS" BASIS,
      +12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      +13   * See the License for the specific language governing permissions and
      +14   * limitations under the License.
      +15   */
      +16  package org.owasp.dependencycheck.analyzer;
      +17  
      +18  import java.io.File;
      +19  import java.io.FileFilter;
      +20  import java.lang.reflect.InvocationTargetException;
      +21  import java.lang.reflect.Method;
      +22  import java.util.logging.Level;
      +23  import java.util.logging.Logger;
      +24  import org.junit.After;
      +25  import org.junit.AfterClass;
      +26  import org.junit.Before;
      +27  import org.junit.BeforeClass;
      +28  import org.junit.Test;
      +29  import static org.junit.Assert.*;
      +30  import static org.junit.Assume.assumeFalse;
      +31  import static org.junit.Assume.assumeNotNull;
      +32  import org.owasp.dependencycheck.BaseTest;
      +33  import org.owasp.dependencycheck.Engine;
      +34  import org.owasp.dependencycheck.dependency.Dependency;
      +35  import org.owasp.dependencycheck.utils.Settings;
      +36  
      +37  /**
      +38   *
      +39   * @author jeremy
      +40   */
      +41  public class ArchiveAnalyzerTest extends BaseTest {
      +42  
      +43      @Before
      +44      public void setUp() {
      +45          Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, "z2, z3");
      +46      }
      +47  
      +48      /**
      +49       * Test of analyzeFileType method, of class ArchiveAnalyzer.
      +50       */
      +51      @Test
      +52      public void testZippableExtensions() throws Exception {
      +53          assumeFalse(isPreviouslyLoaded("org.owasp.dependencycheck.analyzer.ArchiveAnalyzer"));
      +54          ArchiveAnalyzer instance = new ArchiveAnalyzer();
      +55          assertTrue(instance.getFileFilter().accept(new File("c:/test.zip")));
      +56          assertTrue(instance.getFileFilter().accept(new File("c:/test.z2")));
      +57          assertTrue(instance.getFileFilter().accept(new File("c:/test.z3")));
      +58          assertFalse(instance.getFileFilter().accept(new File("c:/test.z4")));
      +59      }
      +60  
      +61      private boolean isPreviouslyLoaded(String className) {
      +62          try {
      +63              Method m = ClassLoader.class.getDeclaredMethod("findLoadedClass", new Class[]{String.class});
      +64              m.setAccessible(true);
      +65              Object t = m.invoke(Thread.currentThread().getContextClassLoader(), className);
      +66              return t != null;
      +67          } catch (NoSuchMethodException ex) {
      +68              Logger.getLogger(ArchiveAnalyzerTest.class.getName()).log(Level.SEVERE, null, ex);
      +69          } catch (SecurityException ex) {
      +70              Logger.getLogger(ArchiveAnalyzerTest.class.getName()).log(Level.SEVERE, null, ex);
      +71          } catch (IllegalAccessException ex) {
      +72              Logger.getLogger(ArchiveAnalyzerTest.class.getName()).log(Level.SEVERE, null, ex);
      +73          } catch (IllegalArgumentException ex) {
      +74              Logger.getLogger(ArchiveAnalyzerTest.class.getName()).log(Level.SEVERE, null, ex);
      +75          } catch (InvocationTargetException ex) {
      +76              Logger.getLogger(ArchiveAnalyzerTest.class.getName()).log(Level.SEVERE, null, ex);
      +77          }
      +78          return false;
      +79      }
      +80  }
      +
      +
      + + + diff --git a/xref-test/org/owasp/dependencycheck/analyzer/CMakeAnalyzerTest.html b/xref-test/org/owasp/dependencycheck/analyzer/CMakeAnalyzerTest.html index 504ad0a83..612b29136 100644 --- a/xref-test/org/owasp/dependencycheck/analyzer/CMakeAnalyzerTest.html +++ b/xref-test/org/owasp/dependencycheck/analyzer/CMakeAnalyzerTest.html @@ -41,14 +41,14 @@ 33 import static org.hamcrest.CoreMatchers.equalTo; 34 import static org.hamcrest.CoreMatchers.is; 35 import static org.junit.Assert.*; -36 import org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase; +36 import org.owasp.dependencycheck.BaseDBTestCase; 37 38 /** 39 * Unit tests for CmakeAnalyzer. 40 * 41 * @author Dale Visser <dvisser@ida.org> 42 */ -43 public class CMakeAnalyzerTest extends BaseDBTestCase { +43 public class CMakeAnalyzerTest extends BaseDBTestCase { 44 45 /** 46 * The package analyzer to test. diff --git a/xref-test/org/owasp/dependencycheck/analyzer/CPEAnalyzerIntegrationTest.html b/xref-test/org/owasp/dependencycheck/analyzer/CPEAnalyzerIntegrationTest.html index bf929759c..23f20b6e4 100644 --- a/xref-test/org/owasp/dependencycheck/analyzer/CPEAnalyzerIntegrationTest.html +++ b/xref-test/org/owasp/dependencycheck/analyzer/CPEAnalyzerIntegrationTest.html @@ -27,7 +27,7 @@ 19 20 import java.io.File; 21 import java.io.IOException; -22 import java.util.HashSet; +22 import java.util.Collections; 23 import java.util.List; 24 import java.util.Set; 25 import org.apache.lucene.index.CorruptIndexException; @@ -36,7 +36,7 @@ 28 import static org.junit.Assert.assertTrue; 29 import org.junit.Test; 30 import org.owasp.dependencycheck.BaseTest; -31 import org.owasp.dependencycheck.data.cpe.AbstractDatabaseTestCase; +31 import org.owasp.dependencycheck.BaseDBTestCase; 32 import org.owasp.dependencycheck.data.cpe.IndexEntry; 33 import org.owasp.dependencycheck.dependency.Confidence; 34 import org.owasp.dependencycheck.dependency.Dependency; @@ -46,7 +46,7 @@ 38 * 39 * @author Jeremy Long 40 */ -41 public class CPEAnalyzerIntegrationTest extends AbstractDatabaseTestCase { +41 public class CPEAnalyzerIntegrationTest extends BaseDBTestCase { 42 43 /** 44 * Tests of buildSearch of class CPEAnalyzer. @@ -57,215 +57,211 @@ 49 */ 50 @Test 51 public void testBuildSearch() throws IOException, CorruptIndexException, ParseException { -52 Set<String> productWeightings = new HashSet<String>(1); -53 productWeightings.add("struts2"); -54 -55 Set<String> vendorWeightings = new HashSet<String>(1); -56 vendorWeightings.add("apache"); -57 -58 String vendor = "apache software foundation"; -59 String product = "struts 2 core"; -60 String version = "2.1.2"; -61 CPEAnalyzer instance = new CPEAnalyzer(); -62 -63 String queryText = instance.buildSearch(vendor, product, null, null); -64 String expResult = " product:( struts 2 core ) AND vendor:( apache software foundation ) "; -65 Assert.assertTrue(expResult.equals(queryText)); -66 -67 queryText = instance.buildSearch(vendor, product, null, productWeightings); -68 expResult = " product:( struts^5 struts2^5 2 core ) AND vendor:( apache software foundation ) "; -69 Assert.assertTrue(expResult.equals(queryText)); -70 -71 queryText = instance.buildSearch(vendor, product, vendorWeightings, null); -72 expResult = " product:( struts 2 core ) AND vendor:( apache^5 software foundation ) "; -73 Assert.assertTrue(expResult.equals(queryText)); -74 -75 queryText = instance.buildSearch(vendor, product, vendorWeightings, productWeightings); -76 expResult = " product:( struts^5 struts2^5 2 core ) AND vendor:( apache^5 software foundation ) "; -77 Assert.assertTrue(expResult.equals(queryText)); -78 } -79 -80 /** -81 * Test of determineCPE method, of class CPEAnalyzer. -82 * -83 * @throws Exception is thrown when an exception occurs -84 */ -85 @Test -86 public void testDetermineCPE_full() throws Exception { -87 CPEAnalyzer instance = new CPEAnalyzer(); -88 instance.open(); -89 FileNameAnalyzer fnAnalyzer = new FileNameAnalyzer(); -90 JarAnalyzer jarAnalyzer = new JarAnalyzer(); -91 HintAnalyzer hAnalyzer = new HintAnalyzer(); -92 FalsePositiveAnalyzer fp = new FalsePositiveAnalyzer(); -93 -94 try { -95 //callDetermineCPE_full("struts2-core-2.3.16.3.jar", "cpe:/a:apache:struts:2.3.16.3", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -96 callDetermineCPE_full("hazelcast-2.5.jar", null, instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -97 callDetermineCPE_full("spring-context-support-2.5.5.jar", "cpe:/a:springsource:spring_framework:2.5.5", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -98 callDetermineCPE_full("spring-core-3.0.0.RELEASE.jar", "cpe:/a:vmware:springsource_spring_framework:3.0.0", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -99 callDetermineCPE_full("org.mortbay.jetty.jar", "cpe:/a:mortbay_jetty:jetty:4.2.27", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -100 callDetermineCPE_full("jaxb-xercesImpl-1.5.jar", null, instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -101 callDetermineCPE_full("ehcache-core-2.2.0.jar", null, instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); -102 } finally { -103 instance.close(); -104 } -105 } -106 -107 /** -108 * Test of determineCPE method, of class CPEAnalyzer. -109 * -110 * @throws Exception is thrown when an exception occurs -111 */ -112 public void callDetermineCPE_full(String depName, String expResult, CPEAnalyzer instance, FileNameAnalyzer fnAnalyzer, JarAnalyzer jarAnalyzer, HintAnalyzer hAnalyzer, FalsePositiveAnalyzer fp) throws Exception { -113 -114 //File file = new File(this.getClass().getClassLoader().getResource(depName).getPath()); -115 File file = BaseTest.getResourceAsFile(this, depName); +52 Set<String> productWeightings = Collections.singleton("struts2"); +53 +54 Set<String> vendorWeightings = Collections.singleton("apache"); +55 +56 String vendor = "apache software foundation"; +57 String product = "struts 2 core"; +58 String version = "2.1.2"; +59 CPEAnalyzer instance = new CPEAnalyzer(); +60 +61 String queryText = instance.buildSearch(vendor, product, null, null); +62 String expResult = " product:( struts 2 core ) AND vendor:( apache software foundation ) "; +63 Assert.assertTrue(expResult.equals(queryText)); +64 +65 queryText = instance.buildSearch(vendor, product, null, productWeightings); +66 expResult = " product:( struts^5 struts2^5 2 core ) AND vendor:( apache software foundation ) "; +67 Assert.assertTrue(expResult.equals(queryText)); +68 +69 queryText = instance.buildSearch(vendor, product, vendorWeightings, null); +70 expResult = " product:( struts 2 core ) AND vendor:( apache^5 software foundation ) "; +71 Assert.assertTrue(expResult.equals(queryText)); +72 +73 queryText = instance.buildSearch(vendor, product, vendorWeightings, productWeightings); +74 expResult = " product:( struts^5 struts2^5 2 core ) AND vendor:( apache^5 software foundation ) "; +75 Assert.assertTrue(expResult.equals(queryText)); +76 } +77 +78 /** +79 * Test of determineCPE method, of class CPEAnalyzer. +80 * +81 * @throws Exception is thrown when an exception occurs +82 */ +83 @Test +84 public void testDetermineCPE_full() throws Exception { +85 CPEAnalyzer instance = new CPEAnalyzer(); +86 instance.open(); +87 FileNameAnalyzer fnAnalyzer = new FileNameAnalyzer(); +88 JarAnalyzer jarAnalyzer = new JarAnalyzer(); +89 HintAnalyzer hAnalyzer = new HintAnalyzer(); +90 FalsePositiveAnalyzer fp = new FalsePositiveAnalyzer(); +91 +92 try { +93 //callDetermineCPE_full("struts2-core-2.3.16.3.jar", "cpe:/a:apache:struts:2.3.16.3", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +94 callDetermineCPE_full("hazelcast-2.5.jar", null, instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +95 callDetermineCPE_full("spring-context-support-2.5.5.jar", "cpe:/a:springsource:spring_framework:2.5.5", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +96 callDetermineCPE_full("spring-core-3.0.0.RELEASE.jar", "cpe:/a:vmware:springsource_spring_framework:3.0.0", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +97 callDetermineCPE_full("org.mortbay.jetty.jar", "cpe:/a:mortbay_jetty:jetty:4.2.27", instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +98 callDetermineCPE_full("jaxb-xercesImpl-1.5.jar", null, instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +99 callDetermineCPE_full("ehcache-core-2.2.0.jar", null, instance, fnAnalyzer, jarAnalyzer, hAnalyzer, fp); +100 } finally { +101 instance.close(); +102 } +103 } +104 +105 /** +106 * Test of determineCPE method, of class CPEAnalyzer. +107 * +108 * @throws Exception is thrown when an exception occurs +109 */ +110 public void callDetermineCPE_full(String depName, String expResult, CPEAnalyzer instance, FileNameAnalyzer fnAnalyzer, JarAnalyzer jarAnalyzer, HintAnalyzer hAnalyzer, FalsePositiveAnalyzer fp) throws Exception { +111 +112 //File file = new File(this.getClass().getClassLoader().getResource(depName).getPath()); +113 File file = BaseTest.getResourceAsFile(this, depName); +114 +115 Dependency dep = new Dependency(file); 116 -117 Dependency dep = new Dependency(file); -118 -119 fnAnalyzer.analyze(dep, null); -120 jarAnalyzer.analyze(dep, null); -121 hAnalyzer.analyze(dep, null); -122 instance.analyze(dep, null); -123 fp.analyze(dep, null); -124 -125 if (expResult != null) { -126 Identifier expIdentifier = new Identifier("cpe", expResult, expResult); -127 Assert.assertTrue("Incorrect match: { dep:'" + dep.getFileName() + "' }", dep.getIdentifiers().contains(expIdentifier)); -128 } else { -129 for (Identifier i : dep.getIdentifiers()) { -130 Assert.assertFalse(String.format("%s - found a CPE identifier when should have been none (found '%s')", dep.getFileName(), i.getValue()), "cpe".equals(i.getType())); -131 } -132 } -133 } -134 -135 /** -136 * Test of determineCPE method, of class CPEAnalyzer. -137 * -138 * @throws Exception is thrown when an exception occurs -139 */ -140 @Test -141 public void testDetermineCPE() throws Exception { -142 //File file = new File(this.getClass().getClassLoader().getResource("struts2-core-2.1.2.jar").getPath()); -143 File file = BaseTest.getResourceAsFile(this, "struts2-core-2.1.2.jar"); -144 //File file = new File(this.getClass().getClassLoader().getResource("axis2-adb-1.4.1.jar").getPath()); -145 Dependency struts = new Dependency(file); -146 -147 FileNameAnalyzer fnAnalyzer = new FileNameAnalyzer(); -148 fnAnalyzer.analyze(struts, null); -149 -150 HintAnalyzer hintAnalyzer = new HintAnalyzer(); -151 JarAnalyzer jarAnalyzer = new JarAnalyzer(); -152 jarAnalyzer.accept(new File("test.jar"));//trick analyzer into "thinking it is active" -153 -154 jarAnalyzer.analyze(struts, null); -155 hintAnalyzer.analyze(struts, null); -156 //File fileCommonValidator = new File(this.getClass().getClassLoader().getResource("commons-validator-1.4.0.jar").getPath()); -157 File fileCommonValidator = BaseTest.getResourceAsFile(this, "commons-validator-1.4.0.jar"); -158 Dependency commonValidator = new Dependency(fileCommonValidator); -159 jarAnalyzer.analyze(commonValidator, null); -160 hintAnalyzer.analyze(commonValidator, null); -161 -162 //File fileSpring = new File(this.getClass().getClassLoader().getResource("spring-core-2.5.5.jar").getPath()); -163 File fileSpring = BaseTest.getResourceAsFile(this, "spring-core-2.5.5.jar"); -164 Dependency spring = new Dependency(fileSpring); -165 jarAnalyzer.analyze(spring, null); -166 hintAnalyzer.analyze(spring, null); -167 -168 //File fileSpring3 = new File(this.getClass().getClassLoader().getResource("spring-core-3.0.0.RELEASE.jar").getPath()); -169 File fileSpring3 = BaseTest.getResourceAsFile(this, "spring-core-3.0.0.RELEASE.jar"); -170 Dependency spring3 = new Dependency(fileSpring3); -171 jarAnalyzer.analyze(spring3, null); -172 hintAnalyzer.analyze(spring3, null); -173 -174 CPEAnalyzer instance = new CPEAnalyzer(); -175 instance.open(); -176 instance.determineCPE(commonValidator); -177 instance.determineCPE(struts); -178 instance.determineCPE(spring); -179 instance.determineCPE(spring3); -180 instance.close(); -181 -182 String expResult = "cpe:/a:apache:struts:2.1.2"; -183 Identifier expIdentifier = new Identifier("cpe", expResult, expResult); -184 String expResultSpring = "cpe:/a:springsource:spring_framework:2.5.5"; -185 String expResultSpring3 = "cpe:/a:vmware:springsource_spring_framework:3.0.0"; -186 -187 for (Identifier i : commonValidator.getIdentifiers()) { -188 Assert.assertFalse("Apache Common Validator - found a CPE identifier?", "cpe".equals(i.getType())); -189 } -190 -191 Assert.assertTrue("Incorrect match size - struts", struts.getIdentifiers().size() >= 1); -192 Assert.assertTrue("Incorrect match - struts", struts.getIdentifiers().contains(expIdentifier)); -193 Assert.assertTrue("Incorrect match size - spring3 - " + spring3.getIdentifiers().size(), spring3.getIdentifiers().size() >= 1); -194 -195 //the following two only work if the HintAnalyzer is used. -196 //Assert.assertTrue("Incorrect match size - spring", spring.getIdentifiers().size() == 1); -197 //Assert.assertTrue("Incorrect match - spring", spring.getIdentifiers().get(0).getValue().equals(expResultSpring)); -198 jarAnalyzer.close(); -199 } -200 -201 /** -202 * Test of determineIdentifiers method, of class CPEAnalyzer. -203 * -204 * @throws Exception is thrown when an exception occurs -205 */ -206 @Test -207 public void testDetermineIdentifiers() throws Exception { -208 Dependency openssl = new Dependency(); -209 openssl.getVendorEvidence().addEvidence("test", "vendor", "openssl", Confidence.HIGHEST); -210 openssl.getProductEvidence().addEvidence("test", "product", "openssl", Confidence.HIGHEST); -211 openssl.getVersionEvidence().addEvidence("test", "version", "1.0.1c", Confidence.HIGHEST); -212 -213 CPEAnalyzer instance = new CPEAnalyzer(); -214 instance.open(); -215 instance.determineIdentifiers(openssl, "openssl", "openssl", Confidence.HIGHEST); -216 instance.close(); -217 -218 String expResult = "cpe:/a:openssl:openssl:1.0.1c"; -219 Identifier expIdentifier = new Identifier("cpe", expResult, expResult); +117 fnAnalyzer.analyze(dep, null); +118 jarAnalyzer.analyze(dep, null); +119 hAnalyzer.analyze(dep, null); +120 instance.analyze(dep, null); +121 fp.analyze(dep, null); +122 +123 if (expResult != null) { +124 Identifier expIdentifier = new Identifier("cpe", expResult, expResult); +125 Assert.assertTrue("Incorrect match: { dep:'" + dep.getFileName() + "' }", dep.getIdentifiers().contains(expIdentifier)); +126 } else { +127 for (Identifier i : dep.getIdentifiers()) { +128 Assert.assertFalse(String.format("%s - found a CPE identifier when should have been none (found '%s')", dep.getFileName(), i.getValue()), "cpe".equals(i.getType())); +129 } +130 } +131 } +132 +133 /** +134 * Test of determineCPE method, of class CPEAnalyzer. +135 * +136 * @throws Exception is thrown when an exception occurs +137 */ +138 @Test +139 public void testDetermineCPE() throws Exception { +140 //File file = new File(this.getClass().getClassLoader().getResource("struts2-core-2.1.2.jar").getPath()); +141 File file = BaseTest.getResourceAsFile(this, "struts2-core-2.1.2.jar"); +142 //File file = new File(this.getClass().getClassLoader().getResource("axis2-adb-1.4.1.jar").getPath()); +143 Dependency struts = new Dependency(file); +144 +145 FileNameAnalyzer fnAnalyzer = new FileNameAnalyzer(); +146 fnAnalyzer.analyze(struts, null); +147 +148 HintAnalyzer hintAnalyzer = new HintAnalyzer(); +149 JarAnalyzer jarAnalyzer = new JarAnalyzer(); +150 jarAnalyzer.accept(new File("test.jar"));//trick analyzer into "thinking it is active" +151 +152 jarAnalyzer.analyze(struts, null); +153 hintAnalyzer.analyze(struts, null); +154 //File fileCommonValidator = new File(this.getClass().getClassLoader().getResource("commons-validator-1.4.0.jar").getPath()); +155 File fileCommonValidator = BaseTest.getResourceAsFile(this, "commons-validator-1.4.0.jar"); +156 Dependency commonValidator = new Dependency(fileCommonValidator); +157 jarAnalyzer.analyze(commonValidator, null); +158 hintAnalyzer.analyze(commonValidator, null); +159 +160 //File fileSpring = new File(this.getClass().getClassLoader().getResource("spring-core-2.5.5.jar").getPath()); +161 File fileSpring = BaseTest.getResourceAsFile(this, "spring-core-2.5.5.jar"); +162 Dependency spring = new Dependency(fileSpring); +163 jarAnalyzer.analyze(spring, null); +164 hintAnalyzer.analyze(spring, null); +165 +166 //File fileSpring3 = new File(this.getClass().getClassLoader().getResource("spring-core-3.0.0.RELEASE.jar").getPath()); +167 File fileSpring3 = BaseTest.getResourceAsFile(this, "spring-core-3.0.0.RELEASE.jar"); +168 Dependency spring3 = new Dependency(fileSpring3); +169 jarAnalyzer.analyze(spring3, null); +170 hintAnalyzer.analyze(spring3, null); +171 +172 CPEAnalyzer instance = new CPEAnalyzer(); +173 instance.open(); +174 instance.determineCPE(commonValidator); +175 instance.determineCPE(struts); +176 instance.determineCPE(spring); +177 instance.determineCPE(spring3); +178 instance.close(); +179 +180 String expResult = "cpe:/a:apache:struts:2.1.2"; +181 Identifier expIdentifier = new Identifier("cpe", expResult, expResult); +182 String expResultSpring = "cpe:/a:springsource:spring_framework:2.5.5"; +183 String expResultSpring3 = "cpe:/a:vmware:springsource_spring_framework:3.0.0"; +184 +185 for (Identifier i : commonValidator.getIdentifiers()) { +186 Assert.assertFalse("Apache Common Validator - found a CPE identifier?", "cpe".equals(i.getType())); +187 } +188 +189 Assert.assertTrue("Incorrect match size - struts", struts.getIdentifiers().size() >= 1); +190 Assert.assertTrue("Incorrect match - struts", struts.getIdentifiers().contains(expIdentifier)); +191 Assert.assertTrue("Incorrect match size - spring3 - " + spring3.getIdentifiers().size(), spring3.getIdentifiers().size() >= 1); +192 +193 //the following two only work if the HintAnalyzer is used. +194 //Assert.assertTrue("Incorrect match size - spring", spring.getIdentifiers().size() == 1); +195 //Assert.assertTrue("Incorrect match - spring", spring.getIdentifiers().get(0).getValue().equals(expResultSpring)); +196 jarAnalyzer.close(); +197 } +198 +199 /** +200 * Test of determineIdentifiers method, of class CPEAnalyzer. +201 * +202 * @throws Exception is thrown when an exception occurs +203 */ +204 @Test +205 public void testDetermineIdentifiers() throws Exception { +206 Dependency openssl = new Dependency(); +207 openssl.getVendorEvidence().addEvidence("test", "vendor", "openssl", Confidence.HIGHEST); +208 openssl.getProductEvidence().addEvidence("test", "product", "openssl", Confidence.HIGHEST); +209 openssl.getVersionEvidence().addEvidence("test", "version", "1.0.1c", Confidence.HIGHEST); +210 +211 CPEAnalyzer instance = new CPEAnalyzer(); +212 instance.open(); +213 instance.determineIdentifiers(openssl, "openssl", "openssl", Confidence.HIGHEST); +214 instance.close(); +215 +216 String expResult = "cpe:/a:openssl:openssl:1.0.1c"; +217 Identifier expIdentifier = new Identifier("cpe", expResult, expResult); +218 +219 assertTrue(openssl.getIdentifiers().contains(expIdentifier)); 220 -221 assertTrue(openssl.getIdentifiers().contains(expIdentifier)); +221 } 222 -223 } -224 -225 /** -226 * Test of searchCPE method, of class CPEAnalyzer. -227 * -228 * @throws Exception is thrown when an exception occurs -229 */ -230 @Test -231 public void testSearchCPE() throws Exception { -232 String vendor = "apache software foundation"; -233 String product = "struts 2 core"; -234 String version = "2.1.2"; -235 String expVendor = "apache"; -236 String expProduct = "struts"; -237 -238 CPEAnalyzer instance = new CPEAnalyzer(); -239 instance.open(); +223 /** +224 * Test of searchCPE method, of class CPEAnalyzer. +225 * +226 * @throws Exception is thrown when an exception occurs +227 */ +228 @Test +229 public void testSearchCPE() throws Exception { +230 String vendor = "apache software foundation"; +231 String product = "struts 2 core"; +232 String version = "2.1.2"; +233 String expVendor = "apache"; +234 String expProduct = "struts"; +235 +236 CPEAnalyzer instance = new CPEAnalyzer(); +237 instance.open(); +238 +239 Set<String> productWeightings = Collections.singleton("struts2"); 240 -241 Set<String> productWeightings = new HashSet<String>(1); -242 productWeightings.add("struts2"); -243 -244 Set<String> vendorWeightings = new HashSet<String>(1); -245 vendorWeightings.add("apache"); -246 -247 List<IndexEntry> result = instance.searchCPE(vendor, product, productWeightings, vendorWeightings); -248 instance.close(); -249 -250 boolean found = false; -251 for (IndexEntry entry : result) { -252 if (expVendor.equals(entry.getVendor()) && expProduct.equals(entry.getProduct())) { -253 found = true; -254 break; -255 } -256 } -257 assertTrue("apache:struts was not identified", found); -258 -259 } -260 } +241 Set<String> vendorWeightings = Collections.singleton("apache"); +242 +243 List<IndexEntry> result = instance.searchCPE(vendor, product, productWeightings, vendorWeightings); +244 instance.close(); +245 +246 boolean found = false; +247 for (IndexEntry entry : result) { +248 if (expVendor.equals(entry.getVendor()) && expProduct.equals(entry.getProduct())) { +249 found = true; +250 break; +251 } +252 } +253 assertTrue("apache:struts was not identified", found); +254 +255 } +256 }
      diff --git a/xref-test/org/owasp/dependencycheck/analyzer/ComposerLockAnalyzerTest.html b/xref-test/org/owasp/dependencycheck/analyzer/ComposerLockAnalyzerTest.html index 200d19a4b..9d70ec73e 100644 --- a/xref-test/org/owasp/dependencycheck/analyzer/ComposerLockAnalyzerTest.html +++ b/xref-test/org/owasp/dependencycheck/analyzer/ComposerLockAnalyzerTest.html @@ -42,71 +42,72 @@ 34 import static org.junit.Assert.assertEquals; 35 import static org.junit.Assert.assertThat; 36 import static org.junit.Assert.assertTrue; -37 -38 /** -39 * Unit tests for NodePackageAnalyzer. -40 * -41 * @author Dale Visser <dvisser@ida.org> -42 */ -43 public class ComposerLockAnalyzerTest extends BaseTest { -44 -45 /** -46 * The analyzer to test. -47 */ -48 ComposerLockAnalyzer analyzer; -49 -50 /** -51 * Correctly setup the analyzer for testing. -52 * -53 * @throws Exception thrown if there is a problem -54 */ -55 @Before -56 public void setUp() throws Exception { -57 analyzer = new ComposerLockAnalyzer(); -58 analyzer.setFilesMatched(true); -59 analyzer.initialize(); -60 } -61 -62 /** -63 * Cleanup the analyzer's temp files, etc. -64 * -65 * @throws Exception thrown if there is a problem -66 */ -67 @After -68 public void tearDown() throws Exception { -69 analyzer.close(); -70 analyzer = null; -71 } -72 -73 /** -74 * Test of getName method, of class ComposerLockAnalyzer. -75 */ -76 @Test -77 public void testGetName() { -78 assertEquals("Composer.lock analyzer", analyzer.getName()); -79 } -80 -81 /** -82 * Test of supportsExtension method, of class ComposerLockAnalyzer. -83 */ -84 @Test -85 public void testSupportsFiles() { -86 assertTrue(analyzer.accept(new File("composer.lock"))); -87 } -88 -89 /** -90 * Test of inspect method, of class PythonDistributionAnalyzer. -91 * -92 * @throws AnalysisException is thrown when an exception occurs. -93 */ -94 @Test -95 public void testAnalyzePackageJson() throws Exception { -96 final Engine engine = new Engine(); -97 final Dependency result = new Dependency(BaseTest.getResourceAsFile(this, -98 "composer.lock")); -99 analyzer.analyze(result, engine); -100 } -101 } +37 import org.owasp.dependencycheck.BaseDBTestCase; +38 +39 /** +40 * Unit tests for NodePackageAnalyzer. +41 * +42 * @author Dale Visser <dvisser@ida.org> +43 */ +44 public class ComposerLockAnalyzerTest extends BaseDBTestCase { +45 +46 /** +47 * The analyzer to test. +48 */ +49 ComposerLockAnalyzer analyzer; +50 +51 /** +52 * Correctly setup the analyzer for testing. +53 * +54 * @throws Exception thrown if there is a problem +55 */ +56 @Before +57 public void setUp() throws Exception { +58 analyzer = new ComposerLockAnalyzer(); +59 analyzer.setFilesMatched(true); +60 analyzer.initialize(); +61 } +62 +63 /** +64 * Cleanup the analyzer's temp files, etc. +65 * +66 * @throws Exception thrown if there is a problem +67 */ +68 @After +69 public void tearDown() throws Exception { +70 analyzer.close(); +71 analyzer = null; +72 } +73 +74 /** +75 * Test of getName method, of class ComposerLockAnalyzer. +76 */ +77 @Test +78 public void testGetName() { +79 assertEquals("Composer.lock analyzer", analyzer.getName()); +80 } +81 +82 /** +83 * Test of supportsExtension method, of class ComposerLockAnalyzer. +84 */ +85 @Test +86 public void testSupportsFiles() { +87 assertTrue(analyzer.accept(new File("composer.lock"))); +88 } +89 +90 /** +91 * Test of inspect method, of class PythonDistributionAnalyzer. +92 * +93 * @throws AnalysisException is thrown when an exception occurs. +94 */ +95 @Test +96 public void testAnalyzePackageJson() throws Exception { +97 final Engine engine = new Engine(); +98 final Dependency result = new Dependency(BaseTest.getResourceAsFile(this, +99 "composer.lock")); +100 analyzer.analyze(result, engine); +101 } +102 }
      diff --git a/xref-test/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzerIntegrationTest.html b/xref-test/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzerIntegrationTest.html index 3b03449d7..ac4257686 100644 --- a/xref-test/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzerIntegrationTest.html +++ b/xref-test/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzerIntegrationTest.html @@ -26,13 +26,13 @@ 18 package org.owasp.dependencycheck.analyzer; 19 20 import org.junit.Test; -21 import org.owasp.dependencycheck.data.cpe.AbstractDatabaseTestCase; +21 import org.owasp.dependencycheck.BaseDBTestCase; 22 23 /** 24 * 25 * @author Jeremy Long 26 */ -27 public class DependencyBundlingAnalyzerIntegrationTest extends AbstractDatabaseTestCase { +27 public class DependencyBundlingAnalyzerIntegrationTest extends BaseDBTestCase { 28 29 /** 30 * Test of analyze method, of class DependencyBundlingAnalyzer. diff --git a/xref-test/org/owasp/dependencycheck/analyzer/HintAnalyzerTest.html b/xref-test/org/owasp/dependencycheck/analyzer/HintAnalyzerTest.html index ee655d18e..f9445a3aa 100644 --- a/xref-test/org/owasp/dependencycheck/analyzer/HintAnalyzerTest.html +++ b/xref-test/org/owasp/dependencycheck/analyzer/HintAnalyzerTest.html @@ -32,96 +32,92 @@ 24 import org.junit.Test; 25 import org.owasp.dependencycheck.BaseTest; 26 import org.owasp.dependencycheck.Engine; -27 import org.owasp.dependencycheck.dependency.Confidence; -28 import org.owasp.dependencycheck.dependency.Dependency; -29 import org.owasp.dependencycheck.dependency.Evidence; -30 import org.owasp.dependencycheck.utils.Settings; -31 -32 /** -33 * -34 * @author Jeremy Long -35 */ -36 public class HintAnalyzerTest extends BaseTest { -37 -38 @Before -39 public void setUp() throws Exception { -40 org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase.ensureDBExists(); -41 } -42 -43 /** -44 * Test of getName method, of class HintAnalyzer. -45 */ -46 @Test -47 public void testGetName() { -48 HintAnalyzer instance = new HintAnalyzer(); -49 String expResult = "Hint Analyzer"; -50 String result = instance.getName(); -51 assertEquals(expResult, result); -52 } -53 -54 /** -55 * Test of getAnalysisPhase method, of class HintAnalyzer. -56 */ -57 @Test -58 public void testGetAnalysisPhase() { -59 HintAnalyzer instance = new HintAnalyzer(); -60 AnalysisPhase expResult = AnalysisPhase.PRE_IDENTIFIER_ANALYSIS; -61 AnalysisPhase result = instance.getAnalysisPhase(); -62 assertEquals(expResult, result); -63 } -64 -65 /** -66 * Test of analyze method, of class HintAnalyzer. -67 */ -68 @Test -69 public void testAnalyze() throws Exception { -70 HintAnalyzer instance = new HintAnalyzer(); -71 -72 //File guice = new File(this.getClass().getClassLoader().getResource("guice-3.0.jar").getPath()); -73 File guice = BaseTest.getResourceAsFile(this, "guice-3.0.jar"); -74 //Dependency guice = new Dependency(fileg); -75 //File spring = new File(this.getClass().getClassLoader().getResource("spring-core-3.0.0.RELEASE.jar").getPath()); -76 File spring = BaseTest.getResourceAsFile(this, "spring-core-3.0.0.RELEASE.jar"); -77 //Dependency spring = new Dependency(files); -78 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, false); -79 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, false); -80 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, false); -81 Engine engine = new Engine(); -82 -83 engine.scan(guice); -84 engine.scan(spring); -85 engine.analyzeDependencies(); -86 Dependency gdep = null; -87 Dependency sdep = null; -88 for (Dependency d : engine.getDependencies()) { -89 if (d.getActualFile().equals(guice)) { -90 gdep = d; -91 } else if (d.getActualFile().equals(spring)) { -92 sdep = d; -93 } -94 } -95 final Evidence springTest1 = new Evidence("hint analyzer", "product", "springsource_spring_framework", Confidence.HIGH); -96 final Evidence springTest2 = new Evidence("hint analyzer", "vendor", "SpringSource", Confidence.HIGH); -97 final Evidence springTest3 = new Evidence("hint analyzer", "vendor", "vmware", Confidence.HIGH); -98 final Evidence springTest4 = new Evidence("hint analyzer", "product", "springsource_spring_framework", Confidence.HIGH); -99 final Evidence springTest5 = new Evidence("hint analyzer", "vendor", "vmware", Confidence.HIGH); -100 -101 Set<Evidence> evidence = gdep.getEvidence().getEvidence(); -102 assertFalse(evidence.contains(springTest1)); -103 assertFalse(evidence.contains(springTest2)); -104 assertFalse(evidence.contains(springTest3)); -105 assertFalse(evidence.contains(springTest4)); -106 assertFalse(evidence.contains(springTest5)); -107 -108 evidence = sdep.getEvidence().getEvidence(); -109 assertTrue(evidence.contains(springTest1)); -110 assertTrue(evidence.contains(springTest2)); -111 assertTrue(evidence.contains(springTest3)); -112 //assertTrue(evidence.contains(springTest4)); -113 //assertTrue(evidence.contains(springTest5)); -114 } -115 -116 } +27 import org.owasp.dependencycheck.BaseDBTestCase; +28 import org.owasp.dependencycheck.dependency.Confidence; +29 import org.owasp.dependencycheck.dependency.Dependency; +30 import org.owasp.dependencycheck.dependency.Evidence; +31 import org.owasp.dependencycheck.utils.Settings; +32 +33 /** +34 * +35 * @author Jeremy Long +36 */ +37 public class HintAnalyzerTest extends BaseDBTestCase { +38 +39 /** +40 * Test of getName method, of class HintAnalyzer. +41 */ +42 @Test +43 public void testGetName() { +44 HintAnalyzer instance = new HintAnalyzer(); +45 String expResult = "Hint Analyzer"; +46 String result = instance.getName(); +47 assertEquals(expResult, result); +48 } +49 +50 /** +51 * Test of getAnalysisPhase method, of class HintAnalyzer. +52 */ +53 @Test +54 public void testGetAnalysisPhase() { +55 HintAnalyzer instance = new HintAnalyzer(); +56 AnalysisPhase expResult = AnalysisPhase.PRE_IDENTIFIER_ANALYSIS; +57 AnalysisPhase result = instance.getAnalysisPhase(); +58 assertEquals(expResult, result); +59 } +60 +61 /** +62 * Test of analyze method, of class HintAnalyzer. +63 */ +64 @Test +65 public void testAnalyze() throws Exception { +66 HintAnalyzer instance = new HintAnalyzer(); +67 +68 //File guice = new File(this.getClass().getClassLoader().getResource("guice-3.0.jar").getPath()); +69 File guice = BaseTest.getResourceAsFile(this, "guice-3.0.jar"); +70 //Dependency guice = new Dependency(fileg); +71 //File spring = new File(this.getClass().getClassLoader().getResource("spring-core-3.0.0.RELEASE.jar").getPath()); +72 File spring = BaseTest.getResourceAsFile(this, "spring-core-3.0.0.RELEASE.jar"); +73 //Dependency spring = new Dependency(files); +74 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, false); +75 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, false); +76 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, false); +77 Engine engine = new Engine(); +78 +79 engine.scan(guice); +80 engine.scan(spring); +81 engine.analyzeDependencies(); +82 Dependency gdep = null; +83 Dependency sdep = null; +84 for (Dependency d : engine.getDependencies()) { +85 if (d.getActualFile().equals(guice)) { +86 gdep = d; +87 } else if (d.getActualFile().equals(spring)) { +88 sdep = d; +89 } +90 } +91 final Evidence springTest1 = new Evidence("hint analyzer", "product", "springsource_spring_framework", Confidence.HIGH); +92 final Evidence springTest2 = new Evidence("hint analyzer", "vendor", "SpringSource", Confidence.HIGH); +93 final Evidence springTest3 = new Evidence("hint analyzer", "vendor", "vmware", Confidence.HIGH); +94 final Evidence springTest4 = new Evidence("hint analyzer", "product", "springsource_spring_framework", Confidence.HIGH); +95 final Evidence springTest5 = new Evidence("hint analyzer", "vendor", "vmware", Confidence.HIGH); +96 +97 Set<Evidence> evidence = gdep.getEvidence().getEvidence(); +98 assertFalse(evidence.contains(springTest1)); +99 assertFalse(evidence.contains(springTest2)); +100 assertFalse(evidence.contains(springTest3)); +101 assertFalse(evidence.contains(springTest4)); +102 assertFalse(evidence.contains(springTest5)); +103 +104 evidence = sdep.getEvidence().getEvidence(); +105 assertTrue(evidence.contains(springTest1)); +106 assertTrue(evidence.contains(springTest2)); +107 assertTrue(evidence.contains(springTest3)); +108 //assertTrue(evidence.contains(springTest4)); +109 //assertTrue(evidence.contains(springTest5)); +110 } +111 +112 }
      diff --git a/xref-test/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzerTest.html b/xref-test/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzerTest.html new file mode 100644 index 000000000..2dbbe0767 --- /dev/null +++ b/xref-test/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzerTest.html @@ -0,0 +1,122 @@ + + + +RubyBundleAuditAnalyzerTest xref + + + +
      +1   /*
      +2    * This file is part of dependency-check-core.
      +3    *
      +4    * Licensed under the Apache License, Version 2.0 (the "License");
      +5    * you may not use this file except in compliance with the License.
      +6    * You may obtain a copy of the License at
      +7    *
      +8    *     http://www.apache.org/licenses/LICENSE-2.0
      +9    *
      +10   * Unless required by applicable law or agreed to in writing, software
      +11   * distributed under the License is distributed on an "AS IS" BASIS,
      +12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      +13   * See the License for the specific language governing permissions and
      +14   * limitations under the License.
      +15   *
      +16   * Copyright (c) 2015 Institute for Defense Analyses. All Rights Reserved.
      +17   */
      +18  package org.owasp.dependencycheck.analyzer;
      +19  
      +20  import org.junit.After;
      +21  import org.junit.Assume;
      +22  import org.junit.Before;
      +23  import org.junit.Test;
      +24  import org.owasp.dependencycheck.BaseTest;
      +25  import org.owasp.dependencycheck.Engine;
      +26  import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
      +27  import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
      +28  import org.owasp.dependencycheck.dependency.Dependency;
      +29  import org.slf4j.Logger;
      +30  import org.slf4j.LoggerFactory;
      +31  
      +32  import java.io.File;
      +33  
      +34  import static org.hamcrest.CoreMatchers.is;
      +35  import static org.hamcrest.CoreMatchers.not;
      +36  import static org.junit.Assert.assertThat;
      +37  
      +38  /**
      +39   * Unit tests for {@link RubyBundleAuditAnalyzer}.
      +40   *
      +41   * @author Dale Visser <dvisser@ida.org>
      +42   */
      +43  public class RubyBundleAuditAnalyzerTest extends BaseTest {
      +44  
      +45      private static final Logger LOGGER = LoggerFactory.getLogger(RubyBundleAuditAnalyzerTest.class);
      +46  
      +47      /**
      +48       * The analyzer to test.
      +49       */
      +50      RubyBundleAuditAnalyzer analyzer;
      +51  
      +52      /**
      +53       * Correctly setup the analyzer for testing.
      +54       *
      +55       * @throws Exception thrown if there is a problem
      +56       */
      +57      @Before
      +58      public void setUp() throws Exception {
      +59          try {
      +60              analyzer = new RubyBundleAuditAnalyzer();
      +61              analyzer.setFilesMatched(true);
      +62              analyzer.initialize();
      +63          } catch (Exception e) {
      +64              //LOGGER.warn("Exception setting up RubyBundleAuditAnalyzer. Tests will be incomplete", e);
      +65              Assume.assumeNoException("Exception setting up RubyBundleAuditAnalyzer; bundle audit may not be installed. Tests will be incomplete", e);
      +66          }
      +67      }
      +68  
      +69      /**
      +70       * Cleanup the analyzer's temp files, etc.
      +71       *
      +72       * @throws Exception thrown if there is a problem
      +73       */
      +74      @After
      +75      public void tearDown() throws Exception {
      +76          analyzer.close();
      +77          analyzer = null;
      +78      }
      +79  
      +80      /**
      +81       * Test Ruby Gemspec name.
      +82       */
      +83      @Test
      +84      public void testGetName() {
      +85          assertThat(analyzer.getName(), is("Ruby Bundle Audit Analyzer"));
      +86      }
      +87  
      +88      /**
      +89       * Test Ruby Bundler Audit file support.
      +90       */
      +91      @Test
      +92      public void testSupportsFiles() {
      +93          assertThat(analyzer.accept(new File("Gemfile.lock")), is(true));
      +94      }
      +95  
      +96      /**
      +97       * Test Ruby BundlerAudit analysis.
      +98       *
      +99       * @throws AnalysisException is thrown when an exception occurs.
      +100      */
      +101     @Test
      +102     public void testAnalysis() throws AnalysisException, DatabaseException {
      +103         final Dependency result = new Dependency(BaseTest.getResourceAsFile(this,
      +104                 "ruby/vulnerable/Gemfile.lock"));
      +105         final Engine engine = new Engine();
      +106         analyzer.analyze(result, engine);
      +107         assertThat(engine.getDependencies().size(), is(not(0)));
      +108     }
      +109 }
      +
      +
      + + + diff --git a/xref-test/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzerTest.html b/xref-test/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzerTest.html index 43b76a407..6aba6f081 100644 --- a/xref-test/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzerTest.html +++ b/xref-test/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzerTest.html @@ -74,7 +74,7 @@ 66 } 67 68 /** -69 * Test of getName method, of class PythonDistributionAnalyzer. +69 * Test Ruby Gemspec name. 70 */ 71 @Test 72 public void testGetName() { @@ -82,7 +82,7 @@ 74 } 75 76 /** -77 * Test of supportsExtension method, of class PythonDistributionAnalyzer. +77 * Test Ruby Gemspec file support. 78 */ 79 @Test 80 public void testSupportsFiles() { @@ -91,14 +91,14 @@ 83 } 84 85 /** -86 * Test of inspect method, of class PythonDistributionAnalyzer. +86 * Test Ruby Gemspec analysis. 87 * 88 * @throws AnalysisException is thrown when an exception occurs. 89 */ 90 @Test 91 public void testAnalyzePackageJson() throws AnalysisException { 92 final Dependency result = new Dependency(BaseTest.getResourceAsFile(this, -93 "ruby/gems/specifications/rest-client-1.7.2.gemspec")); +93 "ruby/vulnerable/gems/specifications/rest-client-1.7.2.gemspec")); 94 analyzer.analyze(result, null); 95 final String vendorString = result.getVendorEvidence().toString(); 96 assertThat(vendorString, containsString("REST Client Team")); diff --git a/xref-test/org/owasp/dependencycheck/analyzer/VulnerabilitySuppressionAnalyzerIntegrationTest.html b/xref-test/org/owasp/dependencycheck/analyzer/VulnerabilitySuppressionAnalyzerIntegrationTest.html index e1ca8c8db..bb723d413 100644 --- a/xref-test/org/owasp/dependencycheck/analyzer/VulnerabilitySuppressionAnalyzerIntegrationTest.html +++ b/xref-test/org/owasp/dependencycheck/analyzer/VulnerabilitySuppressionAnalyzerIntegrationTest.html @@ -29,9 +29,9 @@ 21 import static org.junit.Assert.assertEquals; 22 import static org.junit.Assert.assertTrue; 23 import org.junit.Test; -24 import org.owasp.dependencycheck.BaseTest; -25 import org.owasp.dependencycheck.Engine; -26 import org.owasp.dependencycheck.data.cpe.AbstractDatabaseTestCase; +24 import org.owasp.dependencycheck.BaseDBTestCase; +25 import org.owasp.dependencycheck.BaseTest; +26 import org.owasp.dependencycheck.Engine; 27 import org.owasp.dependencycheck.dependency.Dependency; 28 import org.owasp.dependencycheck.utils.Settings; 29 @@ -40,7 +40,7 @@ 32 * 33 * @author Jeremy Long 34 */ -35 public class VulnerabilitySuppressionAnalyzerIntegrationTest extends AbstractDatabaseTestCase { +35 public class VulnerabilitySuppressionAnalyzerIntegrationTest extends BaseDBTestCase { 36 37 /** 38 * Test of getName method, of class VulnerabilitySuppressionAnalyzer. diff --git a/xref-test/org/owasp/dependencycheck/analyzer/package-frame.html b/xref-test/org/owasp/dependencycheck/analyzer/package-frame.html index f7cdc79bd..d0b6c5e5b 100644 --- a/xref-test/org/owasp/dependencycheck/analyzer/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/analyzer/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.analyzer + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.analyzer @@ -29,6 +29,9 @@
    • ArchiveAnalyzerIntegrationTest +
    • +
    • + ArchiveAnalyzerTest
    • AssemblyAnalyzerTest @@ -77,6 +80,9 @@
    • PythonPackageAnalyzerTest +
    • +
    • + RubyBundleAuditAnalyzerTest
    • RubyGemspecAnalyzerTest diff --git a/xref-test/org/owasp/dependencycheck/analyzer/package-summary.html b/xref-test/org/owasp/dependencycheck/analyzer/package-summary.html index d9f8774d6..63de4398f 100644 --- a/xref-test/org/owasp/dependencycheck/analyzer/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/analyzer/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.analyzer + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.analyzer @@ -59,6 +59,11 @@ ArchiveAnalyzerIntegrationTest + + + + ArchiveAnalyzerTest + @@ -139,6 +144,11 @@ PythonPackageAnalyzerTest + + + + RubyBundleAuditAnalyzerTest + diff --git a/xref-test/org/owasp/dependencycheck/data/central/package-frame.html b/xref-test/org/owasp/dependencycheck/data/central/package-frame.html index abea3d36b..7f52cb983 100644 --- a/xref-test/org/owasp/dependencycheck/data/central/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/data/central/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.central + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.central diff --git a/xref-test/org/owasp/dependencycheck/data/central/package-summary.html b/xref-test/org/owasp/dependencycheck/data/central/package-summary.html index b805825de..310f610da 100644 --- a/xref-test/org/owasp/dependencycheck/data/central/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/data/central/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.central + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.central diff --git a/xref-test/org/owasp/dependencycheck/data/composer/package-frame.html b/xref-test/org/owasp/dependencycheck/data/composer/package-frame.html index 94a76cc9e..795c42af5 100644 --- a/xref-test/org/owasp/dependencycheck/data/composer/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/data/composer/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.composer + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.composer diff --git a/xref-test/org/owasp/dependencycheck/data/composer/package-summary.html b/xref-test/org/owasp/dependencycheck/data/composer/package-summary.html index 40f7807b7..5c29b72ba 100644 --- a/xref-test/org/owasp/dependencycheck/data/composer/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/data/composer/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.composer + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.composer diff --git a/xref-test/org/owasp/dependencycheck/data/cpe/package-frame.html b/xref-test/org/owasp/dependencycheck/data/cpe/package-frame.html index eb117f468..d1fa0e8fd 100644 --- a/xref-test/org/owasp/dependencycheck/data/cpe/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/data/cpe/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.cpe + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.cpe @@ -16,9 +16,6 @@ diff --git a/xref-test/org/owasp/dependencycheck/data/cpe/package-summary.html b/xref-test/org/owasp/dependencycheck/data/cpe/package-summary.html index 46c76c058..256a3ec93 100644 --- a/xref-test/org/owasp/dependencycheck/data/cpe/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/data/cpe/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.cpe + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.cpe @@ -36,11 +36,6 @@ - - AbstractDatabaseTestCase - - - IndexEntryTest diff --git a/xref-test/org/owasp/dependencycheck/data/cwe/package-frame.html b/xref-test/org/owasp/dependencycheck/data/cwe/package-frame.html index d01913b79..4396ea922 100644 --- a/xref-test/org/owasp/dependencycheck/data/cwe/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/data/cwe/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.cwe + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.cwe diff --git a/xref-test/org/owasp/dependencycheck/data/cwe/package-summary.html b/xref-test/org/owasp/dependencycheck/data/cwe/package-summary.html index a47a537c4..877be674a 100644 --- a/xref-test/org/owasp/dependencycheck/data/cwe/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/data/cwe/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.cwe + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.cwe diff --git a/xref-test/org/owasp/dependencycheck/data/lucene/package-frame.html b/xref-test/org/owasp/dependencycheck/data/lucene/package-frame.html index 23fb68083..90efa395b 100644 --- a/xref-test/org/owasp/dependencycheck/data/lucene/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/data/lucene/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.lucene + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.lucene diff --git a/xref-test/org/owasp/dependencycheck/data/lucene/package-summary.html b/xref-test/org/owasp/dependencycheck/data/lucene/package-summary.html index 7fb470f3e..8c9a16bed 100644 --- a/xref-test/org/owasp/dependencycheck/data/lucene/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/data/lucene/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.lucene + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.lucene diff --git a/xref-test/org/owasp/dependencycheck/data/nexus/package-frame.html b/xref-test/org/owasp/dependencycheck/data/nexus/package-frame.html index 4ab927e94..03d7f5159 100644 --- a/xref-test/org/owasp/dependencycheck/data/nexus/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/data/nexus/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.nexus + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.nexus diff --git a/xref-test/org/owasp/dependencycheck/data/nexus/package-summary.html b/xref-test/org/owasp/dependencycheck/data/nexus/package-summary.html index 2be42809d..c0b3314f4 100644 --- a/xref-test/org/owasp/dependencycheck/data/nexus/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/data/nexus/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.nexus + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.nexus diff --git a/xref-test/org/owasp/dependencycheck/data/nuget/package-frame.html b/xref-test/org/owasp/dependencycheck/data/nuget/package-frame.html index 964abd966..17985a33b 100644 --- a/xref-test/org/owasp/dependencycheck/data/nuget/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/data/nuget/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.nuget + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.nuget diff --git a/xref-test/org/owasp/dependencycheck/data/nuget/package-summary.html b/xref-test/org/owasp/dependencycheck/data/nuget/package-summary.html index 88ba59d62..008af88ba 100644 --- a/xref-test/org/owasp/dependencycheck/data/nuget/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/data/nuget/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.nuget + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.nuget diff --git a/xref-test/org/owasp/dependencycheck/data/nvdcve/ConnectionFactoryTest.html b/xref-test/org/owasp/dependencycheck/data/nvdcve/ConnectionFactoryTest.html new file mode 100644 index 000000000..5ace3ffd4 --- /dev/null +++ b/xref-test/org/owasp/dependencycheck/data/nvdcve/ConnectionFactoryTest.html @@ -0,0 +1,60 @@ + + + +ConnectionFactoryTest xref + + + +
      +1   /*
      +2    * Copyright 2015 OWASP.
      +3    *
      +4    * Licensed under the Apache License, Version 2.0 (the "License");
      +5    * you may not use this file except in compliance with the License.
      +6    * You may obtain a copy of the License at
      +7    *
      +8    *      http://www.apache.org/licenses/LICENSE-2.0
      +9    *
      +10   * Unless required by applicable law or agreed to in writing, software
      +11   * distributed under the License is distributed on an "AS IS" BASIS,
      +12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      +13   * See the License for the specific language governing permissions and
      +14   * limitations under the License.
      +15   */
      +16  package org.owasp.dependencycheck.data.nvdcve;
      +17  
      +18  import java.sql.Connection;
      +19  import java.sql.SQLException;
      +20  import org.junit.After;
      +21  import org.junit.AfterClass;
      +22  import org.junit.Before;
      +23  import org.junit.BeforeClass;
      +24  import org.junit.Test;
      +25  import static org.junit.Assert.*;
      +26  import org.owasp.dependencycheck.BaseDBTestCase;
      +27  
      +28  /**
      +29   *
      +30   * @author jeremy
      +31   */
      +32  public class ConnectionFactoryTest extends BaseDBTestCase {
      +33  
      +34      /**
      +35       * Test of initialize method, of class ConnectionFactory.
      +36       *
      +37       * @throws org.owasp.dependencycheck.data.nvdcve.DatabaseException
      +38       */
      +39      @Test
      +40      public void testInitialize() throws DatabaseException, SQLException {
      +41          ConnectionFactory.initialize();
      +42          Connection result = ConnectionFactory.getConnection();
      +43          assertNotNull(result);
      +44          result.close();
      +45          ConnectionFactory.cleanup();
      +46      }
      +47  }
      +
      +
      + + + diff --git a/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBIntegrationTest.html b/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBIntegrationTest.html index 86cd991e1..7804fabb9 100644 --- a/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBIntegrationTest.html +++ b/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBIntegrationTest.html @@ -25,168 +25,169 @@ 17 */ 18 package org.owasp.dependencycheck.data.nvdcve; 19 -20 import java.util.HashMap; -21 import java.util.List; -22 import java.util.Map; -23 import java.util.Map.Entry; -24 import java.util.Set; -25 import org.junit.Assert; -26 import static org.junit.Assert.assertTrue; -27 import org.junit.Test; -28 import org.owasp.dependencycheck.dependency.Vulnerability; -29 import org.owasp.dependencycheck.dependency.VulnerableSoftware; -30 import org.owasp.dependencycheck.utils.DependencyVersion; -31 -32 /** -33 * -34 * @author Jeremy Long -35 */ -36 public class CveDBIntegrationTest extends BaseDBTestCase { -37 -38 /** -39 * Pretty useless tests of open, commit, and close methods, of class CveDB. -40 */ -41 @Test -42 public void testOpen() throws Exception { -43 CveDB instance = null; -44 try { -45 instance = new CveDB(); -46 instance.open(); -47 instance.commit(); -48 } finally { -49 if (instance != null) { -50 instance.close(); -51 } -52 } -53 } -54 -55 /** -56 * Test of getCPEs method, of class CveDB. -57 */ -58 @Test -59 public void testGetCPEs() throws Exception { -60 CveDB instance = null; -61 try { -62 instance = new CveDB(); -63 String vendor = "apache"; -64 String product = "struts"; -65 instance.open(); -66 Set<VulnerableSoftware> result = instance.getCPEs(vendor, product); -67 assertTrue(result.size() > 5); -68 } finally { -69 if (instance != null) { -70 instance.close(); -71 } -72 } -73 } -74 -75 /** -76 * Test of getVulnerabilities method, of class CveDB. -77 */ -78 @Test -79 public void testGetVulnerabilities() throws Exception { -80 String cpeStr = "cpe:/a:apache:struts:2.1.2"; -81 CveDB instance = null; -82 List<Vulnerability> results; -83 try { -84 instance = new CveDB(); -85 instance.open(); -86 results = instance.getVulnerabilities(cpeStr); -87 assertTrue(results.size() > 5); -88 cpeStr = "cpe:/a:jruby:jruby:1.6.3"; -89 results = instance.getVulnerabilities(cpeStr); -90 assertTrue(results.size() > 1); -91 -92 boolean found = false; -93 String expected = "CVE-2011-4838"; -94 for (Vulnerability v : results) { -95 if (expected.equals(v.getName())) { -96 found = true; -97 break; -98 } -99 } -100 assertTrue("Expected " + expected + ", but was not identified", found); -101 -102 found = false; -103 expected = "CVE-2012-5370"; -104 for (Vulnerability v : results) { -105 if (expected.equals(v.getName())) { -106 found = true; -107 break; -108 } -109 } -110 assertTrue("Expected " + expected + ", but was not identified", found); -111 -112 } finally { -113 if (instance != null) { -114 instance.close(); -115 } -116 } -117 } -118 -119 /** -120 * Test of getMatchingSoftware method, of class CveDB. -121 */ -122 @Test -123 public void testGetMatchingSoftware() throws Exception { -124 CveDB instance = null; -125 Map<String, Boolean> versions = new HashMap<String, Boolean>(); -126 DependencyVersion identifiedVersion = new DependencyVersion("1.0.1o"); -127 versions.put("cpe:/a:openssl:openssl:1.0.1e", Boolean.FALSE); -128 try { -129 instance = new CveDB(); -130 Entry<String, Boolean> results = instance.getMatchingSoftware(versions, "openssl", "openssl", identifiedVersion); -131 Assert.assertNull(results); -132 versions.put("cpe:/a:openssl:openssl:1.0.1p", Boolean.FALSE); -133 results = instance.getMatchingSoftware(versions, "openssl", "openssl", identifiedVersion); -134 Assert.assertNull(results); -135 -136 versions.put("cpe:/a:openssl:openssl:1.0.1q", Boolean.TRUE); -137 results = instance.getMatchingSoftware(versions, "openssl", "openssl", identifiedVersion); -138 Assert.assertNotNull(results); -139 Assert.assertEquals("cpe:/a:openssl:openssl:1.0.1q", results.getKey()); -140 -141 versions.clear(); -142 -143 versions.put("cpe:/a:springsource:spring_framework:3.2.5", Boolean.FALSE); -144 versions.put("cpe:/a:springsource:spring_framework:3.2.6", Boolean.FALSE); -145 versions.put("cpe:/a:springsource:spring_framework:3.2.7", Boolean.TRUE); -146 -147 versions.put("cpe:/a:springsource:spring_framework:4.0.1", Boolean.TRUE); -148 versions.put("cpe:/a:springsource:spring_framework:4.0.0:m1", Boolean.FALSE); -149 versions.put("cpe:/a:springsource:spring_framework:4.0.0:m2", Boolean.FALSE); -150 versions.put("cpe:/a:springsource:spring_framework:4.0.0:rc1", Boolean.FALSE); -151 -152 identifiedVersion = new DependencyVersion("3.2.2"); -153 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); -154 Assert.assertEquals("cpe:/a:springsource:spring_framework:3.2.7", results.getKey()); -155 Assert.assertTrue(results.getValue()); -156 identifiedVersion = new DependencyVersion("3.2.12"); -157 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); -158 Assert.assertNull(results); -159 -160 identifiedVersion = new DependencyVersion("4.0.0"); -161 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); -162 Assert.assertEquals("cpe:/a:springsource:spring_framework:4.0.1", results.getKey()); -163 Assert.assertTrue(results.getValue()); -164 identifiedVersion = new DependencyVersion("4.1.0"); -165 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); -166 Assert.assertNull(results); -167 -168 versions.clear(); -169 -170 versions.put("cpe:/a:jruby:jruby:-", Boolean.FALSE); -171 identifiedVersion = new DependencyVersion("1.6.3"); -172 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); -173 Assert.assertNotNull(results); -174 } finally { -175 if (instance != null) { -176 instance.close(); -177 } -178 } -179 } -180 -181 } +20 import org.owasp.dependencycheck.BaseDBTestCase; +21 import java.util.HashMap; +22 import java.util.List; +23 import java.util.Map; +24 import java.util.Map.Entry; +25 import java.util.Set; +26 import org.junit.Assert; +27 import static org.junit.Assert.assertTrue; +28 import org.junit.Test; +29 import org.owasp.dependencycheck.dependency.Vulnerability; +30 import org.owasp.dependencycheck.dependency.VulnerableSoftware; +31 import org.owasp.dependencycheck.utils.DependencyVersion; +32 +33 /** +34 * +35 * @author Jeremy Long +36 */ +37 public class CveDBIntegrationTest extends BaseDBTestCase { +38 +39 /** +40 * Pretty useless tests of open, commit, and close methods, of class CveDB. +41 */ +42 @Test +43 public void testOpen() throws Exception { +44 CveDB instance = null; +45 try { +46 instance = new CveDB(); +47 instance.open(); +48 instance.commit(); +49 } finally { +50 if (instance != null) { +51 instance.close(); +52 } +53 } +54 } +55 +56 /** +57 * Test of getCPEs method, of class CveDB. +58 */ +59 @Test +60 public void testGetCPEs() throws Exception { +61 CveDB instance = null; +62 try { +63 instance = new CveDB(); +64 String vendor = "apache"; +65 String product = "struts"; +66 instance.open(); +67 Set<VulnerableSoftware> result = instance.getCPEs(vendor, product); +68 assertTrue(result.size() > 5); +69 } finally { +70 if (instance != null) { +71 instance.close(); +72 } +73 } +74 } +75 +76 /** +77 * Test of getVulnerabilities method, of class CveDB. +78 */ +79 @Test +80 public void testGetVulnerabilities() throws Exception { +81 String cpeStr = "cpe:/a:apache:struts:2.1.2"; +82 CveDB instance = null; +83 List<Vulnerability> results; +84 try { +85 instance = new CveDB(); +86 instance.open(); +87 results = instance.getVulnerabilities(cpeStr); +88 assertTrue(results.size() > 5); +89 cpeStr = "cpe:/a:jruby:jruby:1.6.3"; +90 results = instance.getVulnerabilities(cpeStr); +91 assertTrue(results.size() > 1); +92 +93 boolean found = false; +94 String expected = "CVE-2011-4838"; +95 for (Vulnerability v : results) { +96 if (expected.equals(v.getName())) { +97 found = true; +98 break; +99 } +100 } +101 assertTrue("Expected " + expected + ", but was not identified", found); +102 +103 found = false; +104 expected = "CVE-2012-5370"; +105 for (Vulnerability v : results) { +106 if (expected.equals(v.getName())) { +107 found = true; +108 break; +109 } +110 } +111 assertTrue("Expected " + expected + ", but was not identified", found); +112 +113 } finally { +114 if (instance != null) { +115 instance.close(); +116 } +117 } +118 } +119 +120 /** +121 * Test of getMatchingSoftware method, of class CveDB. +122 */ +123 @Test +124 public void testGetMatchingSoftware() throws Exception { +125 CveDB instance = null; +126 Map<String, Boolean> versions = new HashMap<String, Boolean>(); +127 DependencyVersion identifiedVersion = new DependencyVersion("1.0.1o"); +128 versions.put("cpe:/a:openssl:openssl:1.0.1e", Boolean.FALSE); +129 try { +130 instance = new CveDB(); +131 Entry<String, Boolean> results = instance.getMatchingSoftware(versions, "openssl", "openssl", identifiedVersion); +132 Assert.assertNull(results); +133 versions.put("cpe:/a:openssl:openssl:1.0.1p", Boolean.FALSE); +134 results = instance.getMatchingSoftware(versions, "openssl", "openssl", identifiedVersion); +135 Assert.assertNull(results); +136 +137 versions.put("cpe:/a:openssl:openssl:1.0.1q", Boolean.TRUE); +138 results = instance.getMatchingSoftware(versions, "openssl", "openssl", identifiedVersion); +139 Assert.assertNotNull(results); +140 Assert.assertEquals("cpe:/a:openssl:openssl:1.0.1q", results.getKey()); +141 +142 versions.clear(); +143 +144 versions.put("cpe:/a:springsource:spring_framework:3.2.5", Boolean.FALSE); +145 versions.put("cpe:/a:springsource:spring_framework:3.2.6", Boolean.FALSE); +146 versions.put("cpe:/a:springsource:spring_framework:3.2.7", Boolean.TRUE); +147 +148 versions.put("cpe:/a:springsource:spring_framework:4.0.1", Boolean.TRUE); +149 versions.put("cpe:/a:springsource:spring_framework:4.0.0:m1", Boolean.FALSE); +150 versions.put("cpe:/a:springsource:spring_framework:4.0.0:m2", Boolean.FALSE); +151 versions.put("cpe:/a:springsource:spring_framework:4.0.0:rc1", Boolean.FALSE); +152 +153 identifiedVersion = new DependencyVersion("3.2.2"); +154 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); +155 Assert.assertEquals("cpe:/a:springsource:spring_framework:3.2.7", results.getKey()); +156 Assert.assertTrue(results.getValue()); +157 identifiedVersion = new DependencyVersion("3.2.12"); +158 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); +159 Assert.assertNull(results); +160 +161 identifiedVersion = new DependencyVersion("4.0.0"); +162 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); +163 Assert.assertEquals("cpe:/a:springsource:spring_framework:4.0.1", results.getKey()); +164 Assert.assertTrue(results.getValue()); +165 identifiedVersion = new DependencyVersion("4.1.0"); +166 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); +167 Assert.assertNull(results); +168 +169 versions.clear(); +170 +171 versions.put("cpe:/a:jruby:jruby:-", Boolean.FALSE); +172 identifiedVersion = new DependencyVersion("1.6.3"); +173 results = instance.getMatchingSoftware(versions, "springsource", "spring_framework", identifiedVersion); +174 Assert.assertNotNull(results); +175 } finally { +176 if (instance != null) { +177 instance.close(); +178 } +179 } +180 } +181 +182 }
      diff --git a/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBMySQLTest.html b/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBMySQLTest.html index eb7d87933..9202e32af 100644 --- a/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBMySQLTest.html +++ b/xref-test/org/owasp/dependencycheck/data/nvdcve/CveDBMySQLTest.html @@ -33,84 +33,88 @@ 25 import org.junit.Before; 26 import org.junit.BeforeClass; 27 import org.junit.Test; -28 import org.owasp.dependencycheck.dependency.VulnerableSoftware; -29 -30 /** -31 * -32 * @author Jeremy Long -33 */ -34 public class CveDBMySQLTest { -35 -36 @BeforeClass -37 public static void setUpClass() { -38 } -39 -40 @AfterClass -41 public static void tearDownClass() { -42 } -43 -44 @Before -45 public void setUp() throws Exception { +28 import org.owasp.dependencycheck.dependency.Vulnerability; +29 import org.owasp.dependencycheck.dependency.VulnerableSoftware; +30 import org.owasp.dependencycheck.utils.Settings; +31 +32 /** +33 * +34 * @author Jeremy Long +35 */ +36 public class CveDBMySQLTest { +37 +38 @BeforeClass +39 public static void setUpClass() { +40 Settings.initialize(); +41 } +42 +43 @AfterClass +44 public static void tearDownClass() { +45 Settings.cleanup(); 46 } 47 -48 @After -49 public void tearDown() throws Exception { +48 @Before +49 public void setUp() throws Exception { 50 } 51 -52 /** -53 * Pretty useless tests of open, commit, and close methods, of class CveDB. -54 */ -55 @Test -56 public void testOpen() throws DatabaseException { -57 try { -58 CveDB instance = new CveDB(); -59 instance.open(); -60 instance.close(); -61 } catch (DatabaseException ex) { -62 System.out.println("Unable to connect to the My SQL database; verify that the db server is running and that the schema has been generated"); -63 throw ex; -64 } -65 } -66 -67 /** -68 * Test of getCPEs method, of class CveDB. -69 */ -70 @Test -71 public void testGetCPEs() throws Exception { -72 CveDB instance = new CveDB(); -73 try { -74 String vendor = "apache"; -75 String product = "struts"; -76 instance.open(); -77 Set<VulnerableSoftware> result = instance.getCPEs(vendor, product); -78 assertTrue("Has data been loaded into the MySQL DB? if not consider using the CLI to populate it", result.size() > 5); -79 } catch (Exception ex) { -80 System.out.println("Unable to access the My SQL database; verify that the db server is running and that the schema has been generated"); -81 throw ex; -82 } finally { -83 instance.close(); -84 } -85 } -86 -87 /** -88 * Test of getVulnerabilities method, of class CveDB. -89 */ -90 @Test -91 public void testGetVulnerabilities() throws Exception { -92 String cpeStr = "cpe:/a:apache:struts:2.1.2"; -93 CveDB instance = new CveDB(); -94 try { -95 instance.open(); -96 List result = instance.getVulnerabilities(cpeStr); -97 assertTrue(result.size() > 5); -98 } catch (Exception ex) { -99 System.out.println("Unable to access the My SQL database; verify that the db server is running and that the schema has been generated"); -100 throw ex; -101 } finally { -102 instance.close(); -103 } -104 } -105 } +52 @After +53 public void tearDown() throws Exception { +54 } +55 +56 /** +57 * Pretty useless tests of open, commit, and close methods, of class CveDB. +58 */ +59 @Test +60 public void testOpen() throws DatabaseException { +61 try { +62 CveDB instance = new CveDB(); +63 instance.open(); +64 instance.close(); +65 } catch (DatabaseException ex) { +66 System.out.println("Unable to connect to the My SQL database; verify that the db server is running and that the schema has been generated"); +67 throw ex; +68 } +69 } +70 +71 /** +72 * Test of getCPEs method, of class CveDB. +73 */ +74 @Test +75 public void testGetCPEs() throws Exception { +76 CveDB instance = new CveDB(); +77 try { +78 String vendor = "apache"; +79 String product = "struts"; +80 instance.open(); +81 Set<VulnerableSoftware> result = instance.getCPEs(vendor, product); +82 assertTrue("Has data been loaded into the MySQL DB? if not consider using the CLI to populate it", result.size() > 5); +83 } catch (Exception ex) { +84 System.out.println("Unable to access the My SQL database; verify that the db server is running and that the schema has been generated"); +85 throw ex; +86 } finally { +87 instance.close(); +88 } +89 } +90 +91 /** +92 * Test of getVulnerabilities method, of class CveDB. +93 */ +94 @Test +95 public void testGetVulnerabilities() throws Exception { +96 String cpeStr = "cpe:/a:apache:struts:2.1.2"; +97 CveDB instance = new CveDB(); +98 try { +99 instance.open(); +100 List<Vulnerability> result = instance.getVulnerabilities(cpeStr); +101 assertTrue(result.size() > 5); +102 } catch (Exception ex) { +103 System.out.println("Unable to access the My SQL database; verify that the db server is running and that the schema has been generated"); +104 throw ex; +105 } finally { +106 instance.close(); +107 } +108 } +109 }
      diff --git a/xref-test/org/owasp/dependencycheck/data/nvdcve/DatabasePropertiesIntegrationTest.html b/xref-test/org/owasp/dependencycheck/data/nvdcve/DatabasePropertiesIntegrationTest.html index 2588517aa..73ed3e2fe 100644 --- a/xref-test/org/owasp/dependencycheck/data/nvdcve/DatabasePropertiesIntegrationTest.html +++ b/xref-test/org/owasp/dependencycheck/data/nvdcve/DatabasePropertiesIntegrationTest.html @@ -25,132 +25,133 @@ 17 */ 18 package org.owasp.dependencycheck.data.nvdcve; 19 -20 import java.util.Properties; -21 import static org.junit.Assert.assertEquals; -22 import static org.junit.Assert.assertTrue; -23 import org.junit.Test; -24 import org.owasp.dependencycheck.data.update.nvd.NvdCveInfo; -25 -26 /** -27 * -28 * @author Jeremy Long -29 */ -30 public class DatabasePropertiesIntegrationTest extends BaseDBTestCase { -31 -32 /** -33 * Test of isEmpty method, of class DatabaseProperties. -34 */ -35 @Test -36 public void testIsEmpty() throws Exception { -37 CveDB cveDB = null; -38 try { -39 cveDB = new CveDB(); -40 cveDB.open(); -41 DatabaseProperties instance = cveDB.getDatabaseProperties(); -42 boolean expResult = false; -43 boolean result = instance.isEmpty(); -44 //no exception means the call worked... whether or not it is empty depends on if the db is new -45 //assertEquals(expResult, result); -46 } finally { -47 if (cveDB != null) { -48 cveDB.close(); -49 } -50 } -51 } -52 -53 /** -54 * Test of save method, of class DatabaseProperties. -55 */ -56 @Test -57 public void testSave() throws Exception { -58 NvdCveInfo updatedValue = new NvdCveInfo(); -59 String key = "test"; -60 long expected = 1337; -61 updatedValue.setId(key); -62 updatedValue.setTimestamp(expected); -63 CveDB cveDB = null; -64 try { -65 cveDB = new CveDB(); -66 cveDB.open(); -67 DatabaseProperties instance = cveDB.getDatabaseProperties(); -68 instance.save(updatedValue); -69 //reload the properties -70 cveDB.close(); -71 cveDB = new CveDB(); -72 cveDB.open(); -73 instance = cveDB.getDatabaseProperties(); -74 long results = Long.parseLong(instance.getProperty("NVD CVE " + key)); -75 assertEquals(expected, results); -76 } finally { -77 if (cveDB != null) { -78 cveDB.close(); -79 } -80 } -81 } -82 -83 /** -84 * Test of getProperty method, of class DatabaseProperties. -85 */ -86 @Test -87 public void testGetProperty_String_String() throws Exception { -88 String key = "doesn't exist"; -89 String defaultValue = "default"; -90 CveDB cveDB = null; -91 try { -92 cveDB = new CveDB(); -93 cveDB.open(); -94 DatabaseProperties instance = cveDB.getDatabaseProperties(); -95 String expResult = "default"; -96 String result = instance.getProperty(key, defaultValue); -97 assertEquals(expResult, result); -98 } finally { -99 if (cveDB != null) { -100 cveDB.close(); -101 } -102 } -103 } -104 -105 /** -106 * Test of getProperty method, of class DatabaseProperties. -107 */ -108 @Test -109 public void testGetProperty_String() throws DatabaseException { -110 String key = "version"; -111 CveDB cveDB = null; -112 try { -113 cveDB = new CveDB(); -114 cveDB.open(); -115 DatabaseProperties instance = cveDB.getDatabaseProperties(); -116 String result = instance.getProperty(key); -117 double version = Double.parseDouble(result); -118 assertTrue(version >= 2.8); -119 assertTrue(version <= 10); -120 } finally { -121 if (cveDB != null) { -122 cveDB.close(); -123 } -124 } -125 } -126 -127 /** -128 * Test of getProperties method, of class DatabaseProperties. -129 */ -130 @Test -131 public void testGetProperties() throws DatabaseException { -132 CveDB cveDB = null; -133 try { -134 cveDB = new CveDB(); -135 cveDB.open(); -136 DatabaseProperties instance = cveDB.getDatabaseProperties(); -137 Properties result = instance.getProperties(); -138 assertTrue(result.size() > 0); -139 } finally { -140 if (cveDB != null) { -141 cveDB.close(); -142 } -143 } -144 } -145 } +20 import org.owasp.dependencycheck.BaseDBTestCase; +21 import java.util.Properties; +22 import static org.junit.Assert.assertEquals; +23 import static org.junit.Assert.assertTrue; +24 import org.junit.Test; +25 import org.owasp.dependencycheck.data.update.nvd.NvdCveInfo; +26 +27 /** +28 * +29 * @author Jeremy Long +30 */ +31 public class DatabasePropertiesIntegrationTest extends BaseDBTestCase { +32 +33 /** +34 * Test of isEmpty method, of class DatabaseProperties. +35 */ +36 @Test +37 public void testIsEmpty() throws Exception { +38 CveDB cveDB = null; +39 try { +40 cveDB = new CveDB(); +41 cveDB.open(); +42 DatabaseProperties instance = cveDB.getDatabaseProperties(); +43 boolean expResult = false; +44 boolean result = instance.isEmpty(); +45 //no exception means the call worked... whether or not it is empty depends on if the db is new +46 //assertEquals(expResult, result); +47 } finally { +48 if (cveDB != null) { +49 cveDB.close(); +50 } +51 } +52 } +53 +54 /** +55 * Test of save method, of class DatabaseProperties. +56 */ +57 @Test +58 public void testSave() throws Exception { +59 NvdCveInfo updatedValue = new NvdCveInfo(); +60 String key = "test"; +61 long expected = 1337; +62 updatedValue.setId(key); +63 updatedValue.setTimestamp(expected); +64 CveDB cveDB = null; +65 try { +66 cveDB = new CveDB(); +67 cveDB.open(); +68 DatabaseProperties instance = cveDB.getDatabaseProperties(); +69 instance.save(updatedValue); +70 //reload the properties +71 cveDB.close(); +72 cveDB = new CveDB(); +73 cveDB.open(); +74 instance = cveDB.getDatabaseProperties(); +75 long results = Long.parseLong(instance.getProperty("NVD CVE " + key)); +76 assertEquals(expected, results); +77 } finally { +78 if (cveDB != null) { +79 cveDB.close(); +80 } +81 } +82 } +83 +84 /** +85 * Test of getProperty method, of class DatabaseProperties. +86 */ +87 @Test +88 public void testGetProperty_String_String() throws Exception { +89 String key = "doesn't exist"; +90 String defaultValue = "default"; +91 CveDB cveDB = null; +92 try { +93 cveDB = new CveDB(); +94 cveDB.open(); +95 DatabaseProperties instance = cveDB.getDatabaseProperties(); +96 String expResult = "default"; +97 String result = instance.getProperty(key, defaultValue); +98 assertEquals(expResult, result); +99 } finally { +100 if (cveDB != null) { +101 cveDB.close(); +102 } +103 } +104 } +105 +106 /** +107 * Test of getProperty method, of class DatabaseProperties. +108 */ +109 @Test +110 public void testGetProperty_String() throws DatabaseException { +111 String key = "version"; +112 CveDB cveDB = null; +113 try { +114 cveDB = new CveDB(); +115 cveDB.open(); +116 DatabaseProperties instance = cveDB.getDatabaseProperties(); +117 String result = instance.getProperty(key); +118 double version = Double.parseDouble(result); +119 assertTrue(version >= 2.8); +120 assertTrue(version <= 10); +121 } finally { +122 if (cveDB != null) { +123 cveDB.close(); +124 } +125 } +126 } +127 +128 /** +129 * Test of getProperties method, of class DatabaseProperties. +130 */ +131 @Test +132 public void testGetProperties() throws DatabaseException { +133 CveDB cveDB = null; +134 try { +135 cveDB = new CveDB(); +136 cveDB.open(); +137 DatabaseProperties instance = cveDB.getDatabaseProperties(); +138 Properties result = instance.getProperties(); +139 assertTrue(result.size() > 0); +140 } finally { +141 if (cveDB != null) { +142 cveDB.close(); +143 } +144 } +145 } +146 }
      diff --git a/xref-test/org/owasp/dependencycheck/data/nvdcve/package-frame.html b/xref-test/org/owasp/dependencycheck/data/nvdcve/package-frame.html index dff4ba5c3..dbc8a2c28 100644 --- a/xref-test/org/owasp/dependencycheck/data/nvdcve/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/data/nvdcve/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.nvdcve + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.nvdcve @@ -16,7 +16,7 @@
      • - BaseDBTestCase + ConnectionFactoryTest
      • CveDBIntegrationTest diff --git a/xref-test/org/owasp/dependencycheck/data/nvdcve/package-summary.html b/xref-test/org/owasp/dependencycheck/data/nvdcve/package-summary.html index 642992c59..aa6c475fd 100644 --- a/xref-test/org/owasp/dependencycheck/data/nvdcve/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/data/nvdcve/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.nvdcve + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.nvdcve @@ -37,7 +37,7 @@ - BaseDBTestCase + ConnectionFactoryTest diff --git a/xref-test/org/owasp/dependencycheck/data/update/BaseUpdaterTest.html b/xref-test/org/owasp/dependencycheck/data/update/BaseUpdaterTest.html index dc4183a46..71d0ed8a5 100644 --- a/xref-test/org/owasp/dependencycheck/data/update/BaseUpdaterTest.html +++ b/xref-test/org/owasp/dependencycheck/data/update/BaseUpdaterTest.html @@ -26,7 +26,7 @@ 18 package org.owasp.dependencycheck.data.update; 19 20 import org.junit.Test; -21 import org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase; +21 import org.owasp.dependencycheck.BaseDBTestCase; 22 import org.owasp.dependencycheck.data.nvdcve.CveDB; 23 import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties; 24 import org.owasp.dependencycheck.data.update.exception.UpdateException; @@ -38,7 +38,7 @@ 30 * 31 * @author Jeremy Long 32 */ -33 public class BaseUpdaterTest extends BaseDBTestCase { +33 public class BaseUpdaterTest extends BaseDBTestCase { 34 35 /** 36 * Test of getCveDB method, of class BaseUpdater. diff --git a/xref-test/org/owasp/dependencycheck/data/update/nvd/package-frame.html b/xref-test/org/owasp/dependencycheck/data/update/nvd/package-frame.html index 31d400bda..66cb71204 100644 --- a/xref-test/org/owasp/dependencycheck/data/update/nvd/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/data/update/nvd/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.update.nvd + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.update.nvd diff --git a/xref-test/org/owasp/dependencycheck/data/update/nvd/package-summary.html b/xref-test/org/owasp/dependencycheck/data/update/nvd/package-summary.html index 3505a6c3d..83b4d1820 100644 --- a/xref-test/org/owasp/dependencycheck/data/update/nvd/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/data/update/nvd/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.update.nvd + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.update.nvd diff --git a/xref-test/org/owasp/dependencycheck/data/update/package-frame.html b/xref-test/org/owasp/dependencycheck/data/update/package-frame.html index 82b8328bc..4d305671e 100644 --- a/xref-test/org/owasp/dependencycheck/data/update/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/data/update/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.update + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.update diff --git a/xref-test/org/owasp/dependencycheck/data/update/package-summary.html b/xref-test/org/owasp/dependencycheck/data/update/package-summary.html index 0f85698d3..2c4119d53 100644 --- a/xref-test/org/owasp/dependencycheck/data/update/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/data/update/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.update + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.update diff --git a/xref-test/org/owasp/dependencycheck/dependency/DependencyTest.html b/xref-test/org/owasp/dependencycheck/dependency/DependencyTest.html index f29864b61..7ff2c9153 100644 --- a/xref-test/org/owasp/dependencycheck/dependency/DependencyTest.html +++ b/xref-test/org/owasp/dependencycheck/dependency/DependencyTest.html @@ -193,133 +193,132 @@ 185 @Test 186 public void testGetIdentifiers() { 187 Dependency instance = new Dependency(); -188 List expResult = null; -189 Set<Identifier> result = instance.getIdentifiers(); -190 -191 assertTrue(true); //this is just a getter setter pair. -192 } -193 -194 /** -195 * Test of setIdentifiers method, of class Dependency. -196 */ -197 @Test -198 public void testSetIdentifiers() { -199 Set<Identifier> identifiers = null; -200 Dependency instance = new Dependency(); -201 instance.setIdentifiers(identifiers); -202 assertTrue(true); //this is just a getter setter pair. -203 } -204 -205 /** -206 * Test of addIdentifier method, of class Dependency. -207 */ -208 @Test -209 public void testAddIdentifier() { -210 String type = "cpe"; -211 String value = "cpe:/a:apache:struts:2.1.2"; -212 String url = "http://somewhere"; -213 Identifier expResult = new Identifier(type, value, url); -214 -215 Dependency instance = new Dependency(); -216 instance.addIdentifier(type, value, url); -217 assertEquals(1, instance.getIdentifiers().size()); -218 assertTrue("Identifier doesn't contain expected result.", instance.getIdentifiers().contains(expResult)); -219 } -220 -221 /** -222 * Test of getEvidence method, of class Dependency. -223 */ -224 @Test -225 public void testGetEvidence() { -226 Dependency instance = new Dependency(); -227 EvidenceCollection expResult = null; -228 EvidenceCollection result = instance.getEvidence(); -229 assertTrue(true); //this is just a getter setter pair. -230 } -231 -232 /** -233 * Test of getEvidenceUsed method, of class Dependency. -234 */ -235 @Test -236 public void testGetEvidenceUsed() { -237 Dependency instance = new Dependency(); -238 String expResult = "used"; -239 -240 instance.getProductEvidence().addEvidence("used", "used", "used", Confidence.HIGH); -241 instance.getProductEvidence().addEvidence("not", "not", "not", Confidence.MEDIUM); -242 for (Evidence e : instance.getProductEvidence().iterator(Confidence.HIGH)) { -243 String use = e.getValue(); -244 } -245 -246 EvidenceCollection result = instance.getEvidenceUsed(); -247 -248 assertEquals(1, result.size()); -249 assertTrue(result.containsUsedString(expResult)); -250 } -251 -252 /** -253 * Test of getVendorEvidence method, of class Dependency. -254 */ -255 @Test -256 public void testGetVendorEvidence() { -257 Dependency instance = new Dependency(); -258 EvidenceCollection expResult = null; -259 EvidenceCollection result = instance.getVendorEvidence(); -260 assertTrue(true); //this is just a getter setter pair. -261 } -262 -263 /** -264 * Test of getProductEvidence method, of class Dependency. -265 */ -266 @Test -267 public void testGetProductEvidence() { -268 Dependency instance = new Dependency(); -269 EvidenceCollection expResult = null; -270 EvidenceCollection result = instance.getProductEvidence(); -271 assertTrue(true); //this is just a getter setter pair. -272 } -273 -274 /** -275 * Test of getVersionEvidence method, of class Dependency. -276 */ -277 @Test -278 public void testGetVersionEvidence() { -279 Dependency instance = new Dependency(); -280 EvidenceCollection expResult = null; -281 EvidenceCollection result = instance.getVersionEvidence(); -282 assertTrue(true); //this is just a getter setter pair. -283 } -284 -285 /** -286 * Test of addAsEvidence method, of class Dependency. -287 */ -288 @Test -289 public void testAddAsEvidence() { -290 Dependency instance = new Dependency(); -291 MavenArtifact mavenArtifact = new MavenArtifact("group", "artifact", "version", "url"); -292 instance.addAsEvidence("pom", mavenArtifact, Confidence.HIGH); -293 assertTrue(instance.getEvidence().contains(Confidence.HIGH)); -294 assertFalse(instance.getEvidence().getEvidence("pom", "groupid").isEmpty()); -295 assertFalse(instance.getEvidence().getEvidence("pom", "artifactid").isEmpty()); -296 assertFalse(instance.getEvidence().getEvidence("pom", "version").isEmpty()); -297 assertFalse(instance.getIdentifiers().isEmpty()); -298 } -299 -300 /** -301 * Test of addAsEvidence method, of class Dependency. -302 */ -303 @Test -304 public void testAddAsEvidenceWithEmptyArtefact() { -305 Dependency instance = new Dependency(); -306 MavenArtifact mavenArtifact = new MavenArtifact(null, null, null, null); -307 instance.addAsEvidence("pom", mavenArtifact, Confidence.HIGH); -308 assertFalse(instance.getEvidence().contains(Confidence.HIGH)); -309 assertTrue(instance.getEvidence().getEvidence("pom", "groupid").isEmpty()); -310 assertTrue(instance.getEvidence().getEvidence("pom", "artifactid").isEmpty()); -311 assertTrue(instance.getEvidence().getEvidence("pom", "version").isEmpty()); -312 assertTrue(instance.getIdentifiers().isEmpty()); -313 } -314 } +188 Set<Identifier> result = instance.getIdentifiers(); +189 +190 assertTrue(true); //this is just a getter setter pair. +191 } +192 +193 /** +194 * Test of setIdentifiers method, of class Dependency. +195 */ +196 @Test +197 public void testSetIdentifiers() { +198 Set<Identifier> identifiers = null; +199 Dependency instance = new Dependency(); +200 instance.setIdentifiers(identifiers); +201 assertTrue(true); //this is just a getter setter pair. +202 } +203 +204 /** +205 * Test of addIdentifier method, of class Dependency. +206 */ +207 @Test +208 public void testAddIdentifier() { +209 String type = "cpe"; +210 String value = "cpe:/a:apache:struts:2.1.2"; +211 String url = "http://somewhere"; +212 Identifier expResult = new Identifier(type, value, url); +213 +214 Dependency instance = new Dependency(); +215 instance.addIdentifier(type, value, url); +216 assertEquals(1, instance.getIdentifiers().size()); +217 assertTrue("Identifier doesn't contain expected result.", instance.getIdentifiers().contains(expResult)); +218 } +219 +220 /** +221 * Test of getEvidence method, of class Dependency. +222 */ +223 @Test +224 public void testGetEvidence() { +225 Dependency instance = new Dependency(); +226 EvidenceCollection expResult = null; +227 EvidenceCollection result = instance.getEvidence(); +228 assertTrue(true); //this is just a getter setter pair. +229 } +230 +231 /** +232 * Test of getEvidenceUsed method, of class Dependency. +233 */ +234 @Test +235 public void testGetEvidenceUsed() { +236 Dependency instance = new Dependency(); +237 String expResult = "used"; +238 +239 instance.getProductEvidence().addEvidence("used", "used", "used", Confidence.HIGH); +240 instance.getProductEvidence().addEvidence("not", "not", "not", Confidence.MEDIUM); +241 for (Evidence e : instance.getProductEvidence().iterator(Confidence.HIGH)) { +242 String use = e.getValue(); +243 } +244 +245 EvidenceCollection result = instance.getEvidenceUsed(); +246 +247 assertEquals(1, result.size()); +248 assertTrue(result.containsUsedString(expResult)); +249 } +250 +251 /** +252 * Test of getVendorEvidence method, of class Dependency. +253 */ +254 @Test +255 public void testGetVendorEvidence() { +256 Dependency instance = new Dependency(); +257 EvidenceCollection expResult = null; +258 EvidenceCollection result = instance.getVendorEvidence(); +259 assertTrue(true); //this is just a getter setter pair. +260 } +261 +262 /** +263 * Test of getProductEvidence method, of class Dependency. +264 */ +265 @Test +266 public void testGetProductEvidence() { +267 Dependency instance = new Dependency(); +268 EvidenceCollection expResult = null; +269 EvidenceCollection result = instance.getProductEvidence(); +270 assertTrue(true); //this is just a getter setter pair. +271 } +272 +273 /** +274 * Test of getVersionEvidence method, of class Dependency. +275 */ +276 @Test +277 public void testGetVersionEvidence() { +278 Dependency instance = new Dependency(); +279 EvidenceCollection expResult = null; +280 EvidenceCollection result = instance.getVersionEvidence(); +281 assertTrue(true); //this is just a getter setter pair. +282 } +283 +284 /** +285 * Test of addAsEvidence method, of class Dependency. +286 */ +287 @Test +288 public void testAddAsEvidence() { +289 Dependency instance = new Dependency(); +290 MavenArtifact mavenArtifact = new MavenArtifact("group", "artifact", "version", "url"); +291 instance.addAsEvidence("pom", mavenArtifact, Confidence.HIGH); +292 assertTrue(instance.getEvidence().contains(Confidence.HIGH)); +293 assertFalse(instance.getEvidence().getEvidence("pom", "groupid").isEmpty()); +294 assertFalse(instance.getEvidence().getEvidence("pom", "artifactid").isEmpty()); +295 assertFalse(instance.getEvidence().getEvidence("pom", "version").isEmpty()); +296 assertFalse(instance.getIdentifiers().isEmpty()); +297 } +298 +299 /** +300 * Test of addAsEvidence method, of class Dependency. +301 */ +302 @Test +303 public void testAddAsEvidenceWithEmptyArtefact() { +304 Dependency instance = new Dependency(); +305 MavenArtifact mavenArtifact = new MavenArtifact(null, null, null, null); +306 instance.addAsEvidence("pom", mavenArtifact, Confidence.HIGH); +307 assertFalse(instance.getEvidence().contains(Confidence.HIGH)); +308 assertTrue(instance.getEvidence().getEvidence("pom", "groupid").isEmpty()); +309 assertTrue(instance.getEvidence().getEvidence("pom", "artifactid").isEmpty()); +310 assertTrue(instance.getEvidence().getEvidence("pom", "version").isEmpty()); +311 assertTrue(instance.getIdentifiers().isEmpty()); +312 } +313 }
        diff --git a/xref-test/org/owasp/dependencycheck/dependency/package-frame.html b/xref-test/org/owasp/dependencycheck/dependency/package-frame.html index b619be626..35afe739c 100644 --- a/xref-test/org/owasp/dependencycheck/dependency/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/dependency/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.dependency + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.dependency diff --git a/xref-test/org/owasp/dependencycheck/dependency/package-summary.html b/xref-test/org/owasp/dependencycheck/dependency/package-summary.html index b8b53b435..f4d8932f5 100644 --- a/xref-test/org/owasp/dependencycheck/dependency/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/dependency/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.dependency + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.dependency diff --git a/xref-test/org/owasp/dependencycheck/maven/BaseDependencyCheckMojoTest.html b/xref-test/org/owasp/dependencycheck/maven/BaseDependencyCheckMojoTest.html index 73f8571a9..86b582a35 100644 --- a/xref-test/org/owasp/dependencycheck/maven/BaseDependencyCheckMojoTest.html +++ b/xref-test/org/owasp/dependencycheck/maven/BaseDependencyCheckMojoTest.html @@ -59,7 +59,7 @@ 51 */ 52 public boolean canRun() { 53 String version = System.getProperty("java.version"); -54 int length = version.indexOf(".", version.indexOf(".") + 1); +54 int length = version.indexOf('.', version.indexOf('.') + 1); 55 version = version.substring(0, length); 56 57 double v = Double.parseDouble(version); diff --git a/xref-test/org/owasp/dependencycheck/maven/package-frame.html b/xref-test/org/owasp/dependencycheck/maven/package-frame.html index 97731c046..250ea84f4 100644 --- a/xref-test/org/owasp/dependencycheck/maven/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/maven/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.maven + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.maven diff --git a/xref-test/org/owasp/dependencycheck/maven/package-summary.html b/xref-test/org/owasp/dependencycheck/maven/package-summary.html index eb38ada1d..a4c9ccdd3 100644 --- a/xref-test/org/owasp/dependencycheck/maven/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/maven/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.maven + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.maven diff --git a/xref-test/org/owasp/dependencycheck/package-frame.html b/xref-test/org/owasp/dependencycheck/package-frame.html index c00be70d2..03a903678 100644 --- a/xref-test/org/owasp/dependencycheck/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck @@ -17,6 +17,9 @@
        • AppTest +
        • +
        • + BaseDBTestCase
        • BaseTest diff --git a/xref-test/org/owasp/dependencycheck/package-summary.html b/xref-test/org/owasp/dependencycheck/package-summary.html index 3603cc11c..49b07c954 100644 --- a/xref-test/org/owasp/dependencycheck/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck @@ -39,6 +39,11 @@ AppTest + + + + BaseDBTestCase + diff --git a/xref-test/org/owasp/dependencycheck/reporting/ReportGeneratorIntegrationTest.html b/xref-test/org/owasp/dependencycheck/reporting/ReportGeneratorIntegrationTest.html index bcbdf2277..a3736cdf0 100644 --- a/xref-test/org/owasp/dependencycheck/reporting/ReportGeneratorIntegrationTest.html +++ b/xref-test/org/owasp/dependencycheck/reporting/ReportGeneratorIntegrationTest.html @@ -48,7 +48,7 @@ 40 41 @Before 42 public void setUp() throws Exception { -43 org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase.ensureDBExists(); +43 org.owasp.dependencycheck.BaseDBTestCase.ensureDBExists(); 44 } 45 46 /** diff --git a/xref-test/org/owasp/dependencycheck/reporting/package-frame.html b/xref-test/org/owasp/dependencycheck/reporting/package-frame.html index cd69c0acf..7a51ce056 100644 --- a/xref-test/org/owasp/dependencycheck/reporting/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/reporting/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.reporting + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.reporting diff --git a/xref-test/org/owasp/dependencycheck/reporting/package-summary.html b/xref-test/org/owasp/dependencycheck/reporting/package-summary.html index bd6cc43b0..2ef73cc96 100644 --- a/xref-test/org/owasp/dependencycheck/reporting/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/reporting/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.reporting + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.reporting diff --git a/xref-test/org/owasp/dependencycheck/suppression/SuppressionParserTest.html b/xref-test/org/owasp/dependencycheck/suppression/SuppressionParserTest.html index 09add0ea4..febbdf203 100644 --- a/xref-test/org/owasp/dependencycheck/suppression/SuppressionParserTest.html +++ b/xref-test/org/owasp/dependencycheck/suppression/SuppressionParserTest.html @@ -69,7 +69,7 @@ 61 //File file = new File(this.getClass().getClassLoader().getResource("suppressions.xml").getPath()); 62 File file = BaseTest.getResourceAsFile(this, "suppressions.xml"); 63 SuppressionParser instance = new SuppressionParser(); -64 List result = instance.parseSuppressionRules(file); +64 List<SuppressionRule> result = instance.parseSuppressionRules(file); 65 assertTrue(result.size() > 3); 66 } 67 } diff --git a/xref-test/org/owasp/dependencycheck/suppression/SuppressionRuleTest.html b/xref-test/org/owasp/dependencycheck/suppression/SuppressionRuleTest.html index 8ba5311e9..72db0c9b2 100644 --- a/xref-test/org/owasp/dependencycheck/suppression/SuppressionRuleTest.html +++ b/xref-test/org/owasp/dependencycheck/suppression/SuppressionRuleTest.html @@ -315,220 +315,199 @@ 307 } 308 309 /** -310 * Test of countCharacter method, of class SuppressionRule. +310 * Test of identifierMatches method, of class SuppressionRule. 311 */ 312 @Test -313 public void testCountCharacter() { -314 String str = "cpe:/a:microsoft:.net_framework:4.5"; -315 char c = ':'; -316 SuppressionRule instance = new SuppressionRule(); -317 int expResult = 4; -318 int result = instance.countCharacter(str, c); -319 assertEquals(expResult, result); -320 str = "::"; -321 expResult = 2; -322 result = instance.countCharacter(str, c); -323 assertEquals(expResult, result); -324 str = "these are not the characters you are looking for"; -325 expResult = 0; -326 result = instance.countCharacter(str, c); +313 public void testCpeMatches() { +314 Identifier identifier = new Identifier("cpe", "cpe:/a:microsoft:.net_framework:4.5", "some url not needed for this test"); +315 +316 PropertyType cpe = new PropertyType(); +317 cpe.setValue("cpe:/a:microsoft:.net_framework:4.5"); +318 +319 SuppressionRule instance = new SuppressionRule(); +320 boolean expResult = true; +321 boolean result = instance.identifierMatches("cpe", cpe, identifier); +322 assertEquals(expResult, result); +323 +324 cpe.setValue("cpe:/a:microsoft:.net_framework:4.0"); +325 expResult = false; +326 result = instance.identifierMatches("cpe", cpe, identifier); 327 assertEquals(expResult, result); -328 } -329 -330 /** -331 * Test of identifierMatches method, of class SuppressionRule. -332 */ -333 @Test -334 public void testCpeMatches() { -335 Identifier identifier = new Identifier("cpe", "cpe:/a:microsoft:.net_framework:4.5", "some url not needed for this test"); -336 -337 PropertyType cpe = new PropertyType(); -338 cpe.setValue("cpe:/a:microsoft:.net_framework:4.5"); -339 -340 SuppressionRule instance = new SuppressionRule(); -341 boolean expResult = true; -342 boolean result = instance.identifierMatches("cpe", cpe, identifier); -343 assertEquals(expResult, result); -344 -345 cpe.setValue("cpe:/a:microsoft:.net_framework:4.0"); -346 expResult = false; -347 result = instance.identifierMatches("cpe", cpe, identifier); -348 assertEquals(expResult, result); -349 -350 cpe.setValue("CPE:/a:microsoft:.net_framework:4.5"); -351 cpe.setCaseSensitive(true); -352 expResult = false; -353 result = instance.identifierMatches("cpe", cpe, identifier); -354 assertEquals(expResult, result); -355 -356 cpe.setValue("cpe:/a:microsoft:.net_framework"); -357 cpe.setCaseSensitive(false); -358 expResult = true; -359 result = instance.identifierMatches("cpe", cpe, identifier); -360 assertEquals(expResult, result); -361 -362 cpe.setValue("cpe:/a:microsoft:.*"); -363 cpe.setRegex(true); -364 expResult = true; -365 result = instance.identifierMatches("cpe", cpe, identifier); -366 assertEquals(expResult, result); -367 -368 cpe.setValue("CPE:/a:microsoft:.*"); -369 cpe.setRegex(true); -370 cpe.setCaseSensitive(true); -371 expResult = false; -372 result = instance.identifierMatches("cpe", cpe, identifier); -373 assertEquals(expResult, result); -374 -375 cpe.setValue("cpe:/a:apache:.*"); -376 cpe.setRegex(true); -377 cpe.setCaseSensitive(false); -378 expResult = false; -379 result = instance.identifierMatches("cpe", cpe, identifier); -380 assertEquals(expResult, result); -381 -382 identifier = new Identifier("maven", "org.springframework:spring-core:2.5.5", "https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.springframework&a=spring-core&v=2.5.5&e=jar"); -383 cpe.setValue("org.springframework:spring-core:2.5.5"); -384 cpe.setRegex(false); -385 cpe.setCaseSensitive(false); -386 expResult = true; -387 result = instance.identifierMatches("maven", cpe, identifier); -388 assertEquals(expResult, result); -389 -390 cpe.setValue("org\\.springframework\\.security:spring.*"); -391 cpe.setRegex(true); -392 cpe.setCaseSensitive(false); -393 expResult = false; -394 result = instance.identifierMatches("maven", cpe, identifier); -395 assertEquals(expResult, result); -396 } -397 -398 /** -399 * Test of process method, of class SuppressionRule. -400 */ -401 @Test -402 public void testProcess() { -403 //File struts = new File(this.getClass().getClassLoader().getResource("struts2-core-2.1.2.jar").getPath()); -404 File struts = BaseTest.getResourceAsFile(this, "struts2-core-2.1.2.jar"); -405 Dependency dependency = new Dependency(struts); -406 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:4.5", "some url not needed for this test"); -407 String sha1 = dependency.getSha1sum(); -408 dependency.setSha1sum("384FAA82E193D4E4B0546059CA09572654BC3970"); -409 Vulnerability v = createVulnerability(); -410 dependency.addVulnerability(v); -411 -412 //cwe -413 SuppressionRule instance = new SuppressionRule(); -414 instance.setSha1(sha1); -415 instance.addCwe("287"); -416 instance.process(dependency); -417 assertEquals(1, dependency.getVulnerabilities().size()); -418 dependency.setSha1sum(sha1); -419 instance.process(dependency); -420 assertTrue(dependency.getVulnerabilities().isEmpty()); -421 assertEquals(1, dependency.getSuppressedVulnerabilities().size()); -422 -423 //cvss -424 dependency.addVulnerability(v); +328 +329 cpe.setValue("CPE:/a:microsoft:.net_framework:4.5"); +330 cpe.setCaseSensitive(true); +331 expResult = false; +332 result = instance.identifierMatches("cpe", cpe, identifier); +333 assertEquals(expResult, result); +334 +335 cpe.setValue("cpe:/a:microsoft:.net_framework"); +336 cpe.setCaseSensitive(false); +337 expResult = true; +338 result = instance.identifierMatches("cpe", cpe, identifier); +339 assertEquals(expResult, result); +340 +341 cpe.setValue("cpe:/a:microsoft:.*"); +342 cpe.setRegex(true); +343 expResult = true; +344 result = instance.identifierMatches("cpe", cpe, identifier); +345 assertEquals(expResult, result); +346 +347 cpe.setValue("CPE:/a:microsoft:.*"); +348 cpe.setRegex(true); +349 cpe.setCaseSensitive(true); +350 expResult = false; +351 result = instance.identifierMatches("cpe", cpe, identifier); +352 assertEquals(expResult, result); +353 +354 cpe.setValue("cpe:/a:apache:.*"); +355 cpe.setRegex(true); +356 cpe.setCaseSensitive(false); +357 expResult = false; +358 result = instance.identifierMatches("cpe", cpe, identifier); +359 assertEquals(expResult, result); +360 +361 identifier = new Identifier("maven", "org.springframework:spring-core:2.5.5", "https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.springframework&a=spring-core&v=2.5.5&e=jar"); +362 cpe.setValue("org.springframework:spring-core:2.5.5"); +363 cpe.setRegex(false); +364 cpe.setCaseSensitive(false); +365 expResult = true; +366 result = instance.identifierMatches("maven", cpe, identifier); +367 assertEquals(expResult, result); +368 +369 cpe.setValue("org\\.springframework\\.security:spring.*"); +370 cpe.setRegex(true); +371 cpe.setCaseSensitive(false); +372 expResult = false; +373 result = instance.identifierMatches("maven", cpe, identifier); +374 assertEquals(expResult, result); +375 } +376 +377 /** +378 * Test of process method, of class SuppressionRule. +379 */ +380 @Test +381 public void testProcess() { +382 //File struts = new File(this.getClass().getClassLoader().getResource("struts2-core-2.1.2.jar").getPath()); +383 File struts = BaseTest.getResourceAsFile(this, "struts2-core-2.1.2.jar"); +384 Dependency dependency = new Dependency(struts); +385 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:4.5", "some url not needed for this test"); +386 String sha1 = dependency.getSha1sum(); +387 dependency.setSha1sum("384FAA82E193D4E4B0546059CA09572654BC3970"); +388 Vulnerability v = createVulnerability(); +389 dependency.addVulnerability(v); +390 +391 //cwe +392 SuppressionRule instance = new SuppressionRule(); +393 instance.setSha1(sha1); +394 instance.addCwe("287"); +395 instance.process(dependency); +396 assertEquals(1, dependency.getVulnerabilities().size()); +397 dependency.setSha1sum(sha1); +398 instance.process(dependency); +399 assertTrue(dependency.getVulnerabilities().isEmpty()); +400 assertEquals(1, dependency.getSuppressedVulnerabilities().size()); +401 +402 //cvss +403 dependency.addVulnerability(v); +404 instance = new SuppressionRule(); +405 instance.addCvssBelow(5f); +406 instance.process(dependency); +407 assertEquals(1, dependency.getVulnerabilities().size()); +408 instance.addCvssBelow(8f); +409 instance.process(dependency); +410 assertTrue(dependency.getVulnerabilities().isEmpty()); +411 assertEquals(1, dependency.getSuppressedVulnerabilities().size()); +412 +413 //cve +414 dependency.addVulnerability(v); +415 instance = new SuppressionRule(); +416 instance.addCve("CVE-2012-1337"); +417 instance.process(dependency); +418 assertEquals(1, dependency.getVulnerabilities().size()); +419 instance.addCve("CVE-2013-1337"); +420 instance.process(dependency); +421 assertTrue(dependency.getVulnerabilities().isEmpty()); +422 assertEquals(1, dependency.getSuppressedVulnerabilities().size()); +423 +424 //cpe 425 instance = new SuppressionRule(); -426 instance.addCvssBelow(5f); -427 instance.process(dependency); -428 assertEquals(1, dependency.getVulnerabilities().size()); -429 instance.addCvssBelow(8f); -430 instance.process(dependency); -431 assertTrue(dependency.getVulnerabilities().isEmpty()); -432 assertEquals(1, dependency.getSuppressedVulnerabilities().size()); -433 -434 //cve -435 dependency.addVulnerability(v); -436 instance = new SuppressionRule(); -437 instance.addCve("CVE-2012-1337"); +426 PropertyType pt = new PropertyType(); +427 pt.setValue("cpe:/a:microsoft:.net_framework:4.0"); +428 instance.addCpe(pt); +429 instance.process(dependency); +430 assertTrue(dependency.getIdentifiers().size() == 1); +431 pt = new PropertyType(); +432 pt.setValue("cpe:/a:microsoft:.net_framework:4.5"); +433 instance.addCpe(pt); +434 pt = new PropertyType(); +435 pt.setValue(".*"); +436 pt.setRegex(true); +437 instance.setFilePath(pt); 438 instance.process(dependency); -439 assertEquals(1, dependency.getVulnerabilities().size()); -440 instance.addCve("CVE-2013-1337"); -441 instance.process(dependency); -442 assertTrue(dependency.getVulnerabilities().isEmpty()); -443 assertEquals(1, dependency.getSuppressedVulnerabilities().size()); -444 -445 //cpe -446 instance = new SuppressionRule(); -447 PropertyType pt = new PropertyType(); -448 pt.setValue("cpe:/a:microsoft:.net_framework:4.0"); -449 instance.addCpe(pt); -450 instance.process(dependency); -451 assertTrue(dependency.getIdentifiers().size() == 1); -452 pt = new PropertyType(); -453 pt.setValue("cpe:/a:microsoft:.net_framework:4.5"); -454 instance.addCpe(pt); -455 pt = new PropertyType(); -456 pt.setValue(".*"); -457 pt.setRegex(true); -458 instance.setFilePath(pt); -459 instance.process(dependency); -460 assertTrue(dependency.getIdentifiers().isEmpty()); -461 assertEquals(1, dependency.getSuppressedIdentifiers().size()); -462 -463 instance = new SuppressionRule(); -464 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:4.0", "some url not needed for this test"); -465 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:4.5", "some url not needed for this test"); -466 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:5.0", "some url not needed for this test"); -467 pt = new PropertyType(); -468 pt.setValue("cpe:/a:microsoft:.net_framework"); -469 instance.addCpe(pt); -470 instance.setBase(true); -471 assertEquals(3, dependency.getIdentifiers().size()); -472 assertEquals(1, dependency.getSuppressedIdentifiers().size()); -473 instance.process(dependency); -474 assertTrue(dependency.getIdentifiers().isEmpty()); -475 assertEquals(1, dependency.getSuppressedIdentifiers().size()); -476 } -477 -478 /** -479 * Test of process method, of class SuppressionRule. -480 */ -481 @Test -482 public void testProcessGAV() { -483 //File spring = new File(this.getClass().getClassLoader().getResource("spring-security-web-3.0.0.RELEASE.jar").getPath()); -484 File spring = BaseTest.getResourceAsFile(this, "spring-security-web-3.0.0.RELEASE.jar"); -485 Dependency dependency = new Dependency(spring); -486 dependency.addIdentifier("cpe", "cpe:/a:vmware:springsource_spring_framework:3.0.0", "some url not needed for this test"); -487 dependency.addIdentifier("cpe", "cpe:/a:springsource:spring_framework:3.0.0", "some url not needed for this test"); -488 dependency.addIdentifier("cpe", "cpe:/a:mod_security:mod_security:3.0.0", "some url not needed for this test"); -489 dependency.addIdentifier("cpe", "cpe:/a:vmware:springsource_spring_security:3.0.0", "some url not needed for this test"); -490 dependency.addIdentifier("maven", "org.springframework.security:spring-security-web:3.0.0.RELEASE", "some url not needed for this test"); -491 -492 //cpe -493 SuppressionRule instance = new SuppressionRule(); -494 PropertyType pt = new PropertyType(); -495 -496 pt.setValue("org\\.springframework\\.security:spring.*"); -497 pt.setRegex(true); -498 pt.setCaseSensitive(false); -499 instance.setGav(pt); -500 -501 pt = new PropertyType(); -502 pt.setValue("cpe:/a:mod_security:mod_security"); -503 instance.addCpe(pt); -504 pt = new PropertyType(); -505 pt.setValue("cpe:/a:springsource:spring_framework"); -506 instance.addCpe(pt); -507 pt = new PropertyType(); -508 pt.setValue("cpe:/a:vmware:springsource_spring_framework"); -509 instance.addCpe(pt); -510 -511 instance.process(dependency); -512 assertEquals(2, dependency.getIdentifiers().size()); -513 -514 } -515 -516 private Vulnerability createVulnerability() { -517 Vulnerability v = new Vulnerability(); -518 v.setCwe("CWE-287 Improper Authentication"); -519 v.setName("CVE-2013-1337"); -520 v.setCvssScore(7.5f); -521 return v; -522 } -523 } +439 assertTrue(dependency.getIdentifiers().isEmpty()); +440 assertEquals(1, dependency.getSuppressedIdentifiers().size()); +441 +442 instance = new SuppressionRule(); +443 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:4.0", "some url not needed for this test"); +444 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:4.5", "some url not needed for this test"); +445 dependency.addIdentifier("cpe", "cpe:/a:microsoft:.net_framework:5.0", "some url not needed for this test"); +446 pt = new PropertyType(); +447 pt.setValue("cpe:/a:microsoft:.net_framework"); +448 instance.addCpe(pt); +449 instance.setBase(true); +450 assertEquals(3, dependency.getIdentifiers().size()); +451 assertEquals(1, dependency.getSuppressedIdentifiers().size()); +452 instance.process(dependency); +453 assertTrue(dependency.getIdentifiers().isEmpty()); +454 assertEquals(1, dependency.getSuppressedIdentifiers().size()); +455 } +456 +457 /** +458 * Test of process method, of class SuppressionRule. +459 */ +460 @Test +461 public void testProcessGAV() { +462 //File spring = new File(this.getClass().getClassLoader().getResource("spring-security-web-3.0.0.RELEASE.jar").getPath()); +463 File spring = BaseTest.getResourceAsFile(this, "spring-security-web-3.0.0.RELEASE.jar"); +464 Dependency dependency = new Dependency(spring); +465 dependency.addIdentifier("cpe", "cpe:/a:vmware:springsource_spring_framework:3.0.0", "some url not needed for this test"); +466 dependency.addIdentifier("cpe", "cpe:/a:springsource:spring_framework:3.0.0", "some url not needed for this test"); +467 dependency.addIdentifier("cpe", "cpe:/a:mod_security:mod_security:3.0.0", "some url not needed for this test"); +468 dependency.addIdentifier("cpe", "cpe:/a:vmware:springsource_spring_security:3.0.0", "some url not needed for this test"); +469 dependency.addIdentifier("maven", "org.springframework.security:spring-security-web:3.0.0.RELEASE", "some url not needed for this test"); +470 +471 //cpe +472 SuppressionRule instance = new SuppressionRule(); +473 PropertyType pt = new PropertyType(); +474 +475 pt.setValue("org\\.springframework\\.security:spring.*"); +476 pt.setRegex(true); +477 pt.setCaseSensitive(false); +478 instance.setGav(pt); +479 +480 pt = new PropertyType(); +481 pt.setValue("cpe:/a:mod_security:mod_security"); +482 instance.addCpe(pt); +483 pt = new PropertyType(); +484 pt.setValue("cpe:/a:springsource:spring_framework"); +485 instance.addCpe(pt); +486 pt = new PropertyType(); +487 pt.setValue("cpe:/a:vmware:springsource_spring_framework"); +488 instance.addCpe(pt); +489 +490 instance.process(dependency); +491 assertEquals(2, dependency.getIdentifiers().size()); +492 +493 } +494 +495 private Vulnerability createVulnerability() { +496 Vulnerability v = new Vulnerability(); +497 v.setCwe("CWE-287 Improper Authentication"); +498 v.setName("CVE-2013-1337"); +499 v.setCvssScore(7.5f); +500 return v; +501 } +502 }
          diff --git a/xref-test/org/owasp/dependencycheck/suppression/package-frame.html b/xref-test/org/owasp/dependencycheck/suppression/package-frame.html index 3ee0ce50f..0172a206a 100644 --- a/xref-test/org/owasp/dependencycheck/suppression/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/suppression/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.suppression + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.suppression diff --git a/xref-test/org/owasp/dependencycheck/suppression/package-summary.html b/xref-test/org/owasp/dependencycheck/suppression/package-summary.html index 80599aa00..b4192725c 100644 --- a/xref-test/org/owasp/dependencycheck/suppression/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/suppression/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.suppression + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.suppression diff --git a/xref-test/org/owasp/dependencycheck/taskdefs/DependencyCheckTaskTest.html b/xref-test/org/owasp/dependencycheck/taskdefs/DependencyCheckTaskTest.html index 2af1a2044..270c981a6 100644 --- a/xref-test/org/owasp/dependencycheck/taskdefs/DependencyCheckTaskTest.html +++ b/xref-test/org/owasp/dependencycheck/taskdefs/DependencyCheckTaskTest.html @@ -34,7 +34,7 @@ 26 import org.junit.Rule; 27 import org.junit.Test; 28 import org.junit.rules.ExpectedException; -29 import org.owasp.dependencycheck.data.nvdcve.BaseDBTestCase; +29 import org.owasp.dependencycheck.BaseDBTestCase; 30 import org.owasp.dependencycheck.utils.Settings; 31 32 import static org.junit.Assert.assertTrue; diff --git a/xref-test/org/owasp/dependencycheck/taskdefs/package-frame.html b/xref-test/org/owasp/dependencycheck/taskdefs/package-frame.html index 71eeb6970..61a99f53d 100644 --- a/xref-test/org/owasp/dependencycheck/taskdefs/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/taskdefs/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.taskdefs + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.taskdefs diff --git a/xref-test/org/owasp/dependencycheck/taskdefs/package-summary.html b/xref-test/org/owasp/dependencycheck/taskdefs/package-summary.html index 839f73ee7..4344ffec7 100644 --- a/xref-test/org/owasp/dependencycheck/taskdefs/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/taskdefs/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.taskdefs + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.taskdefs diff --git a/xref-test/org/owasp/dependencycheck/utils/DependencyVersionTest.html b/xref-test/org/owasp/dependencycheck/utils/DependencyVersionTest.html index 65e29e39b..36aa46080 100644 --- a/xref-test/org/owasp/dependencycheck/utils/DependencyVersionTest.html +++ b/xref-test/org/owasp/dependencycheck/utils/DependencyVersionTest.html @@ -69,11 +69,11 @@ 61 @Test 62 public void testIterator() { 63 DependencyVersion instance = new DependencyVersion("1.2.3"); -64 Iterator result = instance.iterator(); +64 Iterator<String> result = instance.iterator(); 65 assertTrue(result.hasNext()); 66 int count = 1; 67 while (result.hasNext()) { -68 String v = (String) result.next(); +68 String v = result.next(); 69 assertTrue(String.valueOf(count++).equals(v)); 70 } 71 } diff --git a/xref-test/org/owasp/dependencycheck/utils/FileUtilsTest.html b/xref-test/org/owasp/dependencycheck/utils/FileUtilsTest.html index a0af37610..a042cf34d 100644 --- a/xref-test/org/owasp/dependencycheck/utils/FileUtilsTest.html +++ b/xref-test/org/owasp/dependencycheck/utils/FileUtilsTest.html @@ -43,8 +43,8 @@ 35 */ 36 @Test 37 public void testGetFileExtension() { -38 String[] fileName = {"something-0.9.5.jar", "lib2-1.1.js"}; -39 String[] expResult = {"jar", "js"}; +38 String[] fileName = {"something-0.9.5.jar", "lib2-1.1.js", "dir.tmp/noext"}; +39 String[] expResult = {"jar", "js", null}; 40 41 for (int i = 0; i < fileName.length; i++) { 42 String result = FileUtils.getFileExtension(fileName[i]); diff --git a/xref-test/org/owasp/dependencycheck/utils/SettingsTest.html b/xref-test/org/owasp/dependencycheck/utils/SettingsTest.html index 029c1b6b3..56f95f8e6 100644 --- a/xref-test/org/owasp/dependencycheck/utils/SettingsTest.html +++ b/xref-test/org/owasp/dependencycheck/utils/SettingsTest.html @@ -86,111 +86,137 @@ 78 } 79 80 /** -81 * Test of getString method, of class Settings. +81 * Test of setStringIfNotNull method, of class Settings. 82 */ 83 @Test -84 public void testGetString_String_String() { -85 String key = "key That Doesn't Exist"; -86 String defaultValue = "blue bunny"; -87 String expResult = "blue bunny"; -88 String result = Settings.getString(key); -89 Assert.assertTrue(result == null); -90 result = Settings.getString(key, defaultValue); -91 Assert.assertEquals(expResult, result); -92 } -93 -94 /** -95 * Test of getString method, of class Settings. -96 */ -97 @Test -98 public void testGetString_String() { -99 String key = Settings.KEYS.CONNECTION_TIMEOUT; -100 String result = Settings.getString(key); -101 Assert.assertTrue(result == null); -102 } -103 -104 /** -105 * Test of getInt method, of class Settings. -106 */ -107 @Test -108 public void testGetInt() throws InvalidSettingException { -109 String key = "SomeNumber"; -110 int expResult = 85; -111 Settings.setString(key, "85"); -112 int result = Settings.getInt(key); -113 Assert.assertEquals(expResult, result); -114 } -115 -116 /** -117 * Test of getLong method, of class Settings. -118 */ -119 @Test -120 public void testGetLong() throws InvalidSettingException { -121 String key = "SomeNumber"; -122 long expResult = 300L; -123 Settings.setString(key, "300"); -124 long result = Settings.getLong(key); -125 Assert.assertEquals(expResult, result); -126 } -127 -128 /** -129 * Test of getBoolean method, of class Settings. -130 */ -131 @Test -132 public void testGetBoolean() throws InvalidSettingException { -133 String key = "SomeBoolean"; -134 Settings.setString(key, "false"); -135 boolean expResult = false; -136 boolean result = Settings.getBoolean(key); -137 Assert.assertEquals(expResult, result); -138 -139 key = "something that does not exist"; -140 expResult = true; -141 result = Settings.getBoolean(key, true); -142 Assert.assertEquals(expResult, result); -143 } -144 -145 /** -146 * Test of removeProperty method, of class Settings. -147 */ -148 @Test -149 public void testRemoveProperty() { -150 String key = "SomeKey"; -151 String value = "value"; -152 String dfault = "default"; -153 Settings.setString(key, value); -154 String ret = Settings.getString(key); -155 Assert.assertEquals(value, ret); -156 Settings.removeProperty(key); -157 ret = Settings.getString(key, dfault); -158 Assert.assertEquals(dfault, ret); -159 } -160 -161 /** -162 * Test of getConnectionString. -163 */ -164 @Test -165 public void testGetConnectionString() throws Exception { -166 String value = Settings.getConnectionString(Settings.KEYS.DB_CONNECTION_STRING, Settings.KEYS.DB_FILE_NAME); -167 Assert.assertNotNull(value); -168 String msg = null; -169 try { -170 value = Settings.getConnectionString("invalidKey", null); -171 } catch (InvalidSettingException e) { -172 msg = e.getMessage(); -173 } -174 Assert.assertNotNull(msg); -175 } -176 -177 /** -178 * Test of getTempDirectory. -179 */ -180 @Test -181 public void testGetTempDirectory() throws Exception { -182 File tmp = Settings.getTempDirectory(); -183 Assert.assertTrue(tmp.exists()); -184 } -185 } +84 public void testSetStringIfNotNull() { +85 String key = "nullableProperty"; +86 String value = "someValue"; +87 Settings.setString(key, value); +88 Settings.setStringIfNotNull(key, null); // NO-OP +89 String expResults = Settings.getString(key); +90 Assert.assertEquals(expResults, value); +91 } +92 +93 /** +94 * Test of setStringIfNotNull method, of class Settings. +95 */ +96 @Test +97 public void testSetStringIfNotEmpty() { +98 String key = "optionalProperty"; +99 String value = "someValue"; +100 Settings.setString(key, value); +101 Settings.setStringIfNotEmpty(key, ""); // NO-OP +102 String expResults = Settings.getString(key); +103 Assert.assertEquals(expResults, value); +104 } +105 +106 /** +107 * Test of getString method, of class Settings. +108 */ +109 @Test +110 public void testGetString_String_String() { +111 String key = "key That Doesn't Exist"; +112 String defaultValue = "blue bunny"; +113 String expResult = "blue bunny"; +114 String result = Settings.getString(key); +115 Assert.assertTrue(result == null); +116 result = Settings.getString(key, defaultValue); +117 Assert.assertEquals(expResult, result); +118 } +119 +120 /** +121 * Test of getString method, of class Settings. +122 */ +123 @Test +124 public void testGetString_String() { +125 String key = Settings.KEYS.CONNECTION_TIMEOUT; +126 String result = Settings.getString(key); +127 Assert.assertTrue(result == null); +128 } +129 +130 /** +131 * Test of getInt method, of class Settings. +132 */ +133 @Test +134 public void testGetInt() throws InvalidSettingException { +135 String key = "SomeNumber"; +136 int expResult = 85; +137 Settings.setString(key, "85"); +138 int result = Settings.getInt(key); +139 Assert.assertEquals(expResult, result); +140 } +141 +142 /** +143 * Test of getLong method, of class Settings. +144 */ +145 @Test +146 public void testGetLong() throws InvalidSettingException { +147 String key = "SomeNumber"; +148 long expResult = 300L; +149 Settings.setString(key, "300"); +150 long result = Settings.getLong(key); +151 Assert.assertEquals(expResult, result); +152 } +153 +154 /** +155 * Test of getBoolean method, of class Settings. +156 */ +157 @Test +158 public void testGetBoolean() throws InvalidSettingException { +159 String key = "SomeBoolean"; +160 Settings.setString(key, "false"); +161 boolean expResult = false; +162 boolean result = Settings.getBoolean(key); +163 Assert.assertEquals(expResult, result); +164 +165 key = "something that does not exist"; +166 expResult = true; +167 result = Settings.getBoolean(key, true); +168 Assert.assertEquals(expResult, result); +169 } +170 +171 /** +172 * Test of removeProperty method, of class Settings. +173 */ +174 @Test +175 public void testRemoveProperty() { +176 String key = "SomeKey"; +177 String value = "value"; +178 String dfault = "default"; +179 Settings.setString(key, value); +180 String ret = Settings.getString(key); +181 Assert.assertEquals(value, ret); +182 Settings.removeProperty(key); +183 ret = Settings.getString(key, dfault); +184 Assert.assertEquals(dfault, ret); +185 } +186 +187 /** +188 * Test of getConnectionString. +189 */ +190 @Test +191 public void testGetConnectionString() throws Exception { +192 String value = Settings.getConnectionString(Settings.KEYS.DB_CONNECTION_STRING, Settings.KEYS.DB_FILE_NAME); +193 Assert.assertNotNull(value); +194 String msg = null; +195 try { +196 value = Settings.getConnectionString("invalidKey", null); +197 } catch (InvalidSettingException e) { +198 msg = e.getMessage(); +199 } +200 Assert.assertNotNull(msg); +201 } +202 +203 /** +204 * Test of getTempDirectory. +205 */ +206 @Test +207 public void testGetTempDirectory() throws Exception { +208 File tmp = Settings.getTempDirectory(); +209 Assert.assertTrue(tmp.exists()); +210 } +211 }
          diff --git a/xref-test/org/owasp/dependencycheck/utils/package-frame.html b/xref-test/org/owasp/dependencycheck/utils/package-frame.html index 56fb8d7ae..c379fbd6f 100644 --- a/xref-test/org/owasp/dependencycheck/utils/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/utils/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.utils + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.utils diff --git a/xref-test/org/owasp/dependencycheck/utils/package-summary.html b/xref-test/org/owasp/dependencycheck/utils/package-summary.html index 142907dc0..bfb6bb2f7 100644 --- a/xref-test/org/owasp/dependencycheck/utils/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/utils/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.utils + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.utils diff --git a/xref-test/org/owasp/dependencycheck/xml/pom/package-frame.html b/xref-test/org/owasp/dependencycheck/xml/pom/package-frame.html index c6219642a..544a7cc5f 100644 --- a/xref-test/org/owasp/dependencycheck/xml/pom/package-frame.html +++ b/xref-test/org/owasp/dependencycheck/xml/pom/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.xml.pom + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.xml.pom diff --git a/xref-test/org/owasp/dependencycheck/xml/pom/package-summary.html b/xref-test/org/owasp/dependencycheck/xml/pom/package-summary.html index c9e3d998a..871fb69c1 100644 --- a/xref-test/org/owasp/dependencycheck/xml/pom/package-summary.html +++ b/xref-test/org/owasp/dependencycheck/xml/pom/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.xml.pom + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.xml.pom diff --git a/xref-test/overview-frame.html b/xref-test/overview-frame.html index 0ff124b9e..f69299d8d 100644 --- a/xref-test/overview-frame.html +++ b/xref-test/overview-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference + Dependency-Check 1.3.2 Reference diff --git a/xref-test/overview-summary.html b/xref-test/overview-summary.html index 4a20786ce..16b0e26f1 100644 --- a/xref-test/overview-summary.html +++ b/xref-test/overview-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference + Dependency-Check 1.3.2 Reference @@ -24,7 +24,7 @@
        -

        Dependency-Check 1.3.1 Reference

        +

        Dependency-Check 1.3.2 Reference

        diff --git a/xref/allclasses-frame.html b/xref/allclasses-frame.html index 801b58bb1..7716c20f6 100644 --- a/xref/allclasses-frame.html +++ b/xref/allclasses-frame.html @@ -310,9 +310,6 @@
      • NodePackageAnalyzer -
      • -
      • - NonClosingStream
      • NugetPackage @@ -361,6 +358,9 @@
      • ProcessTask +
      • +
      • + PropertyLookup
      • PropertyType @@ -385,6 +385,9 @@
      • ReportGenerator +
      • +
      • + RubyBundleAuditAnalyzer
      • RubyGemspecAnalyzer diff --git a/xref/index.html b/xref/index.html index 0613cdfd0..ce1020668 100644 --- a/xref/index.html +++ b/xref/index.html @@ -4,7 +4,7 @@ - Dependency-Check 1.3.1 Reference + Dependency-Check 1.3.2 Reference diff --git a/xref/org/owasp/dependencycheck/App.html b/xref/org/owasp/dependencycheck/App.html index a08bd7f4e..706116a33 100644 --- a/xref/org/owasp/dependencycheck/App.html +++ b/xref/org/owasp/dependencycheck/App.html @@ -35,443 +35,420 @@ 27 import java.util.List; 28 import java.util.Set; 29 import org.apache.commons.cli.ParseException; -30 import org.owasp.dependencycheck.data.nvdcve.CveDB; -31 import org.owasp.dependencycheck.data.nvdcve.DatabaseException; -32 import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties; -33 import org.owasp.dependencycheck.dependency.Dependency; -34 import org.apache.tools.ant.DirectoryScanner; -35 import org.owasp.dependencycheck.reporting.ReportGenerator; -36 import org.owasp.dependencycheck.utils.Settings; -37 import org.slf4j.Logger; -38 import org.slf4j.LoggerFactory; -39 import ch.qos.logback.core.FileAppender; -40 import org.slf4j.impl.StaticLoggerBinder; -41 -42 /** -43 * The command line interface for the DependencyCheck application. -44 * -45 * @author Jeremy Long -46 */ -47 public class App { -48 -49 /** -50 * The logger. -51 */ -52 private static final Logger LOGGER = LoggerFactory.getLogger(App.class); -53 -54 /** -55 * The main method for the application. -56 * -57 * @param args the command line arguments -58 */ -59 public static void main(String[] args) { -60 try { -61 Settings.initialize(); -62 final App app = new App(); -63 app.run(args); -64 } finally { -65 Settings.cleanup(true); -66 } -67 } -68 -69 /** -70 * Main CLI entry-point into the application. -71 * -72 * @param args the command line arguments -73 */ -74 public void run(String[] args) { -75 final CliParser cli = new CliParser(); -76 -77 try { -78 cli.parse(args); -79 } catch (FileNotFoundException ex) { -80 System.err.println(ex.getMessage()); -81 cli.printHelp(); -82 return; -83 } catch (ParseException ex) { -84 System.err.println(ex.getMessage()); -85 cli.printHelp(); -86 return; -87 } -88 -89 if (cli.getVerboseLog() != null) { -90 prepareLogger(cli.getVerboseLog()); -91 } -92 -93 if (cli.isPurge()) { -94 if (cli.getConnectionString() != null) { -95 LOGGER.error("Unable to purge the database when using a non-default connection string"); -96 } else { -97 populateSettings(cli); -98 File db; -99 try { -100 db = new File(Settings.getDataDirectory(), "dc.h2.db"); -101 if (db.exists()) { -102 if (db.delete()) { -103 LOGGER.info("Database file purged; local copy of the NVD has been removed"); -104 } else { -105 LOGGER.error("Unable to delete '{}'; please delete the file manually", db.getAbsolutePath()); -106 } -107 } else { -108 LOGGER.error("Unable to purge database; the database file does not exists: {}", db.getAbsolutePath()); -109 } -110 } catch (IOException ex) { -111 LOGGER.error("Unable to delete the database"); -112 } -113 } -114 } else if (cli.isGetVersion()) { -115 cli.printVersionInfo(); -116 } else if (cli.isUpdateOnly()) { -117 populateSettings(cli); -118 runUpdateOnly(); -119 } else if (cli.isRunScan()) { -120 populateSettings(cli); -121 try { -122 runScan(cli.getReportDirectory(), cli.getReportFormat(), cli.getProjectName(), cli.getScanFiles(), -123 cli.getExcludeList(), cli.getSymLinkDepth()); -124 } catch (InvalidScanPathException ex) { -125 LOGGER.error("An invalid scan path was detected; unable to scan '//*' paths"); -126 } -127 } else { -128 cli.printHelp(); -129 } -130 } -131 -132 /** -133 * Scans the specified directories and writes the dependency reports to the reportDirectory. -134 * -135 * @param reportDirectory the path to the directory where the reports will be written -136 * @param outputFormat the output format of the report -137 * @param applicationName the application name for the report -138 * @param files the files/directories to scan -139 * @param excludes the patterns for files/directories to exclude -140 * @param symLinkDepth the depth that symbolic links will be followed -141 * -142 * @throws InvalidScanPathException thrown if the path to scan starts with "//" -143 */ -144 private void runScan(String reportDirectory, String outputFormat, String applicationName, String[] files, -145 String[] excludes, int symLinkDepth) throws InvalidScanPathException { -146 Engine engine = null; -147 try { -148 engine = new Engine(); -149 final List<String> antStylePaths = new ArrayList<String>(); -150 for (String file : files) { -151 final String antPath = ensureCanonicalPath(file); -152 antStylePaths.add(antPath); -153 } -154 -155 final Set<File> paths = new HashSet<File>(); -156 for (String file : antStylePaths) { -157 LOGGER.debug("Scanning {}", file); -158 final DirectoryScanner scanner = new DirectoryScanner(); -159 String include = file.replace('\\', '/'); -160 File baseDir; -161 -162 if (include.startsWith("//")) { -163 throw new InvalidScanPathException("Unable to scan paths specified by //"); -164 } else { -165 final int pos = getLastFileSeparator(include); -166 final String tmpBase = include.substring(0, pos); -167 final String tmpInclude = include.substring(pos + 1); -168 if (tmpInclude.indexOf('*') >= 0 || tmpInclude.indexOf('?') >= 0 -169 || (new File(include)).isFile()) { -170 baseDir = new File(tmpBase); -171 include = tmpInclude; -172 } else { -173 baseDir = new File(tmpBase, tmpInclude); -174 include = "**/*"; -175 } -176 } -177 //LOGGER.debug("baseDir: {}", baseDir); -178 //LOGGER.debug("include: {}", include); -179 scanner.setBasedir(baseDir); -180 final String[] includes = {include}; -181 scanner.setIncludes(includes); -182 scanner.setMaxLevelsOfSymlinks(symLinkDepth); -183 if (symLinkDepth <= 0) { -184 scanner.setFollowSymlinks(false); -185 } -186 if (excludes != null && excludes.length > 0) { -187 scanner.addExcludes(excludes); -188 } -189 scanner.scan(); -190 if (scanner.getIncludedFilesCount() > 0) { -191 for (String s : scanner.getIncludedFiles()) { -192 final File f = new File(baseDir, s); -193 LOGGER.debug("Found file {}", f.toString()); -194 paths.add(f); -195 } -196 } -197 } -198 engine.scan(paths); -199 -200 engine.analyzeDependencies(); -201 final List<Dependency> dependencies = engine.getDependencies(); -202 DatabaseProperties prop = null; -203 CveDB cve = null; -204 try { -205 cve = new CveDB(); -206 cve.open(); -207 prop = cve.getDatabaseProperties(); -208 } catch (DatabaseException ex) { -209 LOGGER.debug("Unable to retrieve DB Properties", ex); -210 } finally { -211 if (cve != null) { -212 cve.close(); -213 } -214 } -215 final ReportGenerator report = new ReportGenerator(applicationName, dependencies, engine.getAnalyzers(), prop); -216 try { -217 report.generateReports(reportDirectory, outputFormat); -218 } catch (IOException ex) { -219 LOGGER.error("There was an IO error while attempting to generate the report."); -220 LOGGER.debug("", ex); -221 } catch (Throwable ex) { -222 LOGGER.error("There was an error while attempting to generate the report."); -223 LOGGER.debug("", ex); -224 } -225 } catch (DatabaseException ex) { -226 LOGGER.error("Unable to connect to the dependency-check database; analysis has stopped"); -227 LOGGER.debug("", ex); -228 } finally { -229 if (engine != null) { -230 engine.cleanup(); -231 } -232 } -233 } -234 -235 /** -236 * Only executes the update phase of dependency-check. -237 */ -238 private void runUpdateOnly() { -239 Engine engine = null; -240 try { -241 engine = new Engine(); -242 engine.doUpdates(); -243 } catch (DatabaseException ex) { -244 LOGGER.error("Unable to connect to the dependency-check database; analysis has stopped"); -245 LOGGER.debug("", ex); -246 } finally { -247 if (engine != null) { -248 engine.cleanup(); -249 } -250 } -251 } -252 -253 /** -254 * Updates the global Settings. -255 * -256 * @param cli a reference to the CLI Parser that contains the command line arguments used to set the corresponding settings in -257 * the core engine. -258 */ -259 private void populateSettings(CliParser cli) { -260 -261 final boolean autoUpdate = cli.isAutoUpdate(); -262 final String connectionTimeout = cli.getConnectionTimeout(); -263 final String proxyServer = cli.getProxyServer(); -264 final String proxyPort = cli.getProxyPort(); -265 final String proxyUser = cli.getProxyUsername(); -266 final String proxyPass = cli.getProxyPassword(); -267 final String dataDirectory = cli.getDataDirectory(); -268 final File propertiesFile = cli.getPropertiesFile(); -269 final String suppressionFile = cli.getSuppressionFile(); -270 final String nexusUrl = cli.getNexusUrl(); -271 final String databaseDriverName = cli.getDatabaseDriverName(); -272 final String databaseDriverPath = cli.getDatabaseDriverPath(); -273 final String connectionString = cli.getConnectionString(); -274 final String databaseUser = cli.getDatabaseUser(); -275 final String databasePassword = cli.getDatabasePassword(); -276 final String additionalZipExtensions = cli.getAdditionalZipExtensions(); -277 final String pathToMono = cli.getPathToMono(); -278 final String cveMod12 = cli.getModifiedCve12Url(); -279 final String cveMod20 = cli.getModifiedCve20Url(); -280 final String cveBase12 = cli.getBaseCve12Url(); -281 final String cveBase20 = cli.getBaseCve20Url(); -282 -283 if (propertiesFile != null) { -284 try { -285 Settings.mergeProperties(propertiesFile); -286 } catch (FileNotFoundException ex) { -287 LOGGER.error("Unable to load properties file '{}'", propertiesFile.getPath()); -288 LOGGER.debug("", ex); -289 } catch (IOException ex) { -290 LOGGER.error("Unable to find properties file '{}'", propertiesFile.getPath()); -291 LOGGER.debug("", ex); -292 } -293 } -294 // We have to wait until we've merged the properties before attempting to set whether we use -295 // the proxy for Nexus since it could be disabled in the properties, but not explicitly stated -296 // on the command line -297 final boolean nexusUsesProxy = cli.isNexusUsesProxy(); -298 if (dataDirectory != null) { -299 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory); -300 } else if (System.getProperty("basedir") != null) { -301 final File dataDir = new File(System.getProperty("basedir"), "data"); -302 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); -303 } else { -304 final File jarPath = new File(App.class.getProtectionDomain().getCodeSource().getLocation().getPath()); -305 final File base = jarPath.getParentFile(); -306 final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY); -307 final File dataDir = new File(base, sub); -308 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); -309 } -310 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); -311 if (proxyServer != null && !proxyServer.isEmpty()) { -312 Settings.setString(Settings.KEYS.PROXY_SERVER, proxyServer); -313 } -314 if (proxyPort != null && !proxyPort.isEmpty()) { -315 Settings.setString(Settings.KEYS.PROXY_PORT, proxyPort); -316 } -317 if (proxyUser != null && !proxyUser.isEmpty()) { -318 Settings.setString(Settings.KEYS.PROXY_USERNAME, proxyUser); -319 } -320 if (proxyPass != null && !proxyPass.isEmpty()) { -321 Settings.setString(Settings.KEYS.PROXY_PASSWORD, proxyPass); -322 } -323 if (connectionTimeout != null && !connectionTimeout.isEmpty()) { -324 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); -325 } -326 if (suppressionFile != null && !suppressionFile.isEmpty()) { -327 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); -328 } -329 -330 //File Type Analyzer Settings -331 Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, !cli.isJarDisabled()); -332 Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, !cli.isArchiveDisabled()); -333 Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, !cli.isPythonDistributionDisabled()); -334 Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, !cli.isPythonPackageDisabled()); -335 Settings.setBoolean(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, !cli.isAutoconfDisabled()); -336 Settings.setBoolean(Settings.KEYS.ANALYZER_CMAKE_ENABLED, !cli.isCmakeDisabled()); -337 Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, !cli.isNuspecDisabled()); -338 Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, !cli.isAssemblyDisabled()); -339 Settings.setBoolean(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, !cli.isOpenSSLDisabled()); -340 Settings.setBoolean(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, !cli.isComposerDisabled()); -341 Settings.setBoolean(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, !cli.isNodeJsDisabled()); -342 Settings.setBoolean(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, !cli.isRubyGemspecDisabled()); -343 -344 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, !cli.isCentralDisabled()); -345 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, !cli.isNexusDisabled()); -346 if (nexusUrl != null && !nexusUrl.isEmpty()) { -347 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); -348 } -349 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy); -350 if (databaseDriverName != null && !databaseDriverName.isEmpty()) { -351 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); -352 } -353 if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) { -354 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); -355 } -356 if (connectionString != null && !connectionString.isEmpty()) { -357 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString); -358 } -359 if (databaseUser != null && !databaseUser.isEmpty()) { -360 Settings.setString(Settings.KEYS.DB_USER, databaseUser); -361 } -362 if (databasePassword != null && !databasePassword.isEmpty()) { -363 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword); -364 } -365 if (additionalZipExtensions != null && !additionalZipExtensions.isEmpty()) { -366 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, additionalZipExtensions); -367 } -368 if (pathToMono != null && !pathToMono.isEmpty()) { -369 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); -370 } -371 if (cveBase12 != null && !cveBase12.isEmpty()) { -372 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveBase12); -373 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveBase20); -374 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveMod12); -375 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveMod20); -376 } -377 } -378 -379 /** -380 * Creates a file appender and adds it to logback. -381 * -382 * @param verboseLog the path to the verbose log file -383 */ -384 private void prepareLogger(String verboseLog) { -385 final StaticLoggerBinder loggerBinder = StaticLoggerBinder.getSingleton(); -386 final LoggerContext context = (LoggerContext) loggerBinder.getLoggerFactory(); -387 -388 final PatternLayoutEncoder encoder = new PatternLayoutEncoder(); -389 encoder.setPattern("%d %C:%L%n%-5level - %msg%n"); -390 encoder.setContext(context); -391 encoder.start(); -392 final FileAppender fa = new FileAppender(); -393 fa.setAppend(true); -394 fa.setEncoder(encoder); -395 fa.setContext(context); -396 fa.setFile(verboseLog); -397 final File f = new File(verboseLog); -398 String name = f.getName(); -399 final int i = name.lastIndexOf('.'); -400 if (i > 1) { -401 name = name.substring(0, i); -402 } -403 fa.setName(name); -404 fa.start(); -405 final ch.qos.logback.classic.Logger rootLogger = context.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME); -406 rootLogger.addAppender(fa); -407 } -408 -409 /** -410 * Takes a path and resolves it to be a canonical &amp; absolute path. The caveats are that this method will take an Ant style -411 * file selector path (../someDir/**\/*.jar) and convert it to an absolute/canonical path (at least to the left of the first * -412 * or ?). -413 * -414 * @param path the path to canonicalize -415 * @return the canonical path -416 */ -417 protected String ensureCanonicalPath(String path) { -418 String basePath = null; -419 String wildCards = null; -420 final String file = path.replace('\\', '/'); -421 if (file.contains("*") || file.contains("?")) { -422 -423 int pos = getLastFileSeparator(file); -424 if (pos < 0) { -425 return file; -426 } -427 pos += 1; -428 basePath = file.substring(0, pos); -429 wildCards = file.substring(pos); -430 } else { -431 basePath = file; -432 } -433 -434 File f = new File(basePath); -435 try { -436 f = f.getCanonicalFile(); -437 if (wildCards != null) { -438 f = new File(f, wildCards); -439 } -440 } catch (IOException ex) { -441 LOGGER.warn("Invalid path '{}' was provided.", path); -442 LOGGER.debug("Invalid path provided", ex); -443 } -444 return f.getAbsolutePath().replace('\\', '/'); -445 } -446 -447 /** -448 * Returns the position of the last file separator. -449 * -450 * @param file a file path -451 * @return the position of the last file separator -452 */ -453 private int getLastFileSeparator(String file) { -454 if (file.contains("*") || file.contains("?")) { -455 int p1 = file.indexOf('*'); -456 int p2 = file.indexOf('?'); -457 p1 = p1 > 0 ? p1 : file.length(); -458 p2 = p2 > 0 ? p2 : file.length(); -459 int pos = p1 < p2 ? p1 : p2; -460 pos = file.lastIndexOf('/', pos); -461 return pos; -462 } else { -463 return file.lastIndexOf('/'); -464 } -465 } -466 } +30 import org.apache.commons.lang.StringUtils; +31 import org.owasp.dependencycheck.data.nvdcve.CveDB; +32 import org.owasp.dependencycheck.data.nvdcve.DatabaseException; +33 import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties; +34 import org.owasp.dependencycheck.dependency.Dependency; +35 import org.apache.tools.ant.DirectoryScanner; +36 import org.owasp.dependencycheck.reporting.ReportGenerator; +37 import org.owasp.dependencycheck.utils.Settings; +38 import org.slf4j.Logger; +39 import org.slf4j.LoggerFactory; +40 import ch.qos.logback.core.FileAppender; +41 import org.slf4j.impl.StaticLoggerBinder; +42 +43 /** +44 * The command line interface for the DependencyCheck application. +45 * +46 * @author Jeremy Long +47 */ +48 public class App { +49 +50 /** +51 * The logger. +52 */ +53 private static final Logger LOGGER = LoggerFactory.getLogger(App.class); +54 +55 /** +56 * The main method for the application. +57 * +58 * @param args the command line arguments +59 */ +60 public static void main(String[] args) { +61 try { +62 Settings.initialize(); +63 final App app = new App(); +64 app.run(args); +65 } finally { +66 Settings.cleanup(true); +67 } +68 } +69 +70 /** +71 * Main CLI entry-point into the application. +72 * +73 * @param args the command line arguments +74 */ +75 public void run(String[] args) { +76 final CliParser cli = new CliParser(); +77 +78 try { +79 cli.parse(args); +80 } catch (FileNotFoundException ex) { +81 System.err.println(ex.getMessage()); +82 cli.printHelp(); +83 return; +84 } catch (ParseException ex) { +85 System.err.println(ex.getMessage()); +86 cli.printHelp(); +87 return; +88 } +89 +90 if (cli.getVerboseLog() != null) { +91 prepareLogger(cli.getVerboseLog()); +92 } +93 +94 if (cli.isPurge()) { +95 if (cli.getConnectionString() != null) { +96 LOGGER.error("Unable to purge the database when using a non-default connection string"); +97 } else { +98 populateSettings(cli); +99 File db; +100 try { +101 db = new File(Settings.getDataDirectory(), "dc.h2.db"); +102 if (db.exists()) { +103 if (db.delete()) { +104 LOGGER.info("Database file purged; local copy of the NVD has been removed"); +105 } else { +106 LOGGER.error("Unable to delete '{}'; please delete the file manually", db.getAbsolutePath()); +107 } +108 } else { +109 LOGGER.error("Unable to purge database; the database file does not exists: {}", db.getAbsolutePath()); +110 } +111 } catch (IOException ex) { +112 LOGGER.error("Unable to delete the database"); +113 } +114 } +115 } else if (cli.isGetVersion()) { +116 cli.printVersionInfo(); +117 } else if (cli.isUpdateOnly()) { +118 populateSettings(cli); +119 runUpdateOnly(); +120 } else if (cli.isRunScan()) { +121 populateSettings(cli); +122 try { +123 runScan(cli.getReportDirectory(), cli.getReportFormat(), cli.getProjectName(), cli.getScanFiles(), +124 cli.getExcludeList(), cli.getSymLinkDepth()); +125 } catch (InvalidScanPathException ex) { +126 LOGGER.error("An invalid scan path was detected; unable to scan '//*' paths"); +127 } +128 } else { +129 cli.printHelp(); +130 } +131 } +132 +133 /** +134 * Scans the specified directories and writes the dependency reports to the reportDirectory. +135 * +136 * @param reportDirectory the path to the directory where the reports will be written +137 * @param outputFormat the output format of the report +138 * @param applicationName the application name for the report +139 * @param files the files/directories to scan +140 * @param excludes the patterns for files/directories to exclude +141 * @param symLinkDepth the depth that symbolic links will be followed +142 * +143 * @throws InvalidScanPathException thrown if the path to scan starts with "//" +144 */ +145 private void runScan(String reportDirectory, String outputFormat, String applicationName, String[] files, +146 String[] excludes, int symLinkDepth) throws InvalidScanPathException { +147 Engine engine = null; +148 try { +149 engine = new Engine(); +150 final List<String> antStylePaths = new ArrayList<String>(); +151 for (String file : files) { +152 final String antPath = ensureCanonicalPath(file); +153 antStylePaths.add(antPath); +154 } +155 +156 final Set<File> paths = new HashSet<File>(); +157 for (String file : antStylePaths) { +158 LOGGER.debug("Scanning {}", file); +159 final DirectoryScanner scanner = new DirectoryScanner(); +160 String include = file.replace('\\', '/'); +161 File baseDir; +162 +163 if (include.startsWith("//")) { +164 throw new InvalidScanPathException("Unable to scan paths specified by //"); +165 } else { +166 final int pos = getLastFileSeparator(include); +167 final String tmpBase = include.substring(0, pos); +168 final String tmpInclude = include.substring(pos + 1); +169 if (tmpInclude.indexOf('*') >= 0 || tmpInclude.indexOf('?') >= 0 +170 || (new File(include)).isFile()) { +171 baseDir = new File(tmpBase); +172 include = tmpInclude; +173 } else { +174 baseDir = new File(tmpBase, tmpInclude); +175 include = "**/*"; +176 } +177 } +178 //LOGGER.debug("baseDir: {}", baseDir); +179 //LOGGER.debug("include: {}", include); +180 scanner.setBasedir(baseDir); +181 final String[] includes = {include}; +182 scanner.setIncludes(includes); +183 scanner.setMaxLevelsOfSymlinks(symLinkDepth); +184 if (symLinkDepth <= 0) { +185 scanner.setFollowSymlinks(false); +186 } +187 if (excludes != null && excludes.length > 0) { +188 scanner.addExcludes(excludes); +189 } +190 scanner.scan(); +191 if (scanner.getIncludedFilesCount() > 0) { +192 for (String s : scanner.getIncludedFiles()) { +193 final File f = new File(baseDir, s); +194 LOGGER.debug("Found file {}", f.toString()); +195 paths.add(f); +196 } +197 } +198 } +199 engine.scan(paths); +200 +201 engine.analyzeDependencies(); +202 final List<Dependency> dependencies = engine.getDependencies(); +203 DatabaseProperties prop = null; +204 CveDB cve = null; +205 try { +206 cve = new CveDB(); +207 cve.open(); +208 prop = cve.getDatabaseProperties(); +209 } catch (DatabaseException ex) { +210 LOGGER.debug("Unable to retrieve DB Properties", ex); +211 } finally { +212 if (cve != null) { +213 cve.close(); +214 } +215 } +216 final ReportGenerator report = new ReportGenerator(applicationName, dependencies, engine.getAnalyzers(), prop); +217 try { +218 report.generateReports(reportDirectory, outputFormat); +219 } catch (IOException ex) { +220 LOGGER.error("There was an IO error while attempting to generate the report."); +221 LOGGER.debug("", ex); +222 } catch (Throwable ex) { +223 LOGGER.error("There was an error while attempting to generate the report."); +224 LOGGER.debug("", ex); +225 } +226 } catch (DatabaseException ex) { +227 LOGGER.error("Unable to connect to the dependency-check database; analysis has stopped"); +228 LOGGER.debug("", ex); +229 } finally { +230 if (engine != null) { +231 engine.cleanup(); +232 } +233 } +234 } +235 +236 /** +237 * Only executes the update phase of dependency-check. +238 */ +239 private void runUpdateOnly() { +240 Engine engine = null; +241 try { +242 engine = new Engine(); +243 engine.doUpdates(); +244 } catch (DatabaseException ex) { +245 LOGGER.error("Unable to connect to the dependency-check database; analysis has stopped"); +246 LOGGER.debug("", ex); +247 } finally { +248 if (engine != null) { +249 engine.cleanup(); +250 } +251 } +252 } +253 +254 /** +255 * Updates the global Settings. +256 * +257 * @param cli a reference to the CLI Parser that contains the command line arguments used to set the corresponding settings in +258 * the core engine. +259 */ +260 private void populateSettings(CliParser cli) { +261 +262 final boolean autoUpdate = cli.isAutoUpdate(); +263 final String connectionTimeout = cli.getConnectionTimeout(); +264 final String proxyServer = cli.getProxyServer(); +265 final String proxyPort = cli.getProxyPort(); +266 final String proxyUser = cli.getProxyUsername(); +267 final String proxyPass = cli.getProxyPassword(); +268 final String dataDirectory = cli.getDataDirectory(); +269 final File propertiesFile = cli.getPropertiesFile(); +270 final String suppressionFile = cli.getSuppressionFile(); +271 final String nexusUrl = cli.getNexusUrl(); +272 final String databaseDriverName = cli.getDatabaseDriverName(); +273 final String databaseDriverPath = cli.getDatabaseDriverPath(); +274 final String connectionString = cli.getConnectionString(); +275 final String databaseUser = cli.getDatabaseUser(); +276 final String databasePassword = cli.getDatabasePassword(); +277 final String additionalZipExtensions = cli.getAdditionalZipExtensions(); +278 final String pathToMono = cli.getPathToMono(); +279 final String cveMod12 = cli.getModifiedCve12Url(); +280 final String cveMod20 = cli.getModifiedCve20Url(); +281 final String cveBase12 = cli.getBaseCve12Url(); +282 final String cveBase20 = cli.getBaseCve20Url(); +283 final Integer cveValidForHours = cli.getCveValidForHours(); +284 +285 if (propertiesFile != null) { +286 try { +287 Settings.mergeProperties(propertiesFile); +288 } catch (FileNotFoundException ex) { +289 LOGGER.error("Unable to load properties file '{}'", propertiesFile.getPath()); +290 LOGGER.debug("", ex); +291 } catch (IOException ex) { +292 LOGGER.error("Unable to find properties file '{}'", propertiesFile.getPath()); +293 LOGGER.debug("", ex); +294 } +295 } +296 // We have to wait until we've merged the properties before attempting to set whether we use +297 // the proxy for Nexus since it could be disabled in the properties, but not explicitly stated +298 // on the command line +299 final boolean nexusUsesProxy = cli.isNexusUsesProxy(); +300 if (dataDirectory != null) { +301 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory); +302 } else if (System.getProperty("basedir") != null) { +303 final File dataDir = new File(System.getProperty("basedir"), "data"); +304 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); +305 } else { +306 final File jarPath = new File(App.class.getProtectionDomain().getCodeSource().getLocation().getPath()); +307 final File base = jarPath.getParentFile(); +308 final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY); +309 final File dataDir = new File(base, sub); +310 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); +311 } +312 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); +313 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_SERVER, proxyServer); +314 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PORT, proxyPort); +315 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_USERNAME, proxyUser); +316 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PASSWORD, proxyPass); +317 Settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); +318 Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); +319 Settings.setIntIfNotNull(Settings.KEYS.CVE_CHECK_VALID_FOR_HOURS, cveValidForHours); +320 +321 //File Type Analyzer Settings +322 Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, !cli.isJarDisabled()); +323 Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, !cli.isArchiveDisabled()); +324 Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, !cli.isPythonDistributionDisabled()); +325 Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, !cli.isPythonPackageDisabled()); +326 Settings.setBoolean(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, !cli.isAutoconfDisabled()); +327 Settings.setBoolean(Settings.KEYS.ANALYZER_CMAKE_ENABLED, !cli.isCmakeDisabled()); +328 Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, !cli.isNuspecDisabled()); +329 Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, !cli.isAssemblyDisabled()); +330 Settings.setBoolean(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_ENABLED, !cli.isBundleAuditDisabled()); +331 Settings.setBoolean(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, !cli.isOpenSSLDisabled()); +332 Settings.setBoolean(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, !cli.isComposerDisabled()); +333 Settings.setBoolean(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, !cli.isNodeJsDisabled()); +334 Settings.setBoolean(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, !cli.isRubyGemspecDisabled()); +335 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, !cli.isCentralDisabled()); +336 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, !cli.isNexusDisabled()); +337 +338 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_PATH, cli.getPathToBundleAudit()); +339 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); +340 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy); +341 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); +342 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); +343 Settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString); +344 Settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser); +345 Settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword); +346 Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, additionalZipExtensions); +347 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); +348 if (cveBase12 != null && !cveBase12.isEmpty()) { +349 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveBase12); +350 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveBase20); +351 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveMod12); +352 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveMod20); +353 } +354 } +355 +356 /** +357 * Creates a file appender and adds it to logback. +358 * +359 * @param verboseLog the path to the verbose log file +360 */ +361 private void prepareLogger(String verboseLog) { +362 final StaticLoggerBinder loggerBinder = StaticLoggerBinder.getSingleton(); +363 final LoggerContext context = (LoggerContext) loggerBinder.getLoggerFactory(); +364 +365 final PatternLayoutEncoder encoder = new PatternLayoutEncoder(); +366 encoder.setPattern("%d %C:%L%n%-5level - %msg%n"); +367 encoder.setContext(context); +368 encoder.start(); +369 final FileAppender fa = new FileAppender(); +370 fa.setAppend(true); +371 fa.setEncoder(encoder); +372 fa.setContext(context); +373 fa.setFile(verboseLog); +374 final File f = new File(verboseLog); +375 String name = f.getName(); +376 final int i = name.lastIndexOf('.'); +377 if (i > 1) { +378 name = name.substring(0, i); +379 } +380 fa.setName(name); +381 fa.start(); +382 final ch.qos.logback.classic.Logger rootLogger = context.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME); +383 rootLogger.addAppender(fa); +384 } +385 +386 /** +387 * Takes a path and resolves it to be a canonical &amp; absolute path. The caveats are that this method will take an Ant style +388 * file selector path (../someDir/**\/*.jar) and convert it to an absolute/canonical path (at least to the left of the first * +389 * or ?). +390 * +391 * @param path the path to canonicalize +392 * @return the canonical path +393 */ +394 protected String ensureCanonicalPath(String path) { +395 String basePath = null; +396 String wildCards = null; +397 final String file = path.replace('\\', '/'); +398 if (file.contains("*") || file.contains("?")) { +399 +400 int pos = getLastFileSeparator(file); +401 if (pos < 0) { +402 return file; +403 } +404 pos += 1; +405 basePath = file.substring(0, pos); +406 wildCards = file.substring(pos); +407 } else { +408 basePath = file; +409 } +410 +411 File f = new File(basePath); +412 try { +413 f = f.getCanonicalFile(); +414 if (wildCards != null) { +415 f = new File(f, wildCards); +416 } +417 } catch (IOException ex) { +418 LOGGER.warn("Invalid path '{}' was provided.", path); +419 LOGGER.debug("Invalid path provided", ex); +420 } +421 return f.getAbsolutePath().replace('\\', '/'); +422 } +423 +424 /** +425 * Returns the position of the last file separator. +426 * +427 * @param file a file path +428 * @return the position of the last file separator +429 */ +430 private int getLastFileSeparator(String file) { +431 if (file.contains("*") || file.contains("?")) { +432 int p1 = file.indexOf('*'); +433 int p2 = file.indexOf('?'); +434 p1 = p1 > 0 ? p1 : file.length(); +435 p2 = p2 > 0 ? p2 : file.length(); +436 int pos = p1 < p2 ? p1 : p2; +437 pos = file.lastIndexOf('/', pos); +438 return pos; +439 } else { +440 return file.lastIndexOf('/'); +441 } +442 } +443 }
        diff --git a/xref/org/owasp/dependencycheck/CliParser.html b/xref/org/owasp/dependencycheck/CliParser.html index aeaf079ee..84c4f2ba4 100644 --- a/xref/org/owasp/dependencycheck/CliParser.html +++ b/xref/org/owasp/dependencycheck/CliParser.html @@ -98,1147 +98,1217 @@ 90 * @throws ParseException is thrown if there is an exception parsing the command line. 91 */ 92 private void validateArgs() throws FileNotFoundException, ParseException { -93 if (isRunScan()) { -94 validatePathExists(getScanFiles(), ARGUMENT.SCAN); -95 validatePathExists(getReportDirectory(), ARGUMENT.OUT); -96 if (getPathToMono() != null) { -97 validatePathExists(getPathToMono(), ARGUMENT.PATH_TO_MONO); -98 } -99 if (!line.hasOption(ARGUMENT.APP_NAME) && !line.hasOption(ARGUMENT.PROJECT)) { -100 throw new ParseException("Missing '" + ARGUMENT.PROJECT + "' argument; the scan cannot be run without the an project name."); -101 } -102 if (line.hasOption(ARGUMENT.OUTPUT_FORMAT)) { -103 final String format = line.getOptionValue(ARGUMENT.OUTPUT_FORMAT); -104 try { -105 Format.valueOf(format); -106 } catch (IllegalArgumentException ex) { -107 final String msg = String.format("An invalid 'format' of '%s' was specified. " -108 + "Supported output formats are XML, HTML, VULN, or ALL", format); -109 throw new ParseException(msg); -110 } +93 if (isUpdateOnly() || isRunScan()) { +94 final String value = line.getOptionValue(ARGUMENT.CVE_VALID_FOR_HOURS); +95 if (value != null) { +96 try { +97 final int i = Integer.parseInt(value); +98 if (i < 0) { +99 throw new ParseException("Invalid Setting: cveValidForHours must be a number greater than or equal to 0."); +100 } +101 } catch (NumberFormatException ex) { +102 throw new ParseException("Invalid Setting: cveValidForHours must be a number greater than or equal to 0."); +103 } +104 } +105 } +106 if (isRunScan()) { +107 validatePathExists(getScanFiles(), ARGUMENT.SCAN); +108 validatePathExists(getReportDirectory(), ARGUMENT.OUT); +109 if (getPathToMono() != null) { +110 validatePathExists(getPathToMono(), ARGUMENT.PATH_TO_MONO); 111 } -112 if ((getBaseCve12Url() != null || getBaseCve20Url() != null || getModifiedCve12Url() != null || getModifiedCve20Url() != null) -113 && (getBaseCve12Url() == null || getBaseCve20Url() == null || getModifiedCve12Url() == null || getModifiedCve20Url() == null)) { -114 final String msg = "If one of the CVE URLs is specified they must all be specified; please add the missing CVE URL."; -115 throw new ParseException(msg); -116 } -117 if (line.hasOption((ARGUMENT.SYM_LINK_DEPTH))) { -118 try { -119 final int i = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH)); -120 if (i < 0) { -121 throw new ParseException("Symbolic Link Depth (symLink) must be greater than zero."); -122 } -123 } catch (NumberFormatException ex) { -124 throw new ParseException("Symbolic Link Depth (symLink) is not a number."); -125 } -126 } -127 } -128 } -129 -130 /** -131 * Validates whether or not the path(s) points at a file that exists; if the path(s) does not point to an existing file a -132 * FileNotFoundException is thrown. -133 * -134 * @param paths the paths to validate if they exists -135 * @param optType the option being validated (e.g. scan, out, etc.) -136 * @throws FileNotFoundException is thrown if one of the paths being validated does not exist. -137 */ -138 private void validatePathExists(String[] paths, String optType) throws FileNotFoundException { -139 for (String path : paths) { -140 validatePathExists(path, optType); -141 } -142 } -143 -144 /** -145 * Validates whether or not the path points at a file that exists; if the path does not point to an existing file a -146 * FileNotFoundException is thrown. -147 * -148 * @param path the paths to validate if they exists -149 * @param argumentName the argument being validated (e.g. scan, out, etc.) -150 * @throws FileNotFoundException is thrown if the path being validated does not exist. -151 */ -152 private void validatePathExists(String path, String argumentName) throws FileNotFoundException { -153 if (path == null) { -154 isValid = false; -155 final String msg = String.format("Invalid '%s' argument: null", argumentName); -156 throw new FileNotFoundException(msg); -157 } else if (!path.contains("*") && !path.contains("?")) { -158 File f = new File(path); -159 if ("o".equalsIgnoreCase(argumentName.substring(0, 1)) && !"ALL".equalsIgnoreCase(this.getReportFormat())) { -160 final String checkPath = path.toLowerCase(); -161 if (checkPath.endsWith(".html") || checkPath.endsWith(".xml") || checkPath.endsWith(".htm")) { -162 if (f.getParentFile() == null) { -163 f = new File(".", path); -164 } -165 if (!f.getParentFile().isDirectory()) { -166 isValid = false; -167 final String msg = String.format("Invalid '%s' argument: '%s'", argumentName, path); -168 throw new FileNotFoundException(msg); -169 } -170 } -171 } else { -172 if (!f.exists()) { -173 isValid = false; -174 final String msg = String.format("Invalid '%s' argument: '%s'", argumentName, path); -175 throw new FileNotFoundException(msg); -176 } -177 } -178 } else if (path.startsWith("//") || path.startsWith("\\\\")) { -179 isValid = false; -180 final String msg = String.format("Invalid '%s' argument: '%s'%nUnable to scan paths that start with '//'.", argumentName, path); -181 throw new FileNotFoundException(msg); -182 } -183 } -184 -185 /** -186 * Generates an Options collection that is used to parse the command line and to display the help message. -187 * -188 * @return the command line options used for parsing the command line -189 */ -190 @SuppressWarnings("static-access") -191 private Options createCommandLineOptions() { -192 final Options options = new Options(); -193 addStandardOptions(options); -194 addAdvancedOptions(options); -195 addDeprecatedOptions(options); -196 return options; -197 } -198 -199 /** -200 * Adds the standard command line options to the given options collection. -201 * -202 * @param options a collection of command line arguments -203 * @throws IllegalArgumentException thrown if there is an exception -204 */ -205 @SuppressWarnings("static-access") -206 private void addStandardOptions(final Options options) throws IllegalArgumentException { -207 final Option help = new Option(ARGUMENT.HELP_SHORT, ARGUMENT.HELP, false, -208 "Print this message."); -209 -210 final Option advancedHelp = Option.builder().longOpt(ARGUMENT.ADVANCED_HELP) -211 .desc("Print the advanced help message.").build(); -212 -213 final Option version = new Option(ARGUMENT.VERSION_SHORT, ARGUMENT.VERSION, -214 false, "Print the version information."); -215 -216 final Option noUpdate = new Option(ARGUMENT.DISABLE_AUTO_UPDATE_SHORT, ARGUMENT.DISABLE_AUTO_UPDATE, -217 false, "Disables the automatic updating of the CPE data."); -218 -219 final Option projectName = Option.builder().hasArg().argName("name").longOpt(ARGUMENT.PROJECT) -220 .desc("The name of the project being scanned. This is a required argument.") -221 .build(); +112 if (!line.hasOption(ARGUMENT.APP_NAME) && !line.hasOption(ARGUMENT.PROJECT)) { +113 throw new ParseException("Missing '" + ARGUMENT.PROJECT + "' argument; the scan cannot be run without the an project name."); +114 } +115 if (line.hasOption(ARGUMENT.OUTPUT_FORMAT)) { +116 final String format = line.getOptionValue(ARGUMENT.OUTPUT_FORMAT); +117 try { +118 Format.valueOf(format); +119 } catch (IllegalArgumentException ex) { +120 final String msg = String.format("An invalid 'format' of '%s' was specified. " +121 + "Supported output formats are XML, HTML, VULN, or ALL", format); +122 throw new ParseException(msg); +123 } +124 } +125 if ((getBaseCve12Url() != null || getBaseCve20Url() != null || getModifiedCve12Url() != null || getModifiedCve20Url() != null) +126 && (getBaseCve12Url() == null || getBaseCve20Url() == null || getModifiedCve12Url() == null || getModifiedCve20Url() == null)) { +127 final String msg = "If one of the CVE URLs is specified they must all be specified; please add the missing CVE URL."; +128 throw new ParseException(msg); +129 } +130 if (line.hasOption((ARGUMENT.SYM_LINK_DEPTH))) { +131 try { +132 final int i = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH)); +133 if (i < 0) { +134 throw new ParseException("Symbolic Link Depth (symLink) must be greater than zero."); +135 } +136 } catch (NumberFormatException ex) { +137 throw new ParseException("Symbolic Link Depth (symLink) is not a number."); +138 } +139 } +140 } +141 } +142 +143 /** +144 * Validates whether or not the path(s) points at a file that exists; if the path(s) does not point to an existing file a +145 * FileNotFoundException is thrown. +146 * +147 * @param paths the paths to validate if they exists +148 * @param optType the option being validated (e.g. scan, out, etc.) +149 * @throws FileNotFoundException is thrown if one of the paths being validated does not exist. +150 */ +151 private void validatePathExists(String[] paths, String optType) throws FileNotFoundException { +152 for (String path : paths) { +153 validatePathExists(path, optType); +154 } +155 } +156 +157 /** +158 * Validates whether or not the path points at a file that exists; if the path does not point to an existing file a +159 * FileNotFoundException is thrown. +160 * +161 * @param path the paths to validate if they exists +162 * @param argumentName the argument being validated (e.g. scan, out, etc.) +163 * @throws FileNotFoundException is thrown if the path being validated does not exist. +164 */ +165 private void validatePathExists(String path, String argumentName) throws FileNotFoundException { +166 if (path == null) { +167 isValid = false; +168 final String msg = String.format("Invalid '%s' argument: null", argumentName); +169 throw new FileNotFoundException(msg); +170 } else if (!path.contains("*") && !path.contains("?")) { +171 File f = new File(path); +172 if ("o".equalsIgnoreCase(argumentName.substring(0, 1)) && !"ALL".equalsIgnoreCase(this.getReportFormat())) { +173 final String checkPath = path.toLowerCase(); +174 if (checkPath.endsWith(".html") || checkPath.endsWith(".xml") || checkPath.endsWith(".htm")) { +175 if (f.getParentFile() == null) { +176 f = new File(".", path); +177 } +178 if (!f.getParentFile().isDirectory()) { +179 isValid = false; +180 final String msg = String.format("Invalid '%s' argument: '%s'", argumentName, path); +181 throw new FileNotFoundException(msg); +182 } +183 } +184 } else { +185 if (!f.exists()) { +186 isValid = false; +187 final String msg = String.format("Invalid '%s' argument: '%s'", argumentName, path); +188 throw new FileNotFoundException(msg); +189 } +190 } +191 } else if (path.startsWith("//") || path.startsWith("\\\\")) { +192 isValid = false; +193 final String msg = String.format("Invalid '%s' argument: '%s'%nUnable to scan paths that start with '//'.", argumentName, path); +194 throw new FileNotFoundException(msg); +195 } +196 } +197 +198 /** +199 * Generates an Options collection that is used to parse the command line and to display the help message. +200 * +201 * @return the command line options used for parsing the command line +202 */ +203 @SuppressWarnings("static-access") +204 private Options createCommandLineOptions() { +205 final Options options = new Options(); +206 addStandardOptions(options); +207 addAdvancedOptions(options); +208 addDeprecatedOptions(options); +209 return options; +210 } +211 +212 /** +213 * Adds the standard command line options to the given options collection. +214 * +215 * @param options a collection of command line arguments +216 * @throws IllegalArgumentException thrown if there is an exception +217 */ +218 @SuppressWarnings("static-access") +219 private void addStandardOptions(final Options options) throws IllegalArgumentException { +220 final Option help = new Option(ARGUMENT.HELP_SHORT, ARGUMENT.HELP, false, +221 "Print this message."); 222 -223 final Option path = Option.builder(ARGUMENT.SCAN_SHORT).argName("path").hasArg().longOpt(ARGUMENT.SCAN) -224 .desc("The path to scan - this option can be specified multiple times. Ant style" -225 + " paths are supported (e.g. path/**/*.jar).") -226 .build(); -227 -228 final Option excludes = Option.builder().argName("pattern").hasArg().longOpt(ARGUMENT.EXCLUDE) -229 .desc("Specify and exclusion pattern. This option can be specified multiple times" -230 + " and it accepts Ant style excludsions.") -231 .build(); -232 -233 final Option props = Option.builder(ARGUMENT.PROP_SHORT).argName("file").hasArg().longOpt(ARGUMENT.PROP) -234 .desc("A property file to load.") -235 .build(); -236 -237 final Option out = Option.builder(ARGUMENT.OUT_SHORT).argName("path").hasArg().longOpt(ARGUMENT.OUT) -238 .desc("The folder to write reports to. This defaults to the current directory. " -239 + "It is possible to set this to a specific file name if the format argument is not set to ALL.") -240 .build(); -241 -242 final Option outputFormat = Option.builder(ARGUMENT.OUTPUT_FORMAT_SHORT).argName("format").hasArg().longOpt(ARGUMENT.OUTPUT_FORMAT) -243 .desc("The output format to write to (XML, HTML, VULN, ALL). The default is HTML.") +223 final Option advancedHelp = Option.builder().longOpt(ARGUMENT.ADVANCED_HELP) +224 .desc("Print the advanced help message.").build(); +225 +226 final Option version = new Option(ARGUMENT.VERSION_SHORT, ARGUMENT.VERSION, +227 false, "Print the version information."); +228 +229 final Option noUpdate = new Option(ARGUMENT.DISABLE_AUTO_UPDATE_SHORT, ARGUMENT.DISABLE_AUTO_UPDATE, +230 false, "Disables the automatic updating of the CPE data."); +231 +232 final Option projectName = Option.builder().hasArg().argName("name").longOpt(ARGUMENT.PROJECT) +233 .desc("The name of the project being scanned. This is a required argument.") +234 .build(); +235 +236 final Option path = Option.builder(ARGUMENT.SCAN_SHORT).argName("path").hasArg().longOpt(ARGUMENT.SCAN) +237 .desc("The path to scan - this option can be specified multiple times. Ant style" +238 + " paths are supported (e.g. path/**/*.jar).") +239 .build(); +240 +241 final Option excludes = Option.builder().argName("pattern").hasArg().longOpt(ARGUMENT.EXCLUDE) +242 .desc("Specify and exclusion pattern. This option can be specified multiple times" +243 + " and it accepts Ant style excludsions.") 244 .build(); 245 -246 final Option verboseLog = Option.builder(ARGUMENT.VERBOSE_LOG_SHORT).argName("file").hasArg().longOpt(ARGUMENT.VERBOSE_LOG) -247 .desc("The file path to write verbose logging information.") +246 final Option props = Option.builder(ARGUMENT.PROP_SHORT).argName("file").hasArg().longOpt(ARGUMENT.PROP) +247 .desc("A property file to load.") 248 .build(); 249 -250 final Option symLinkDepth = Option.builder().argName("depth").hasArg().longOpt(ARGUMENT.SYM_LINK_DEPTH) -251 .desc("Sets how deep nested symbolic links will be followed; 0 indicates symbolic links will not be followed.") -252 .build(); -253 -254 final Option suppressionFile = Option.builder().argName("file").hasArg().longOpt(ARGUMENT.SUPPRESSION_FILE) -255 .desc("The file path to the suppression XML file.") -256 .build(); -257 -258 //This is an option group because it can be specified more then once. -259 final OptionGroup og = new OptionGroup(); -260 og.addOption(path); -261 -262 final OptionGroup exog = new OptionGroup(); -263 exog.addOption(excludes); -264 -265 options.addOptionGroup(og) -266 .addOptionGroup(exog) -267 .addOption(projectName) -268 .addOption(out) -269 .addOption(outputFormat) -270 .addOption(version) -271 .addOption(help) -272 .addOption(advancedHelp) -273 .addOption(noUpdate) -274 .addOption(symLinkDepth) -275 .addOption(props) -276 .addOption(verboseLog) -277 .addOption(suppressionFile); -278 } -279 -280 /** -281 * Adds the advanced command line options to the given options collection. These are split out for purposes of being able to -282 * display two different help messages. -283 * -284 * @param options a collection of command line arguments -285 * @throws IllegalArgumentException thrown if there is an exception -286 */ -287 @SuppressWarnings("static-access") -288 private void addAdvancedOptions(final Options options) throws IllegalArgumentException { -289 -290 final Option cve12Base = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_BASE_12) -291 .desc("Base URL for each year’s CVE 1.2, the %d will be replaced with the year. ") -292 .build(); -293 -294 final Option cve20Base = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_BASE_20) -295 .desc("Base URL for each year’s CVE 2.0, the %d will be replaced with the year.") -296 .build(); +250 final Option out = Option.builder(ARGUMENT.OUT_SHORT).argName("path").hasArg().longOpt(ARGUMENT.OUT) +251 .desc("The folder to write reports to. This defaults to the current directory. " +252 + "It is possible to set this to a specific file name if the format argument is not set to ALL.") +253 .build(); +254 +255 final Option outputFormat = Option.builder(ARGUMENT.OUTPUT_FORMAT_SHORT).argName("format").hasArg().longOpt(ARGUMENT.OUTPUT_FORMAT) +256 .desc("The output format to write to (XML, HTML, VULN, ALL). The default is HTML.") +257 .build(); +258 +259 final Option verboseLog = Option.builder(ARGUMENT.VERBOSE_LOG_SHORT).argName("file").hasArg().longOpt(ARGUMENT.VERBOSE_LOG) +260 .desc("The file path to write verbose logging information.") +261 .build(); +262 +263 final Option symLinkDepth = Option.builder().argName("depth").hasArg().longOpt(ARGUMENT.SYM_LINK_DEPTH) +264 .desc("Sets how deep nested symbolic links will be followed; 0 indicates symbolic links will not be followed.") +265 .build(); +266 +267 final Option suppressionFile = Option.builder().argName("file").hasArg().longOpt(ARGUMENT.SUPPRESSION_FILE) +268 .desc("The file path to the suppression XML file.") +269 .build(); +270 +271 final Option cveValidForHours = Option.builder().argName("hours").hasArg().longOpt(ARGUMENT.CVE_VALID_FOR_HOURS) +272 .desc("The number of hours to wait before checking for new updates from the NVD.") +273 .build(); +274 +275 //This is an option group because it can be specified more then once. +276 final OptionGroup og = new OptionGroup(); +277 og.addOption(path); +278 +279 final OptionGroup exog = new OptionGroup(); +280 exog.addOption(excludes); +281 +282 options.addOptionGroup(og) +283 .addOptionGroup(exog) +284 .addOption(projectName) +285 .addOption(out) +286 .addOption(outputFormat) +287 .addOption(version) +288 .addOption(help) +289 .addOption(advancedHelp) +290 .addOption(noUpdate) +291 .addOption(symLinkDepth) +292 .addOption(props) +293 .addOption(verboseLog) +294 .addOption(suppressionFile) +295 .addOption(cveValidForHours); +296 } 297 -298 final Option cve12Modified = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_MOD_12) -299 .desc("URL for the modified CVE 1.2.") -300 .build(); -301 -302 final Option cve20Modified = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_MOD_20) -303 .desc("URL for the modified CVE 2.0.") -304 .build(); -305 -306 final Option updateOnly = Option.builder().longOpt(ARGUMENT.UPDATE_ONLY) -307 .desc("Only update the local NVD data cache; no scan will be executed.").build(); -308 -309 final Option data = Option.builder(ARGUMENT.DATA_DIRECTORY_SHORT).argName("path").hasArg().longOpt(ARGUMENT.DATA_DIRECTORY) -310 .desc("The location of the H2 Database file. This option should generally not be set.") -311 .build(); -312 -313 final Option nexusUrl = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.NEXUS_URL) -314 .desc("The url to the Nexus Server's REST API Endpoint (http://domain/nexus/service/local). " -315 + "If not set the Nexus Analyzer will be disabled.").build(); -316 -317 final Option nexusUsesProxy = Option.builder().argName("true/false").hasArg().longOpt(ARGUMENT.NEXUS_USES_PROXY) -318 .desc("Whether or not the configured proxy should be used when connecting to Nexus.") -319 .build(); -320 -321 final Option additionalZipExtensions = Option.builder().argName("extensions").hasArg() -322 .longOpt(ARGUMENT.ADDITIONAL_ZIP_EXTENSIONS) -323 .desc("A comma separated list of additional extensions to be scanned as ZIP files " -324 + "(ZIP, EAR, WAR are already treated as zip files)").build(); -325 -326 final Option pathToMono = Option.builder().argName("path").hasArg().longOpt(ARGUMENT.PATH_TO_MONO) -327 .desc("The path to Mono for .NET Assembly analysis on non-windows systems.") -328 .build(); -329 -330 final Option connectionTimeout = Option.builder(ARGUMENT.CONNECTION_TIMEOUT_SHORT).argName("timeout").hasArg() -331 .longOpt(ARGUMENT.CONNECTION_TIMEOUT).desc("The connection timeout (in milliseconds) to use when downloading resources.") -332 .build(); -333 -334 final Option proxyServer = Option.builder().argName("server").hasArg().longOpt(ARGUMENT.PROXY_SERVER) -335 .desc("The proxy server to use when downloading resources.").build(); -336 -337 final Option proxyPort = Option.builder().argName("port").hasArg().longOpt(ARGUMENT.PROXY_PORT) -338 .desc("The proxy port to use when downloading resources.").build(); -339 -340 final Option proxyUsername = Option.builder().argName("user").hasArg().longOpt(ARGUMENT.PROXY_USERNAME) -341 .desc("The proxy username to use when downloading resources.").build(); -342 -343 final Option proxyPassword = Option.builder().argName("pass").hasArg().longOpt(ARGUMENT.PROXY_PASSWORD) -344 .desc("The proxy password to use when downloading resources.").build(); -345 -346 final Option connectionString = Option.builder().argName("connStr").hasArg().longOpt(ARGUMENT.CONNECTION_STRING) -347 .desc("The connection string to the database.").build(); -348 -349 final Option dbUser = Option.builder().argName("user").hasArg().longOpt(ARGUMENT.DB_NAME) -350 .desc("The username used to connect to the database.").build(); +298 /** +299 * Adds the advanced command line options to the given options collection. These are split out for purposes of being able to +300 * display two different help messages. +301 * +302 * @param options a collection of command line arguments +303 * @throws IllegalArgumentException thrown if there is an exception +304 */ +305 @SuppressWarnings("static-access") +306 private void addAdvancedOptions(final Options options) throws IllegalArgumentException { +307 +308 final Option cve12Base = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_BASE_12) +309 .desc("Base URL for each year’s CVE 1.2, the %d will be replaced with the year. ") +310 .build(); +311 +312 final Option cve20Base = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_BASE_20) +313 .desc("Base URL for each year’s CVE 2.0, the %d will be replaced with the year.") +314 .build(); +315 +316 final Option cve12Modified = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_MOD_12) +317 .desc("URL for the modified CVE 1.2.") +318 .build(); +319 +320 final Option cve20Modified = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.CVE_MOD_20) +321 .desc("URL for the modified CVE 2.0.") +322 .build(); +323 +324 final Option updateOnly = Option.builder().longOpt(ARGUMENT.UPDATE_ONLY) +325 .desc("Only update the local NVD data cache; no scan will be executed.").build(); +326 +327 final Option data = Option.builder(ARGUMENT.DATA_DIRECTORY_SHORT).argName("path").hasArg().longOpt(ARGUMENT.DATA_DIRECTORY) +328 .desc("The location of the H2 Database file. This option should generally not be set.") +329 .build(); +330 +331 final Option nexusUrl = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.NEXUS_URL) +332 .desc("The url to the Nexus Server's REST API Endpoint (http://domain/nexus/service/local). " +333 + "If not set the Nexus Analyzer will be disabled.").build(); +334 +335 final Option nexusUsesProxy = Option.builder().argName("true/false").hasArg().longOpt(ARGUMENT.NEXUS_USES_PROXY) +336 .desc("Whether or not the configured proxy should be used when connecting to Nexus.") +337 .build(); +338 +339 final Option additionalZipExtensions = Option.builder().argName("extensions").hasArg() +340 .longOpt(ARGUMENT.ADDITIONAL_ZIP_EXTENSIONS) +341 .desc("A comma separated list of additional extensions to be scanned as ZIP files " +342 + "(ZIP, EAR, WAR are already treated as zip files)").build(); +343 +344 final Option pathToMono = Option.builder().argName("path").hasArg().longOpt(ARGUMENT.PATH_TO_MONO) +345 .desc("The path to Mono for .NET Assembly analysis on non-windows systems.") +346 .build(); +347 +348 final Option pathToBundleAudit = Option.builder().argName("path").hasArg() +349 .longOpt(ARGUMENT.PATH_TO_BUNDLE_AUDIT) +350 .desc("The path to bundle-audit for Gem bundle analysis.").build(); 351 -352 final Option dbPassword = Option.builder().argName("password").hasArg().longOpt(ARGUMENT.DB_PASSWORD) -353 .desc("The password for connecting to the database.").build(); -354 -355 final Option dbDriver = Option.builder().argName("driver").hasArg().longOpt(ARGUMENT.DB_DRIVER) -356 .desc("The database driver name.").build(); -357 -358 final Option dbDriverPath = Option.builder().argName("path").hasArg().longOpt(ARGUMENT.DB_DRIVER_PATH) -359 .desc("The path to the database driver; note, this does not need to be set unless the JAR is outside of the classpath.") -360 .build(); +352 final Option connectionTimeout = Option.builder(ARGUMENT.CONNECTION_TIMEOUT_SHORT).argName("timeout").hasArg() +353 .longOpt(ARGUMENT.CONNECTION_TIMEOUT).desc("The connection timeout (in milliseconds) to use when downloading resources.") +354 .build(); +355 +356 final Option proxyServer = Option.builder().argName("server").hasArg().longOpt(ARGUMENT.PROXY_SERVER) +357 .desc("The proxy server to use when downloading resources.").build(); +358 +359 final Option proxyPort = Option.builder().argName("port").hasArg().longOpt(ARGUMENT.PROXY_PORT) +360 .desc("The proxy port to use when downloading resources.").build(); 361 -362 final Option disableJarAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_JAR) -363 .desc("Disable the Jar Analyzer.").build(); +362 final Option proxyUsername = Option.builder().argName("user").hasArg().longOpt(ARGUMENT.PROXY_USERNAME) +363 .desc("The proxy username to use when downloading resources.").build(); 364 -365 final Option disableArchiveAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_ARCHIVE) -366 .desc("Disable the Archive Analyzer.").build(); +365 final Option proxyPassword = Option.builder().argName("pass").hasArg().longOpt(ARGUMENT.PROXY_PASSWORD) +366 .desc("The proxy password to use when downloading resources.").build(); 367 -368 final Option disableNuspecAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_NUSPEC) -369 .desc("Disable the Nuspec Analyzer.").build(); +368 final Option connectionString = Option.builder().argName("connStr").hasArg().longOpt(ARGUMENT.CONNECTION_STRING) +369 .desc("The connection string to the database.").build(); 370 -371 final Option disableAssemblyAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_ASSEMBLY) -372 .desc("Disable the .NET Assembly Analyzer.").build(); +371 final Option dbUser = Option.builder().argName("user").hasArg().longOpt(ARGUMENT.DB_NAME) +372 .desc("The username used to connect to the database.").build(); 373 -374 final Option disablePythonDistributionAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_PY_DIST) -375 .desc("Disable the Python Distribution Analyzer.").build(); +374 final Option dbPassword = Option.builder().argName("password").hasArg().longOpt(ARGUMENT.DB_PASSWORD) +375 .desc("The password for connecting to the database.").build(); 376 -377 final Option disablePythonPackageAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_PY_PKG) -378 .desc("Disable the Python Package Analyzer.").build(); +377 final Option dbDriver = Option.builder().argName("driver").hasArg().longOpt(ARGUMENT.DB_DRIVER) +378 .desc("The database driver name.").build(); 379 -380 final Option disableComposerAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_COMPOSER) -381 .desc("Disable the PHP Composer Analyzer.").build(); -382 -383 final Option disableAutoconfAnalyzer = Option.builder() -384 .longOpt(ARGUMENT.DISABLE_AUTOCONF) -385 .desc("Disable the Autoconf Analyzer.").build(); +380 final Option dbDriverPath = Option.builder().argName("path").hasArg().longOpt(ARGUMENT.DB_DRIVER_PATH) +381 .desc("The path to the database driver; note, this does not need to be set unless the JAR is outside of the classpath.") +382 .build(); +383 +384 final Option disableJarAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_JAR) +385 .desc("Disable the Jar Analyzer.").build(); 386 -387 final Option disableOpenSSLAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_OPENSSL) -388 .desc("Disable the OpenSSL Analyzer.").build(); -389 final Option disableCmakeAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_CMAKE) -390 .desc("Disable the Cmake Analyzer.").build(); -391 -392 final Option disableCentralAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_CENTRAL) -393 .desc("Disable the Central Analyzer. If this analyzer is disabled it is likely you also want to disable " -394 + "the Nexus Analyzer.").build(); +387 final Option disableArchiveAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_ARCHIVE) +388 .desc("Disable the Archive Analyzer.").build(); +389 +390 final Option disableNuspecAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_NUSPEC) +391 .desc("Disable the Nuspec Analyzer.").build(); +392 +393 final Option disableAssemblyAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_ASSEMBLY) +394 .desc("Disable the .NET Assembly Analyzer.").build(); 395 -396 final Option disableNexusAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_NEXUS) -397 .desc("Disable the Nexus Analyzer.").build(); +396 final Option disablePythonDistributionAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_PY_DIST) +397 .desc("Disable the Python Distribution Analyzer.").build(); 398 -399 final Option purge = Option.builder().longOpt(ARGUMENT.PURGE_NVD) -400 .desc("Purges the local NVD data cache") -401 .build(); -402 -403 options.addOption(updateOnly) -404 .addOption(cve12Base) -405 .addOption(cve20Base) -406 .addOption(cve12Modified) -407 .addOption(cve20Modified) -408 .addOption(proxyPort) -409 .addOption(proxyServer) -410 .addOption(proxyUsername) -411 .addOption(proxyPassword) -412 .addOption(connectionTimeout) -413 .addOption(connectionString) -414 .addOption(dbUser) -415 .addOption(data) -416 .addOption(dbPassword) -417 .addOption(dbDriver) -418 .addOption(dbDriverPath) -419 .addOption(disableJarAnalyzer) -420 .addOption(disableArchiveAnalyzer) -421 .addOption(disableAssemblyAnalyzer) -422 .addOption(disablePythonDistributionAnalyzer) -423 .addOption(disableCmakeAnalyzer) -424 .addOption(disablePythonPackageAnalyzer) -425 .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_RUBYGEMS) -426 .desc("Disable the Ruby Gemspec Analyzer.").build()) -427 .addOption(disableAutoconfAnalyzer) -428 .addOption(disableComposerAnalyzer) -429 .addOption(disableOpenSSLAnalyzer) -430 .addOption(disableNuspecAnalyzer) -431 .addOption(disableCentralAnalyzer) -432 .addOption(disableNexusAnalyzer) -433 .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_NODE_JS) -434 .desc("Disable the Node.js Package Analyzer.").build()) -435 .addOption(nexusUrl) -436 .addOption(nexusUsesProxy) -437 .addOption(additionalZipExtensions) -438 .addOption(pathToMono) -439 .addOption(purge); -440 } -441 -442 /** -443 * Adds the deprecated command line options to the given options collection. These are split out for purposes of not including -444 * them in the help message. We need to add the deprecated options so as not to break existing scripts. -445 * -446 * @param options a collection of command line arguments -447 * @throws IllegalArgumentException thrown if there is an exception -448 */ -449 @SuppressWarnings({"static-access", "deprecation"}) -450 private void addDeprecatedOptions(final Options options) throws IllegalArgumentException { -451 -452 final Option proxyServer = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.PROXY_URL) -453 .desc("The proxy url argument is deprecated, use proxyserver instead.") -454 .build(); -455 final Option appName = Option.builder(ARGUMENT.APP_NAME_SHORT).argName("name").hasArg().longOpt(ARGUMENT.APP_NAME) -456 .desc("The name of the project being scanned.") -457 .build(); -458 -459 options.addOption(proxyServer); -460 options.addOption(appName); -461 } -462 -463 /** -464 * Determines if the 'version' command line argument was passed in. -465 * -466 * @return whether or not the 'version' command line argument was passed in -467 */ -468 public boolean isGetVersion() { -469 return (line != null) && line.hasOption(ARGUMENT.VERSION); -470 } -471 -472 /** -473 * Determines if the 'help' command line argument was passed in. -474 * -475 * @return whether or not the 'help' command line argument was passed in -476 */ -477 public boolean isGetHelp() { -478 return (line != null) && line.hasOption(ARGUMENT.HELP); -479 } -480 -481 /** -482 * Determines if the 'scan' command line argument was passed in. -483 * -484 * @return whether or not the 'scan' command line argument was passed in -485 */ -486 public boolean isRunScan() { -487 return (line != null) && isValid && line.hasOption(ARGUMENT.SCAN); -488 } -489 -490 /** -491 * Returns the symbolic link depth (how deeply symbolic links will be followed). -492 * -493 * @return the symbolic link depth -494 */ -495 public int getSymLinkDepth() { -496 int value = 0; -497 try { -498 value = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH, "0")); -499 if (value < 0) { -500 value = 0; -501 } -502 } catch (NumberFormatException ex) { -503 LOGGER.debug("Symbolic link was not a number"); -504 } -505 return value; -506 } -507 -508 /** -509 * Returns true if the disableJar command line argument was specified. -510 * -511 * @return true if the disableJar command line argument was specified; otherwise false -512 */ -513 public boolean isJarDisabled() { -514 return (line != null) && line.hasOption(ARGUMENT.DISABLE_JAR); -515 } -516 -517 /** -518 * Returns true if the disableArchive command line argument was specified. -519 * -520 * @return true if the disableArchive command line argument was specified; otherwise false -521 */ -522 public boolean isArchiveDisabled() { -523 return (line != null) && line.hasOption(ARGUMENT.DISABLE_ARCHIVE); -524 } -525 -526 /** -527 * Returns true if the disableNuspec command line argument was specified. -528 * -529 * @return true if the disableNuspec command line argument was specified; otherwise false -530 */ -531 public boolean isNuspecDisabled() { -532 return (line != null) && line.hasOption(ARGUMENT.DISABLE_NUSPEC); -533 } -534 -535 /** -536 * Returns true if the disableAssembly command line argument was specified. -537 * -538 * @return true if the disableAssembly command line argument was specified; otherwise false -539 */ -540 public boolean isAssemblyDisabled() { -541 return (line != null) && line.hasOption(ARGUMENT.DISABLE_ASSEMBLY); -542 } -543 -544 /** -545 * Returns true if the disablePyDist command line argument was specified. -546 * -547 * @return true if the disablePyDist command line argument was specified; otherwise false -548 */ -549 public boolean isPythonDistributionDisabled() { -550 return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_DIST); -551 } -552 -553 /** -554 * Returns true if the disablePyPkg command line argument was specified. -555 * -556 * @return true if the disablePyPkg command line argument was specified; otherwise false -557 */ -558 public boolean isPythonPackageDisabled() { -559 return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_PKG); -560 } -561 -562 /** -563 * Returns whether the Ruby gemspec analyzer is disabled. -564 * -565 * @return true if the {@link ARGUMENT#DISABLE_RUBYGEMS} command line argument was specified; otherwise false -566 */ -567 public boolean isRubyGemspecDisabled() { -568 return (null != line) && line.hasOption(ARGUMENT.DISABLE_RUBYGEMS); -569 } -570 -571 /** -572 * Returns true if the disableCmake command line argument was specified. -573 * -574 * @return true if the disableCmake command line argument was specified; otherwise false -575 */ -576 public boolean isCmakeDisabled() { -577 return (line != null) && line.hasOption(ARGUMENT.DISABLE_CMAKE); -578 } +399 final Option disablePythonPackageAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_PY_PKG) +400 .desc("Disable the Python Package Analyzer.").build(); +401 +402 final Option disableComposerAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_COMPOSER) +403 .desc("Disable the PHP Composer Analyzer.").build(); +404 +405 final Option disableAutoconfAnalyzer = Option.builder() +406 .longOpt(ARGUMENT.DISABLE_AUTOCONF) +407 .desc("Disable the Autoconf Analyzer.").build(); +408 +409 final Option disableOpenSSLAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_OPENSSL) +410 .desc("Disable the OpenSSL Analyzer.").build(); +411 final Option disableCmakeAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_CMAKE) +412 .desc("Disable the Cmake Analyzer.").build(); +413 +414 final Option disableCentralAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_CENTRAL) +415 .desc("Disable the Central Analyzer. If this analyzer is disabled it is likely you also want to disable " +416 + "the Nexus Analyzer.").build(); +417 +418 final Option disableNexusAnalyzer = Option.builder().longOpt(ARGUMENT.DISABLE_NEXUS) +419 .desc("Disable the Nexus Analyzer.").build(); +420 +421 final Option purge = Option.builder().longOpt(ARGUMENT.PURGE_NVD) +422 .desc("Purges the local NVD data cache") +423 .build(); +424 +425 options.addOption(updateOnly) +426 .addOption(cve12Base) +427 .addOption(cve20Base) +428 .addOption(cve12Modified) +429 .addOption(cve20Modified) +430 .addOption(proxyPort) +431 .addOption(proxyServer) +432 .addOption(proxyUsername) +433 .addOption(proxyPassword) +434 .addOption(connectionTimeout) +435 .addOption(connectionString) +436 .addOption(dbUser) +437 .addOption(data) +438 .addOption(dbPassword) +439 .addOption(dbDriver) +440 .addOption(dbDriverPath) +441 .addOption(disableJarAnalyzer) +442 .addOption(disableArchiveAnalyzer) +443 .addOption(disableAssemblyAnalyzer) +444 .addOption(pathToBundleAudit) +445 .addOption(disablePythonDistributionAnalyzer) +446 .addOption(disableCmakeAnalyzer) +447 .addOption(disablePythonPackageAnalyzer) +448 .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_RUBYGEMS) +449 .desc("Disable the Ruby Gemspec Analyzer.").build()) +450 .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_BUNDLE_AUDIT) +451 .desc("Disable the Ruby Bundler-Audit Analyzer.").build()) +452 .addOption(disableAutoconfAnalyzer) +453 .addOption(disableComposerAnalyzer) +454 .addOption(disableOpenSSLAnalyzer) +455 .addOption(disableNuspecAnalyzer) +456 .addOption(disableCentralAnalyzer) +457 .addOption(disableNexusAnalyzer) +458 .addOption(Option.builder().longOpt(ARGUMENT.DISABLE_NODE_JS) +459 .desc("Disable the Node.js Package Analyzer.").build()) +460 .addOption(nexusUrl) +461 .addOption(nexusUsesProxy) +462 .addOption(additionalZipExtensions) +463 .addOption(pathToMono) +464 .addOption(pathToBundleAudit) +465 .addOption(purge); +466 } +467 +468 /** +469 * Adds the deprecated command line options to the given options collection. These are split out for purposes of not including +470 * them in the help message. We need to add the deprecated options so as not to break existing scripts. +471 * +472 * @param options a collection of command line arguments +473 * @throws IllegalArgumentException thrown if there is an exception +474 */ +475 @SuppressWarnings({"static-access", "deprecation"}) +476 private void addDeprecatedOptions(final Options options) throws IllegalArgumentException { +477 +478 final Option proxyServer = Option.builder().argName("url").hasArg().longOpt(ARGUMENT.PROXY_URL) +479 .desc("The proxy url argument is deprecated, use proxyserver instead.") +480 .build(); +481 final Option appName = Option.builder(ARGUMENT.APP_NAME_SHORT).argName("name").hasArg().longOpt(ARGUMENT.APP_NAME) +482 .desc("The name of the project being scanned.") +483 .build(); +484 +485 options.addOption(proxyServer); +486 options.addOption(appName); +487 } +488 +489 /** +490 * Determines if the 'version' command line argument was passed in. +491 * +492 * @return whether or not the 'version' command line argument was passed in +493 */ +494 public boolean isGetVersion() { +495 return (line != null) && line.hasOption(ARGUMENT.VERSION); +496 } +497 +498 /** +499 * Determines if the 'help' command line argument was passed in. +500 * +501 * @return whether or not the 'help' command line argument was passed in +502 */ +503 public boolean isGetHelp() { +504 return (line != null) && line.hasOption(ARGUMENT.HELP); +505 } +506 +507 /** +508 * Determines if the 'scan' command line argument was passed in. +509 * +510 * @return whether or not the 'scan' command line argument was passed in +511 */ +512 public boolean isRunScan() { +513 return (line != null) && isValid && line.hasOption(ARGUMENT.SCAN); +514 } +515 +516 /** +517 * Returns the symbolic link depth (how deeply symbolic links will be followed). +518 * +519 * @return the symbolic link depth +520 */ +521 public int getSymLinkDepth() { +522 int value = 0; +523 try { +524 value = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH, "0")); +525 if (value < 0) { +526 value = 0; +527 } +528 } catch (NumberFormatException ex) { +529 LOGGER.debug("Symbolic link was not a number"); +530 } +531 return value; +532 } +533 +534 /** +535 * Returns true if the disableJar command line argument was specified. +536 * +537 * @return true if the disableJar command line argument was specified; otherwise false +538 */ +539 public boolean isJarDisabled() { +540 return (line != null) && line.hasOption(ARGUMENT.DISABLE_JAR); +541 } +542 +543 /** +544 * Returns true if the disableArchive command line argument was specified. +545 * +546 * @return true if the disableArchive command line argument was specified; otherwise false +547 */ +548 public boolean isArchiveDisabled() { +549 return (line != null) && line.hasOption(ARGUMENT.DISABLE_ARCHIVE); +550 } +551 +552 /** +553 * Returns true if the disableNuspec command line argument was specified. +554 * +555 * @return true if the disableNuspec command line argument was specified; otherwise false +556 */ +557 public boolean isNuspecDisabled() { +558 return (line != null) && line.hasOption(ARGUMENT.DISABLE_NUSPEC); +559 } +560 +561 /** +562 * Returns true if the disableAssembly command line argument was specified. +563 * +564 * @return true if the disableAssembly command line argument was specified; otherwise false +565 */ +566 public boolean isAssemblyDisabled() { +567 return (line != null) && line.hasOption(ARGUMENT.DISABLE_ASSEMBLY); +568 } +569 +570 /** +571 * Returns true if the disableBundleAudit command line argument was specified. +572 * +573 * @return true if the disableBundleAudit command line argument was specified; otherwise false +574 */ +575 public boolean isBundleAuditDisabled() { +576 return (line != null) && line.hasOption(ARGUMENT.DISABLE_BUNDLE_AUDIT); +577 } +578 579 580 /** -581 * Returns true if the disableAutoconf command line argument was specified. +581 * Returns true if the disablePyDist command line argument was specified. 582 * -583 * @return true if the disableAutoconf command line argument was specified; otherwise false +583 * @return true if the disablePyDist command line argument was specified; otherwise false 584 */ -585 public boolean isAutoconfDisabled() { -586 return (line != null) && line.hasOption(ARGUMENT.DISABLE_AUTOCONF); +585 public boolean isPythonDistributionDisabled() { +586 return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_DIST); 587 } 588 589 /** -590 * Returns true if the disableComposer command line argument was specified. +590 * Returns true if the disablePyPkg command line argument was specified. 591 * -592 * @return true if the disableComposer command line argument was specified; otherwise false +592 * @return true if the disablePyPkg command line argument was specified; otherwise false 593 */ -594 public boolean isComposerDisabled() { -595 return (line != null) && line.hasOption(ARGUMENT.DISABLE_COMPOSER); +594 public boolean isPythonPackageDisabled() { +595 return (line != null) && line.hasOption(ARGUMENT.DISABLE_PY_PKG); 596 } 597 598 /** -599 * Returns true if the disableNexus command line argument was specified. +599 * Returns whether the Ruby gemspec analyzer is disabled. 600 * -601 * @return true if the disableNexus command line argument was specified; otherwise false +601 * @return true if the {@link ARGUMENT#DISABLE_RUBYGEMS} command line argument was specified; otherwise false 602 */ -603 public boolean isNexusDisabled() { -604 return (line != null) && line.hasOption(ARGUMENT.DISABLE_NEXUS); +603 public boolean isRubyGemspecDisabled() { +604 return (null != line) && line.hasOption(ARGUMENT.DISABLE_RUBYGEMS); 605 } 606 607 /** -608 * Returns true if the disableOpenSSL command line argument was specified. +608 * Returns true if the disableCmake command line argument was specified. 609 * -610 * @return true if the disableOpenSSL command line argument was specified; otherwise false +610 * @return true if the disableCmake command line argument was specified; otherwise false 611 */ -612 public boolean isOpenSSLDisabled() { -613 return (line != null) && line.hasOption(ARGUMENT.DISABLE_OPENSSL); +612 public boolean isCmakeDisabled() { +613 return (line != null) && line.hasOption(ARGUMENT.DISABLE_CMAKE); 614 } 615 616 /** -617 * Returns true if the disableNodeJS command line argument was specified. +617 * Returns true if the disableAutoconf command line argument was specified. 618 * -619 * @return true if the disableNodeJS command line argument was specified; otherwise false +619 * @return true if the disableAutoconf command line argument was specified; otherwise false 620 */ -621 public boolean isNodeJsDisabled() { -622 return (line != null) && line.hasOption(ARGUMENT.DISABLE_NODE_JS); +621 public boolean isAutoconfDisabled() { +622 return (line != null) && line.hasOption(ARGUMENT.DISABLE_AUTOCONF); 623 } 624 625 /** -626 * Returns true if the disableCentral command line argument was specified. +626 * Returns true if the disableComposer command line argument was specified. 627 * -628 * @return true if the disableCentral command line argument was specified; otherwise false +628 * @return true if the disableComposer command line argument was specified; otherwise false 629 */ -630 public boolean isCentralDisabled() { -631 return (line != null) && line.hasOption(ARGUMENT.DISABLE_CENTRAL); +630 public boolean isComposerDisabled() { +631 return (line != null) && line.hasOption(ARGUMENT.DISABLE_COMPOSER); 632 } 633 634 /** -635 * Returns the url to the nexus server if one was specified. +635 * Returns true if the disableNexus command line argument was specified. 636 * -637 * @return the url to the nexus server; if none was specified this will return null; +637 * @return true if the disableNexus command line argument was specified; otherwise false 638 */ -639 public String getNexusUrl() { -640 if (line == null || !line.hasOption(ARGUMENT.NEXUS_URL)) { -641 return null; -642 } else { -643 return line.getOptionValue(ARGUMENT.NEXUS_URL); -644 } -645 } -646 -647 /** -648 * Returns true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false is returned. -649 * -650 * @return true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false -651 */ -652 public boolean isNexusUsesProxy() { -653 // If they didn't specify whether Nexus needs to use the proxy, we should -654 // still honor the property if it's set. -655 if (line == null || !line.hasOption(ARGUMENT.NEXUS_USES_PROXY)) { -656 try { -657 return Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY); -658 } catch (InvalidSettingException ise) { -659 return true; -660 } -661 } else { -662 return Boolean.parseBoolean(line.getOptionValue(ARGUMENT.NEXUS_USES_PROXY)); -663 } -664 } -665 -666 /** -667 * Displays the command line help message to the standard output. -668 */ -669 public void printHelp() { -670 final HelpFormatter formatter = new HelpFormatter(); -671 final Options options = new Options(); -672 addStandardOptions(options); -673 if (line != null && line.hasOption(ARGUMENT.ADVANCED_HELP)) { -674 addAdvancedOptions(options); -675 } -676 final String helpMsg = String.format("%n%s" -677 + " can be used to identify if there are any known CVE vulnerabilities in libraries utilized by an application. " -678 + "%s will automatically update required data from the Internet, such as the CVE and CPE data files from nvd.nist.gov.%n%n", -679 Settings.getString("application.name", "DependencyCheck"), -680 Settings.getString("application.name", "DependencyCheck")); -681 -682 formatter.printHelp(Settings.getString("application.name", "DependencyCheck"), -683 helpMsg, -684 options, -685 "", -686 true); -687 } -688 -689 /** -690 * Retrieves the file command line parameter(s) specified for the 'scan' argument. -691 * -692 * @return the file paths specified on the command line for scan -693 */ -694 public String[] getScanFiles() { -695 return line.getOptionValues(ARGUMENT.SCAN); -696 } -697 -698 /** -699 * Retrieves the list of excluded file patterns specified by the 'exclude' argument. -700 * -701 * @return the excluded file patterns -702 */ -703 public String[] getExcludeList() { -704 return line.getOptionValues(ARGUMENT.EXCLUDE); -705 } -706 -707 /** -708 * Returns the directory to write the reports to specified on the command line. -709 * -710 * @return the path to the reports directory. -711 */ -712 public String getReportDirectory() { -713 return line.getOptionValue(ARGUMENT.OUT, "."); -714 } -715 -716 /** -717 * Returns the path to Mono for .NET Assembly analysis on non-windows systems. -718 * -719 * @return the path to Mono -720 */ -721 public String getPathToMono() { -722 return line.getOptionValue(ARGUMENT.PATH_TO_MONO); +639 public boolean isNexusDisabled() { +640 return (line != null) && line.hasOption(ARGUMENT.DISABLE_NEXUS); +641 } +642 +643 /** +644 * Returns true if the disableOpenSSL command line argument was specified. +645 * +646 * @return true if the disableOpenSSL command line argument was specified; otherwise false +647 */ +648 public boolean isOpenSSLDisabled() { +649 return (line != null) && line.hasOption(ARGUMENT.DISABLE_OPENSSL); +650 } +651 +652 /** +653 * Returns true if the disableNodeJS command line argument was specified. +654 * +655 * @return true if the disableNodeJS command line argument was specified; otherwise false +656 */ +657 public boolean isNodeJsDisabled() { +658 return (line != null) && line.hasOption(ARGUMENT.DISABLE_NODE_JS); +659 } +660 +661 /** +662 * Returns true if the disableCentral command line argument was specified. +663 * +664 * @return true if the disableCentral command line argument was specified; otherwise false +665 */ +666 public boolean isCentralDisabled() { +667 return (line != null) && line.hasOption(ARGUMENT.DISABLE_CENTRAL); +668 } +669 +670 /** +671 * Returns the url to the nexus server if one was specified. +672 * +673 * @return the url to the nexus server; if none was specified this will return null; +674 */ +675 public String getNexusUrl() { +676 if (line == null || !line.hasOption(ARGUMENT.NEXUS_URL)) { +677 return null; +678 } else { +679 return line.getOptionValue(ARGUMENT.NEXUS_URL); +680 } +681 } +682 +683 /** +684 * Returns true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false is returned. +685 * +686 * @return true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false +687 */ +688 public boolean isNexusUsesProxy() { +689 // If they didn't specify whether Nexus needs to use the proxy, we should +690 // still honor the property if it's set. +691 if (line == null || !line.hasOption(ARGUMENT.NEXUS_USES_PROXY)) { +692 try { +693 return Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY); +694 } catch (InvalidSettingException ise) { +695 return true; +696 } +697 } else { +698 return Boolean.parseBoolean(line.getOptionValue(ARGUMENT.NEXUS_USES_PROXY)); +699 } +700 } +701 +702 /** +703 * Displays the command line help message to the standard output. +704 */ +705 public void printHelp() { +706 final HelpFormatter formatter = new HelpFormatter(); +707 final Options options = new Options(); +708 addStandardOptions(options); +709 if (line != null && line.hasOption(ARGUMENT.ADVANCED_HELP)) { +710 addAdvancedOptions(options); +711 } +712 final String helpMsg = String.format("%n%s" +713 + " can be used to identify if there are any known CVE vulnerabilities in libraries utilized by an application. " +714 + "%s will automatically update required data from the Internet, such as the CVE and CPE data files from nvd.nist.gov.%n%n", +715 Settings.getString("application.name", "DependencyCheck"), +716 Settings.getString("application.name", "DependencyCheck")); +717 +718 formatter.printHelp(Settings.getString("application.name", "DependencyCheck"), +719 helpMsg, +720 options, +721 "", +722 true); 723 } 724 725 /** -726 * Returns the output format specified on the command line. Defaults to HTML if no format was specified. +726 * Retrieves the file command line parameter(s) specified for the 'scan' argument. 727 * -728 * @return the output format name. +728 * @return the file paths specified on the command line for scan 729 */ -730 public String getReportFormat() { -731 return line.getOptionValue(ARGUMENT.OUTPUT_FORMAT, "HTML"); +730 public String[] getScanFiles() { +731 return line.getOptionValues(ARGUMENT.SCAN); 732 } 733 734 /** -735 * Returns the application name specified on the command line. +735 * Retrieves the list of excluded file patterns specified by the 'exclude' argument. 736 * -737 * @return the application name. +737 * @return the excluded file patterns 738 */ -739 public String getProjectName() { -740 final String appName = line.getOptionValue(ARGUMENT.APP_NAME); -741 String name = line.getOptionValue(ARGUMENT.PROJECT); -742 if (name == null && appName != null) { -743 name = appName; -744 LOGGER.warn("The '" + ARGUMENT.APP_NAME + "' argument should no longer be used; use '" + ARGUMENT.PROJECT + "' instead."); -745 } -746 return name; -747 } -748 -749 /** -750 * Returns the base URL for the CVE 1.2 XMl file. -751 * -752 * @return the URL to the CVE 1.2 XML file. -753 */ -754 public String getBaseCve12Url() { -755 return line.getOptionValue(ARGUMENT.CVE_BASE_12); -756 } -757 -758 /** -759 * Returns the base URL for the CVE 2.0 XMl file. -760 * -761 * @return the URL to the CVE 2.0 XML file. -762 */ -763 public String getBaseCve20Url() { -764 return line.getOptionValue(ARGUMENT.CVE_BASE_20); -765 } -766 -767 /** -768 * Returns the URL for the modified CVE 1.2 XMl file. -769 * -770 * @return the URL to the modified CVE 1.2 XML file. -771 */ -772 public String getModifiedCve12Url() { -773 return line.getOptionValue(ARGUMENT.CVE_MOD_12); -774 } -775 -776 /** -777 * Returns the URL for the modified CVE 2.0 XMl file. -778 * -779 * @return the URL to the modified CVE 2.0 XML file. -780 */ -781 public String getModifiedCve20Url() { -782 return line.getOptionValue(ARGUMENT.CVE_MOD_20); -783 } -784 -785 /** -786 * Returns the connection timeout. -787 * -788 * @return the connection timeout -789 */ -790 public String getConnectionTimeout() { -791 return line.getOptionValue(ARGUMENT.CONNECTION_TIMEOUT); +739 public String[] getExcludeList() { +740 return line.getOptionValues(ARGUMENT.EXCLUDE); +741 } +742 +743 /** +744 * Returns the directory to write the reports to specified on the command line. +745 * +746 * @return the path to the reports directory. +747 */ +748 public String getReportDirectory() { +749 return line.getOptionValue(ARGUMENT.OUT, "."); +750 } +751 +752 /** +753 * Returns the path to Mono for .NET Assembly analysis on non-windows systems. +754 * +755 * @return the path to Mono +756 */ +757 public String getPathToMono() { +758 return line.getOptionValue(ARGUMENT.PATH_TO_MONO); +759 } +760 +761 /** +762 * Returns the path to bundle-audit for Ruby bundle analysis. +763 * +764 * @return the path to Mono +765 */ +766 public String getPathToBundleAudit() { +767 return line.getOptionValue(ARGUMENT.PATH_TO_BUNDLE_AUDIT); +768 } +769 +770 /** +771 * Returns the output format specified on the command line. Defaults to HTML if no format was specified. +772 * +773 * @return the output format name. +774 */ +775 public String getReportFormat() { +776 return line.getOptionValue(ARGUMENT.OUTPUT_FORMAT, "HTML"); +777 } +778 +779 /** +780 * Returns the application name specified on the command line. +781 * +782 * @return the application name. +783 */ +784 public String getProjectName() { +785 final String appName = line.getOptionValue(ARGUMENT.APP_NAME); +786 String name = line.getOptionValue(ARGUMENT.PROJECT); +787 if (name == null && appName != null) { +788 name = appName; +789 LOGGER.warn("The '" + ARGUMENT.APP_NAME + "' argument should no longer be used; use '" + ARGUMENT.PROJECT + "' instead."); +790 } +791 return name; 792 } 793 794 /** -795 * Returns the proxy server. +795 * Returns the base URL for the CVE 1.2 XMl file. 796 * -797 * @return the proxy server +797 * @return the URL to the CVE 1.2 XML file. 798 */ -799 @SuppressWarnings("deprecation") -800 public String getProxyServer() { -801 -802 String server = line.getOptionValue(ARGUMENT.PROXY_SERVER); -803 if (server == null) { -804 server = line.getOptionValue(ARGUMENT.PROXY_URL); -805 if (server != null) { -806 LOGGER.warn("An old command line argument 'proxyurl' was detected; use proxyserver instead"); -807 } -808 } -809 return server; +799 public String getBaseCve12Url() { +800 return line.getOptionValue(ARGUMENT.CVE_BASE_12); +801 } +802 +803 /** +804 * Returns the base URL for the CVE 2.0 XMl file. +805 * +806 * @return the URL to the CVE 2.0 XML file. +807 */ +808 public String getBaseCve20Url() { +809 return line.getOptionValue(ARGUMENT.CVE_BASE_20); 810 } 811 812 /** -813 * Returns the proxy port. +813 * Returns the URL for the modified CVE 1.2 XMl file. 814 * -815 * @return the proxy port +815 * @return the URL to the modified CVE 1.2 XML file. 816 */ -817 public String getProxyPort() { -818 return line.getOptionValue(ARGUMENT.PROXY_PORT); +817 public String getModifiedCve12Url() { +818 return line.getOptionValue(ARGUMENT.CVE_MOD_12); 819 } 820 821 /** -822 * Returns the proxy username. +822 * Returns the URL for the modified CVE 2.0 XMl file. 823 * -824 * @return the proxy username +824 * @return the URL to the modified CVE 2.0 XML file. 825 */ -826 public String getProxyUsername() { -827 return line.getOptionValue(ARGUMENT.PROXY_USERNAME); +826 public String getModifiedCve20Url() { +827 return line.getOptionValue(ARGUMENT.CVE_MOD_20); 828 } 829 830 /** -831 * Returns the proxy password. +831 * Returns the connection timeout. 832 * -833 * @return the proxy password +833 * @return the connection timeout 834 */ -835 public String getProxyPassword() { -836 return line.getOptionValue(ARGUMENT.PROXY_PASSWORD); +835 public String getConnectionTimeout() { +836 return line.getOptionValue(ARGUMENT.CONNECTION_TIMEOUT); 837 } 838 839 /** -840 * Get the value of dataDirectory. +840 * Returns the proxy server. 841 * -842 * @return the value of dataDirectory +842 * @return the proxy server 843 */ -844 public String getDataDirectory() { -845 return line.getOptionValue(ARGUMENT.DATA_DIRECTORY); -846 } -847 -848 /** -849 * Returns the properties file specified on the command line. -850 * -851 * @return the properties file specified on the command line -852 */ -853 public File getPropertiesFile() { -854 final String path = line.getOptionValue(ARGUMENT.PROP); -855 if (path != null) { -856 return new File(path); -857 } -858 return null; -859 } -860 -861 /** -862 * Returns the path to the verbose log file. -863 * -864 * @return the path to the verbose log file -865 */ -866 public String getVerboseLog() { -867 return line.getOptionValue(ARGUMENT.VERBOSE_LOG); -868 } -869 -870 /** -871 * Returns the path to the suppression file. -872 * -873 * @return the path to the suppression file -874 */ -875 public String getSuppressionFile() { -876 return line.getOptionValue(ARGUMENT.SUPPRESSION_FILE); -877 } -878 -879 /** -880 * <p> -881 * Prints the manifest information to standard output.</p> -882 * <ul><li>Implementation-Title: ${pom.name}</li> -883 * <li>Implementation-Version: ${pom.version}</li></ul> -884 */ -885 public void printVersionInfo() { -886 final String version = String.format("%s version %s", -887 Settings.getString(Settings.KEYS.APPLICATION_VAME, "dependency-check"), -888 Settings.getString(Settings.KEYS.APPLICATION_VERSION, "Unknown")); -889 System.out.println(version); -890 } -891 -892 /** -893 * Checks if the auto update feature has been disabled. If it has been disabled via the command line this will return false. -894 * -895 * @return <code>true</code> if auto-update is allowed; otherwise <code>false</code> -896 */ -897 public boolean isAutoUpdate() { -898 return line != null && !line.hasOption(ARGUMENT.DISABLE_AUTO_UPDATE); -899 } -900 -901 /** -902 * Checks if the update only flag has been set. -903 * -904 * @return <code>true</code> if the update only flag has been set; otherwise <code>false</code>. -905 */ -906 public boolean isUpdateOnly() { -907 return line != null && line.hasOption(ARGUMENT.UPDATE_ONLY); -908 } -909 -910 /** -911 * Checks if the purge NVD flag has been set. -912 * -913 * @return <code>true</code> if the purge nvd flag has been set; otherwise <code>false</code>. -914 */ -915 public boolean isPurge() { -916 return line != null && line.hasOption(ARGUMENT.PURGE_NVD); -917 } -918 -919 /** -920 * Returns the database driver name if specified; otherwise null is returned. -921 * -922 * @return the database driver name if specified; otherwise null is returned -923 */ -924 public String getDatabaseDriverName() { -925 return line.getOptionValue(ARGUMENT.DB_DRIVER); -926 } -927 -928 /** -929 * Returns the database driver path if specified; otherwise null is returned. -930 * -931 * @return the database driver name if specified; otherwise null is returned -932 */ -933 public String getDatabaseDriverPath() { -934 return line.getOptionValue(ARGUMENT.DB_DRIVER_PATH); +844 @SuppressWarnings("deprecation") +845 public String getProxyServer() { +846 +847 String server = line.getOptionValue(ARGUMENT.PROXY_SERVER); +848 if (server == null) { +849 server = line.getOptionValue(ARGUMENT.PROXY_URL); +850 if (server != null) { +851 LOGGER.warn("An old command line argument 'proxyurl' was detected; use proxyserver instead"); +852 } +853 } +854 return server; +855 } +856 +857 /** +858 * Returns the proxy port. +859 * +860 * @return the proxy port +861 */ +862 public String getProxyPort() { +863 return line.getOptionValue(ARGUMENT.PROXY_PORT); +864 } +865 +866 /** +867 * Returns the proxy username. +868 * +869 * @return the proxy username +870 */ +871 public String getProxyUsername() { +872 return line.getOptionValue(ARGUMENT.PROXY_USERNAME); +873 } +874 +875 /** +876 * Returns the proxy password. +877 * +878 * @return the proxy password +879 */ +880 public String getProxyPassword() { +881 return line.getOptionValue(ARGUMENT.PROXY_PASSWORD); +882 } +883 +884 /** +885 * Get the value of dataDirectory. +886 * +887 * @return the value of dataDirectory +888 */ +889 public String getDataDirectory() { +890 return line.getOptionValue(ARGUMENT.DATA_DIRECTORY); +891 } +892 +893 /** +894 * Returns the properties file specified on the command line. +895 * +896 * @return the properties file specified on the command line +897 */ +898 public File getPropertiesFile() { +899 final String path = line.getOptionValue(ARGUMENT.PROP); +900 if (path != null) { +901 return new File(path); +902 } +903 return null; +904 } +905 +906 /** +907 * Returns the path to the verbose log file. +908 * +909 * @return the path to the verbose log file +910 */ +911 public String getVerboseLog() { +912 return line.getOptionValue(ARGUMENT.VERBOSE_LOG); +913 } +914 +915 /** +916 * Returns the path to the suppression file. +917 * +918 * @return the path to the suppression file +919 */ +920 public String getSuppressionFile() { +921 return line.getOptionValue(ARGUMENT.SUPPRESSION_FILE); +922 } +923 +924 /** +925 * <p> +926 * Prints the manifest information to standard output.</p> +927 * <ul><li>Implementation-Title: ${pom.name}</li> +928 * <li>Implementation-Version: ${pom.version}</li></ul> +929 */ +930 public void printVersionInfo() { +931 final String version = String.format("%s version %s", +932 Settings.getString(Settings.KEYS.APPLICATION_VAME, "dependency-check"), +933 Settings.getString(Settings.KEYS.APPLICATION_VERSION, "Unknown")); +934 System.out.println(version); 935 } 936 937 /** -938 * Returns the database connection string if specified; otherwise null is returned. +938 * Checks if the auto update feature has been disabled. If it has been disabled via the command line this will return false. 939 * -940 * @return the database connection string if specified; otherwise null is returned +940 * @return <code>true</code> if auto-update is allowed; otherwise <code>false</code> 941 */ -942 public String getConnectionString() { -943 return line.getOptionValue(ARGUMENT.CONNECTION_STRING); +942 public boolean isAutoUpdate() { +943 return line != null && !line.hasOption(ARGUMENT.DISABLE_AUTO_UPDATE); 944 } 945 946 /** -947 * Returns the database database user name if specified; otherwise null is returned. +947 * Checks if the update only flag has been set. 948 * -949 * @return the database database user name if specified; otherwise null is returned +949 * @return <code>true</code> if the update only flag has been set; otherwise <code>false</code>. 950 */ -951 public String getDatabaseUser() { -952 return line.getOptionValue(ARGUMENT.DB_NAME); +951 public boolean isUpdateOnly() { +952 return line != null && line.hasOption(ARGUMENT.UPDATE_ONLY); 953 } 954 955 /** -956 * Returns the database database password if specified; otherwise null is returned. +956 * Checks if the purge NVD flag has been set. 957 * -958 * @return the database database password if specified; otherwise null is returned +958 * @return <code>true</code> if the purge nvd flag has been set; otherwise <code>false</code>. 959 */ -960 public String getDatabasePassword() { -961 return line.getOptionValue(ARGUMENT.DB_PASSWORD); +960 public boolean isPurge() { +961 return line != null && line.hasOption(ARGUMENT.PURGE_NVD); 962 } 963 964 /** -965 * Returns the additional Extensions if specified; otherwise null is returned. +965 * Returns the database driver name if specified; otherwise null is returned. 966 * -967 * @return the additional Extensions; otherwise null is returned +967 * @return the database driver name if specified; otherwise null is returned 968 */ -969 public String getAdditionalZipExtensions() { -970 return line.getOptionValue(ARGUMENT.ADDITIONAL_ZIP_EXTENSIONS); +969 public String getDatabaseDriverName() { +970 return line.getOptionValue(ARGUMENT.DB_DRIVER); 971 } 972 973 /** -974 * A collection of static final strings that represent the possible command line arguments. -975 */ -976 public static class ARGUMENT { -977 -978 /** -979 * The long CLI argument name specifying the directory/file to scan. -980 */ -981 public static final String SCAN = "scan"; -982 /** -983 * The short CLI argument name specifying the directory/file to scan. -984 */ -985 public static final String SCAN_SHORT = "s"; -986 /** -987 * The long CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated. -988 */ -989 public static final String DISABLE_AUTO_UPDATE = "noupdate"; -990 /** -991 * The short CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated. -992 */ -993 public static final String DISABLE_AUTO_UPDATE_SHORT = "n"; -994 /** -995 * The long CLI argument name specifying that only the update phase should be executed; no scan should be run. -996 */ -997 public static final String UPDATE_ONLY = "updateonly"; -998 /** -999 * The long CLI argument name specifying that only the update phase should be executed; no scan should be run. -1000 */ -1001 public static final String PURGE_NVD = "purge"; -1002 /** -1003 * The long CLI argument name specifying the directory to write the reports to. -1004 */ -1005 public static final String OUT = "out"; -1006 /** -1007 * The short CLI argument name specifying the directory to write the reports to. -1008 */ -1009 public static final String OUT_SHORT = "o"; -1010 /** -1011 * The long CLI argument name specifying the output format to write the reports to. -1012 */ -1013 public static final String OUTPUT_FORMAT = "format"; -1014 /** -1015 * The short CLI argument name specifying the output format to write the reports to. -1016 */ -1017 public static final String OUTPUT_FORMAT_SHORT = "f"; -1018 /** -1019 * The long CLI argument name specifying the name of the project to be scanned. -1020 */ -1021 public static final String PROJECT = "project"; -1022 /** -1023 * The long CLI argument name specifying the name of the application to be scanned. -1024 * -1025 * @deprecated project should be used instead -1026 */ -1027 @Deprecated -1028 public static final String APP_NAME = "app"; -1029 /** -1030 * The short CLI argument name specifying the name of the application to be scanned. -1031 * -1032 * @deprecated project should be used instead -1033 */ -1034 @Deprecated -1035 public static final String APP_NAME_SHORT = "a"; +974 * Returns the database driver path if specified; otherwise null is returned. +975 * +976 * @return the database driver name if specified; otherwise null is returned +977 */ +978 public String getDatabaseDriverPath() { +979 return line.getOptionValue(ARGUMENT.DB_DRIVER_PATH); +980 } +981 +982 /** +983 * Returns the database connection string if specified; otherwise null is returned. +984 * +985 * @return the database connection string if specified; otherwise null is returned +986 */ +987 public String getConnectionString() { +988 return line.getOptionValue(ARGUMENT.CONNECTION_STRING); +989 } +990 +991 /** +992 * Returns the database database user name if specified; otherwise null is returned. +993 * +994 * @return the database database user name if specified; otherwise null is returned +995 */ +996 public String getDatabaseUser() { +997 return line.getOptionValue(ARGUMENT.DB_NAME); +998 } +999 +1000 /** +1001 * Returns the database database password if specified; otherwise null is returned. +1002 * +1003 * @return the database database password if specified; otherwise null is returned +1004 */ +1005 public String getDatabasePassword() { +1006 return line.getOptionValue(ARGUMENT.DB_PASSWORD); +1007 } +1008 +1009 /** +1010 * Returns the additional Extensions if specified; otherwise null is returned. +1011 * +1012 * @return the additional Extensions; otherwise null is returned +1013 */ +1014 public String getAdditionalZipExtensions() { +1015 return line.getOptionValue(ARGUMENT.ADDITIONAL_ZIP_EXTENSIONS); +1016 } +1017 +1018 /** +1019 * Get the value of cveValidForHours. +1020 * +1021 * @return the value of cveValidForHours +1022 */ +1023 public Integer getCveValidForHours() { +1024 final String v = line.getOptionValue(ARGUMENT.CVE_VALID_FOR_HOURS); +1025 if (v != null) { +1026 return Integer.parseInt(v); +1027 } +1028 return null; +1029 } +1030 +1031 /** +1032 * A collection of static final strings that represent the possible command line arguments. +1033 */ +1034 public static class ARGUMENT { +1035 1036 /** -1037 * The long CLI argument name asking for help. +1037 * The long CLI argument name specifying the directory/file to scan. 1038 */ -1039 public static final String HELP = "help"; +1039 public static final String SCAN = "scan"; 1040 /** -1041 * The long CLI argument name asking for advanced help. +1041 * The short CLI argument name specifying the directory/file to scan. 1042 */ -1043 public static final String ADVANCED_HELP = "advancedHelp"; +1043 public static final String SCAN_SHORT = "s"; 1044 /** -1045 * The short CLI argument name asking for help. +1045 * The long CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated. 1046 */ -1047 public static final String HELP_SHORT = "h"; +1047 public static final String DISABLE_AUTO_UPDATE = "noupdate"; 1048 /** -1049 * The long CLI argument name asking for the version. +1049 * The short CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated. 1050 */ -1051 public static final String VERSION_SHORT = "v"; +1051 public static final String DISABLE_AUTO_UPDATE_SHORT = "n"; 1052 /** -1053 * The short CLI argument name asking for the version. +1053 * The long CLI argument name specifying that only the update phase should be executed; no scan should be run. 1054 */ -1055 public static final String VERSION = "version"; +1055 public static final String UPDATE_ONLY = "updateonly"; 1056 /** -1057 * The CLI argument name indicating the proxy port. +1057 * The long CLI argument name specifying that only the update phase should be executed; no scan should be run. 1058 */ -1059 public static final String PROXY_PORT = "proxyport"; +1059 public static final String PURGE_NVD = "purge"; 1060 /** -1061 * The CLI argument name indicating the proxy server. +1061 * The long CLI argument name specifying the directory to write the reports to. 1062 */ -1063 public static final String PROXY_SERVER = "proxyserver"; +1063 public static final String OUT = "out"; 1064 /** -1065 * The CLI argument name indicating the proxy url. -1066 * -1067 * @deprecated use {@link #PROXY_SERVER} instead -1068 */ -1069 @Deprecated -1070 public static final String PROXY_URL = "proxyurl"; -1071 /** -1072 * The CLI argument name indicating the proxy username. -1073 */ -1074 public static final String PROXY_USERNAME = "proxyuser"; -1075 /** -1076 * The CLI argument name indicating the proxy password. -1077 */ -1078 public static final String PROXY_PASSWORD = "proxypass"; -1079 /** -1080 * The short CLI argument name indicating the connection timeout. -1081 */ -1082 public static final String CONNECTION_TIMEOUT_SHORT = "c"; -1083 /** -1084 * The CLI argument name indicating the connection timeout. -1085 */ -1086 public static final String CONNECTION_TIMEOUT = "connectiontimeout"; +1065 * The short CLI argument name specifying the directory to write the reports to. +1066 */ +1067 public static final String OUT_SHORT = "o"; +1068 /** +1069 * The long CLI argument name specifying the output format to write the reports to. +1070 */ +1071 public static final String OUTPUT_FORMAT = "format"; +1072 /** +1073 * The short CLI argument name specifying the output format to write the reports to. +1074 */ +1075 public static final String OUTPUT_FORMAT_SHORT = "f"; +1076 /** +1077 * The long CLI argument name specifying the name of the project to be scanned. +1078 */ +1079 public static final String PROJECT = "project"; +1080 /** +1081 * The long CLI argument name specifying the name of the application to be scanned. +1082 * +1083 * @deprecated project should be used instead +1084 */ +1085 @Deprecated +1086 public static final String APP_NAME = "app"; 1087 /** -1088 * The short CLI argument name for setting the location of an additional properties file. -1089 */ -1090 public static final String PROP_SHORT = "P"; -1091 /** -1092 * The CLI argument name for setting the location of an additional properties file. -1093 */ -1094 public static final String PROP = "propertyfile"; -1095 /** -1096 * The CLI argument name for setting the location of the data directory. -1097 */ -1098 public static final String DATA_DIRECTORY = "data"; -1099 /** -1100 * The CLI argument name for setting the URL for the CVE Data Files. -1101 */ -1102 public static final String CVE_MOD_12 = "cveUrl12Modified"; -1103 /** -1104 * The CLI argument name for setting the URL for the CVE Data Files. -1105 */ -1106 public static final String CVE_MOD_20 = "cveUrl20Modified"; -1107 /** -1108 * The CLI argument name for setting the URL for the CVE Data Files. -1109 */ -1110 public static final String CVE_BASE_12 = "cveUrl12Base"; -1111 /** -1112 * The CLI argument name for setting the URL for the CVE Data Files. -1113 */ -1114 public static final String CVE_BASE_20 = "cveUrl20Base"; -1115 /** -1116 * The short CLI argument name for setting the location of the data directory. -1117 */ -1118 public static final String DATA_DIRECTORY_SHORT = "d"; -1119 /** -1120 * The CLI argument name for setting the location of the data directory. -1121 */ -1122 public static final String VERBOSE_LOG = "log"; -1123 /** -1124 * The short CLI argument name for setting the location of the data directory. -1125 */ -1126 public static final String VERBOSE_LOG_SHORT = "l"; -1127 -1128 /** -1129 * The CLI argument name for setting the depth of symbolic links that will be followed. -1130 */ -1131 public static final String SYM_LINK_DEPTH = "symLink"; -1132 /** -1133 * The CLI argument name for setting the location of the suppression file. -1134 */ -1135 public static final String SUPPRESSION_FILE = "suppression"; -1136 /** -1137 * Disables the Jar Analyzer. -1138 */ -1139 public static final String DISABLE_JAR = "disableJar"; -1140 /** -1141 * Disables the Archive Analyzer. -1142 */ -1143 public static final String DISABLE_ARCHIVE = "disableArchive"; -1144 /** -1145 * Disables the Python Distribution Analyzer. -1146 */ -1147 public static final String DISABLE_PY_DIST = "disablePyDist"; -1148 /** -1149 * Disables the Python Package Analyzer. -1150 */ -1151 public static final String DISABLE_PY_PKG = "disablePyPkg"; -1152 /** -1153 * Disables the Python Package Analyzer. -1154 */ -1155 public static final String DISABLE_COMPOSER = "disableComposer"; -1156 /** -1157 * Disables the Ruby Gemspec Analyzer. -1158 */ -1159 public static final String DISABLE_RUBYGEMS = "disableRubygems"; -1160 /** -1161 * Disables the Autoconf Analyzer. -1162 */ -1163 public static final String DISABLE_AUTOCONF = "disableAutoconf"; -1164 /** -1165 * Disables the Cmake Analyzer. -1166 */ -1167 public static final String DISABLE_CMAKE = "disableCmake"; -1168 /** -1169 * Disables the Assembly Analyzer. -1170 */ -1171 public static final String DISABLE_ASSEMBLY = "disableAssembly"; -1172 /** -1173 * Disables the Nuspec Analyzer. -1174 */ -1175 public static final String DISABLE_NUSPEC = "disableNuspec"; -1176 /** -1177 * Disables the Central Analyzer. -1178 */ -1179 public static final String DISABLE_CENTRAL = "disableCentral"; -1180 /** -1181 * Disables the Nexus Analyzer. -1182 */ -1183 public static final String DISABLE_NEXUS = "disableNexus"; -1184 /** -1185 * Disables the OpenSSL Analyzer. -1186 */ -1187 public static final String DISABLE_OPENSSL = "disableOpenSSL"; -1188 /** -1189 * Disables the Node.js Package Analyzer. -1190 */ -1191 public static final String DISABLE_NODE_JS = "disableNodeJS"; -1192 /** -1193 * The URL of the nexus server. -1194 */ -1195 public static final String NEXUS_URL = "nexus"; -1196 /** -1197 * Whether or not the defined proxy should be used when connecting to Nexus. -1198 */ -1199 public static final String NEXUS_USES_PROXY = "nexusUsesProxy"; -1200 /** -1201 * The CLI argument name for setting the connection string. -1202 */ -1203 public static final String CONNECTION_STRING = "connectionString"; -1204 /** -1205 * The CLI argument name for setting the database user name. -1206 */ -1207 public static final String DB_NAME = "dbUser"; -1208 /** -1209 * The CLI argument name for setting the database password. -1210 */ -1211 public static final String DB_PASSWORD = "dbPassword"; -1212 /** -1213 * The CLI argument name for setting the database driver name. -1214 */ -1215 public static final String DB_DRIVER = "dbDriverName"; -1216 /** -1217 * The CLI argument name for setting the path to the database driver; in case it is not on the class path. -1218 */ -1219 public static final String DB_DRIVER_PATH = "dbDriverPath"; -1220 /** -1221 * The CLI argument name for setting the path to mono for .NET Assembly analysis on non-windows systems. -1222 */ -1223 public static final String PATH_TO_MONO = "mono"; -1224 /** -1225 * The CLI argument name for setting extra extensions. -1226 */ -1227 public static final String ADDITIONAL_ZIP_EXTENSIONS = "zipExtensions"; -1228 /** -1229 * Exclude path argument. -1230 */ -1231 public static final String EXCLUDE = "exclude"; -1232 } -1233 } +1088 * The short CLI argument name specifying the name of the application to be scanned. +1089 * +1090 * @deprecated project should be used instead +1091 */ +1092 @Deprecated +1093 public static final String APP_NAME_SHORT = "a"; +1094 /** +1095 * The long CLI argument name asking for help. +1096 */ +1097 public static final String HELP = "help"; +1098 /** +1099 * The long CLI argument name asking for advanced help. +1100 */ +1101 public static final String ADVANCED_HELP = "advancedHelp"; +1102 /** +1103 * The short CLI argument name asking for help. +1104 */ +1105 public static final String HELP_SHORT = "h"; +1106 /** +1107 * The long CLI argument name asking for the version. +1108 */ +1109 public static final String VERSION_SHORT = "v"; +1110 /** +1111 * The short CLI argument name asking for the version. +1112 */ +1113 public static final String VERSION = "version"; +1114 /** +1115 * The CLI argument name indicating the proxy port. +1116 */ +1117 public static final String PROXY_PORT = "proxyport"; +1118 /** +1119 * The CLI argument name indicating the proxy server. +1120 */ +1121 public static final String PROXY_SERVER = "proxyserver"; +1122 /** +1123 * The CLI argument name indicating the proxy url. +1124 * +1125 * @deprecated use {@link #PROXY_SERVER} instead +1126 */ +1127 @Deprecated +1128 public static final String PROXY_URL = "proxyurl"; +1129 /** +1130 * The CLI argument name indicating the proxy username. +1131 */ +1132 public static final String PROXY_USERNAME = "proxyuser"; +1133 /** +1134 * The CLI argument name indicating the proxy password. +1135 */ +1136 public static final String PROXY_PASSWORD = "proxypass"; +1137 /** +1138 * The short CLI argument name indicating the connection timeout. +1139 */ +1140 public static final String CONNECTION_TIMEOUT_SHORT = "c"; +1141 /** +1142 * The CLI argument name indicating the connection timeout. +1143 */ +1144 public static final String CONNECTION_TIMEOUT = "connectiontimeout"; +1145 /** +1146 * The short CLI argument name for setting the location of an additional properties file. +1147 */ +1148 public static final String PROP_SHORT = "P"; +1149 /** +1150 * The CLI argument name for setting the location of an additional properties file. +1151 */ +1152 public static final String PROP = "propertyfile"; +1153 /** +1154 * The CLI argument name for setting the location of the data directory. +1155 */ +1156 public static final String DATA_DIRECTORY = "data"; +1157 /** +1158 * The CLI argument name for setting the URL for the CVE Data Files. +1159 */ +1160 public static final String CVE_MOD_12 = "cveUrl12Modified"; +1161 /** +1162 * The CLI argument name for setting the URL for the CVE Data Files. +1163 */ +1164 public static final String CVE_MOD_20 = "cveUrl20Modified"; +1165 /** +1166 * The CLI argument name for setting the URL for the CVE Data Files. +1167 */ +1168 public static final String CVE_BASE_12 = "cveUrl12Base"; +1169 /** +1170 * The CLI argument name for setting the URL for the CVE Data Files. +1171 */ +1172 public static final String CVE_BASE_20 = "cveUrl20Base"; +1173 /** +1174 * The short CLI argument name for setting the location of the data directory. +1175 */ +1176 public static final String DATA_DIRECTORY_SHORT = "d"; +1177 /** +1178 * The CLI argument name for setting the location of the data directory. +1179 */ +1180 public static final String VERBOSE_LOG = "log"; +1181 /** +1182 * The short CLI argument name for setting the location of the data directory. +1183 */ +1184 public static final String VERBOSE_LOG_SHORT = "l"; +1185 +1186 /** +1187 * The CLI argument name for setting the depth of symbolic links that will be followed. +1188 */ +1189 public static final String SYM_LINK_DEPTH = "symLink"; +1190 /** +1191 * The CLI argument name for setting the location of the suppression file. +1192 */ +1193 public static final String SUPPRESSION_FILE = "suppression"; +1194 /** +1195 * The CLI argument name for setting the location of the suppression file. +1196 */ +1197 public static final String CVE_VALID_FOR_HOURS = "cveValidForHours"; +1198 /** +1199 * Disables the Jar Analyzer. +1200 */ +1201 public static final String DISABLE_JAR = "disableJar"; +1202 /** +1203 * Disables the Archive Analyzer. +1204 */ +1205 public static final String DISABLE_ARCHIVE = "disableArchive"; +1206 /** +1207 * Disables the Python Distribution Analyzer. +1208 */ +1209 public static final String DISABLE_PY_DIST = "disablePyDist"; +1210 /** +1211 * Disables the Python Package Analyzer. +1212 */ +1213 public static final String DISABLE_PY_PKG = "disablePyPkg"; +1214 /** +1215 * Disables the Python Package Analyzer. +1216 */ +1217 public static final String DISABLE_COMPOSER = "disableComposer"; +1218 /** +1219 * Disables the Ruby Gemspec Analyzer. +1220 */ +1221 public static final String DISABLE_RUBYGEMS = "disableRubygems"; +1222 /** +1223 * Disables the Autoconf Analyzer. +1224 */ +1225 public static final String DISABLE_AUTOCONF = "disableAutoconf"; +1226 /** +1227 * Disables the Cmake Analyzer. +1228 */ +1229 public static final String DISABLE_CMAKE = "disableCmake"; +1230 /** +1231 * Disables the Assembly Analyzer. +1232 */ +1233 public static final String DISABLE_ASSEMBLY = "disableAssembly"; +1234 /** +1235 * Disables the Ruby Bundler Audit Analyzer. +1236 */ +1237 public static final String DISABLE_BUNDLE_AUDIT = "disableBundleAudit"; +1238 /** +1239 * Disables the Nuspec Analyzer. +1240 */ +1241 public static final String DISABLE_NUSPEC = "disableNuspec"; +1242 /** +1243 * Disables the Central Analyzer. +1244 */ +1245 public static final String DISABLE_CENTRAL = "disableCentral"; +1246 /** +1247 * Disables the Nexus Analyzer. +1248 */ +1249 public static final String DISABLE_NEXUS = "disableNexus"; +1250 /** +1251 * Disables the OpenSSL Analyzer. +1252 */ +1253 public static final String DISABLE_OPENSSL = "disableOpenSSL"; +1254 /** +1255 * Disables the Node.js Package Analyzer. +1256 */ +1257 public static final String DISABLE_NODE_JS = "disableNodeJS"; +1258 /** +1259 * The URL of the nexus server. +1260 */ +1261 public static final String NEXUS_URL = "nexus"; +1262 /** +1263 * Whether or not the defined proxy should be used when connecting to Nexus. +1264 */ +1265 public static final String NEXUS_USES_PROXY = "nexusUsesProxy"; +1266 /** +1267 * The CLI argument name for setting the connection string. +1268 */ +1269 public static final String CONNECTION_STRING = "connectionString"; +1270 /** +1271 * The CLI argument name for setting the database user name. +1272 */ +1273 public static final String DB_NAME = "dbUser"; +1274 /** +1275 * The CLI argument name for setting the database password. +1276 */ +1277 public static final String DB_PASSWORD = "dbPassword"; +1278 /** +1279 * The CLI argument name for setting the database driver name. +1280 */ +1281 public static final String DB_DRIVER = "dbDriverName"; +1282 /** +1283 * The CLI argument name for setting the path to the database driver; in case it is not on the class path. +1284 */ +1285 public static final String DB_DRIVER_PATH = "dbDriverPath"; +1286 /** +1287 * The CLI argument name for setting the path to mono for .NET Assembly analysis on non-windows systems. +1288 */ +1289 public static final String PATH_TO_MONO = "mono"; +1290 /** +1291 * The CLI argument name for setting extra extensions. +1292 */ +1293 public static final String ADDITIONAL_ZIP_EXTENSIONS = "zipExtensions"; +1294 /** +1295 * Exclude path argument. +1296 */ +1297 public static final String EXCLUDE = "exclude"; +1298 /** +1299 * The CLI argument name for setting the path to bundle-audit for Ruby bundle analysis. +1300 */ +1301 public static final String PATH_TO_BUNDLE_AUDIT = "bundleAudit"; +1302 } +1303 }
        diff --git a/xref/org/owasp/dependencycheck/Engine.html b/xref/org/owasp/dependencycheck/Engine.html index 5afcee9c2..aa3777ac1 100644 --- a/xref/org/owasp/dependencycheck/Engine.html +++ b/xref/org/owasp/dependencycheck/Engine.html @@ -46,144 +46,144 @@ 38 import java.io.File; 39 import java.io.FileFilter; 40 import java.util.ArrayList; -41 import java.util.EnumMap; -42 import java.util.HashSet; -43 import java.util.Iterator; -44 import java.util.List; -45 import java.util.Map; -46 import java.util.Set; -47 -48 /** -49 * Scans files, directories, etc. for Dependencies. Analyzers are loaded and used to process the files found by the scan, if a -50 * file is encountered and an Analyzer is associated with the file type then the file is turned into a dependency. -51 * -52 * @author Jeremy Long -53 */ -54 public class Engine implements FileFilter { -55 -56 /** -57 * The list of dependencies. -58 */ -59 private List<Dependency> dependencies = new ArrayList<Dependency>(); -60 /** -61 * A Map of analyzers grouped by Analysis phase. -62 */ -63 private Map<AnalysisPhase, List<Analyzer>> analyzers = new EnumMap<AnalysisPhase, List<Analyzer>>(AnalysisPhase.class); -64 -65 /** -66 * A Map of analyzers grouped by Analysis phase. -67 */ -68 private Set<FileTypeAnalyzer> fileTypeAnalyzers = new HashSet<FileTypeAnalyzer>(); -69 -70 /** -71 * The ClassLoader to use when dynamically loading Analyzer and Update services. -72 */ -73 private ClassLoader serviceClassLoader = Thread.currentThread().getContextClassLoader(); -74 /** -75 * The Logger for use throughout the class. -76 */ -77 private static final Logger LOGGER = LoggerFactory.getLogger(Engine.class); -78 -79 /** -80 * Creates a new Engine. -81 * -82 * @throws DatabaseException thrown if there is an error connecting to the database -83 */ -84 public Engine() throws DatabaseException { -85 initializeEngine(); -86 } -87 -88 /** -89 * Creates a new Engine. -90 * -91 * @param serviceClassLoader a reference the class loader being used -92 * @throws DatabaseException thrown if there is an error connecting to the database -93 */ -94 public Engine(ClassLoader serviceClassLoader) throws DatabaseException { -95 this.serviceClassLoader = serviceClassLoader; -96 initializeEngine(); -97 } -98 -99 /** -100 * Creates a new Engine using the specified classloader to dynamically load Analyzer and Update services. -101 * -102 * @throws DatabaseException thrown if there is an error connecting to the database -103 */ -104 protected final void initializeEngine() throws DatabaseException { -105 ConnectionFactory.initialize(); -106 loadAnalyzers(); -107 } -108 -109 /** -110 * Properly cleans up resources allocated during analysis. -111 */ -112 public void cleanup() { -113 ConnectionFactory.cleanup(); -114 } -115 -116 /** -117 * Loads the analyzers specified in the configuration file (or system properties). -118 */ -119 private void loadAnalyzers() { -120 if (!analyzers.isEmpty()) { -121 return; -122 } -123 for (AnalysisPhase phase : AnalysisPhase.values()) { -124 analyzers.put(phase, new ArrayList<Analyzer>()); -125 } -126 -127 final AnalyzerService service = new AnalyzerService(serviceClassLoader); -128 final Iterator<Analyzer> iterator = service.getAnalyzers(); -129 while (iterator.hasNext()) { -130 final Analyzer a = iterator.next(); -131 analyzers.get(a.getAnalysisPhase()).add(a); -132 if (a instanceof FileTypeAnalyzer) { -133 this.fileTypeAnalyzers.add((FileTypeAnalyzer) a); -134 } -135 } -136 } -137 -138 /** -139 * Get the List of the analyzers for a specific phase of analysis. -140 * -141 * @param phase the phase to get the configured analyzers. -142 * @return the analyzers loaded -143 */ -144 public List<Analyzer> getAnalyzers(AnalysisPhase phase) { -145 return analyzers.get(phase); -146 } -147 -148 /** -149 * Get the dependencies identified. -150 * -151 * @return the dependencies identified -152 */ -153 public List<Dependency> getDependencies() { -154 return dependencies; -155 } -156 -157 /** -158 * Sets the dependencies. -159 * -160 * @param dependencies the dependencies -161 */ -162 public void setDependencies(List<Dependency> dependencies) { -163 this.dependencies = dependencies; -164 } -165 -166 /** -167 * Scans an array of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies -168 * identified are added to the dependency collection. -169 * -170 * @param paths an array of paths to files or directories to be analyzed -171 * @return the list of dependencies scanned -172 * @since v0.3.2.5 -173 */ -174 public List<Dependency> scan(String[] paths) { -175 final List<Dependency> deps = new ArrayList<Dependency>(); -176 for (String path : paths) { -177 final File file = new File(path); -178 final List<Dependency> d = scan(file); +41 import java.util.Collection; +42 import java.util.EnumMap; +43 import java.util.HashSet; +44 import java.util.Iterator; +45 import java.util.List; +46 import java.util.Map; +47 import java.util.Set; +48 +49 /** +50 * Scans files, directories, etc. for Dependencies. Analyzers are loaded and used to process the files found by the scan, if a +51 * file is encountered and an Analyzer is associated with the file type then the file is turned into a dependency. +52 * +53 * @author Jeremy Long +54 */ +55 public class Engine implements FileFilter { +56 +57 /** +58 * The list of dependencies. +59 */ +60 private List<Dependency> dependencies = new ArrayList<Dependency>(); +61 /** +62 * A Map of analyzers grouped by Analysis phase. +63 */ +64 private Map<AnalysisPhase, List<Analyzer>> analyzers = new EnumMap<AnalysisPhase, List<Analyzer>>(AnalysisPhase.class); +65 +66 /** +67 * A Map of analyzers grouped by Analysis phase. +68 */ +69 private Set<FileTypeAnalyzer> fileTypeAnalyzers = new HashSet<FileTypeAnalyzer>(); +70 +71 /** +72 * The ClassLoader to use when dynamically loading Analyzer and Update services. +73 */ +74 private ClassLoader serviceClassLoader = Thread.currentThread().getContextClassLoader(); +75 /** +76 * The Logger for use throughout the class. +77 */ +78 private static final Logger LOGGER = LoggerFactory.getLogger(Engine.class); +79 +80 /** +81 * Creates a new Engine. +82 * +83 * @throws DatabaseException thrown if there is an error connecting to the database +84 */ +85 public Engine() throws DatabaseException { +86 initializeEngine(); +87 } +88 +89 /** +90 * Creates a new Engine. +91 * +92 * @param serviceClassLoader a reference the class loader being used +93 * @throws DatabaseException thrown if there is an error connecting to the database +94 */ +95 public Engine(ClassLoader serviceClassLoader) throws DatabaseException { +96 this.serviceClassLoader = serviceClassLoader; +97 initializeEngine(); +98 } +99 +100 /** +101 * Creates a new Engine using the specified classloader to dynamically load Analyzer and Update services. +102 * +103 * @throws DatabaseException thrown if there is an error connecting to the database +104 */ +105 protected final void initializeEngine() throws DatabaseException { +106 ConnectionFactory.initialize(); +107 loadAnalyzers(); +108 } +109 +110 /** +111 * Properly cleans up resources allocated during analysis. +112 */ +113 public void cleanup() { +114 ConnectionFactory.cleanup(); +115 } +116 +117 /** +118 * Loads the analyzers specified in the configuration file (or system properties). +119 */ +120 private void loadAnalyzers() { +121 if (!analyzers.isEmpty()) { +122 return; +123 } +124 for (AnalysisPhase phase : AnalysisPhase.values()) { +125 analyzers.put(phase, new ArrayList<Analyzer>()); +126 } +127 +128 final AnalyzerService service = new AnalyzerService(serviceClassLoader); +129 final Iterator<Analyzer> iterator = service.getAnalyzers(); +130 while (iterator.hasNext()) { +131 final Analyzer a = iterator.next(); +132 analyzers.get(a.getAnalysisPhase()).add(a); +133 if (a instanceof FileTypeAnalyzer) { +134 this.fileTypeAnalyzers.add((FileTypeAnalyzer) a); +135 } +136 } +137 } +138 +139 /** +140 * Get the List of the analyzers for a specific phase of analysis. +141 * +142 * @param phase the phase to get the configured analyzers. +143 * @return the analyzers loaded +144 */ +145 public List<Analyzer> getAnalyzers(AnalysisPhase phase) { +146 return analyzers.get(phase); +147 } +148 +149 /** +150 * Get the dependencies identified. +151 * +152 * @return the dependencies identified +153 */ +154 public List<Dependency> getDependencies() { +155 return dependencies; +156 } +157 +158 /** +159 * Sets the dependencies. +160 * +161 * @param dependencies the dependencies +162 */ +163 public void setDependencies(List<Dependency> dependencies) { +164 this.dependencies = dependencies; +165 } +166 +167 /** +168 * Scans an array of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies +169 * identified are added to the dependency collection. +170 * +171 * @param paths an array of paths to files or directories to be analyzed +172 * @return the list of dependencies scanned +173 * @since v0.3.2.5 +174 */ +175 public List<Dependency> scan(String[] paths) { +176 final List<Dependency> deps = new ArrayList<Dependency>(); +177 for (String path : paths) { +178 final List<Dependency> d = scan(path); 179 if (d != null) { 180 deps.addAll(d); 181 } @@ -223,14 +223,14 @@ 215 } 216 217 /** -218 * Scans a list of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies +218 * Scans a collection of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies 219 * identified are added to the dependency collection. 220 * 221 * @param files a set of paths to files or directories to be analyzed 222 * @return the list of dependencies scanned 223 * @since v0.3.2.5 224 */ -225 public List<Dependency> scan(Set<File> files) { +225 public List<Dependency> scan(Collection<File> files) { 226 final List<Dependency> deps = new ArrayList<Dependency>(); 227 for (File file : files) { 228 final List<Dependency> d = scan(file); @@ -242,294 +242,275 @@ 234 } 235 236 /** -237 * Scans a list of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies -238 * identified are added to the dependency collection. +237 * Scans a given file or directory. If a directory is specified, it will be scanned recursively. Any dependencies identified +238 * are added to the dependency collection. 239 * -240 * @param files a set of paths to files or directories to be analyzed +240 * @param file the path to a file or directory to be analyzed 241 * @return the list of dependencies scanned -242 * @since v0.3.2.5 +242 * @since v0.3.2.4 243 */ -244 public List<Dependency> scan(List<File> files) { -245 final List<Dependency> deps = new ArrayList<Dependency>(); -246 for (File file : files) { -247 final List<Dependency> d = scan(file); -248 if (d != null) { -249 deps.addAll(d); -250 } -251 } -252 return deps; -253 } -254 -255 /** -256 * Scans a given file or directory. If a directory is specified, it will be scanned recursively. Any dependencies identified -257 * are added to the dependency collection. -258 * -259 * @param file the path to a file or directory to be analyzed -260 * @return the list of dependencies scanned -261 * @since v0.3.2.4 -262 */ -263 public List<Dependency> scan(File file) { -264 if (file.exists()) { -265 if (file.isDirectory()) { -266 return scanDirectory(file); -267 } else { -268 final Dependency d = scanFile(file); -269 if (d != null) { -270 final List<Dependency> deps = new ArrayList<Dependency>(); -271 deps.add(d); -272 return deps; -273 } -274 } -275 } -276 return null; -277 } -278 -279 /** -280 * Recursively scans files and directories. Any dependencies identified are added to the dependency collection. -281 * -282 * @param dir the directory to scan -283 * @return the list of Dependency objects scanned -284 */ -285 protected List<Dependency> scanDirectory(File dir) { -286 final File[] files = dir.listFiles(); -287 final List<Dependency> deps = new ArrayList<Dependency>(); -288 if (files != null) { -289 for (File f : files) { -290 if (f.isDirectory()) { -291 final List<Dependency> d = scanDirectory(f); -292 if (d != null) { -293 deps.addAll(d); -294 } -295 } else { -296 final Dependency d = scanFile(f); -297 deps.add(d); -298 } -299 } +244 public List<Dependency> scan(File file) { +245 if (file.exists()) { +246 if (file.isDirectory()) { +247 return scanDirectory(file); +248 } else { +249 final Dependency d = scanFile(file); +250 if (d != null) { +251 final List<Dependency> deps = new ArrayList<Dependency>(); +252 deps.add(d); +253 return deps; +254 } +255 } +256 } +257 return null; +258 } +259 +260 /** +261 * Recursively scans files and directories. Any dependencies identified are added to the dependency collection. +262 * +263 * @param dir the directory to scan +264 * @return the list of Dependency objects scanned +265 */ +266 protected List<Dependency> scanDirectory(File dir) { +267 final File[] files = dir.listFiles(); +268 final List<Dependency> deps = new ArrayList<Dependency>(); +269 if (files != null) { +270 for (File f : files) { +271 if (f.isDirectory()) { +272 final List<Dependency> d = scanDirectory(f); +273 if (d != null) { +274 deps.addAll(d); +275 } +276 } else { +277 final Dependency d = scanFile(f); +278 deps.add(d); +279 } +280 } +281 } +282 return deps; +283 } +284 +285 /** +286 * Scans a specified file. If a dependency is identified it is added to the dependency collection. +287 * +288 * @param file The file to scan +289 * @return the scanned dependency +290 */ +291 protected Dependency scanFile(File file) { +292 Dependency dependency = null; +293 if (file.isFile()) { +294 if (accept(file)) { +295 dependency = new Dependency(file); +296 dependencies.add(dependency); +297 } +298 } else { +299 LOGGER.debug("Path passed to scanFile(File) is not a file: {}. Skipping the file.", file); 300 } -301 return deps; +301 return dependency; 302 } 303 304 /** -305 * Scans a specified file. If a dependency is identified it is added to the dependency collection. -306 * -307 * @param file The file to scan -308 * @return the scanned dependency +305 * Runs the analyzers against all of the dependencies. Since the mutable dependencies list is exposed via +306 * {@link #getDependencies()}, this method iterates over a copy of the dependencies list. Thus, the potential for +307 * {@link java.util.ConcurrentModificationException}s is avoided, and analyzers may safely add or remove entries from the +308 * dependencies list. 309 */ -310 protected Dependency scanFile(File file) { -311 Dependency dependency = null; -312 if (file.isFile()) { -313 if (accept(file)) { -314 dependency = new Dependency(file); -315 dependencies.add(dependency); -316 } -317 } else { -318 LOGGER.debug("Path passed to scanFile(File) is not a file: {}. Skipping the file.", file); +310 public void analyzeDependencies() { +311 boolean autoUpdate = true; +312 try { +313 autoUpdate = Settings.getBoolean(Settings.KEYS.AUTO_UPDATE); +314 } catch (InvalidSettingException ex) { +315 LOGGER.debug("Invalid setting for auto-update; using true."); +316 } +317 if (autoUpdate) { +318 doUpdates(); 319 } -320 return dependency; -321 } -322 -323 /** -324 * Runs the analyzers against all of the dependencies. Since the mutable dependencies list is exposed via -325 * {@link #getDependencies()}, this method iterates over a copy of the dependencies list. Thus, the potential for -326 * {@link java.util.ConcurrentModificationException}s is avoided, and analyzers may safely add or remove entries from the -327 * dependencies list. -328 */ -329 public void analyzeDependencies() { -330 boolean autoUpdate = true; -331 try { -332 autoUpdate = Settings.getBoolean(Settings.KEYS.AUTO_UPDATE); -333 } catch (InvalidSettingException ex) { -334 LOGGER.debug("Invalid setting for auto-update; using true."); -335 } -336 if (autoUpdate) { -337 doUpdates(); -338 } -339 -340 //need to ensure that data exists -341 try { -342 ensureDataExists(); -343 } catch (NoDataException ex) { -344 LOGGER.error("{}\n\nUnable to continue dependency-check analysis.", ex.getMessage()); -345 LOGGER.debug("", ex); -346 return; -347 } catch (DatabaseException ex) { -348 LOGGER.error("{}\n\nUnable to continue dependency-check analysis.", ex.getMessage()); -349 LOGGER.debug("", ex); -350 return; -351 -352 } -353 -354 LOGGER.debug("\n----------------------------------------------------\nBEGIN ANALYSIS\n----------------------------------------------------"); -355 LOGGER.info("Analysis Starting"); -356 final long analysisStart = System.currentTimeMillis(); -357 -358 // analysis phases -359 for (AnalysisPhase phase : AnalysisPhase.values()) { -360 final List<Analyzer> analyzerList = analyzers.get(phase); -361 -362 for (Analyzer a : analyzerList) { -363 a = initializeAnalyzer(a); -364 -365 /* need to create a copy of the collection because some of the -366 * analyzers may modify it. This prevents ConcurrentModificationExceptions. -367 * This is okay for adds/deletes because it happens per analyzer. -368 */ -369 LOGGER.debug("Begin Analyzer '{}'", a.getName()); -370 final Set<Dependency> dependencySet = new HashSet<Dependency>(dependencies); -371 for (Dependency d : dependencySet) { -372 boolean shouldAnalyze = true; -373 if (a instanceof FileTypeAnalyzer) { -374 final FileTypeAnalyzer fAnalyzer = (FileTypeAnalyzer) a; -375 shouldAnalyze = fAnalyzer.accept(d.getActualFile()); -376 } -377 if (shouldAnalyze) { -378 LOGGER.debug("Begin Analysis of '{}'", d.getActualFilePath()); -379 try { -380 a.analyze(d, this); -381 } catch (AnalysisException ex) { -382 LOGGER.warn("An error occurred while analyzing '{}'.", d.getActualFilePath()); -383 LOGGER.debug("", ex); -384 } catch (Throwable ex) { -385 //final AnalysisException ax = new AnalysisException(axMsg, ex); -386 LOGGER.warn("An unexpected error occurred during analysis of '{}'", d.getActualFilePath()); -387 LOGGER.debug("", ex); -388 } -389 } -390 } -391 } -392 } -393 for (AnalysisPhase phase : AnalysisPhase.values()) { -394 final List<Analyzer> analyzerList = analyzers.get(phase); -395 -396 for (Analyzer a : analyzerList) { -397 closeAnalyzer(a); -398 } -399 } -400 -401 LOGGER.debug("\n----------------------------------------------------\nEND ANALYSIS\n----------------------------------------------------"); -402 LOGGER.info("Analysis Complete ({} ms)", System.currentTimeMillis() - analysisStart); -403 } -404 -405 /** -406 * Initializes the given analyzer. -407 * -408 * @param analyzer the analyzer to initialize -409 * @return the initialized analyzer -410 */ -411 protected Analyzer initializeAnalyzer(Analyzer analyzer) { -412 try { -413 LOGGER.debug("Initializing {}", analyzer.getName()); -414 analyzer.initialize(); -415 } catch (Throwable ex) { -416 LOGGER.error("Exception occurred initializing {}.", analyzer.getName()); -417 LOGGER.debug("", ex); -418 try { -419 analyzer.close(); -420 } catch (Throwable ex1) { -421 LOGGER.trace("", ex1); -422 } -423 } -424 return analyzer; -425 } -426 -427 /** -428 * Closes the given analyzer. -429 * -430 * @param analyzer the analyzer to close -431 */ -432 protected void closeAnalyzer(Analyzer analyzer) { -433 LOGGER.debug("Closing Analyzer '{}'", analyzer.getName()); -434 try { -435 analyzer.close(); -436 } catch (Throwable ex) { -437 LOGGER.trace("", ex); -438 } -439 } -440 -441 /** -442 * Cycles through the cached web data sources and calls update on all of them. -443 */ -444 public void doUpdates() { -445 LOGGER.info("Checking for updates"); -446 final long updateStart = System.currentTimeMillis(); -447 final UpdateService service = new UpdateService(serviceClassLoader); -448 final Iterator<CachedWebDataSource> iterator = service.getDataSources(); -449 while (iterator.hasNext()) { -450 final CachedWebDataSource source = iterator.next(); -451 try { -452 source.update(); -453 } catch (UpdateException ex) { -454 LOGGER.warn( -455 "Unable to update Cached Web DataSource, using local data instead. Results may not include recent vulnerabilities."); -456 LOGGER.debug("Unable to update details for {}", source.getClass().getName(), ex); -457 } -458 } -459 LOGGER.info("Check for updates complete ({} ms)", System.currentTimeMillis() - updateStart); -460 } -461 -462 /** -463 * Returns a full list of all of the analyzers. This is useful for reporting which analyzers where used. -464 * -465 * @return a list of Analyzers -466 */ -467 public List<Analyzer> getAnalyzers() { -468 final List<Analyzer> ret = new ArrayList<Analyzer>(); -469 for (AnalysisPhase phase : AnalysisPhase.values()) { -470 final List<Analyzer> analyzerList = analyzers.get(phase); -471 ret.addAll(analyzerList); -472 } -473 return ret; -474 } -475 -476 /** -477 * Checks all analyzers to see if an extension is supported. -478 * -479 * @param file a file extension -480 * @return true or false depending on whether or not the file extension is supported +320 +321 //need to ensure that data exists +322 try { +323 ensureDataExists(); +324 } catch (NoDataException ex) { +325 LOGGER.error("{}\n\nUnable to continue dependency-check analysis.", ex.getMessage()); +326 LOGGER.debug("", ex); +327 return; +328 } catch (DatabaseException ex) { +329 LOGGER.error("{}\n\nUnable to continue dependency-check analysis.", ex.getMessage()); +330 LOGGER.debug("", ex); +331 return; +332 +333 } +334 +335 LOGGER.debug("\n----------------------------------------------------\nBEGIN ANALYSIS\n----------------------------------------------------"); +336 LOGGER.info("Analysis Starting"); +337 final long analysisStart = System.currentTimeMillis(); +338 +339 // analysis phases +340 for (AnalysisPhase phase : AnalysisPhase.values()) { +341 final List<Analyzer> analyzerList = analyzers.get(phase); +342 +343 for (Analyzer a : analyzerList) { +344 a = initializeAnalyzer(a); +345 +346 /* need to create a copy of the collection because some of the +347 * analyzers may modify it. This prevents ConcurrentModificationExceptions. +348 * This is okay for adds/deletes because it happens per analyzer. +349 */ +350 LOGGER.debug("Begin Analyzer '{}'", a.getName()); +351 final Set<Dependency> dependencySet = new HashSet<Dependency>(dependencies); +352 for (Dependency d : dependencySet) { +353 boolean shouldAnalyze = true; +354 if (a instanceof FileTypeAnalyzer) { +355 final FileTypeAnalyzer fAnalyzer = (FileTypeAnalyzer) a; +356 shouldAnalyze = fAnalyzer.accept(d.getActualFile()); +357 } +358 if (shouldAnalyze) { +359 LOGGER.debug("Begin Analysis of '{}'", d.getActualFilePath()); +360 try { +361 a.analyze(d, this); +362 } catch (AnalysisException ex) { +363 LOGGER.warn("An error occurred while analyzing '{}'.", d.getActualFilePath()); +364 LOGGER.debug("", ex); +365 } catch (Throwable ex) { +366 //final AnalysisException ax = new AnalysisException(axMsg, ex); +367 LOGGER.warn("An unexpected error occurred during analysis of '{}'", d.getActualFilePath()); +368 LOGGER.debug("", ex); +369 } +370 } +371 } +372 } +373 } +374 for (AnalysisPhase phase : AnalysisPhase.values()) { +375 final List<Analyzer> analyzerList = analyzers.get(phase); +376 +377 for (Analyzer a : analyzerList) { +378 closeAnalyzer(a); +379 } +380 } +381 +382 LOGGER.debug("\n----------------------------------------------------\nEND ANALYSIS\n----------------------------------------------------"); +383 LOGGER.info("Analysis Complete ({} ms)", System.currentTimeMillis() - analysisStart); +384 } +385 +386 /** +387 * Initializes the given analyzer. +388 * +389 * @param analyzer the analyzer to initialize +390 * @return the initialized analyzer +391 */ +392 protected Analyzer initializeAnalyzer(Analyzer analyzer) { +393 try { +394 LOGGER.debug("Initializing {}", analyzer.getName()); +395 analyzer.initialize(); +396 } catch (Throwable ex) { +397 LOGGER.error("Exception occurred initializing {}.", analyzer.getName()); +398 LOGGER.debug("", ex); +399 try { +400 analyzer.close(); +401 } catch (Throwable ex1) { +402 LOGGER.trace("", ex1); +403 } +404 } +405 return analyzer; +406 } +407 +408 /** +409 * Closes the given analyzer. +410 * +411 * @param analyzer the analyzer to close +412 */ +413 protected void closeAnalyzer(Analyzer analyzer) { +414 LOGGER.debug("Closing Analyzer '{}'", analyzer.getName()); +415 try { +416 analyzer.close(); +417 } catch (Throwable ex) { +418 LOGGER.trace("", ex); +419 } +420 } +421 +422 /** +423 * Cycles through the cached web data sources and calls update on all of them. +424 */ +425 public void doUpdates() { +426 LOGGER.info("Checking for updates"); +427 final long updateStart = System.currentTimeMillis(); +428 final UpdateService service = new UpdateService(serviceClassLoader); +429 final Iterator<CachedWebDataSource> iterator = service.getDataSources(); +430 while (iterator.hasNext()) { +431 final CachedWebDataSource source = iterator.next(); +432 try { +433 source.update(); +434 } catch (UpdateException ex) { +435 LOGGER.warn( +436 "Unable to update Cached Web DataSource, using local data instead. Results may not include recent vulnerabilities."); +437 LOGGER.debug("Unable to update details for {}", source.getClass().getName(), ex); +438 } +439 } +440 LOGGER.info("Check for updates complete ({} ms)", System.currentTimeMillis() - updateStart); +441 } +442 +443 /** +444 * Returns a full list of all of the analyzers. This is useful for reporting which analyzers where used. +445 * +446 * @return a list of Analyzers +447 */ +448 public List<Analyzer> getAnalyzers() { +449 final List<Analyzer> ret = new ArrayList<Analyzer>(); +450 for (AnalysisPhase phase : AnalysisPhase.values()) { +451 final List<Analyzer> analyzerList = analyzers.get(phase); +452 ret.addAll(analyzerList); +453 } +454 return ret; +455 } +456 +457 /** +458 * Checks all analyzers to see if an extension is supported. +459 * +460 * @param file a file extension +461 * @return true or false depending on whether or not the file extension is supported +462 */ +463 @Override +464 public boolean accept(File file) { +465 if (file == null) { +466 return false; +467 } +468 boolean scan = false; +469 for (FileTypeAnalyzer a : this.fileTypeAnalyzers) { +470 /* note, we can't break early on this loop as the analyzers need to know if +471 they have files to work on prior to initialization */ +472 scan |= a.accept(file); +473 } +474 return scan; +475 } +476 +477 /** +478 * Returns the set of file type analyzers. +479 * +480 * @return the set of file type analyzers 481 */ -482 @Override -483 public boolean accept(File file) { -484 if (file == null) { -485 return false; -486 } -487 boolean scan = false; -488 for (FileTypeAnalyzer a : this.fileTypeAnalyzers) { -489 /* note, we can't break early on this loop as the analyzers need to know if -490 they have files to work on prior to initialization */ -491 scan |= a.accept(file); -492 } -493 return scan; -494 } -495 -496 /** -497 * Returns the set of file type analyzers. -498 * -499 * @return the set of file type analyzers -500 */ -501 public Set<FileTypeAnalyzer> getFileTypeAnalyzers() { -502 return this.fileTypeAnalyzers; -503 } -504 -505 /** -506 * Checks the CPE Index to ensure documents exists. If none exist a NoDataException is thrown. -507 * -508 * @throws NoDataException thrown if no data exists in the CPE Index -509 * @throws DatabaseException thrown if there is an exception opening the database -510 */ -511 private void ensureDataExists() throws NoDataException, DatabaseException { -512 final CveDB cve = new CveDB(); -513 try { -514 cve.open(); -515 if (!cve.dataExists()) { -516 throw new NoDataException("No documents exist"); -517 } -518 } catch (DatabaseException ex) { -519 throw new NoDataException(ex.getMessage(), ex); -520 } finally { -521 cve.close(); -522 } -523 } -524 } +482 public Set<FileTypeAnalyzer> getFileTypeAnalyzers() { +483 return this.fileTypeAnalyzers; +484 } +485 +486 /** +487 * Checks the CPE Index to ensure documents exists. If none exist a NoDataException is thrown. +488 * +489 * @throws NoDataException thrown if no data exists in the CPE Index +490 * @throws DatabaseException thrown if there is an exception opening the database +491 */ +492 private void ensureDataExists() throws NoDataException, DatabaseException { +493 final CveDB cve = new CveDB(); +494 try { +495 cve.open(); +496 if (!cve.dataExists()) { +497 throw new NoDataException("No documents exist"); +498 } +499 } catch (DatabaseException ex) { +500 throw new NoDataException(ex.getMessage(), ex); +501 } finally { +502 cve.close(); +503 } +504 } +505 }
        diff --git a/xref/org/owasp/dependencycheck/InvalidScanPathException.html b/xref/org/owasp/dependencycheck/InvalidScanPathException.html index fe9582c50..86f3183a8 100644 --- a/xref/org/owasp/dependencycheck/InvalidScanPathException.html +++ b/xref/org/owasp/dependencycheck/InvalidScanPathException.html @@ -30,7 +30,7 @@ 22 * 23 * @author Jeremy Long 24 */ -25 class InvalidScanPathException extends Exception { +25 public class InvalidScanPathException extends Exception { 26 27 /** 28 * The serial version UID for serialization. diff --git a/xref/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.html b/xref/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.html index 940b0f3e2..71686ab6b 100644 --- a/xref/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.html +++ b/xref/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.html @@ -848,231 +848,191 @@ 840 */ 841 private Engine executeDependencyCheck() throws DatabaseException { 842 populateSettings(); -843 Engine engine = null; -844 engine = new Engine(); -845 engine.setDependencies(this.dependencies); -846 engine.analyzeDependencies(); -847 return engine; -848 } -849 -850 /** -851 * Generates the reports for a given dependency-check engine. -852 * -853 * @param engine a dependency-check engine -854 * @param outDirectory the directory to write the reports to -855 */ -856 private void generateExternalReports(Engine engine, File outDirectory) { -857 DatabaseProperties prop = null; -858 CveDB cve = null; -859 try { -860 cve = new CveDB(); -861 cve.open(); -862 prop = cve.getDatabaseProperties(); -863 } catch (DatabaseException ex) { -864 LOGGER.debug("Unable to retrieve DB Properties", ex); -865 } finally { -866 if (cve != null) { -867 cve.close(); -868 } -869 } -870 final ReportGenerator r = new ReportGenerator(this.applicationName, engine.getDependencies(), engine.getAnalyzers(), prop); -871 try { -872 r.generateReports(outDirectory.getCanonicalPath(), this.reportFormat.name()); -873 } catch (IOException ex) { -874 LOGGER.error( -875 "Unexpected exception occurred during analysis; please see the verbose error log for more details."); -876 LOGGER.debug("", ex); -877 } catch (Throwable ex) { -878 LOGGER.error( -879 "Unexpected exception occurred during analysis; please see the verbose error log for more details."); -880 LOGGER.debug("", ex); -881 } -882 } -883 -884 /** -885 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties -886 * required to change the proxy server, port, and connection timeout. -887 */ -888 private void populateSettings() { -889 Settings.initialize(); -890 if (dataDirectory != null) { -891 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory); -892 } else { -893 final File jarPath = new File(DependencyCheckScanAgent.class.getProtectionDomain().getCodeSource().getLocation().getPath()); -894 final File base = jarPath.getParentFile(); -895 final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY); -896 final File dataDir = new File(base, sub); -897 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); -898 } -899 -900 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); -901 -902 if (proxyServer != null && !proxyServer.isEmpty()) { -903 Settings.setString(Settings.KEYS.PROXY_SERVER, proxyServer); -904 } -905 if (proxyPort != null && !proxyPort.isEmpty()) { -906 Settings.setString(Settings.KEYS.PROXY_PORT, proxyPort); -907 } -908 if (proxyUsername != null && !proxyUsername.isEmpty()) { -909 Settings.setString(Settings.KEYS.PROXY_USERNAME, proxyUsername); -910 } -911 if (proxyPassword != null && !proxyPassword.isEmpty()) { -912 Settings.setString(Settings.KEYS.PROXY_PASSWORD, proxyPassword); -913 } -914 if (connectionTimeout != null && !connectionTimeout.isEmpty()) { -915 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); -916 } -917 if (suppressionFile != null && !suppressionFile.isEmpty()) { -918 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); -919 } -920 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); -921 if (centralUrl != null && !centralUrl.isEmpty()) { -922 Settings.setString(Settings.KEYS.ANALYZER_CENTRAL_URL, centralUrl); -923 } -924 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); -925 if (nexusUrl != null && !nexusUrl.isEmpty()) { -926 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); -927 } -928 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy); -929 if (databaseDriverName != null && !databaseDriverName.isEmpty()) { -930 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); -931 } -932 if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) { -933 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); -934 } -935 if (connectionString != null && !connectionString.isEmpty()) { -936 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString); -937 } -938 if (databaseUser != null && !databaseUser.isEmpty()) { -939 Settings.setString(Settings.KEYS.DB_USER, databaseUser); -940 } -941 if (databasePassword != null && !databasePassword.isEmpty()) { -942 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword); -943 } -944 if (zipExtensions != null && !zipExtensions.isEmpty()) { -945 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); -946 } -947 if (cveUrl12Modified != null && !cveUrl12Modified.isEmpty()) { -948 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); -949 } -950 if (cveUrl20Modified != null && !cveUrl20Modified.isEmpty()) { -951 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); +843 final Engine engine = new Engine(); +844 engine.setDependencies(this.dependencies); +845 engine.analyzeDependencies(); +846 return engine; +847 } +848 +849 /** +850 * Generates the reports for a given dependency-check engine. +851 * +852 * @param engine a dependency-check engine +853 * @param outDirectory the directory to write the reports to +854 */ +855 private void generateExternalReports(Engine engine, File outDirectory) { +856 DatabaseProperties prop = null; +857 CveDB cve = null; +858 try { +859 cve = new CveDB(); +860 cve.open(); +861 prop = cve.getDatabaseProperties(); +862 } catch (DatabaseException ex) { +863 LOGGER.debug("Unable to retrieve DB Properties", ex); +864 } finally { +865 if (cve != null) { +866 cve.close(); +867 } +868 } +869 final ReportGenerator r = new ReportGenerator(this.applicationName, engine.getDependencies(), engine.getAnalyzers(), prop); +870 try { +871 r.generateReports(outDirectory.getCanonicalPath(), this.reportFormat.name()); +872 } catch (IOException ex) { +873 LOGGER.error( +874 "Unexpected exception occurred during analysis; please see the verbose error log for more details."); +875 LOGGER.debug("", ex); +876 } catch (Throwable ex) { +877 LOGGER.error( +878 "Unexpected exception occurred during analysis; please see the verbose error log for more details."); +879 LOGGER.debug("", ex); +880 } +881 } +882 +883 /** +884 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties +885 * required to change the proxy server, port, and connection timeout. +886 */ +887 private void populateSettings() { +888 Settings.initialize(); +889 if (dataDirectory != null) { +890 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory); +891 } else { +892 final File jarPath = new File(DependencyCheckScanAgent.class.getProtectionDomain().getCodeSource().getLocation().getPath()); +893 final File base = jarPath.getParentFile(); +894 final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY); +895 final File dataDir = new File(base, sub); +896 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); +897 } +898 +899 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); +900 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_SERVER, proxyServer); +901 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PORT, proxyPort); +902 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_USERNAME, proxyUsername); +903 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PASSWORD, proxyPassword); +904 Settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); +905 Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); +906 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); +907 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_CENTRAL_URL, centralUrl); +908 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); +909 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); +910 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy); +911 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); +912 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); +913 Settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString); +914 Settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser); +915 Settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword); +916 Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); +917 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); +918 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); +919 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); +920 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); +921 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); +922 } +923 +924 /** +925 * Executes the dependency-check and generates the report. +926 * +927 * @return a reference to the engine used to perform the scan. +928 * @throws org.owasp.dependencycheck.exception.ScanAgentException thrown if there is an exception executing the scan. +929 */ +930 public Engine execute() throws ScanAgentException { +931 Engine engine = null; +932 try { +933 engine = executeDependencyCheck(); +934 if (this.generateReport) { +935 generateExternalReports(engine, new File(this.reportOutputDirectory)); +936 } +937 if (this.showSummary) { +938 showSummary(engine.getDependencies()); +939 } +940 if (this.failBuildOnCVSS <= 10) { +941 checkForFailure(engine.getDependencies()); +942 } +943 } catch (DatabaseException ex) { +944 LOGGER.error( +945 "Unable to connect to the dependency-check database; analysis has stopped"); +946 LOGGER.debug("", ex); +947 } finally { +948 Settings.cleanup(true); +949 if (engine != null) { +950 engine.cleanup(); +951 } 952 } -953 if (cveUrl12Base != null && !cveUrl12Base.isEmpty()) { -954 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); -955 } -956 if (cveUrl20Base != null && !cveUrl20Base.isEmpty()) { -957 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); -958 } -959 if (pathToMono != null && !pathToMono.isEmpty()) { -960 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); -961 } -962 } -963 -964 /** -965 * Executes the dependency-check and generates the report. -966 * -967 * @return a reference to the engine used to perform the scan. -968 * @throws org.owasp.dependencycheck.exception.ScanAgentException thrown if there is an exception executing the scan. -969 */ -970 public Engine execute() throws ScanAgentException { -971 Engine engine = null; -972 try { -973 engine = executeDependencyCheck(); -974 if (this.generateReport) { -975 generateExternalReports(engine, new File(this.reportOutputDirectory)); -976 } -977 if (this.showSummary) { -978 showSummary(engine.getDependencies()); -979 } -980 if (this.failBuildOnCVSS <= 10) { -981 checkForFailure(engine.getDependencies()); -982 } -983 } catch (DatabaseException ex) { -984 LOGGER.error( -985 "Unable to connect to the dependency-check database; analysis has stopped"); -986 LOGGER.debug("", ex); -987 } finally { -988 Settings.cleanup(true); -989 if (engine != null) { -990 engine.cleanup(); -991 } -992 } -993 return engine; -994 } -995 -996 /** -997 * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the -998 * configuration. -999 * -1000 * @param dependencies the list of dependency objects -1001 * @throws org.owasp.dependencycheck.exception.ScanAgentException thrown if there is an exception executing the scan. -1002 */ -1003 private void checkForFailure(List<Dependency> dependencies) throws ScanAgentException { -1004 final StringBuilder ids = new StringBuilder(); -1005 for (Dependency d : dependencies) { -1006 boolean addName = true; -1007 for (Vulnerability v : d.getVulnerabilities()) { -1008 if (v.getCvssScore() >= failBuildOnCVSS) { -1009 if (addName) { -1010 addName = false; -1011 ids.append(NEW_LINE).append(d.getFileName()).append(": "); -1012 ids.append(v.getName()); -1013 } else { -1014 ids.append(", ").append(v.getName()); -1015 } +953 return engine; +954 } +955 +956 /** +957 * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the +958 * configuration. +959 * +960 * @param dependencies the list of dependency objects +961 * @throws org.owasp.dependencycheck.exception.ScanAgentException thrown if there is an exception executing the scan. +962 */ +963 private void checkForFailure(List<Dependency> dependencies) throws ScanAgentException { +964 final StringBuilder ids = new StringBuilder(); +965 for (Dependency d : dependencies) { +966 boolean addName = true; +967 for (Vulnerability v : d.getVulnerabilities()) { +968 if (v.getCvssScore() >= failBuildOnCVSS) { +969 if (addName) { +970 addName = false; +971 ids.append(NEW_LINE).append(d.getFileName()).append(": "); +972 ids.append(v.getName()); +973 } else { +974 ids.append(", ").append(v.getName()); +975 } +976 } +977 } +978 } +979 if (ids.length() > 0) { +980 final String msg = String.format("%n%nDependency-Check Failure:%n" +981 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" +982 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); +983 +984 throw new ScanAgentException(msg); +985 } +986 } +987 +988 /** +989 * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. +990 * +991 * @param dependencies a list of dependency objects +992 */ +993 private void showSummary(List<Dependency> dependencies) { +994 final StringBuilder summary = new StringBuilder(); +995 for (Dependency d : dependencies) { +996 boolean firstEntry = true; +997 final StringBuilder ids = new StringBuilder(); +998 for (Vulnerability v : d.getVulnerabilities()) { +999 if (firstEntry) { +1000 firstEntry = false; +1001 } else { +1002 ids.append(", "); +1003 } +1004 ids.append(v.getName()); +1005 } +1006 if (ids.length() > 0) { +1007 summary.append(d.getFileName()).append(" ("); +1008 firstEntry = true; +1009 for (Identifier id : d.getIdentifiers()) { +1010 if (firstEntry) { +1011 firstEntry = false; +1012 } else { +1013 summary.append(", "); +1014 } +1015 summary.append(id.getValue()); 1016 } -1017 } -1018 } -1019 if (ids.length() > 0) { -1020 final String msg = String.format("%n%nDependency-Check Failure:%n" -1021 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" -1022 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); -1023 -1024 throw new ScanAgentException(msg); -1025 } -1026 } -1027 -1028 /** -1029 * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. -1030 * -1031 * @param dependencies a list of dependency objects -1032 */ -1033 private void showSummary(List<Dependency> dependencies) { -1034 final StringBuilder summary = new StringBuilder(); -1035 for (Dependency d : dependencies) { -1036 boolean firstEntry = true; -1037 final StringBuilder ids = new StringBuilder(); -1038 for (Vulnerability v : d.getVulnerabilities()) { -1039 if (firstEntry) { -1040 firstEntry = false; -1041 } else { -1042 ids.append(", "); -1043 } -1044 ids.append(v.getName()); -1045 } -1046 if (ids.length() > 0) { -1047 summary.append(d.getFileName()).append(" ("); -1048 firstEntry = true; -1049 for (Identifier id : d.getIdentifiers()) { -1050 if (firstEntry) { -1051 firstEntry = false; -1052 } else { -1053 summary.append(", "); -1054 } -1055 summary.append(id.getValue()); -1056 } -1057 summary.append(") : ").append(ids).append(NEW_LINE); -1058 } -1059 } -1060 if (summary.length() > 0) { -1061 LOGGER.warn("\n\nOne or more dependencies were identified with known vulnerabilities:\n\n{}\n\n" -1062 + "See the dependency-check report for more details.\n\n", -1063 summary.toString()); -1064 } -1065 } -1066 -1067 } +1017 summary.append(") : ").append(ids).append(NEW_LINE); +1018 } +1019 } +1020 if (summary.length() > 0) { +1021 LOGGER.warn("\n\nOne or more dependencies were identified with known vulnerabilities:\n\n{}\n\n" +1022 + "See the dependency-check report for more details.\n\n", +1023 summary.toString()); +1024 } +1025 } +1026 +1027 }
        diff --git a/xref/org/owasp/dependencycheck/agent/package-frame.html b/xref/org/owasp/dependencycheck/agent/package-frame.html index 496ba1e2d..b75433914 100644 --- a/xref/org/owasp/dependencycheck/agent/package-frame.html +++ b/xref/org/owasp/dependencycheck/agent/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.agent + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.agent diff --git a/xref/org/owasp/dependencycheck/agent/package-summary.html b/xref/org/owasp/dependencycheck/agent/package-summary.html index bdcb6e5dc..a1560dcc1 100644 --- a/xref/org/owasp/dependencycheck/agent/package-summary.html +++ b/xref/org/owasp/dependencycheck/agent/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.agent + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.agent diff --git a/xref/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzer.html index 9630ee9ef..c1d3fe9ab 100644 --- a/xref/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/AbstractFileTypeAnalyzer.html @@ -222,7 +222,7 @@ 214 * @return a Set of strings. 215 */ 216 protected static Set<String> newHashSet(String... strings) { -217 final Set<String> set = new HashSet<String>(); +217 final Set<String> set = new HashSet<String>(strings.length); 218 Collections.addAll(set, strings); 219 return set; 220 } diff --git a/xref/org/owasp/dependencycheck/analyzer/AnalysisPhase.html b/xref/org/owasp/dependencycheck/analyzer/AnalysisPhase.html index b42341bbb..467d58eaa 100644 --- a/xref/org/owasp/dependencycheck/analyzer/AnalysisPhase.html +++ b/xref/org/owasp/dependencycheck/analyzer/AnalysisPhase.html @@ -37,38 +37,42 @@ 29 */ 30 INITIAL, 31 /** -32 * Information collection phase. +32 * Pre information collection phase 33 */ -34 INFORMATION_COLLECTION, +34 PRE_INFORMATION_COLLECTION, 35 /** -36 * Pre identifier analysis phase. +36 * Information collection phase. 37 */ -38 PRE_IDENTIFIER_ANALYSIS, +38 INFORMATION_COLLECTION, 39 /** -40 * Identifier analysis phase. +40 * Pre identifier analysis phase. 41 */ -42 IDENTIFIER_ANALYSIS, +42 PRE_IDENTIFIER_ANALYSIS, 43 /** -44 * Post identifier analysis phase. +44 * Identifier analysis phase. 45 */ -46 POST_IDENTIFIER_ANALYSIS, +46 IDENTIFIER_ANALYSIS, 47 /** -48 * Pre finding analysis phase. +48 * Post identifier analysis phase. 49 */ -50 PRE_FINDING_ANALYSIS, +50 POST_IDENTIFIER_ANALYSIS, 51 /** -52 * Finding analysis phase. +52 * Pre finding analysis phase. 53 */ -54 FINDING_ANALYSIS, +54 PRE_FINDING_ANALYSIS, 55 /** -56 * Post analysis phase. +56 * Finding analysis phase. 57 */ -58 POST_FINDING_ANALYSIS, +58 FINDING_ANALYSIS, 59 /** -60 * The final analysis phase. +60 * Post analysis phase. 61 */ -62 FINAL -63 } +62 POST_FINDING_ANALYSIS, +63 /** +64 * The final analysis phase. +65 */ +66 FINAL +67 }
        diff --git a/xref/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.html index 94bf4b6ed..17c9d8c0b 100644 --- a/xref/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.html @@ -122,8 +122,8 @@ 114 static { 115 final String additionalZipExt = Settings.getString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS); 116 if (additionalZipExt != null) { -117 final Set<String> ext = new HashSet<String>(Collections.singletonList(additionalZipExt)); -118 ZIPPABLES.addAll(ext); +117 final String[] ext = additionalZipExt.split("\\s*,\\s*"); +118 Collections.addAll(ZIPPABLES, ext); 119 } 120 EXTENSIONS.addAll(ZIPPABLES); 121 } @@ -203,320 +203,321 @@ 195 if (tempFileLocation != null && tempFileLocation.exists()) { 196 LOGGER.debug("Attempting to delete temporary files"); 197 final boolean success = FileUtils.delete(tempFileLocation); -198 if (!success && tempFileLocation.exists() && tempFileLocation.list().length > 0) { -199 LOGGER.warn("Failed to delete some temporary files, see the log for more details"); -200 } -201 } -202 } -203 -204 /** -205 * Analyzes a given dependency. If the dependency is an archive, such as a WAR or EAR, the contents are extracted, scanned, -206 * and added to the list of dependencies within the engine. -207 * -208 * @param dependency the dependency to analyze -209 * @param engine the engine scanning -210 * @throws AnalysisException thrown if there is an analysis exception -211 */ -212 @Override -213 public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { -214 final File f = new File(dependency.getActualFilePath()); -215 final File tmpDir = getNextTempDirectory(); -216 extractFiles(f, tmpDir, engine); -217 -218 //make a copy -219 final Set<Dependency> dependencySet = findMoreDependencies(engine, tmpDir); -220 if (!dependencySet.isEmpty()) { -221 for (Dependency d : dependencySet) { -222 //fix the dependency's display name and path -223 final String displayPath = String.format("%s%s", -224 dependency.getFilePath(), -225 d.getActualFilePath().substring(tmpDir.getAbsolutePath().length())); -226 final String displayName = String.format("%s: %s", -227 dependency.getFileName(), -228 d.getFileName()); -229 d.setFilePath(displayPath); -230 d.setFileName(displayName); -231 -232 //TODO - can we get more evidence from the parent? EAR contains module name, etc. -233 //analyze the dependency (i.e. extract files) if it is a supported type. -234 if (this.accept(d.getActualFile()) && scanDepth < MAX_SCAN_DEPTH) { -235 scanDepth += 1; -236 analyze(d, engine); -237 scanDepth -= 1; -238 } -239 } -240 } -241 if (REMOVE_FROM_ANALYSIS.accept(dependency.getActualFile())) { -242 addDisguisedJarsToDependencies(dependency, engine); -243 engine.getDependencies().remove(dependency); -244 } -245 Collections.sort(engine.getDependencies()); -246 } -247 -248 /** -249 * If a zip file was identified as a possible JAR, this method will add the zip to the list of dependencies. -250 * -251 * @param dependency the zip file -252 * @param engine the engine -253 * @throws AnalysisException thrown if there is an issue -254 */ -255 private void addDisguisedJarsToDependencies(Dependency dependency, Engine engine) throws AnalysisException { -256 if (ZIP_FILTER.accept(dependency.getActualFile()) && isZipFileActuallyJarFile(dependency)) { -257 final File tdir = getNextTempDirectory(); -258 final String fileName = dependency.getFileName(); -259 -260 LOGGER.info("The zip file '{}' appears to be a JAR file, making a copy and analyzing it as a JAR.", fileName); -261 -262 final File tmpLoc = new File(tdir, fileName.substring(0, fileName.length() - 3) + "jar"); -263 try { -264 org.apache.commons.io.FileUtils.copyFile(tdir, tmpLoc); -265 final Set<Dependency> dependencySet = findMoreDependencies(engine, tmpLoc); -266 if (!dependencySet.isEmpty()) { -267 if (dependencySet.size() != 1) { -268 LOGGER.info("Deep copy of ZIP to JAR file resulted in more than one dependency?"); -269 } -270 for (Dependency d : dependencySet) { -271 //fix the dependency's display name and path -272 d.setFilePath(dependency.getFilePath()); -273 d.setDisplayFileName(dependency.getFileName()); -274 } -275 } -276 } catch (IOException ex) { -277 LOGGER.debug("Unable to perform deep copy on '{}'", dependency.getActualFile().getPath(), ex); -278 } -279 } -280 } -281 /** -282 * An empty dependency set. -283 */ -284 private static final Set<Dependency> EMPTY_DEPENDENCY_SET = Collections.emptySet(); -285 -286 /** -287 * Scan the given file/folder, and return any new dependencies found. -288 * -289 * @param engine used to scan -290 * @param file target of scanning -291 * @return any dependencies that weren't known to the engine before -292 */ -293 private static Set<Dependency> findMoreDependencies(Engine engine, File file) { -294 final List<Dependency> before = new ArrayList<Dependency>(engine.getDependencies()); -295 engine.scan(file); -296 final List<Dependency> after = engine.getDependencies(); -297 final boolean sizeChanged = before.size() != after.size(); -298 final Set<Dependency> newDependencies; -299 if (sizeChanged) { -300 //get the new dependencies -301 newDependencies = new HashSet<Dependency>(after); -302 newDependencies.removeAll(before); -303 } else { -304 newDependencies = EMPTY_DEPENDENCY_SET; -305 } -306 return newDependencies; -307 } -308 -309 /** -310 * Retrieves the next temporary directory to extract an archive too. -311 * -312 * @return a directory -313 * @throws AnalysisException thrown if unable to create temporary directory -314 */ -315 private File getNextTempDirectory() throws AnalysisException { -316 dirCount += 1; -317 final File directory = new File(tempFileLocation, String.valueOf(dirCount)); -318 //getting an exception for some directories not being able to be created; might be because the directory already exists? -319 if (directory.exists()) { -320 return getNextTempDirectory(); -321 } -322 if (!directory.mkdirs()) { -323 final String msg = String.format("Unable to create temp directory '%s'.", directory.getAbsolutePath()); -324 throw new AnalysisException(msg); -325 } -326 return directory; -327 } -328 -329 /** -330 * Extracts the contents of an archive into the specified directory. -331 * -332 * @param archive an archive file such as a WAR or EAR -333 * @param destination a directory to extract the contents to -334 * @param engine the scanning engine -335 * @throws AnalysisException thrown if the archive is not found -336 */ -337 private void extractFiles(File archive, File destination, Engine engine) throws AnalysisException { -338 if (archive != null && destination != null) { -339 FileInputStream fis; -340 try { -341 fis = new FileInputStream(archive); -342 } catch (FileNotFoundException ex) { -343 LOGGER.debug("", ex); -344 throw new AnalysisException("Archive file was not found.", ex); -345 } -346 final String archiveExt = FileUtils.getFileExtension(archive.getName()).toLowerCase(); -347 try { -348 if (ZIPPABLES.contains(archiveExt)) { -349 extractArchive(new ZipArchiveInputStream(new BufferedInputStream(fis)), destination, engine); -350 } else if ("tar".equals(archiveExt)) { -351 extractArchive(new TarArchiveInputStream(new BufferedInputStream(fis)), destination, engine); -352 } else if ("gz".equals(archiveExt) || "tgz".equals(archiveExt)) { -353 final String uncompressedName = GzipUtils.getUncompressedFilename(archive.getName()); -354 final File f = new File(destination, uncompressedName); -355 if (engine.accept(f)) { -356 decompressFile(new GzipCompressorInputStream(new BufferedInputStream(fis)), f); -357 } -358 } else if ("bz2".equals(archiveExt) || "tbz2".equals(archiveExt)) { -359 final String uncompressedName = BZip2Utils.getUncompressedFilename(archive.getName()); -360 final File f = new File(destination, uncompressedName); -361 if (engine.accept(f)) { -362 decompressFile(new BZip2CompressorInputStream(new BufferedInputStream(fis)), f); -363 } -364 } -365 } catch (ArchiveExtractionException ex) { -366 LOGGER.warn("Exception extracting archive '{}'.", archive.getName()); -367 LOGGER.debug("", ex); -368 } catch (IOException ex) { -369 LOGGER.warn("Exception reading archive '{}'.", archive.getName()); +198 if (!success && tempFileLocation.exists()) { +199 final String[] l = tempFileLocation.list(); +200 if (l != null && l.length > 0) { +201 LOGGER.warn("Failed to delete some temporary files, see the log for more details"); +202 } +203 } +204 } +205 } +206 +207 /** +208 * Analyzes a given dependency. If the dependency is an archive, such as a WAR or EAR, the contents are extracted, scanned, +209 * and added to the list of dependencies within the engine. +210 * +211 * @param dependency the dependency to analyze +212 * @param engine the engine scanning +213 * @throws AnalysisException thrown if there is an analysis exception +214 */ +215 @Override +216 public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { +217 final File f = new File(dependency.getActualFilePath()); +218 final File tmpDir = getNextTempDirectory(); +219 extractFiles(f, tmpDir, engine); +220 +221 //make a copy +222 final Set<Dependency> dependencySet = findMoreDependencies(engine, tmpDir); +223 if (!dependencySet.isEmpty()) { +224 for (Dependency d : dependencySet) { +225 //fix the dependency's display name and path +226 final String displayPath = String.format("%s%s", +227 dependency.getFilePath(), +228 d.getActualFilePath().substring(tmpDir.getAbsolutePath().length())); +229 final String displayName = String.format("%s: %s", +230 dependency.getFileName(), +231 d.getFileName()); +232 d.setFilePath(displayPath); +233 d.setFileName(displayName); +234 +235 //TODO - can we get more evidence from the parent? EAR contains module name, etc. +236 //analyze the dependency (i.e. extract files) if it is a supported type. +237 if (this.accept(d.getActualFile()) && scanDepth < MAX_SCAN_DEPTH) { +238 scanDepth += 1; +239 analyze(d, engine); +240 scanDepth -= 1; +241 } +242 } +243 } +244 if (REMOVE_FROM_ANALYSIS.accept(dependency.getActualFile())) { +245 addDisguisedJarsToDependencies(dependency, engine); +246 engine.getDependencies().remove(dependency); +247 } +248 Collections.sort(engine.getDependencies()); +249 } +250 +251 /** +252 * If a zip file was identified as a possible JAR, this method will add the zip to the list of dependencies. +253 * +254 * @param dependency the zip file +255 * @param engine the engine +256 * @throws AnalysisException thrown if there is an issue +257 */ +258 private void addDisguisedJarsToDependencies(Dependency dependency, Engine engine) throws AnalysisException { +259 if (ZIP_FILTER.accept(dependency.getActualFile()) && isZipFileActuallyJarFile(dependency)) { +260 final File tdir = getNextTempDirectory(); +261 final String fileName = dependency.getFileName(); +262 +263 LOGGER.info("The zip file '{}' appears to be a JAR file, making a copy and analyzing it as a JAR.", fileName); +264 +265 final File tmpLoc = new File(tdir, fileName.substring(0, fileName.length() - 3) + "jar"); +266 try { +267 org.apache.commons.io.FileUtils.copyFile(tdir, tmpLoc); +268 final Set<Dependency> dependencySet = findMoreDependencies(engine, tmpLoc); +269 if (!dependencySet.isEmpty()) { +270 if (dependencySet.size() != 1) { +271 LOGGER.info("Deep copy of ZIP to JAR file resulted in more than one dependency?"); +272 } +273 for (Dependency d : dependencySet) { +274 //fix the dependency's display name and path +275 d.setFilePath(dependency.getFilePath()); +276 d.setDisplayFileName(dependency.getFileName()); +277 } +278 } +279 } catch (IOException ex) { +280 LOGGER.debug("Unable to perform deep copy on '{}'", dependency.getActualFile().getPath(), ex); +281 } +282 } +283 } +284 /** +285 * An empty dependency set. +286 */ +287 private static final Set<Dependency> EMPTY_DEPENDENCY_SET = Collections.emptySet(); +288 +289 /** +290 * Scan the given file/folder, and return any new dependencies found. +291 * +292 * @param engine used to scan +293 * @param file target of scanning +294 * @return any dependencies that weren't known to the engine before +295 */ +296 private static Set<Dependency> findMoreDependencies(Engine engine, File file) { +297 final List<Dependency> before = new ArrayList<Dependency>(engine.getDependencies()); +298 engine.scan(file); +299 final List<Dependency> after = engine.getDependencies(); +300 final boolean sizeChanged = before.size() != after.size(); +301 final Set<Dependency> newDependencies; +302 if (sizeChanged) { +303 //get the new dependencies +304 newDependencies = new HashSet<Dependency>(after); +305 newDependencies.removeAll(before); +306 } else { +307 newDependencies = EMPTY_DEPENDENCY_SET; +308 } +309 return newDependencies; +310 } +311 +312 /** +313 * Retrieves the next temporary directory to extract an archive too. +314 * +315 * @return a directory +316 * @throws AnalysisException thrown if unable to create temporary directory +317 */ +318 private File getNextTempDirectory() throws AnalysisException { +319 dirCount += 1; +320 final File directory = new File(tempFileLocation, String.valueOf(dirCount)); +321 //getting an exception for some directories not being able to be created; might be because the directory already exists? +322 if (directory.exists()) { +323 return getNextTempDirectory(); +324 } +325 if (!directory.mkdirs()) { +326 final String msg = String.format("Unable to create temp directory '%s'.", directory.getAbsolutePath()); +327 throw new AnalysisException(msg); +328 } +329 return directory; +330 } +331 +332 /** +333 * Extracts the contents of an archive into the specified directory. +334 * +335 * @param archive an archive file such as a WAR or EAR +336 * @param destination a directory to extract the contents to +337 * @param engine the scanning engine +338 * @throws AnalysisException thrown if the archive is not found +339 */ +340 private void extractFiles(File archive, File destination, Engine engine) throws AnalysisException { +341 if (archive != null && destination != null) { +342 FileInputStream fis; +343 try { +344 fis = new FileInputStream(archive); +345 } catch (FileNotFoundException ex) { +346 LOGGER.debug("", ex); +347 throw new AnalysisException("Archive file was not found.", ex); +348 } +349 final String archiveExt = FileUtils.getFileExtension(archive.getName()).toLowerCase(); +350 try { +351 if (ZIPPABLES.contains(archiveExt)) { +352 extractArchive(new ZipArchiveInputStream(new BufferedInputStream(fis)), destination, engine); +353 } else if ("tar".equals(archiveExt)) { +354 extractArchive(new TarArchiveInputStream(new BufferedInputStream(fis)), destination, engine); +355 } else if ("gz".equals(archiveExt) || "tgz".equals(archiveExt)) { +356 final String uncompressedName = GzipUtils.getUncompressedFilename(archive.getName()); +357 final File f = new File(destination, uncompressedName); +358 if (engine.accept(f)) { +359 decompressFile(new GzipCompressorInputStream(new BufferedInputStream(fis)), f); +360 } +361 } else if ("bz2".equals(archiveExt) || "tbz2".equals(archiveExt)) { +362 final String uncompressedName = BZip2Utils.getUncompressedFilename(archive.getName()); +363 final File f = new File(destination, uncompressedName); +364 if (engine.accept(f)) { +365 decompressFile(new BZip2CompressorInputStream(new BufferedInputStream(fis)), f); +366 } +367 } +368 } catch (ArchiveExtractionException ex) { +369 LOGGER.warn("Exception extracting archive '{}'.", archive.getName()); 370 LOGGER.debug("", ex); -371 } finally { -372 close(fis); -373 } -374 } -375 } -376 -377 /** -378 * Extracts files from an archive. -379 * -380 * @param input the archive to extract files from -381 * @param destination the location to write the files too -382 * @param engine the dependency-check engine -383 * @throws ArchiveExtractionException thrown if there is an exception extracting files from the archive -384 */ -385 private void extractArchive(ArchiveInputStream input, File destination, Engine engine) throws ArchiveExtractionException { -386 ArchiveEntry entry; -387 try { -388 while ((entry = input.getNextEntry()) != null) { -389 final File file = new File(destination, entry.getName()); -390 if (entry.isDirectory()) { -391 if (!file.exists() && !file.mkdirs()) { -392 final String msg = String.format("Unable to create directory '%s'.", file.getAbsolutePath()); -393 throw new AnalysisException(msg); -394 } -395 } else if (engine.accept(file)) { -396 extractAcceptedFile(input, file); -397 } -398 } -399 } catch (Throwable ex) { -400 throw new ArchiveExtractionException(ex); -401 } finally { -402 close(input); -403 } -404 } -405 -406 /** -407 * Extracts a file from an archive. -408 * -409 * @param input the archives input stream -410 * @param file the file to extract -411 * @throws AnalysisException thrown if there is an error -412 */ -413 private static void extractAcceptedFile(ArchiveInputStream input, File file) throws AnalysisException { -414 LOGGER.debug("Extracting '{}'", file.getPath()); -415 FileOutputStream fos = null; -416 try { -417 final File parent = file.getParentFile(); -418 if (!parent.isDirectory()) { -419 if (!parent.mkdirs()) { -420 final String msg = String.format("Unable to build directory '%s'.", parent.getAbsolutePath()); -421 throw new AnalysisException(msg); -422 } -423 } -424 fos = new FileOutputStream(file); -425 IOUtils.copy(input, fos); -426 } catch (FileNotFoundException ex) { -427 LOGGER.debug("", ex); -428 final String msg = String.format("Unable to find file '%s'.", file.getName()); -429 throw new AnalysisException(msg, ex); -430 } catch (IOException ex) { -431 LOGGER.debug("", ex); -432 final String msg = String.format("IO Exception while parsing file '%s'.", file.getName()); -433 throw new AnalysisException(msg, ex); -434 } finally { -435 close(fos); -436 } -437 } -438 -439 /** -440 * Decompresses a file. -441 * -442 * @param inputStream the compressed file -443 * @param outputFile the location to write the decompressed file -444 * @throws ArchiveExtractionException thrown if there is an exception decompressing the file -445 */ -446 private void decompressFile(CompressorInputStream inputStream, File outputFile) throws ArchiveExtractionException { -447 LOGGER.debug("Decompressing '{}'", outputFile.getPath()); -448 FileOutputStream out = null; -449 try { -450 out = new FileOutputStream(outputFile); -451 IOUtils.copy(inputStream, out); -452 } catch (FileNotFoundException ex) { -453 LOGGER.debug("", ex); -454 throw new ArchiveExtractionException(ex); -455 } catch (IOException ex) { -456 LOGGER.debug("", ex); -457 throw new ArchiveExtractionException(ex); -458 } finally { -459 close(out); -460 } -461 } -462 -463 /** -464 * Close the given {@link Closeable} instance, ignoring nulls, and logging any thrown {@link IOException}. -465 * -466 * @param closeable to be closed -467 */ -468 private static void close(Closeable closeable) { -469 if (null != closeable) { -470 try { -471 closeable.close(); -472 } catch (IOException ex) { -473 LOGGER.trace("", ex); -474 } -475 } -476 } -477 -478 /** -479 * Attempts to determine if a zip file is actually a JAR file. -480 * -481 * @param dependency the dependency to check -482 * @return true if the dependency appears to be a JAR file; otherwise false -483 */ -484 private boolean isZipFileActuallyJarFile(Dependency dependency) { -485 boolean isJar = false; -486 ZipFile zip = null; -487 try { -488 zip = new ZipFile(dependency.getActualFilePath()); -489 if (zip.getEntry("META-INF/MANIFEST.MF") != null -490 || zip.getEntry("META-INF/maven") != null) { -491 final Enumeration<ZipArchiveEntry> entries = zip.getEntries(); -492 while (entries.hasMoreElements()) { -493 final ZipArchiveEntry entry = entries.nextElement(); -494 if (!entry.isDirectory()) { -495 final String name = entry.getName().toLowerCase(); -496 if (name.endsWith(".class")) { -497 isJar = true; -498 break; -499 } -500 } -501 } -502 } -503 } catch (IOException ex) { -504 LOGGER.debug("Unable to unzip zip file '{}'", dependency.getFilePath(), ex); -505 } finally { -506 ZipFile.closeQuietly(zip); -507 } -508 -509 return isJar; -510 } -511 } +371 } catch (IOException ex) { +372 LOGGER.warn("Exception reading archive '{}'.", archive.getName()); +373 LOGGER.debug("", ex); +374 } finally { +375 close(fis); +376 } +377 } +378 } +379 +380 /** +381 * Extracts files from an archive. +382 * +383 * @param input the archive to extract files from +384 * @param destination the location to write the files too +385 * @param engine the dependency-check engine +386 * @throws ArchiveExtractionException thrown if there is an exception extracting files from the archive +387 */ +388 private void extractArchive(ArchiveInputStream input, File destination, Engine engine) throws ArchiveExtractionException { +389 ArchiveEntry entry; +390 try { +391 while ((entry = input.getNextEntry()) != null) { +392 final File file = new File(destination, entry.getName()); +393 if (entry.isDirectory()) { +394 if (!file.exists() && !file.mkdirs()) { +395 final String msg = String.format("Unable to create directory '%s'.", file.getAbsolutePath()); +396 throw new AnalysisException(msg); +397 } +398 } else if (engine.accept(file)) { +399 extractAcceptedFile(input, file); +400 } +401 } +402 } catch (Throwable ex) { +403 throw new ArchiveExtractionException(ex); +404 } finally { +405 close(input); +406 } +407 } +408 +409 /** +410 * Extracts a file from an archive. +411 * +412 * @param input the archives input stream +413 * @param file the file to extract +414 * @throws AnalysisException thrown if there is an error +415 */ +416 private static void extractAcceptedFile(ArchiveInputStream input, File file) throws AnalysisException { +417 LOGGER.debug("Extracting '{}'", file.getPath()); +418 FileOutputStream fos = null; +419 try { +420 final File parent = file.getParentFile(); +421 if (!parent.isDirectory() && !parent.mkdirs()) { +422 final String msg = String.format("Unable to build directory '%s'.", parent.getAbsolutePath()); +423 throw new AnalysisException(msg); +424 } +425 fos = new FileOutputStream(file); +426 IOUtils.copy(input, fos); +427 } catch (FileNotFoundException ex) { +428 LOGGER.debug("", ex); +429 final String msg = String.format("Unable to find file '%s'.", file.getName()); +430 throw new AnalysisException(msg, ex); +431 } catch (IOException ex) { +432 LOGGER.debug("", ex); +433 final String msg = String.format("IO Exception while parsing file '%s'.", file.getName()); +434 throw new AnalysisException(msg, ex); +435 } finally { +436 close(fos); +437 } +438 } +439 +440 /** +441 * Decompresses a file. +442 * +443 * @param inputStream the compressed file +444 * @param outputFile the location to write the decompressed file +445 * @throws ArchiveExtractionException thrown if there is an exception decompressing the file +446 */ +447 private void decompressFile(CompressorInputStream inputStream, File outputFile) throws ArchiveExtractionException { +448 LOGGER.debug("Decompressing '{}'", outputFile.getPath()); +449 FileOutputStream out = null; +450 try { +451 out = new FileOutputStream(outputFile); +452 IOUtils.copy(inputStream, out); +453 } catch (FileNotFoundException ex) { +454 LOGGER.debug("", ex); +455 throw new ArchiveExtractionException(ex); +456 } catch (IOException ex) { +457 LOGGER.debug("", ex); +458 throw new ArchiveExtractionException(ex); +459 } finally { +460 close(out); +461 } +462 } +463 +464 /** +465 * Close the given {@link Closeable} instance, ignoring nulls, and logging any thrown {@link IOException}. +466 * +467 * @param closeable to be closed +468 */ +469 private static void close(Closeable closeable) { +470 if (null != closeable) { +471 try { +472 closeable.close(); +473 } catch (IOException ex) { +474 LOGGER.trace("", ex); +475 } +476 } +477 } +478 +479 /** +480 * Attempts to determine if a zip file is actually a JAR file. +481 * +482 * @param dependency the dependency to check +483 * @return true if the dependency appears to be a JAR file; otherwise false +484 */ +485 private boolean isZipFileActuallyJarFile(Dependency dependency) { +486 boolean isJar = false; +487 ZipFile zip = null; +488 try { +489 zip = new ZipFile(dependency.getActualFilePath()); +490 if (zip.getEntry("META-INF/MANIFEST.MF") != null +491 || zip.getEntry("META-INF/maven") != null) { +492 final Enumeration<ZipArchiveEntry> entries = zip.getEntries(); +493 while (entries.hasMoreElements()) { +494 final ZipArchiveEntry entry = entries.nextElement(); +495 if (!entry.isDirectory()) { +496 final String name = entry.getName().toLowerCase(); +497 if (name.endsWith(".class")) { +498 isJar = true; +499 break; +500 } +501 } +502 } +503 } +504 } catch (IOException ex) { +505 LOGGER.debug("Unable to unzip zip file '{}'", dependency.getFilePath(), ex); +506 } finally { +507 ZipFile.closeQuietly(zip); +508 } +509 +510 return isJar; +511 } +512 }
        diff --git a/xref/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.html index de7540863..7806b1b25 100644 --- a/xref/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.html @@ -25,13 +25,13 @@ 17 */ 18 package org.owasp.dependencycheck.analyzer; 19 -20 import java.io.BufferedReader; -21 import java.io.File; -22 import java.io.FileFilter; -23 import java.io.FileOutputStream; -24 import java.io.IOException; -25 import java.io.InputStream; -26 import java.io.InputStreamReader; +20 import java.io.File; +21 import java.io.FileFilter; +22 import java.io.FileOutputStream; +23 import java.io.IOException; +24 import java.io.InputStream; +25 import org.apache.commons.io.IOUtils; +26 import org.apache.commons.io.output.NullOutputStream; 27 import org.owasp.dependencycheck.Engine; 28 import org.owasp.dependencycheck.analyzer.exception.AnalysisException; 29 import org.owasp.dependencycheck.dependency.Confidence; @@ -123,224 +123,198 @@ 115 final List<String> args = buildArgumentList(); 116 args.add(dependency.getActualFilePath()); 117 final ProcessBuilder pb = new ProcessBuilder(args); -118 BufferedReader rdr = null; -119 Document doc = null; -120 try { -121 final Process proc = pb.start(); -122 // Try evacuating the error stream -123 rdr = new BufferedReader(new InputStreamReader(proc.getErrorStream(), "UTF-8")); -124 String line = null; -125 // CHECKSTYLE:OFF -126 while (rdr.ready() && (line = rdr.readLine()) != null) { -127 LOGGER.warn("Error from GrokAssembly: {}", line); +118 Document doc = null; +119 try { +120 final Process proc = pb.start(); +121 +122 doc = builder.parse(proc.getInputStream()); +123 +124 // Try evacuating the error stream +125 final String errorStream = IOUtils.toString(proc.getErrorStream(), "UTF-8"); +126 if (null != errorStream && !errorStream.isEmpty()) { +127 LOGGER.warn("Error from GrokAssembly: {}", errorStream); 128 } -129 // CHECKSTYLE:ON +129 130 int rc = 0; -131 doc = builder.parse(proc.getInputStream()); -132 -133 try { -134 rc = proc.waitFor(); -135 } catch (InterruptedException ie) { -136 return; -137 } -138 if (rc == 3) { -139 LOGGER.debug("{} is not a .NET assembly or executable and as such cannot be analyzed by dependency-check", -140 dependency.getActualFilePath()); -141 return; -142 } else if (rc != 0) { -143 LOGGER.warn("Return code {} from GrokAssembly", rc); -144 } +131 try { +132 rc = proc.waitFor(); +133 } catch (InterruptedException ie) { +134 return; +135 } +136 if (rc == 3) { +137 LOGGER.debug("{} is not a .NET assembly or executable and as such cannot be analyzed by dependency-check", +138 dependency.getActualFilePath()); +139 return; +140 } else if (rc != 0) { +141 LOGGER.warn("Return code {} from GrokAssembly", rc); +142 } +143 +144 final XPath xpath = XPathFactory.newInstance().newXPath(); 145 -146 final XPath xpath = XPathFactory.newInstance().newXPath(); -147 -148 // First, see if there was an error -149 final String error = xpath.evaluate("/assembly/error", doc); -150 if (error != null && !error.isEmpty()) { -151 throw new AnalysisException(error); -152 } -153 -154 final String version = xpath.evaluate("/assembly/version", doc); -155 if (version != null) { -156 dependency.getVersionEvidence().addEvidence(new Evidence("grokassembly", "version", -157 version, Confidence.HIGHEST)); -158 } -159 -160 final String vendor = xpath.evaluate("/assembly/company", doc); -161 if (vendor != null) { -162 dependency.getVendorEvidence().addEvidence(new Evidence("grokassembly", "vendor", -163 vendor, Confidence.HIGH)); -164 } -165 -166 final String product = xpath.evaluate("/assembly/product", doc); -167 if (product != null) { -168 dependency.getProductEvidence().addEvidence(new Evidence("grokassembly", "product", -169 product, Confidence.HIGH)); -170 } -171 -172 } catch (IOException ioe) { -173 throw new AnalysisException(ioe); -174 } catch (SAXException saxe) { -175 throw new AnalysisException("Couldn't parse GrokAssembly result", saxe); -176 } catch (XPathExpressionException xpe) { -177 // This shouldn't happen -178 throw new AnalysisException(xpe); -179 } finally { -180 if (rdr != null) { -181 try { -182 rdr.close(); -183 } catch (IOException ex) { -184 LOGGER.debug("ignore", ex); -185 } -186 } -187 } -188 } -189 -190 /** -191 * Initialize the analyzer. In this case, extract GrokAssembly.exe to a temporary location. -192 * -193 * @throws Exception if anything goes wrong -194 */ -195 @Override -196 public void initializeFileTypeAnalyzer() throws Exception { -197 final File tempFile = File.createTempFile("GKA", ".exe", Settings.getTempDirectory()); -198 FileOutputStream fos = null; -199 InputStream is = null; -200 try { -201 fos = new FileOutputStream(tempFile); -202 is = AssemblyAnalyzer.class.getClassLoader().getResourceAsStream("GrokAssembly.exe"); -203 final byte[] buff = new byte[4096]; -204 int bread = -1; -205 while ((bread = is.read(buff)) >= 0) { -206 fos.write(buff, 0, bread); -207 } -208 grokAssemblyExe = tempFile; -209 // Set the temp file to get deleted when we're done -210 grokAssemblyExe.deleteOnExit(); -211 LOGGER.debug("Extracted GrokAssembly.exe to {}", grokAssemblyExe.getPath()); -212 } catch (IOException ioe) { -213 this.setEnabled(false); -214 LOGGER.warn("Could not extract GrokAssembly.exe: {}", ioe.getMessage()); -215 throw new AnalysisException("Could not extract GrokAssembly.exe", ioe); -216 } finally { -217 if (fos != null) { -218 try { -219 fos.close(); -220 } catch (Throwable e) { -221 LOGGER.debug("Error closing output stream"); -222 } -223 } -224 if (is != null) { -225 try { -226 is.close(); -227 } catch (Throwable e) { -228 LOGGER.debug("Error closing input stream"); -229 } -230 } -231 } -232 -233 // Now, need to see if GrokAssembly actually runs from this location. -234 final List<String> args = buildArgumentList(); -235 BufferedReader rdr = null; -236 try { -237 final ProcessBuilder pb = new ProcessBuilder(args); -238 final Process p = pb.start(); -239 // Try evacuating the error stream -240 rdr = new BufferedReader(new InputStreamReader(p.getErrorStream(), "UTF-8")); -241 // CHECKSTYLE:OFF -242 while (rdr.ready() && rdr.readLine() != null) { -243 // We expect this to complain -244 } -245 // CHECKSTYLE:ON -246 final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(p.getInputStream()); -247 final XPath xpath = XPathFactory.newInstance().newXPath(); -248 final String error = xpath.evaluate("/assembly/error", doc); -249 if (p.waitFor() != 1 || error == null || error.isEmpty()) { -250 LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer, please see the log for more details."); -251 LOGGER.debug("GrokAssembly.exe is not working properly"); -252 grokAssemblyExe = null; -253 this.setEnabled(false); -254 throw new AnalysisException("Could not execute .NET AssemblyAnalyzer"); -255 } -256 } catch (Throwable e) { -257 if (e instanceof AnalysisException) { -258 throw (AnalysisException) e; -259 } else { -260 LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer;\n" -261 + "this can be ignored unless you are scanning .NET DLLs. Please see the log for more details."); -262 LOGGER.debug("Could not execute GrokAssembly {}", e.getMessage()); -263 this.setEnabled(false); -264 throw new AnalysisException("An error occured with the .NET AssemblyAnalyzer", e); -265 } -266 } finally { -267 if (rdr != null) { -268 try { -269 rdr.close(); -270 } catch (IOException ex) { -271 LOGGER.trace("ignore", ex); -272 } -273 } -274 } -275 builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); -276 } -277 -278 /** -279 * Removes resources used from the local file system. -280 * -281 * @throws Exception thrown if there is a problem closing the analyzer -282 */ -283 @Override -284 public void close() throws Exception { -285 super.close(); -286 try { -287 if (grokAssemblyExe != null && !grokAssemblyExe.delete()) { -288 grokAssemblyExe.deleteOnExit(); -289 } -290 } catch (SecurityException se) { -291 LOGGER.debug("Can't delete temporary GrokAssembly.exe"); -292 } -293 } -294 -295 /** -296 * The File Filter used to filter supported extensions. -297 */ -298 private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions( -299 SUPPORTED_EXTENSIONS).build(); -300 -301 @Override -302 protected FileFilter getFileFilter() { -303 return FILTER; -304 } -305 -306 /** -307 * Gets this analyzer's name. -308 * -309 * @return the analyzer name -310 */ -311 @Override -312 public String getName() { -313 return ANALYZER_NAME; -314 } -315 -316 /** -317 * Returns the phase this analyzer runs under. -318 * -319 * @return the phase this runs under -320 */ -321 @Override -322 public AnalysisPhase getAnalysisPhase() { -323 return ANALYSIS_PHASE; -324 } -325 -326 /** -327 * Returns the key used in the properties file to reference the analyzer's enabled property. -328 * -329 * @return the analyzer's enabled property setting key -330 */ -331 @Override -332 protected String getAnalyzerEnabledSettingKey() { -333 return Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED; -334 } -335 } +146 // First, see if there was an error +147 final String error = xpath.evaluate("/assembly/error", doc); +148 if (error != null && !error.isEmpty()) { +149 throw new AnalysisException(error); +150 } +151 +152 final String version = xpath.evaluate("/assembly/version", doc); +153 if (version != null) { +154 dependency.getVersionEvidence().addEvidence(new Evidence("grokassembly", "version", +155 version, Confidence.HIGHEST)); +156 } +157 +158 final String vendor = xpath.evaluate("/assembly/company", doc); +159 if (vendor != null) { +160 dependency.getVendorEvidence().addEvidence(new Evidence("grokassembly", "vendor", +161 vendor, Confidence.HIGH)); +162 } +163 +164 final String product = xpath.evaluate("/assembly/product", doc); +165 if (product != null) { +166 dependency.getProductEvidence().addEvidence(new Evidence("grokassembly", "product", +167 product, Confidence.HIGH)); +168 } +169 +170 } catch (IOException ioe) { +171 throw new AnalysisException(ioe); +172 } catch (SAXException saxe) { +173 throw new AnalysisException("Couldn't parse GrokAssembly result", saxe); +174 } catch (XPathExpressionException xpe) { +175 // This shouldn't happen +176 throw new AnalysisException(xpe); +177 } +178 } +179 +180 /** +181 * Initialize the analyzer. In this case, extract GrokAssembly.exe to a temporary location. +182 * +183 * @throws Exception if anything goes wrong +184 */ +185 @Override +186 public void initializeFileTypeAnalyzer() throws Exception { +187 final File tempFile = File.createTempFile("GKA", ".exe", Settings.getTempDirectory()); +188 FileOutputStream fos = null; +189 InputStream is = null; +190 try { +191 fos = new FileOutputStream(tempFile); +192 is = AssemblyAnalyzer.class.getClassLoader().getResourceAsStream("GrokAssembly.exe"); +193 IOUtils.copy(is, fos); +194 +195 grokAssemblyExe = tempFile; +196 // Set the temp file to get deleted when we're done +197 grokAssemblyExe.deleteOnExit(); +198 LOGGER.debug("Extracted GrokAssembly.exe to {}", grokAssemblyExe.getPath()); +199 } catch (IOException ioe) { +200 this.setEnabled(false); +201 LOGGER.warn("Could not extract GrokAssembly.exe: {}", ioe.getMessage()); +202 throw new AnalysisException("Could not extract GrokAssembly.exe", ioe); +203 } finally { +204 if (fos != null) { +205 try { +206 fos.close(); +207 } catch (Throwable e) { +208 LOGGER.debug("Error closing output stream"); +209 } +210 } +211 if (is != null) { +212 try { +213 is.close(); +214 } catch (Throwable e) { +215 LOGGER.debug("Error closing input stream"); +216 } +217 } +218 } +219 +220 // Now, need to see if GrokAssembly actually runs from this location. +221 final List<String> args = buildArgumentList(); +222 try { +223 final ProcessBuilder pb = new ProcessBuilder(args); +224 final Process p = pb.start(); +225 // Try evacuating the error stream +226 IOUtils.copy(p.getErrorStream(), NullOutputStream.NULL_OUTPUT_STREAM); +227 +228 final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(p.getInputStream()); +229 final XPath xpath = XPathFactory.newInstance().newXPath(); +230 final String error = xpath.evaluate("/assembly/error", doc); +231 if (p.waitFor() != 1 || error == null || error.isEmpty()) { +232 LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer, please see the log for more details."); +233 LOGGER.debug("GrokAssembly.exe is not working properly"); +234 grokAssemblyExe = null; +235 this.setEnabled(false); +236 throw new AnalysisException("Could not execute .NET AssemblyAnalyzer"); +237 } +238 } catch (Throwable e) { +239 if (e instanceof AnalysisException) { +240 throw (AnalysisException) e; +241 } else { +242 LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer;\n" +243 + "this can be ignored unless you are scanning .NET DLLs. Please see the log for more details."); +244 LOGGER.debug("Could not execute GrokAssembly {}", e.getMessage()); +245 this.setEnabled(false); +246 throw new AnalysisException("An error occured with the .NET AssemblyAnalyzer", e); +247 } +248 } +249 builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); +250 } +251 +252 /** +253 * Removes resources used from the local file system. +254 * +255 * @throws Exception thrown if there is a problem closing the analyzer +256 */ +257 @Override +258 public void close() throws Exception { +259 super.close(); +260 try { +261 if (grokAssemblyExe != null && !grokAssemblyExe.delete()) { +262 grokAssemblyExe.deleteOnExit(); +263 } +264 } catch (SecurityException se) { +265 LOGGER.debug("Can't delete temporary GrokAssembly.exe"); +266 } +267 } +268 +269 /** +270 * The File Filter used to filter supported extensions. +271 */ +272 private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions( +273 SUPPORTED_EXTENSIONS).build(); +274 +275 @Override +276 protected FileFilter getFileFilter() { +277 return FILTER; +278 } +279 +280 /** +281 * Gets this analyzer's name. +282 * +283 * @return the analyzer name +284 */ +285 @Override +286 public String getName() { +287 return ANALYZER_NAME; +288 } +289 +290 /** +291 * Returns the phase this analyzer runs under. +292 * +293 * @return the phase this runs under +294 */ +295 @Override +296 public AnalysisPhase getAnalysisPhase() { +297 return ANALYSIS_PHASE; +298 } +299 +300 /** +301 * Returns the key used in the properties file to reference the analyzer's enabled property. +302 * +303 * @return the analyzer's enabled property setting key +304 */ +305 @Override +306 protected String getAnalyzerEnabledSettingKey() { +307 return Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED; +308 } +309 }
        diff --git a/xref/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.html index 879698ad8..8b3632ace 100644 --- a/xref/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.html @@ -70,157 +70,174 @@ 62 private static final int REGEX_OPTIONS = Pattern.DOTALL 63 | Pattern.CASE_INSENSITIVE | Pattern.MULTILINE; 64 -65 private static final Pattern PROJECT = Pattern.compile( -66 "^ *project *\\([ \\n]*(\\w+)[ \\n]*.*?\\)", REGEX_OPTIONS); -67 -68 // Group 1: Product -69 // Group 2: Version -70 private static final Pattern SET_VERSION = Pattern -71 .compile( -72 "^ *set\\s*\\(\\s*(\\w+)_version\\s+\"?(\\d+(?:\\.\\d+)+)[\\s\"]?\\)", -73 REGEX_OPTIONS); -74 -75 /** -76 * Detects files that can be analyzed. +65 /** +66 * Regex to extract the product information. +67 */ +68 private static final Pattern PROJECT = Pattern.compile( +69 "^ *project *\\([ \\n]*(\\w+)[ \\n]*.*?\\)", REGEX_OPTIONS); +70 +71 /** +72 * Regex to extract product and version information. +73 * +74 * Group 1: Product +75 * +76 * Group 2: Version 77 */ -78 private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions(".cmake") -79 .addFilenames("CMakeLists.txt").build(); -80 -81 /** -82 * A reference to SHA1 message digest. -83 */ -84 private static MessageDigest sha1 = null; -85 -86 static { -87 try { -88 sha1 = MessageDigest.getInstance("SHA1"); -89 } catch (NoSuchAlgorithmException e) { -90 LOGGER.error(e.getMessage()); -91 } -92 } +78 private static final Pattern SET_VERSION = Pattern +79 .compile( +80 "^ *set\\s*\\(\\s*(\\w+)_version\\s+\"?(\\d+(?:\\.\\d+)+)[\\s\"]?\\)", +81 REGEX_OPTIONS); +82 +83 /** +84 * Detects files that can be analyzed. +85 */ +86 private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions(".cmake") +87 .addFilenames("CMakeLists.txt").build(); +88 +89 /** +90 * A reference to SHA1 message digest. +91 */ +92 private static MessageDigest sha1 = null; 93 -94 /** -95 * Returns the name of the CMake analyzer. -96 * -97 * @return the name of the analyzer -98 * -99 */ -100 @Override -101 public String getName() { -102 return "CMake Analyzer"; -103 } -104 -105 /** -106 * Tell that we are used for information collection. -107 * -108 * @return INFORMATION_COLLECTION -109 */ -110 @Override -111 public AnalysisPhase getAnalysisPhase() { -112 return AnalysisPhase.INFORMATION_COLLECTION; -113 } -114 -115 /** -116 * Returns the set of supported file extensions. -117 * -118 * @return the set of supported file extensions -119 */ -120 @Override -121 protected FileFilter getFileFilter() { -122 return FILTER; -123 } -124 -125 /** -126 * No-op initializer implementation. -127 * -128 * @throws Exception never thrown -129 */ -130 @Override -131 protected void initializeFileTypeAnalyzer() throws Exception { -132 // Nothing to do here. -133 } -134 -135 /** -136 * Analyzes python packages and adds evidence to the dependency. -137 * -138 * @param dependency the dependency being analyzed -139 * @param engine the engine being used to perform the scan -140 * @throws AnalysisException thrown if there is an unrecoverable error analyzing the dependency -141 */ -142 @Override -143 protected void analyzeFileType(Dependency dependency, Engine engine) -144 throws AnalysisException { -145 final File file = dependency.getActualFile(); -146 final String parentName = file.getParentFile().getName(); -147 final String name = file.getName(); -148 dependency.setDisplayFileName(String.format("%s%c%s", parentName, File.separatorChar, name)); -149 String contents; -150 try { -151 contents = FileUtils.readFileToString(file).trim(); -152 } catch (IOException e) { -153 throw new AnalysisException( -154 "Problem occurred while reading dependency file.", e); -155 } -156 -157 if (StringUtils.isNotBlank(contents)) { -158 final Matcher m = PROJECT.matcher(contents); -159 int count = 0; -160 while (m.find()) { -161 count++; -162 LOGGER.debug(String.format( -163 "Found project command match with %d groups: %s", -164 m.groupCount(), m.group(0))); -165 final String group = m.group(1); -166 LOGGER.debug("Group 1: " + group); -167 dependency.getProductEvidence().addEvidence(name, "Project", -168 group, Confidence.HIGH); -169 } -170 LOGGER.debug("Found {} matches.", count); -171 analyzeSetVersionCommand(dependency, engine, contents); -172 } -173 } -174 -175 private void analyzeSetVersionCommand(Dependency dependency, Engine engine, String contents) { -176 final Dependency orig = dependency; -177 final Matcher m = SET_VERSION.matcher(contents); -178 int count = 0; -179 while (m.find()) { -180 count++; -181 LOGGER.debug("Found project command match with {} groups: {}", -182 m.groupCount(), m.group(0)); -183 String product = m.group(1); -184 final String version = m.group(2); -185 LOGGER.debug("Group 1: " + product); -186 LOGGER.debug("Group 2: " + version); -187 final String aliasPrefix = "ALIASOF_"; -188 if (product.startsWith(aliasPrefix)) { -189 product = product.replaceFirst(aliasPrefix, ""); -190 } -191 if (count > 1) { -192 //TODO - refactor so we do not assign to the parameter (checkstyle) -193 dependency = new Dependency(orig.getActualFile()); -194 dependency.setDisplayFileName(String.format("%s:%s", orig.getDisplayFileName(), product)); -195 final String filePath = String.format("%s:%s", orig.getFilePath(), product); -196 dependency.setFilePath(filePath); -197 -198 // prevents coalescing into the dependency provided by engine -199 dependency.setSha1sum(Checksum.getHex(sha1.digest(filePath.getBytes()))); -200 engine.getDependencies().add(dependency); -201 } -202 final String source = dependency.getDisplayFileName(); -203 dependency.getProductEvidence().addEvidence(source, "Product", -204 product, Confidence.MEDIUM); -205 dependency.getVersionEvidence().addEvidence(source, "Version", -206 version, Confidence.MEDIUM); -207 } -208 LOGGER.debug(String.format("Found %d matches.", count)); -209 } -210 -211 @Override -212 protected String getAnalyzerEnabledSettingKey() { -213 return Settings.KEYS.ANALYZER_CMAKE_ENABLED; -214 } -215 } +94 static { +95 try { +96 sha1 = MessageDigest.getInstance("SHA1"); +97 } catch (NoSuchAlgorithmException e) { +98 LOGGER.error(e.getMessage()); +99 } +100 } +101 +102 /** +103 * Returns the name of the CMake analyzer. +104 * +105 * @return the name of the analyzer +106 * +107 */ +108 @Override +109 public String getName() { +110 return "CMake Analyzer"; +111 } +112 +113 /** +114 * Tell that we are used for information collection. +115 * +116 * @return INFORMATION_COLLECTION +117 */ +118 @Override +119 public AnalysisPhase getAnalysisPhase() { +120 return AnalysisPhase.INFORMATION_COLLECTION; +121 } +122 +123 /** +124 * Returns the set of supported file extensions. +125 * +126 * @return the set of supported file extensions +127 */ +128 @Override +129 protected FileFilter getFileFilter() { +130 return FILTER; +131 } +132 +133 /** +134 * No-op initializer implementation. +135 * +136 * @throws Exception never thrown +137 */ +138 @Override +139 protected void initializeFileTypeAnalyzer() throws Exception { +140 // Nothing to do here. +141 } +142 +143 /** +144 * Analyzes python packages and adds evidence to the dependency. +145 * +146 * @param dependency the dependency being analyzed +147 * @param engine the engine being used to perform the scan +148 * @throws AnalysisException thrown if there is an unrecoverable error analyzing the dependency +149 */ +150 @Override +151 protected void analyzeFileType(Dependency dependency, Engine engine) +152 throws AnalysisException { +153 final File file = dependency.getActualFile(); +154 final String parentName = file.getParentFile().getName(); +155 final String name = file.getName(); +156 dependency.setDisplayFileName(String.format("%s%c%s", parentName, File.separatorChar, name)); +157 String contents; +158 try { +159 contents = FileUtils.readFileToString(file).trim(); +160 } catch (IOException e) { +161 throw new AnalysisException( +162 "Problem occurred while reading dependency file.", e); +163 } +164 +165 if (StringUtils.isNotBlank(contents)) { +166 final Matcher m = PROJECT.matcher(contents); +167 int count = 0; +168 while (m.find()) { +169 count++; +170 LOGGER.debug(String.format( +171 "Found project command match with %d groups: %s", +172 m.groupCount(), m.group(0))); +173 final String group = m.group(1); +174 LOGGER.debug("Group 1: " + group); +175 dependency.getProductEvidence().addEvidence(name, "Project", +176 group, Confidence.HIGH); +177 } +178 LOGGER.debug("Found {} matches.", count); +179 analyzeSetVersionCommand(dependency, engine, contents); +180 } +181 } +182 +183 /** +184 * Extracts the version information from the contents. If more then one version is found additional dependencies are added to +185 * the dependency list. +186 * +187 * @param dependency the dependency being analyzed +188 * @param engine the dependency-check engine +189 * @param contents the version information +190 */ +191 private void analyzeSetVersionCommand(Dependency dependency, Engine engine, String contents) { +192 Dependency currentDep = dependency; +193 +194 final Matcher m = SET_VERSION.matcher(contents); +195 int count = 0; +196 while (m.find()) { +197 count++; +198 LOGGER.debug("Found project command match with {} groups: {}", +199 m.groupCount(), m.group(0)); +200 String product = m.group(1); +201 final String version = m.group(2); +202 LOGGER.debug("Group 1: " + product); +203 LOGGER.debug("Group 2: " + version); +204 final String aliasPrefix = "ALIASOF_"; +205 if (product.startsWith(aliasPrefix)) { +206 product = product.replaceFirst(aliasPrefix, ""); +207 } +208 if (count > 1) { +209 //TODO - refactor so we do not assign to the parameter (checkstyle) +210 currentDep = new Dependency(dependency.getActualFile()); +211 currentDep.setDisplayFileName(String.format("%s:%s", dependency.getDisplayFileName(), product)); +212 final String filePath = String.format("%s:%s", dependency.getFilePath(), product); +213 currentDep.setFilePath(filePath); +214 +215 // prevents coalescing into the dependency provided by engine +216 currentDep.setSha1sum(Checksum.getHex(sha1.digest(filePath.getBytes()))); +217 engine.getDependencies().add(currentDep); +218 } +219 final String source = currentDep.getDisplayFileName(); +220 currentDep.getProductEvidence().addEvidence(source, "Product", +221 product, Confidence.MEDIUM); +222 currentDep.getVersionEvidence().addEvidence(source, "Version", +223 version, Confidence.MEDIUM); +224 } +225 LOGGER.debug(String.format("Found %d matches.", count)); +226 } +227 +228 @Override +229 protected String getAnalyzerEnabledSettingKey() { +230 return Settings.KEYS.ANALYZER_CMAKE_ENABLED; +231 } +232 }
        diff --git a/xref/org/owasp/dependencycheck/analyzer/CPEAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/CPEAnalyzer.html index f2de7ed0f..a248eb73b 100644 --- a/xref/org/owasp/dependencycheck/analyzer/CPEAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/CPEAnalyzer.html @@ -343,7 +343,7 @@ 335 * @return if the append was successful. 336 */ 337 private boolean appendWeightedSearch(StringBuilder sb, String field, String searchText, Set<String> weightedText) { -338 sb.append(" ").append(field).append(":( "); +338 sb.append(' ').append(field).append(":( "); 339 340 final String cleanText = cleanseText(searchText); 341 @@ -357,419 +357,426 @@ 349 final StringTokenizer tokens = new StringTokenizer(cleanText); 350 while (tokens.hasMoreElements()) { 351 final String word = tokens.nextToken(); -352 String temp = null; +352 StringBuilder temp = null; 353 for (String weighted : weightedText) { 354 final String weightedStr = cleanseText(weighted); 355 if (equalsIgnoreCaseAndNonAlpha(word, weightedStr)) { -356 temp = LuceneUtils.escapeLuceneQuery(word) + WEIGHTING_BOOST; -357 if (!word.equalsIgnoreCase(weightedStr)) { -358 temp += " " + LuceneUtils.escapeLuceneQuery(weightedStr) + WEIGHTING_BOOST; -359 } -360 } -361 } -362 if (temp == null) { -363 temp = LuceneUtils.escapeLuceneQuery(word); -364 } -365 sb.append(" ").append(temp); -366 } -367 } -368 sb.append(" ) "); -369 return true; -370 } -371 -372 /** -373 * Removes characters from the input text that are not used within the CPE index. -374 * -375 * @param text is the text to remove the characters from. -376 * @return the text having removed some characters. -377 */ -378 private String cleanseText(String text) { -379 return text.replaceAll(CLEANSE_CHARACTER_RX, " "); -380 } -381 -382 /** -383 * Compares two strings after lower casing them and removing the non-alpha characters. -384 * -385 * @param l string one to compare. -386 * @param r string two to compare. -387 * @return whether or not the two strings are similar. -388 */ -389 private boolean equalsIgnoreCaseAndNonAlpha(String l, String r) { -390 if (l == null || r == null) { -391 return false; -392 } -393 -394 final String left = l.replaceAll(CLEANSE_NONALPHA_RX, ""); -395 final String right = r.replaceAll(CLEANSE_NONALPHA_RX, ""); -396 return left.equalsIgnoreCase(right); -397 } -398 -399 /** -400 * Ensures that the CPE Identified matches the dependency. This validates that the product, vendor, and version information -401 * for the CPE are contained within the dependencies evidence. -402 * -403 * @param entry a CPE entry. -404 * @param dependency the dependency that the CPE entries could be for. -405 * @return whether or not the entry is valid. -406 */ -407 private boolean verifyEntry(final IndexEntry entry, final Dependency dependency) { -408 boolean isValid = false; -409 -410 //TODO - does this nullify some of the fuzzy matching that happens in the lucene search? -411 // for instance CPE some-component and in the evidence we have SomeComponent. -412 if (collectionContainsString(dependency.getProductEvidence(), entry.getProduct()) -413 && collectionContainsString(dependency.getVendorEvidence(), entry.getVendor())) { -414 //&& collectionContainsVersion(dependency.getVersionEvidence(), entry.getVersion()) -415 isValid = true; -416 } -417 return isValid; -418 } -419 -420 /** -421 * Used to determine if the EvidenceCollection contains a specific string. -422 * -423 * @param ec an EvidenceCollection -424 * @param text the text to search for -425 * @return whether or not the EvidenceCollection contains the string -426 */ -427 private boolean collectionContainsString(EvidenceCollection ec, String text) { -428 //TODO - likely need to change the split... not sure if this will work for CPE with special chars -429 if (text == null) { -430 return false; -431 } -432 final String[] words = text.split("[\\s_-]"); -433 final List<String> list = new ArrayList<String>(); -434 String tempWord = null; -435 for (String word : words) { -436 /* -437 single letter words should be concatenated with the next word. -438 so { "m", "core", "sample" } -> { "mcore", "sample" } -439 */ -440 if (tempWord != null) { -441 list.add(tempWord + word); -442 tempWord = null; -443 } else if (word.length() <= 2) { -444 tempWord = word; -445 } else { -446 list.add(word); -447 } -448 } -449 if (tempWord != null) { -450 if (!list.isEmpty()) { -451 final String tmp = list.get(list.size() - 1) + tempWord; -452 list.add(tmp); -453 } else { -454 list.add(tempWord); -455 } -456 } -457 if (list.isEmpty()) { -458 return false; -459 } -460 boolean contains = true; -461 for (String word : list) { -462 contains &= ec.containsUsedString(word); +356 temp = new StringBuilder(word.length() + 2); +357 LuceneUtils.appendEscapedLuceneQuery(temp, word); +358 temp.append(WEIGHTING_BOOST); +359 if (!word.equalsIgnoreCase(weightedStr)) { +360 temp.append(' '); +361 LuceneUtils.appendEscapedLuceneQuery(temp, weightedStr); +362 temp.append(WEIGHTING_BOOST); +363 } +364 break; +365 } +366 } +367 sb.append(' '); +368 if (temp == null) { +369 LuceneUtils.appendEscapedLuceneQuery(sb, word); +370 } else { +371 sb.append(temp); +372 } +373 } +374 } +375 sb.append(" ) "); +376 return true; +377 } +378 +379 /** +380 * Removes characters from the input text that are not used within the CPE index. +381 * +382 * @param text is the text to remove the characters from. +383 * @return the text having removed some characters. +384 */ +385 private String cleanseText(String text) { +386 return text.replaceAll(CLEANSE_CHARACTER_RX, " "); +387 } +388 +389 /** +390 * Compares two strings after lower casing them and removing the non-alpha characters. +391 * +392 * @param l string one to compare. +393 * @param r string two to compare. +394 * @return whether or not the two strings are similar. +395 */ +396 private boolean equalsIgnoreCaseAndNonAlpha(String l, String r) { +397 if (l == null || r == null) { +398 return false; +399 } +400 +401 final String left = l.replaceAll(CLEANSE_NONALPHA_RX, ""); +402 final String right = r.replaceAll(CLEANSE_NONALPHA_RX, ""); +403 return left.equalsIgnoreCase(right); +404 } +405 +406 /** +407 * Ensures that the CPE Identified matches the dependency. This validates that the product, vendor, and version information +408 * for the CPE are contained within the dependencies evidence. +409 * +410 * @param entry a CPE entry. +411 * @param dependency the dependency that the CPE entries could be for. +412 * @return whether or not the entry is valid. +413 */ +414 private boolean verifyEntry(final IndexEntry entry, final Dependency dependency) { +415 boolean isValid = false; +416 +417 //TODO - does this nullify some of the fuzzy matching that happens in the lucene search? +418 // for instance CPE some-component and in the evidence we have SomeComponent. +419 if (collectionContainsString(dependency.getProductEvidence(), entry.getProduct()) +420 && collectionContainsString(dependency.getVendorEvidence(), entry.getVendor())) { +421 //&& collectionContainsVersion(dependency.getVersionEvidence(), entry.getVersion()) +422 isValid = true; +423 } +424 return isValid; +425 } +426 +427 /** +428 * Used to determine if the EvidenceCollection contains a specific string. +429 * +430 * @param ec an EvidenceCollection +431 * @param text the text to search for +432 * @return whether or not the EvidenceCollection contains the string +433 */ +434 private boolean collectionContainsString(EvidenceCollection ec, String text) { +435 //TODO - likely need to change the split... not sure if this will work for CPE with special chars +436 if (text == null) { +437 return false; +438 } +439 final String[] words = text.split("[\\s_-]"); +440 final List<String> list = new ArrayList<String>(); +441 String tempWord = null; +442 for (String word : words) { +443 /* +444 single letter words should be concatenated with the next word. +445 so { "m", "core", "sample" } -> { "mcore", "sample" } +446 */ +447 if (tempWord != null) { +448 list.add(tempWord + word); +449 tempWord = null; +450 } else if (word.length() <= 2) { +451 tempWord = word; +452 } else { +453 list.add(word); +454 } +455 } +456 if (tempWord != null) { +457 if (!list.isEmpty()) { +458 final String tmp = list.get(list.size() - 1) + tempWord; +459 list.add(tmp); +460 } else { +461 list.add(tempWord); +462 } 463 } -464 return contains; -465 } -466 -467 /** -468 * Analyzes a dependency and attempts to determine if there are any CPE identifiers for this dependency. -469 * -470 * @param dependency The Dependency to analyze. -471 * @param engine The analysis engine -472 * @throws AnalysisException is thrown if there is an issue analyzing the dependency. -473 */ -474 @Override -475 public void analyze(Dependency dependency, Engine engine) throws AnalysisException { -476 try { -477 determineCPE(dependency); -478 } catch (CorruptIndexException ex) { -479 throw new AnalysisException("CPE Index is corrupt.", ex); -480 } catch (IOException ex) { -481 throw new AnalysisException("Failure opening the CPE Index.", ex); -482 } catch (ParseException ex) { -483 throw new AnalysisException("Unable to parse the generated Lucene query for this dependency.", ex); -484 } -485 } -486 -487 /** -488 * Retrieves a list of CPE values from the CveDB based on the vendor and product passed in. The list is then validated to find -489 * only CPEs that are valid for the given dependency. It is possible that the CPE identified is a best effort "guess" based on -490 * the vendor, product, and version information. -491 * -492 * @param dependency the Dependency being analyzed -493 * @param vendor the vendor for the CPE being analyzed -494 * @param product the product for the CPE being analyzed -495 * @param currentConfidence the current confidence being used during analysis -496 * @return <code>true</code> if an identifier was added to the dependency; otherwise <code>false</code> -497 * @throws UnsupportedEncodingException is thrown if UTF-8 is not supported -498 */ -499 protected boolean determineIdentifiers(Dependency dependency, String vendor, String product, -500 Confidence currentConfidence) throws UnsupportedEncodingException { -501 final Set<VulnerableSoftware> cpes = cve.getCPEs(vendor, product); -502 DependencyVersion bestGuess = new DependencyVersion("-"); -503 Confidence bestGuessConf = null; -504 boolean hasBroadMatch = false; -505 final List<IdentifierMatch> collected = new ArrayList<IdentifierMatch>(); -506 for (Confidence conf : Confidence.values()) { -507 // if (conf.compareTo(currentConfidence) > 0) { -508 // break; -509 // } -510 for (Evidence evidence : dependency.getVersionEvidence().iterator(conf)) { -511 final DependencyVersion evVer = DependencyVersionUtil.parseVersion(evidence.getValue()); -512 if (evVer == null) { -513 continue; -514 } -515 for (VulnerableSoftware vs : cpes) { -516 DependencyVersion dbVer; -517 if (vs.getUpdate() != null && !vs.getUpdate().isEmpty()) { -518 dbVer = DependencyVersionUtil.parseVersion(vs.getVersion() + "." + vs.getUpdate()); -519 } else { -520 dbVer = DependencyVersionUtil.parseVersion(vs.getVersion()); -521 } -522 if (dbVer == null) { //special case, no version specified - everything is vulnerable -523 hasBroadMatch = true; -524 final String url = String.format(NVD_SEARCH_URL, URLEncoder.encode(vs.getName(), "UTF-8")); -525 final IdentifierMatch match = new IdentifierMatch("cpe", vs.getName(), url, IdentifierConfidence.BROAD_MATCH, conf); -526 collected.add(match); -527 } else if (evVer.equals(dbVer)) { //yeah! exact match -528 final String url = String.format(NVD_SEARCH_URL, URLEncoder.encode(vs.getName(), "UTF-8")); -529 final IdentifierMatch match = new IdentifierMatch("cpe", vs.getName(), url, IdentifierConfidence.EXACT_MATCH, conf); -530 collected.add(match); -531 } else { -532 //TODO the following isn't quite right is it? need to think about this guessing game a bit more. -533 if (evVer.getVersionParts().size() <= dbVer.getVersionParts().size() -534 && evVer.matchesAtLeastThreeLevels(dbVer)) { -535 if (bestGuessConf == null || bestGuessConf.compareTo(conf) > 0) { -536 if (bestGuess.getVersionParts().size() < dbVer.getVersionParts().size()) { -537 bestGuess = dbVer; -538 bestGuessConf = conf; -539 } -540 } -541 } -542 } -543 } -544 if (bestGuessConf == null || bestGuessConf.compareTo(conf) > 0) { -545 if (bestGuess.getVersionParts().size() < evVer.getVersionParts().size()) { -546 bestGuess = evVer; -547 bestGuessConf = conf; -548 } -549 } -550 } -551 } -552 final String cpeName = String.format("cpe:/a:%s:%s:%s", vendor, product, bestGuess.toString()); -553 String url = null; -554 if (hasBroadMatch) { //if we have a broad match we can add the URL to the best guess. -555 final String cpeUrlName = String.format("cpe:/a:%s:%s", vendor, product); -556 url = String.format(NVD_SEARCH_URL, URLEncoder.encode(cpeUrlName, "UTF-8")); -557 } -558 if (bestGuessConf == null) { -559 bestGuessConf = Confidence.LOW; -560 } -561 final IdentifierMatch match = new IdentifierMatch("cpe", cpeName, url, IdentifierConfidence.BEST_GUESS, bestGuessConf); -562 collected.add(match); -563 -564 Collections.sort(collected); -565 final IdentifierConfidence bestIdentifierQuality = collected.get(0).getConfidence(); -566 final Confidence bestEvidenceQuality = collected.get(0).getEvidenceConfidence(); -567 boolean identifierAdded = false; -568 for (IdentifierMatch m : collected) { -569 if (bestIdentifierQuality.equals(m.getConfidence()) -570 && bestEvidenceQuality.equals(m.getEvidenceConfidence())) { -571 final Identifier i = m.getIdentifier(); -572 if (bestIdentifierQuality == IdentifierConfidence.BEST_GUESS) { -573 i.setConfidence(Confidence.LOW); -574 } else { -575 i.setConfidence(bestEvidenceQuality); -576 } -577 dependency.addIdentifier(i); -578 identifierAdded = true; -579 } -580 } -581 return identifierAdded; -582 } -583 -584 /** -585 * The confidence whether the identifier is an exact match, or a best guess. -586 */ -587 private enum IdentifierConfidence { -588 -589 /** -590 * An exact match for the CPE. -591 */ -592 EXACT_MATCH, -593 /** -594 * A best guess for the CPE. -595 */ -596 BEST_GUESS, -597 /** -598 * The entire vendor/product group must be added (without a guess at version) because there is a CVE with a VS that only -599 * specifies vendor/product. -600 */ -601 BROAD_MATCH -602 } -603 -604 /** -605 * A simple object to hold an identifier and carry information about the confidence in the identifier. -606 */ -607 private static class IdentifierMatch implements Comparable<IdentifierMatch> { -608 -609 /** -610 * Constructs an IdentifierMatch. -611 * -612 * @param type the type of identifier (such as CPE) -613 * @param value the value of the identifier -614 * @param url the URL of the identifier -615 * @param identifierConfidence the confidence in the identifier: best guess or exact match -616 * @param evidenceConfidence the confidence of the evidence used to find the identifier -617 */ -618 IdentifierMatch(String type, String value, String url, IdentifierConfidence identifierConfidence, Confidence evidenceConfidence) { -619 this.identifier = new Identifier(type, value, url); -620 this.confidence = identifierConfidence; -621 this.evidenceConfidence = evidenceConfidence; -622 } -623 //<editor-fold defaultstate="collapsed" desc="Property implementations: evidenceConfidence, confidence, identifier"> -624 /** -625 * The confidence in the evidence used to identify this match. -626 */ -627 private Confidence evidenceConfidence; -628 -629 /** -630 * Get the value of evidenceConfidence -631 * -632 * @return the value of evidenceConfidence +464 if (list.isEmpty()) { +465 return false; +466 } +467 boolean contains = true; +468 for (String word : list) { +469 contains &= ec.containsUsedString(word); +470 } +471 return contains; +472 } +473 +474 /** +475 * Analyzes a dependency and attempts to determine if there are any CPE identifiers for this dependency. +476 * +477 * @param dependency The Dependency to analyze. +478 * @param engine The analysis engine +479 * @throws AnalysisException is thrown if there is an issue analyzing the dependency. +480 */ +481 @Override +482 public void analyze(Dependency dependency, Engine engine) throws AnalysisException { +483 try { +484 determineCPE(dependency); +485 } catch (CorruptIndexException ex) { +486 throw new AnalysisException("CPE Index is corrupt.", ex); +487 } catch (IOException ex) { +488 throw new AnalysisException("Failure opening the CPE Index.", ex); +489 } catch (ParseException ex) { +490 throw new AnalysisException("Unable to parse the generated Lucene query for this dependency.", ex); +491 } +492 } +493 +494 /** +495 * Retrieves a list of CPE values from the CveDB based on the vendor and product passed in. The list is then validated to find +496 * only CPEs that are valid for the given dependency. It is possible that the CPE identified is a best effort "guess" based on +497 * the vendor, product, and version information. +498 * +499 * @param dependency the Dependency being analyzed +500 * @param vendor the vendor for the CPE being analyzed +501 * @param product the product for the CPE being analyzed +502 * @param currentConfidence the current confidence being used during analysis +503 * @return <code>true</code> if an identifier was added to the dependency; otherwise <code>false</code> +504 * @throws UnsupportedEncodingException is thrown if UTF-8 is not supported +505 */ +506 protected boolean determineIdentifiers(Dependency dependency, String vendor, String product, +507 Confidence currentConfidence) throws UnsupportedEncodingException { +508 final Set<VulnerableSoftware> cpes = cve.getCPEs(vendor, product); +509 DependencyVersion bestGuess = new DependencyVersion("-"); +510 Confidence bestGuessConf = null; +511 boolean hasBroadMatch = false; +512 final List<IdentifierMatch> collected = new ArrayList<IdentifierMatch>(); +513 for (Confidence conf : Confidence.values()) { +514 // if (conf.compareTo(currentConfidence) > 0) { +515 // break; +516 // } +517 for (Evidence evidence : dependency.getVersionEvidence().iterator(conf)) { +518 final DependencyVersion evVer = DependencyVersionUtil.parseVersion(evidence.getValue()); +519 if (evVer == null) { +520 continue; +521 } +522 for (VulnerableSoftware vs : cpes) { +523 DependencyVersion dbVer; +524 if (vs.getUpdate() != null && !vs.getUpdate().isEmpty()) { +525 dbVer = DependencyVersionUtil.parseVersion(vs.getVersion() + '.' + vs.getUpdate()); +526 } else { +527 dbVer = DependencyVersionUtil.parseVersion(vs.getVersion()); +528 } +529 if (dbVer == null) { //special case, no version specified - everything is vulnerable +530 hasBroadMatch = true; +531 final String url = String.format(NVD_SEARCH_URL, URLEncoder.encode(vs.getName(), "UTF-8")); +532 final IdentifierMatch match = new IdentifierMatch("cpe", vs.getName(), url, IdentifierConfidence.BROAD_MATCH, conf); +533 collected.add(match); +534 } else if (evVer.equals(dbVer)) { //yeah! exact match +535 final String url = String.format(NVD_SEARCH_URL, URLEncoder.encode(vs.getName(), "UTF-8")); +536 final IdentifierMatch match = new IdentifierMatch("cpe", vs.getName(), url, IdentifierConfidence.EXACT_MATCH, conf); +537 collected.add(match); +538 } else { +539 //TODO the following isn't quite right is it? need to think about this guessing game a bit more. +540 if (evVer.getVersionParts().size() <= dbVer.getVersionParts().size() +541 && evVer.matchesAtLeastThreeLevels(dbVer)) { +542 if (bestGuessConf == null || bestGuessConf.compareTo(conf) > 0) { +543 if (bestGuess.getVersionParts().size() < dbVer.getVersionParts().size()) { +544 bestGuess = dbVer; +545 bestGuessConf = conf; +546 } +547 } +548 } +549 } +550 } +551 if (bestGuessConf == null || bestGuessConf.compareTo(conf) > 0) { +552 if (bestGuess.getVersionParts().size() < evVer.getVersionParts().size()) { +553 bestGuess = evVer; +554 bestGuessConf = conf; +555 } +556 } +557 } +558 } +559 final String cpeName = String.format("cpe:/a:%s:%s:%s", vendor, product, bestGuess.toString()); +560 String url = null; +561 if (hasBroadMatch) { //if we have a broad match we can add the URL to the best guess. +562 final String cpeUrlName = String.format("cpe:/a:%s:%s", vendor, product); +563 url = String.format(NVD_SEARCH_URL, URLEncoder.encode(cpeUrlName, "UTF-8")); +564 } +565 if (bestGuessConf == null) { +566 bestGuessConf = Confidence.LOW; +567 } +568 final IdentifierMatch match = new IdentifierMatch("cpe", cpeName, url, IdentifierConfidence.BEST_GUESS, bestGuessConf); +569 collected.add(match); +570 +571 Collections.sort(collected); +572 final IdentifierConfidence bestIdentifierQuality = collected.get(0).getConfidence(); +573 final Confidence bestEvidenceQuality = collected.get(0).getEvidenceConfidence(); +574 boolean identifierAdded = false; +575 for (IdentifierMatch m : collected) { +576 if (bestIdentifierQuality.equals(m.getConfidence()) +577 && bestEvidenceQuality.equals(m.getEvidenceConfidence())) { +578 final Identifier i = m.getIdentifier(); +579 if (bestIdentifierQuality == IdentifierConfidence.BEST_GUESS) { +580 i.setConfidence(Confidence.LOW); +581 } else { +582 i.setConfidence(bestEvidenceQuality); +583 } +584 dependency.addIdentifier(i); +585 identifierAdded = true; +586 } +587 } +588 return identifierAdded; +589 } +590 +591 /** +592 * The confidence whether the identifier is an exact match, or a best guess. +593 */ +594 private enum IdentifierConfidence { +595 +596 /** +597 * An exact match for the CPE. +598 */ +599 EXACT_MATCH, +600 /** +601 * A best guess for the CPE. +602 */ +603 BEST_GUESS, +604 /** +605 * The entire vendor/product group must be added (without a guess at version) because there is a CVE with a VS that only +606 * specifies vendor/product. +607 */ +608 BROAD_MATCH +609 } +610 +611 /** +612 * A simple object to hold an identifier and carry information about the confidence in the identifier. +613 */ +614 private static class IdentifierMatch implements Comparable<IdentifierMatch> { +615 +616 /** +617 * Constructs an IdentifierMatch. +618 * +619 * @param type the type of identifier (such as CPE) +620 * @param value the value of the identifier +621 * @param url the URL of the identifier +622 * @param identifierConfidence the confidence in the identifier: best guess or exact match +623 * @param evidenceConfidence the confidence of the evidence used to find the identifier +624 */ +625 IdentifierMatch(String type, String value, String url, IdentifierConfidence identifierConfidence, Confidence evidenceConfidence) { +626 this.identifier = new Identifier(type, value, url); +627 this.confidence = identifierConfidence; +628 this.evidenceConfidence = evidenceConfidence; +629 } +630 //<editor-fold defaultstate="collapsed" desc="Property implementations: evidenceConfidence, confidence, identifier"> +631 /** +632 * The confidence in the evidence used to identify this match. 633 */ -634 public Confidence getEvidenceConfidence() { -635 return evidenceConfidence; -636 } -637 -638 /** -639 * Set the value of evidenceConfidence -640 * -641 * @param evidenceConfidence new value of evidenceConfidence -642 */ -643 public void setEvidenceConfidence(Confidence evidenceConfidence) { -644 this.evidenceConfidence = evidenceConfidence; -645 } -646 /** -647 * The confidence whether this is an exact match, or a best guess. -648 */ -649 private IdentifierConfidence confidence; -650 -651 /** -652 * Get the value of confidence. -653 * -654 * @return the value of confidence +634 private Confidence evidenceConfidence; +635 +636 /** +637 * Get the value of evidenceConfidence +638 * +639 * @return the value of evidenceConfidence +640 */ +641 public Confidence getEvidenceConfidence() { +642 return evidenceConfidence; +643 } +644 +645 /** +646 * Set the value of evidenceConfidence +647 * +648 * @param evidenceConfidence new value of evidenceConfidence +649 */ +650 public void setEvidenceConfidence(Confidence evidenceConfidence) { +651 this.evidenceConfidence = evidenceConfidence; +652 } +653 /** +654 * The confidence whether this is an exact match, or a best guess. 655 */ -656 public IdentifierConfidence getConfidence() { -657 return confidence; -658 } -659 -660 /** -661 * Set the value of confidence. -662 * -663 * @param confidence new value of confidence -664 */ -665 public void setConfidence(IdentifierConfidence confidence) { -666 this.confidence = confidence; -667 } -668 /** -669 * The CPE identifier. -670 */ -671 private Identifier identifier; -672 -673 /** -674 * Get the value of identifier. -675 * -676 * @return the value of identifier +656 private IdentifierConfidence confidence; +657 +658 /** +659 * Get the value of confidence. +660 * +661 * @return the value of confidence +662 */ +663 public IdentifierConfidence getConfidence() { +664 return confidence; +665 } +666 +667 /** +668 * Set the value of confidence. +669 * +670 * @param confidence new value of confidence +671 */ +672 public void setConfidence(IdentifierConfidence confidence) { +673 this.confidence = confidence; +674 } +675 /** +676 * The CPE identifier. 677 */ -678 public Identifier getIdentifier() { -679 return identifier; -680 } -681 -682 /** -683 * Set the value of identifier. -684 * -685 * @param identifier new value of identifier -686 */ -687 public void setIdentifier(Identifier identifier) { -688 this.identifier = identifier; -689 } -690 //</editor-fold> -691 //<editor-fold defaultstate="collapsed" desc="Standard implementations of toString, hashCode, and equals"> -692 -693 /** -694 * Standard toString() implementation. -695 * -696 * @return the string representation of the object -697 */ -698 @Override -699 public String toString() { -700 return "IdentifierMatch{" + "evidenceConfidence=" + evidenceConfidence -701 + ", confidence=" + confidence + ", identifier=" + identifier + '}'; -702 } -703 -704 /** -705 * Standard hashCode() implementation. -706 * -707 * @return the hashCode -708 */ -709 @Override -710 public int hashCode() { -711 int hash = 5; -712 hash = 97 * hash + (this.evidenceConfidence != null ? this.evidenceConfidence.hashCode() : 0); -713 hash = 97 * hash + (this.confidence != null ? this.confidence.hashCode() : 0); -714 hash = 97 * hash + (this.identifier != null ? this.identifier.hashCode() : 0); -715 return hash; -716 } -717 -718 /** -719 * Standard equals implementation. -720 * -721 * @param obj the object to compare -722 * @return true if the objects are equal, otherwise false -723 */ -724 @Override -725 public boolean equals(Object obj) { -726 if (obj == null) { -727 return false; -728 } -729 if (getClass() != obj.getClass()) { -730 return false; -731 } -732 final IdentifierMatch other = (IdentifierMatch) obj; -733 if (this.evidenceConfidence != other.evidenceConfidence) { +678 private Identifier identifier; +679 +680 /** +681 * Get the value of identifier. +682 * +683 * @return the value of identifier +684 */ +685 public Identifier getIdentifier() { +686 return identifier; +687 } +688 +689 /** +690 * Set the value of identifier. +691 * +692 * @param identifier new value of identifier +693 */ +694 public void setIdentifier(Identifier identifier) { +695 this.identifier = identifier; +696 } +697 //</editor-fold> +698 //<editor-fold defaultstate="collapsed" desc="Standard implementations of toString, hashCode, and equals"> +699 +700 /** +701 * Standard toString() implementation. +702 * +703 * @return the string representation of the object +704 */ +705 @Override +706 public String toString() { +707 return "IdentifierMatch{" + "evidenceConfidence=" + evidenceConfidence +708 + ", confidence=" + confidence + ", identifier=" + identifier + '}'; +709 } +710 +711 /** +712 * Standard hashCode() implementation. +713 * +714 * @return the hashCode +715 */ +716 @Override +717 public int hashCode() { +718 int hash = 5; +719 hash = 97 * hash + (this.evidenceConfidence != null ? this.evidenceConfidence.hashCode() : 0); +720 hash = 97 * hash + (this.confidence != null ? this.confidence.hashCode() : 0); +721 hash = 97 * hash + (this.identifier != null ? this.identifier.hashCode() : 0); +722 return hash; +723 } +724 +725 /** +726 * Standard equals implementation. +727 * +728 * @param obj the object to compare +729 * @return true if the objects are equal, otherwise false +730 */ +731 @Override +732 public boolean equals(Object obj) { +733 if (obj == null) { 734 return false; 735 } -736 if (this.confidence != other.confidence) { +736 if (getClass() != obj.getClass()) { 737 return false; 738 } -739 if (this.identifier != other.identifier && (this.identifier == null || !this.identifier.equals(other.identifier))) { -740 return false; -741 } -742 return true; -743 } -744 //</editor-fold> -745 -746 /** -747 * Standard implementation of compareTo that compares identifier confidence, evidence confidence, and then the identifier. -748 * -749 * @param o the IdentifierMatch to compare to -750 * @return the natural ordering of IdentifierMatch -751 */ -752 @Override -753 public int compareTo(IdentifierMatch o) { -754 int conf = this.confidence.compareTo(o.confidence); -755 if (conf == 0) { -756 conf = this.evidenceConfidence.compareTo(o.evidenceConfidence); -757 if (conf == 0) { -758 conf = identifier.compareTo(o.identifier); -759 } -760 } -761 return conf; -762 } -763 } -764 } +739 final IdentifierMatch other = (IdentifierMatch) obj; +740 if (this.evidenceConfidence != other.evidenceConfidence) { +741 return false; +742 } +743 if (this.confidence != other.confidence) { +744 return false; +745 } +746 if (this.identifier != other.identifier && (this.identifier == null || !this.identifier.equals(other.identifier))) { +747 return false; +748 } +749 return true; +750 } +751 //</editor-fold> +752 +753 /** +754 * Standard implementation of compareTo that compares identifier confidence, evidence confidence, and then the identifier. +755 * +756 * @param o the IdentifierMatch to compare to +757 * @return the natural ordering of IdentifierMatch +758 */ +759 @Override +760 public int compareTo(IdentifierMatch o) { +761 int conf = this.confidence.compareTo(o.confidence); +762 if (conf == 0) { +763 conf = this.evidenceConfidence.compareTo(o.evidenceConfidence); +764 if (conf == 0) { +765 conf = identifier.compareTo(o.identifier); +766 } +767 } +768 return conf; +769 } +770 } +771 }
        diff --git a/xref/org/owasp/dependencycheck/analyzer/CentralAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/CentralAnalyzer.html index d61ea95c5..1e64ac384 100644 --- a/xref/org/owasp/dependencycheck/analyzer/CentralAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/CentralAnalyzer.html @@ -200,7 +200,7 @@ 192 final List<MavenArtifact> mas = searcher.searchSha1(dependency.getSha1sum()); 193 final Confidence confidence = mas.size() > 1 ? Confidence.HIGH : Confidence.HIGHEST; 194 for (MavenArtifact ma : mas) { -195 LOGGER.debug("Central analyzer found artifact ({}) for dependency ({})", ma.toString(), dependency.getFileName()); +195 LOGGER.debug("Central analyzer found artifact ({}) for dependency ({})", ma, dependency.getFileName()); 196 dependency.addAsEvidence("central", ma, confidence); 197 boolean pomAnalyzed = false; 198 for (Evidence e : dependency.getVendorEvidence()) { diff --git a/xref/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.html index 510a8935b..d7da91769 100644 --- a/xref/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.html @@ -221,221 +221,219 @@ 213 //version check 214 final DependencyVersion version1 = DependencyVersionUtil.parseVersion(fileName1); 215 final DependencyVersion version2 = DependencyVersionUtil.parseVersion(fileName2); -216 if (version1 != null && version2 != null) { -217 if (!version1.equals(version2)) { -218 return false; -219 } -220 } -221 -222 //filename check -223 final Matcher match1 = STARTING_TEXT_PATTERN.matcher(fileName1); -224 final Matcher match2 = STARTING_TEXT_PATTERN.matcher(fileName2); -225 if (match1.find() && match2.find()) { -226 return match1.group().equals(match2.group()); -227 } -228 -229 return false; -230 } -231 -232 /** -233 * Returns true if the CPE identifiers in the two supplied dependencies are equal. -234 * -235 * @param dependency1 a dependency2 to compare -236 * @param dependency2 a dependency2 to compare -237 * @return true if the identifiers in the two supplied dependencies are equal -238 */ -239 private boolean cpeIdentifiersMatch(Dependency dependency1, Dependency dependency2) { -240 if (dependency1 == null || dependency1.getIdentifiers() == null -241 || dependency2 == null || dependency2.getIdentifiers() == null) { -242 return false; -243 } -244 boolean matches = false; -245 int cpeCount1 = 0; -246 int cpeCount2 = 0; -247 for (Identifier i : dependency1.getIdentifiers()) { -248 if ("cpe".equals(i.getType())) { -249 cpeCount1 += 1; -250 } -251 } -252 for (Identifier i : dependency2.getIdentifiers()) { -253 if ("cpe".equals(i.getType())) { -254 cpeCount2 += 1; -255 } -256 } -257 if (cpeCount1 > 0 && cpeCount1 == cpeCount2) { -258 for (Identifier i : dependency1.getIdentifiers()) { -259 if ("cpe".equals(i.getType())) { -260 matches |= dependency2.getIdentifiers().contains(i); -261 if (!matches) { -262 break; -263 } -264 } -265 } -266 } -267 LOGGER.debug("IdentifiersMatch={} ({}, {})", matches, dependency1.getFileName(), dependency2.getFileName()); -268 return matches; -269 } -270 -271 /** -272 * Determines if the two dependencies have the same base path. -273 * -274 * @param dependency1 a Dependency object -275 * @param dependency2 a Dependency object -276 * @return true if the base paths of the dependencies are identical -277 */ -278 private boolean hasSameBasePath(Dependency dependency1, Dependency dependency2) { -279 if (dependency1 == null || dependency2 == null) { -280 return false; -281 } -282 final File lFile = new File(dependency1.getFilePath()); -283 String left = lFile.getParent(); -284 final File rFile = new File(dependency2.getFilePath()); -285 String right = rFile.getParent(); -286 if (left == null) { -287 return right == null; -288 } -289 if (left.equalsIgnoreCase(right)) { -290 return true; -291 } -292 if (left.matches(".*[/\\\\]repository[/\\\\].*") && right.matches(".*[/\\\\]repository[/\\\\].*")) { -293 left = getBaseRepoPath(left); -294 right = getBaseRepoPath(right); -295 } -296 if (left.equalsIgnoreCase(right)) { -297 return true; -298 } -299 //new code -300 for (Dependency child : dependency2.getRelatedDependencies()) { -301 if (hasSameBasePath(dependency1, child)) { -302 return true; -303 } -304 } -305 return false; -306 } -307 -308 /** -309 * This is likely a very broken attempt at determining if the 'left' dependency is the 'core' library in comparison to the -310 * 'right' library. -311 * -312 * @param left the dependency to test -313 * @param right the dependency to test against -314 * @return a boolean indicating whether or not the left dependency should be considered the "core" version. -315 */ -316 boolean isCore(Dependency left, Dependency right) { -317 final String leftName = left.getFileName().toLowerCase(); -318 final String rightName = right.getFileName().toLowerCase(); -319 -320 final boolean returnVal; -321 if (!rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") && leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") -322 || rightName.contains("core") && !leftName.contains("core") -323 || rightName.contains("kernel") && !leftName.contains("kernel")) { -324 returnVal = false; -325 } else if (rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") && !leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") -326 || !rightName.contains("core") && leftName.contains("core") -327 || !rightName.contains("kernel") && leftName.contains("kernel")) { -328 returnVal = true; -329 // } else if (leftName.matches(".*struts2\\-core.*") && rightName.matches(".*xwork\\-core.*")) { -330 // returnVal = true; -331 // } else if (rightName.matches(".*struts2\\-core.*") && leftName.matches(".*xwork\\-core.*")) { -332 // returnVal = false; -333 } else { -334 /* -335 * considered splitting the names up and comparing the components, -336 * but decided that the file name length should be sufficient as the -337 * "core" component, if this follows a normal naming protocol should -338 * be shorter: -339 * axis2-saaj-1.4.1.jar -340 * axis2-1.4.1.jar <----- -341 * axis2-kernel-1.4.1.jar -342 */ -343 returnVal = leftName.length() <= rightName.length(); -344 } -345 LOGGER.debug("IsCore={} ({}, {})", returnVal, left.getFileName(), right.getFileName()); -346 return returnVal; -347 } -348 -349 /** -350 * Compares the SHA1 hashes of two dependencies to determine if they are equal. -351 * -352 * @param dependency1 a dependency object to compare -353 * @param dependency2 a dependency object to compare -354 * @return true if the sha1 hashes of the two dependencies match; otherwise false -355 */ -356 private boolean hashesMatch(Dependency dependency1, Dependency dependency2) { -357 if (dependency1 == null || dependency2 == null || dependency1.getSha1sum() == null || dependency2.getSha1sum() == null) { -358 return false; -359 } -360 return dependency1.getSha1sum().equals(dependency2.getSha1sum()); -361 } -362 -363 /** -364 * Determines if the jar is shaded and the created pom.xml identified the same CPE as the jar - if so, the pom.xml dependency -365 * should be removed. -366 * -367 * @param dependency a dependency to check -368 * @param nextDependency another dependency to check -369 * @return true if on of the dependencies is a pom.xml and the identifiers between the two collections match; otherwise false -370 */ -371 private boolean isShadedJar(Dependency dependency, Dependency nextDependency) { -372 final String mainName = dependency.getFileName().toLowerCase(); -373 final String nextName = nextDependency.getFileName().toLowerCase(); -374 if (mainName.endsWith(".jar") && nextName.endsWith("pom.xml")) { -375 return dependency.getIdentifiers().containsAll(nextDependency.getIdentifiers()); -376 } else if (nextName.endsWith(".jar") && mainName.endsWith("pom.xml")) { -377 return nextDependency.getIdentifiers().containsAll(dependency.getIdentifiers()); -378 } -379 return false; -380 } -381 -382 /** -383 * Determines which path is shortest; if path lengths are equal then we use compareTo of the string method to determine if the -384 * first path is smaller. -385 * -386 * @param left the first path to compare -387 * @param right the second path to compare -388 * @return <code>true</code> if the leftPath is the shortest; otherwise <code>false</code> -389 */ -390 protected boolean firstPathIsShortest(String left, String right) { -391 final String leftPath = left.replace('\\', '/'); -392 final String rightPath = right.replace('\\', '/'); -393 -394 final int leftCount = countChar(leftPath, '/'); -395 final int rightCount = countChar(rightPath, '/'); -396 if (leftCount == rightCount) { -397 return leftPath.compareTo(rightPath) <= 0; -398 } else { -399 return leftCount < rightCount; -400 } -401 } -402 -403 /** -404 * Counts the number of times the character is present in the string. -405 * -406 * @param string the string to count the characters in -407 * @param c the character to count -408 * @return the number of times the character is present in the string -409 */ -410 private int countChar(String string, char c) { -411 int count = 0; -412 final int max = string.length(); -413 for (int i = 0; i < max; i++) { -414 if (c == string.charAt(i)) { -415 count++; -416 } -417 } -418 return count; -419 } -420 -421 /** -422 * Checks if the given file path is contained within a war or ear file. -423 * -424 * @param filePath the file path to check -425 * @return true if the path contains '.war\' or '.ear\'. -426 */ -427 private boolean containedInWar(String filePath) { -428 return filePath == null ? false : filePath.matches(".*\\.(ear|war)[\\\\/].*"); -429 } -430 } +216 if (version1 != null && version2 != null && !version1.equals(version2)) { +217 return false; +218 } +219 +220 //filename check +221 final Matcher match1 = STARTING_TEXT_PATTERN.matcher(fileName1); +222 final Matcher match2 = STARTING_TEXT_PATTERN.matcher(fileName2); +223 if (match1.find() && match2.find()) { +224 return match1.group().equals(match2.group()); +225 } +226 +227 return false; +228 } +229 +230 /** +231 * Returns true if the CPE identifiers in the two supplied dependencies are equal. +232 * +233 * @param dependency1 a dependency2 to compare +234 * @param dependency2 a dependency2 to compare +235 * @return true if the identifiers in the two supplied dependencies are equal +236 */ +237 private boolean cpeIdentifiersMatch(Dependency dependency1, Dependency dependency2) { +238 if (dependency1 == null || dependency1.getIdentifiers() == null +239 || dependency2 == null || dependency2.getIdentifiers() == null) { +240 return false; +241 } +242 boolean matches = false; +243 int cpeCount1 = 0; +244 int cpeCount2 = 0; +245 for (Identifier i : dependency1.getIdentifiers()) { +246 if ("cpe".equals(i.getType())) { +247 cpeCount1 += 1; +248 } +249 } +250 for (Identifier i : dependency2.getIdentifiers()) { +251 if ("cpe".equals(i.getType())) { +252 cpeCount2 += 1; +253 } +254 } +255 if (cpeCount1 > 0 && cpeCount1 == cpeCount2) { +256 for (Identifier i : dependency1.getIdentifiers()) { +257 if ("cpe".equals(i.getType())) { +258 matches |= dependency2.getIdentifiers().contains(i); +259 if (!matches) { +260 break; +261 } +262 } +263 } +264 } +265 LOGGER.debug("IdentifiersMatch={} ({}, {})", matches, dependency1.getFileName(), dependency2.getFileName()); +266 return matches; +267 } +268 +269 /** +270 * Determines if the two dependencies have the same base path. +271 * +272 * @param dependency1 a Dependency object +273 * @param dependency2 a Dependency object +274 * @return true if the base paths of the dependencies are identical +275 */ +276 private boolean hasSameBasePath(Dependency dependency1, Dependency dependency2) { +277 if (dependency1 == null || dependency2 == null) { +278 return false; +279 } +280 final File lFile = new File(dependency1.getFilePath()); +281 String left = lFile.getParent(); +282 final File rFile = new File(dependency2.getFilePath()); +283 String right = rFile.getParent(); +284 if (left == null) { +285 return right == null; +286 } +287 if (left.equalsIgnoreCase(right)) { +288 return true; +289 } +290 if (left.matches(".*[/\\\\]repository[/\\\\].*") && right.matches(".*[/\\\\]repository[/\\\\].*")) { +291 left = getBaseRepoPath(left); +292 right = getBaseRepoPath(right); +293 } +294 if (left.equalsIgnoreCase(right)) { +295 return true; +296 } +297 //new code +298 for (Dependency child : dependency2.getRelatedDependencies()) { +299 if (hasSameBasePath(dependency1, child)) { +300 return true; +301 } +302 } +303 return false; +304 } +305 +306 /** +307 * This is likely a very broken attempt at determining if the 'left' dependency is the 'core' library in comparison to the +308 * 'right' library. +309 * +310 * @param left the dependency to test +311 * @param right the dependency to test against +312 * @return a boolean indicating whether or not the left dependency should be considered the "core" version. +313 */ +314 boolean isCore(Dependency left, Dependency right) { +315 final String leftName = left.getFileName().toLowerCase(); +316 final String rightName = right.getFileName().toLowerCase(); +317 +318 final boolean returnVal; +319 if (!rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") && leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") +320 || rightName.contains("core") && !leftName.contains("core") +321 || rightName.contains("kernel") && !leftName.contains("kernel")) { +322 returnVal = false; +323 } else if (rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") && !leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") +324 || !rightName.contains("core") && leftName.contains("core") +325 || !rightName.contains("kernel") && leftName.contains("kernel")) { +326 returnVal = true; +327 // } else if (leftName.matches(".*struts2\\-core.*") && rightName.matches(".*xwork\\-core.*")) { +328 // returnVal = true; +329 // } else if (rightName.matches(".*struts2\\-core.*") && leftName.matches(".*xwork\\-core.*")) { +330 // returnVal = false; +331 } else { +332 /* +333 * considered splitting the names up and comparing the components, +334 * but decided that the file name length should be sufficient as the +335 * "core" component, if this follows a normal naming protocol should +336 * be shorter: +337 * axis2-saaj-1.4.1.jar +338 * axis2-1.4.1.jar <----- +339 * axis2-kernel-1.4.1.jar +340 */ +341 returnVal = leftName.length() <= rightName.length(); +342 } +343 LOGGER.debug("IsCore={} ({}, {})", returnVal, left.getFileName(), right.getFileName()); +344 return returnVal; +345 } +346 +347 /** +348 * Compares the SHA1 hashes of two dependencies to determine if they are equal. +349 * +350 * @param dependency1 a dependency object to compare +351 * @param dependency2 a dependency object to compare +352 * @return true if the sha1 hashes of the two dependencies match; otherwise false +353 */ +354 private boolean hashesMatch(Dependency dependency1, Dependency dependency2) { +355 if (dependency1 == null || dependency2 == null || dependency1.getSha1sum() == null || dependency2.getSha1sum() == null) { +356 return false; +357 } +358 return dependency1.getSha1sum().equals(dependency2.getSha1sum()); +359 } +360 +361 /** +362 * Determines if the jar is shaded and the created pom.xml identified the same CPE as the jar - if so, the pom.xml dependency +363 * should be removed. +364 * +365 * @param dependency a dependency to check +366 * @param nextDependency another dependency to check +367 * @return true if on of the dependencies is a pom.xml and the identifiers between the two collections match; otherwise false +368 */ +369 private boolean isShadedJar(Dependency dependency, Dependency nextDependency) { +370 final String mainName = dependency.getFileName().toLowerCase(); +371 final String nextName = nextDependency.getFileName().toLowerCase(); +372 if (mainName.endsWith(".jar") && nextName.endsWith("pom.xml")) { +373 return dependency.getIdentifiers().containsAll(nextDependency.getIdentifiers()); +374 } else if (nextName.endsWith(".jar") && mainName.endsWith("pom.xml")) { +375 return nextDependency.getIdentifiers().containsAll(dependency.getIdentifiers()); +376 } +377 return false; +378 } +379 +380 /** +381 * Determines which path is shortest; if path lengths are equal then we use compareTo of the string method to determine if the +382 * first path is smaller. +383 * +384 * @param left the first path to compare +385 * @param right the second path to compare +386 * @return <code>true</code> if the leftPath is the shortest; otherwise <code>false</code> +387 */ +388 protected boolean firstPathIsShortest(String left, String right) { +389 final String leftPath = left.replace('\\', '/'); +390 final String rightPath = right.replace('\\', '/'); +391 +392 final int leftCount = countChar(leftPath, '/'); +393 final int rightCount = countChar(rightPath, '/'); +394 if (leftCount == rightCount) { +395 return leftPath.compareTo(rightPath) <= 0; +396 } else { +397 return leftCount < rightCount; +398 } +399 } +400 +401 /** +402 * Counts the number of times the character is present in the string. +403 * +404 * @param string the string to count the characters in +405 * @param c the character to count +406 * @return the number of times the character is present in the string +407 */ +408 private int countChar(String string, char c) { +409 int count = 0; +410 final int max = string.length(); +411 for (int i = 0; i < max; i++) { +412 if (c == string.charAt(i)) { +413 count++; +414 } +415 } +416 return count; +417 } +418 +419 /** +420 * Checks if the given file path is contained within a war or ear file. +421 * +422 * @param filePath the file path to check +423 * @return true if the path contains '.war\' or '.ear\'. +424 */ +425 private boolean containedInWar(String filePath) { +426 return filePath == null ? false : filePath.matches(".*\\.(ear|war)[\\\\/].*"); +427 } +428 }
        diff --git a/xref/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.html index e4b842ee7..87e0d107e 100644 --- a/xref/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.html @@ -121,7 +121,7 @@ 113 for (Identifier i : dependency.getIdentifiers()) { 114 if ("maven".contains(i.getType())) { 115 if (i.getValue() != null && i.getValue().startsWith("org.springframework.")) { -116 final int endPoint = i.getValue().indexOf(":", 19); +116 final int endPoint = i.getValue().indexOf(':', 19); 117 if (endPoint >= 0) { 118 mustContain = i.getValue().substring(19, endPoint).toLowerCase(); 119 break; @@ -480,8 +480,8 @@ 472 */ 473 private String trimCpeToVendor(String value) { 474 //cpe:/a:jruby:jruby:1.0.8 -475 final int pos1 = value.indexOf(":", 7); //right of vendor -476 final int pos2 = value.indexOf(":", pos1 + 1); //right of product +475 final int pos1 = value.indexOf(':', 7); //right of vendor +476 final int pos2 = value.indexOf(':', pos1 + 1); //right of product 477 if (pos2 < 0) { 478 return value; 479 } else { diff --git a/xref/org/owasp/dependencycheck/analyzer/FileNameAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/FileNameAnalyzer.html index 03187253c..e658990ac 100644 --- a/xref/org/owasp/dependencycheck/analyzer/FileNameAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/FileNameAnalyzer.html @@ -26,103 +26,98 @@ 18 package org.owasp.dependencycheck.analyzer; 19 20 import java.io.File; -21 import org.owasp.dependencycheck.Engine; -22 import org.owasp.dependencycheck.analyzer.exception.AnalysisException; -23 import org.owasp.dependencycheck.dependency.Confidence; -24 import org.owasp.dependencycheck.dependency.Dependency; -25 import org.owasp.dependencycheck.utils.DependencyVersion; -26 import org.owasp.dependencycheck.utils.DependencyVersionUtil; -27 -28 /** -29 * -30 * Takes a dependency and analyzes the filename and determines the hashes. -31 * -32 * @author Jeremy Long -33 */ -34 public class FileNameAnalyzer extends AbstractAnalyzer implements Analyzer { -35 -36 //<editor-fold defaultstate="collapsed" desc="All standard implementation details of Analyzer"> -37 /** -38 * The name of the analyzer. -39 */ -40 private static final String ANALYZER_NAME = "File Name Analyzer"; -41 /** -42 * The phase that this analyzer is intended to run in. -43 */ -44 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION; -45 -46 /** -47 * Returns the name of the analyzer. -48 * -49 * @return the name of the analyzer. -50 */ -51 @Override -52 public String getName() { -53 return ANALYZER_NAME; -54 } -55 -56 /** -57 * Returns the phase that the analyzer is intended to run in. -58 * -59 * @return the phase that the analyzer is intended to run in. -60 */ -61 @Override -62 public AnalysisPhase getAnalysisPhase() { -63 return ANALYSIS_PHASE; -64 } -65 //</editor-fold> -66 -67 /** -68 * Collects information about the file name. -69 * -70 * @param dependency the dependency to analyze. -71 * @param engine the engine that is scanning the dependencies -72 * @throws AnalysisException is thrown if there is an error reading the JAR file. -73 */ -74 @Override -75 public void analyze(Dependency dependency, Engine engine) throws AnalysisException { -76 -77 //strip any path information that may get added by ArchiveAnalyzer, etc. -78 final File f = dependency.getActualFile(); -79 String fileName = f.getName(); -80 -81 //remove file extension -82 final int pos = fileName.lastIndexOf("."); -83 if (pos > 0) { -84 fileName = fileName.substring(0, pos); -85 } -86 -87 //add version evidence -88 final DependencyVersion version = DependencyVersionUtil.parseVersion(fileName); -89 if (version != null) { -90 // If the version number is just a number like 2 or 23, reduce the confidence -91 // a shade. This should hopefully correct for cases like log4j.jar or -92 // struts2-core.jar -93 if (version.getVersionParts() == null || version.getVersionParts().size() < 2) { -94 dependency.getVersionEvidence().addEvidence("file", "name", -95 version.toString(), Confidence.MEDIUM); -96 } else { -97 dependency.getVersionEvidence().addEvidence("file", "name", -98 version.toString(), Confidence.HIGHEST); -99 } -100 dependency.getVersionEvidence().addEvidence("file", "name", -101 fileName, Confidence.MEDIUM); -102 } -103 -104 //add as vendor and product evidence -105 if (fileName.contains("-")) { +21 import org.apache.commons.io.FilenameUtils; +22 import org.owasp.dependencycheck.Engine; +23 import org.owasp.dependencycheck.analyzer.exception.AnalysisException; +24 import org.owasp.dependencycheck.dependency.Confidence; +25 import org.owasp.dependencycheck.dependency.Dependency; +26 import org.owasp.dependencycheck.utils.DependencyVersion; +27 import org.owasp.dependencycheck.utils.DependencyVersionUtil; +28 +29 /** +30 * +31 * Takes a dependency and analyzes the filename and determines the hashes. +32 * +33 * @author Jeremy Long +34 */ +35 public class FileNameAnalyzer extends AbstractAnalyzer implements Analyzer { +36 +37 //<editor-fold defaultstate="collapsed" desc="All standard implementation details of Analyzer"> +38 /** +39 * The name of the analyzer. +40 */ +41 private static final String ANALYZER_NAME = "File Name Analyzer"; +42 /** +43 * The phase that this analyzer is intended to run in. +44 */ +45 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION; +46 +47 /** +48 * Returns the name of the analyzer. +49 * +50 * @return the name of the analyzer. +51 */ +52 @Override +53 public String getName() { +54 return ANALYZER_NAME; +55 } +56 +57 /** +58 * Returns the phase that the analyzer is intended to run in. +59 * +60 * @return the phase that the analyzer is intended to run in. +61 */ +62 @Override +63 public AnalysisPhase getAnalysisPhase() { +64 return ANALYSIS_PHASE; +65 } +66 //</editor-fold> +67 +68 /** +69 * Collects information about the file name. +70 * +71 * @param dependency the dependency to analyze. +72 * @param engine the engine that is scanning the dependencies +73 * @throws AnalysisException is thrown if there is an error reading the JAR file. +74 */ +75 @Override +76 public void analyze(Dependency dependency, Engine engine) throws AnalysisException { +77 +78 //strip any path information that may get added by ArchiveAnalyzer, etc. +79 final File f = dependency.getActualFile(); +80 final String fileName = FilenameUtils.removeExtension(f.getName()); +81 +82 //add version evidence +83 final DependencyVersion version = DependencyVersionUtil.parseVersion(fileName); +84 if (version != null) { +85 // If the version number is just a number like 2 or 23, reduce the confidence +86 // a shade. This should hopefully correct for cases like log4j.jar or +87 // struts2-core.jar +88 if (version.getVersionParts() == null || version.getVersionParts().size() < 2) { +89 dependency.getVersionEvidence().addEvidence("file", "name", +90 version.toString(), Confidence.MEDIUM); +91 } else { +92 dependency.getVersionEvidence().addEvidence("file", "name", +93 version.toString(), Confidence.HIGHEST); +94 } +95 dependency.getVersionEvidence().addEvidence("file", "name", +96 fileName, Confidence.MEDIUM); +97 } +98 +99 //add as vendor and product evidence +100 if (fileName.contains("-")) { +101 dependency.getProductEvidence().addEvidence("file", "name", +102 fileName, Confidence.HIGHEST); +103 dependency.getVendorEvidence().addEvidence("file", "name", +104 fileName, Confidence.HIGHEST); +105 } else { 106 dependency.getProductEvidence().addEvidence("file", "name", -107 fileName, Confidence.HIGHEST); +107 fileName, Confidence.HIGH); 108 dependency.getVendorEvidence().addEvidence("file", "name", -109 fileName, Confidence.HIGHEST); -110 } else { -111 dependency.getProductEvidence().addEvidence("file", "name", -112 fileName, Confidence.HIGH); -113 dependency.getVendorEvidence().addEvidence("file", "name", -114 fileName, Confidence.HIGH); -115 } -116 } -117 } +109 fileName, Confidence.HIGH); +110 } +111 } +112 }
        diff --git a/xref/org/owasp/dependencycheck/analyzer/JarAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/JarAnalyzer.html index 0892bcde7..b5b20b9cb 100644 --- a/xref/org/owasp/dependencycheck/analyzer/JarAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/JarAnalyzer.html @@ -50,235 +50,235 @@ 42 import java.util.regex.Pattern; 43 import java.util.zip.ZipEntry; 44 import org.apache.commons.compress.utils.IOUtils; -45 import org.jsoup.Jsoup; -46 import org.owasp.dependencycheck.Engine; -47 import org.owasp.dependencycheck.analyzer.exception.AnalysisException; -48 import org.owasp.dependencycheck.dependency.Confidence; -49 import org.owasp.dependencycheck.dependency.Dependency; -50 import org.owasp.dependencycheck.dependency.EvidenceCollection; -51 import org.owasp.dependencycheck.utils.FileFilterBuilder; -52 import org.owasp.dependencycheck.xml.pom.License; -53 import org.owasp.dependencycheck.xml.pom.PomUtils; -54 import org.owasp.dependencycheck.xml.pom.Model; -55 import org.owasp.dependencycheck.utils.FileUtils; -56 import org.owasp.dependencycheck.utils.Settings; -57 import org.slf4j.Logger; -58 import org.slf4j.LoggerFactory; -59 -60 /** -61 * Used to load a JAR file and collect information that can be used to determine the associated CPE. -62 * -63 * @author Jeremy Long -64 */ -65 public class JarAnalyzer extends AbstractFileTypeAnalyzer { -66 -67 //<editor-fold defaultstate="collapsed" desc="Constants and Member Variables"> -68 /** -69 * The logger. -70 */ -71 private static final Logger LOGGER = LoggerFactory.getLogger(JarAnalyzer.class); -72 /** -73 * The count of directories created during analysis. This is used for creating temporary directories. -74 */ -75 private static int dirCount = 0; -76 /** -77 * The system independent newline character. -78 */ -79 private static final String NEWLINE = System.getProperty("line.separator"); -80 /** -81 * A list of values in the manifest to ignore as they only result in false positives. -82 */ -83 private static final Set<String> IGNORE_VALUES = newHashSet( -84 "Sun Java System Application Server"); -85 /** -86 * A list of elements in the manifest to ignore. -87 */ -88 private static final Set<String> IGNORE_KEYS = newHashSet( -89 "built-by", -90 "created-by", -91 "builtby", -92 "createdby", -93 "build-jdk", -94 "buildjdk", -95 "ant-version", -96 "antversion", -97 "dynamicimportpackage", -98 "dynamicimport-package", -99 "dynamic-importpackage", -100 "dynamic-import-package", -101 "import-package", -102 "ignore-package", -103 "export-package", -104 "importpackage", -105 "ignorepackage", -106 "exportpackage", -107 "sealed", -108 "manifest-version", -109 "archiver-version", -110 "manifestversion", -111 "archiverversion", -112 "classpath", -113 "class-path", -114 "tool", -115 "bundle-manifestversion", -116 "bundlemanifestversion", -117 "bundle-vendor", -118 "include-resource", -119 "embed-dependency", -120 "ipojo-components", -121 "ipojo-extension", -122 "eclipse-sourcereferences"); -123 /** -124 * Deprecated Jar manifest attribute, that is, nonetheless, useful for analysis. -125 */ -126 @SuppressWarnings("deprecation") -127 private static final String IMPLEMENTATION_VENDOR_ID = Attributes.Name.IMPLEMENTATION_VENDOR_ID -128 .toString(); -129 /** -130 * item in some manifest, should be considered medium confidence. -131 */ -132 private static final String BUNDLE_VERSION = "Bundle-Version"; //: 2.1.2 -133 /** -134 * item in some manifest, should be considered medium confidence. -135 */ -136 private static final String BUNDLE_DESCRIPTION = "Bundle-Description"; //: Apache Struts 2 -137 /** -138 * item in some manifest, should be considered medium confidence. -139 */ -140 private static final String BUNDLE_NAME = "Bundle-Name"; //: Struts 2 Core -141 /** -142 * A pattern to detect HTML within text. -143 */ -144 private static final Pattern HTML_DETECTION_PATTERN = Pattern.compile("\\<[a-z]+.*/?\\>", Pattern.CASE_INSENSITIVE); -145 -146 //</editor-fold> -147 /** -148 * Constructs a new JarAnalyzer. -149 */ -150 public JarAnalyzer() { -151 } -152 -153 //<editor-fold defaultstate="collapsed" desc="All standard implmentation details of Analyzer"> -154 /** -155 * The name of the analyzer. -156 */ -157 private static final String ANALYZER_NAME = "Jar Analyzer"; -158 /** -159 * The phase that this analyzer is intended to run in. -160 */ -161 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION; -162 /** -163 * The set of file extensions supported by this analyzer. -164 */ -165 private static final String[] EXTENSIONS = {"jar", "war"}; -166 -167 /** -168 * The file filter used to determine which files this analyzer supports. -169 */ -170 private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions(EXTENSIONS).build(); -171 -172 /** -173 * Returns the FileFilter. -174 * -175 * @return the FileFilter -176 */ -177 @Override -178 protected FileFilter getFileFilter() { -179 return FILTER; -180 } -181 -182 /** -183 * Returns the name of the analyzer. -184 * -185 * @return the name of the analyzer. -186 */ -187 @Override -188 public String getName() { -189 return ANALYZER_NAME; -190 } -191 -192 /** -193 * Returns the phase that the analyzer is intended to run in. -194 * -195 * @return the phase that the analyzer is intended to run in. -196 */ -197 @Override -198 public AnalysisPhase getAnalysisPhase() { -199 return ANALYSIS_PHASE; -200 } -201 //</editor-fold> -202 -203 /** -204 * Returns the key used in the properties file to reference the analyzer's enabled property. -205 * -206 * @return the analyzer's enabled property setting key -207 */ -208 @Override -209 protected String getAnalyzerEnabledSettingKey() { -210 return Settings.KEYS.ANALYZER_JAR_ENABLED; -211 } -212 -213 /** -214 * Loads a specified JAR file and collects information from the manifest and checksums to identify the correct CPE -215 * information. -216 * -217 * @param dependency the dependency to analyze. -218 * @param engine the engine that is scanning the dependencies -219 * @throws AnalysisException is thrown if there is an error reading the JAR file. -220 */ -221 @Override -222 public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { -223 try { -224 final List<ClassNameInformation> classNames = collectClassNames(dependency); -225 final String fileName = dependency.getFileName().toLowerCase(); -226 if (classNames.isEmpty() -227 && (fileName.endsWith("-sources.jar") -228 || fileName.endsWith("-javadoc.jar") -229 || fileName.endsWith("-src.jar") -230 || fileName.endsWith("-doc.jar"))) { -231 engine.getDependencies().remove(dependency); -232 } -233 final boolean hasManifest = parseManifest(dependency, classNames); -234 final boolean hasPOM = analyzePOM(dependency, classNames, engine); -235 final boolean addPackagesAsEvidence = !(hasManifest && hasPOM); -236 analyzePackageNames(classNames, dependency, addPackagesAsEvidence); -237 } catch (IOException ex) { -238 throw new AnalysisException("Exception occurred reading the JAR file.", ex); -239 } -240 } -241 -242 /** -243 * Attempts to find a pom.xml within the JAR file. If found it extracts information and adds it to the evidence. This will -244 * attempt to interpolate the strings contained within the pom.properties if one exists. -245 * -246 * @param dependency the dependency being analyzed -247 * @param classes a collection of class name information -248 * @param engine the analysis engine, used to add additional dependencies -249 * @throws AnalysisException is thrown if there is an exception parsing the pom -250 * @return whether or not evidence was added to the dependency -251 */ -252 protected boolean analyzePOM(Dependency dependency, List<ClassNameInformation> classes, Engine engine) throws AnalysisException { -253 boolean foundSomething = false; -254 final JarFile jar; -255 try { -256 jar = new JarFile(dependency.getActualFilePath()); -257 } catch (IOException ex) { -258 LOGGER.warn("Unable to read JarFile '{}'.", dependency.getActualFilePath()); -259 LOGGER.trace("", ex); -260 return false; -261 } -262 List<String> pomEntries; -263 try { -264 pomEntries = retrievePomListing(jar); -265 } catch (IOException ex) { -266 LOGGER.warn("Unable to read Jar file entries in '{}'.", dependency.getActualFilePath()); -267 LOGGER.trace("", ex); -268 return false; -269 } -270 File externalPom = null; -271 if (pomEntries.isEmpty()) { -272 String pomPath = dependency.getActualFilePath(); -273 pomPath = pomPath.substring(0, pomPath.lastIndexOf('.')) + ".pom"; +45 import org.apache.commons.io.FilenameUtils; +46 import org.jsoup.Jsoup; +47 import org.owasp.dependencycheck.Engine; +48 import org.owasp.dependencycheck.analyzer.exception.AnalysisException; +49 import org.owasp.dependencycheck.dependency.Confidence; +50 import org.owasp.dependencycheck.dependency.Dependency; +51 import org.owasp.dependencycheck.dependency.EvidenceCollection; +52 import org.owasp.dependencycheck.utils.FileFilterBuilder; +53 import org.owasp.dependencycheck.xml.pom.License; +54 import org.owasp.dependencycheck.xml.pom.PomUtils; +55 import org.owasp.dependencycheck.xml.pom.Model; +56 import org.owasp.dependencycheck.utils.FileUtils; +57 import org.owasp.dependencycheck.utils.Settings; +58 import org.slf4j.Logger; +59 import org.slf4j.LoggerFactory; +60 +61 /** +62 * Used to load a JAR file and collect information that can be used to determine the associated CPE. +63 * +64 * @author Jeremy Long +65 */ +66 public class JarAnalyzer extends AbstractFileTypeAnalyzer { +67 +68 //<editor-fold defaultstate="collapsed" desc="Constants and Member Variables"> +69 /** +70 * The logger. +71 */ +72 private static final Logger LOGGER = LoggerFactory.getLogger(JarAnalyzer.class); +73 /** +74 * The count of directories created during analysis. This is used for creating temporary directories. +75 */ +76 private static int dirCount = 0; +77 /** +78 * The system independent newline character. +79 */ +80 private static final String NEWLINE = System.getProperty("line.separator"); +81 /** +82 * A list of values in the manifest to ignore as they only result in false positives. +83 */ +84 private static final Set<String> IGNORE_VALUES = newHashSet( +85 "Sun Java System Application Server"); +86 /** +87 * A list of elements in the manifest to ignore. +88 */ +89 private static final Set<String> IGNORE_KEYS = newHashSet( +90 "built-by", +91 "created-by", +92 "builtby", +93 "createdby", +94 "build-jdk", +95 "buildjdk", +96 "ant-version", +97 "antversion", +98 "dynamicimportpackage", +99 "dynamicimport-package", +100 "dynamic-importpackage", +101 "dynamic-import-package", +102 "import-package", +103 "ignore-package", +104 "export-package", +105 "importpackage", +106 "ignorepackage", +107 "exportpackage", +108 "sealed", +109 "manifest-version", +110 "archiver-version", +111 "manifestversion", +112 "archiverversion", +113 "classpath", +114 "class-path", +115 "tool", +116 "bundle-manifestversion", +117 "bundlemanifestversion", +118 "bundle-vendor", +119 "include-resource", +120 "embed-dependency", +121 "ipojo-components", +122 "ipojo-extension", +123 "eclipse-sourcereferences"); +124 /** +125 * Deprecated Jar manifest attribute, that is, nonetheless, useful for analysis. +126 */ +127 @SuppressWarnings("deprecation") +128 private static final String IMPLEMENTATION_VENDOR_ID = Attributes.Name.IMPLEMENTATION_VENDOR_ID +129 .toString(); +130 /** +131 * item in some manifest, should be considered medium confidence. +132 */ +133 private static final String BUNDLE_VERSION = "Bundle-Version"; //: 2.1.2 +134 /** +135 * item in some manifest, should be considered medium confidence. +136 */ +137 private static final String BUNDLE_DESCRIPTION = "Bundle-Description"; //: Apache Struts 2 +138 /** +139 * item in some manifest, should be considered medium confidence. +140 */ +141 private static final String BUNDLE_NAME = "Bundle-Name"; //: Struts 2 Core +142 /** +143 * A pattern to detect HTML within text. +144 */ +145 private static final Pattern HTML_DETECTION_PATTERN = Pattern.compile("\\<[a-z]+.*/?\\>", Pattern.CASE_INSENSITIVE); +146 +147 //</editor-fold> +148 /** +149 * Constructs a new JarAnalyzer. +150 */ +151 public JarAnalyzer() { +152 } +153 +154 //<editor-fold defaultstate="collapsed" desc="All standard implmentation details of Analyzer"> +155 /** +156 * The name of the analyzer. +157 */ +158 private static final String ANALYZER_NAME = "Jar Analyzer"; +159 /** +160 * The phase that this analyzer is intended to run in. +161 */ +162 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION; +163 /** +164 * The set of file extensions supported by this analyzer. +165 */ +166 private static final String[] EXTENSIONS = {"jar", "war"}; +167 +168 /** +169 * The file filter used to determine which files this analyzer supports. +170 */ +171 private static final FileFilter FILTER = FileFilterBuilder.newInstance().addExtensions(EXTENSIONS).build(); +172 +173 /** +174 * Returns the FileFilter. +175 * +176 * @return the FileFilter +177 */ +178 @Override +179 protected FileFilter getFileFilter() { +180 return FILTER; +181 } +182 +183 /** +184 * Returns the name of the analyzer. +185 * +186 * @return the name of the analyzer. +187 */ +188 @Override +189 public String getName() { +190 return ANALYZER_NAME; +191 } +192 +193 /** +194 * Returns the phase that the analyzer is intended to run in. +195 * +196 * @return the phase that the analyzer is intended to run in. +197 */ +198 @Override +199 public AnalysisPhase getAnalysisPhase() { +200 return ANALYSIS_PHASE; +201 } +202 //</editor-fold> +203 +204 /** +205 * Returns the key used in the properties file to reference the analyzer's enabled property. +206 * +207 * @return the analyzer's enabled property setting key +208 */ +209 @Override +210 protected String getAnalyzerEnabledSettingKey() { +211 return Settings.KEYS.ANALYZER_JAR_ENABLED; +212 } +213 +214 /** +215 * Loads a specified JAR file and collects information from the manifest and checksums to identify the correct CPE +216 * information. +217 * +218 * @param dependency the dependency to analyze. +219 * @param engine the engine that is scanning the dependencies +220 * @throws AnalysisException is thrown if there is an error reading the JAR file. +221 */ +222 @Override +223 public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { +224 try { +225 final List<ClassNameInformation> classNames = collectClassNames(dependency); +226 final String fileName = dependency.getFileName().toLowerCase(); +227 if (classNames.isEmpty() +228 && (fileName.endsWith("-sources.jar") +229 || fileName.endsWith("-javadoc.jar") +230 || fileName.endsWith("-src.jar") +231 || fileName.endsWith("-doc.jar"))) { +232 engine.getDependencies().remove(dependency); +233 } +234 final boolean hasManifest = parseManifest(dependency, classNames); +235 final boolean hasPOM = analyzePOM(dependency, classNames, engine); +236 final boolean addPackagesAsEvidence = !(hasManifest && hasPOM); +237 analyzePackageNames(classNames, dependency, addPackagesAsEvidence); +238 } catch (IOException ex) { +239 throw new AnalysisException("Exception occurred reading the JAR file.", ex); +240 } +241 } +242 +243 /** +244 * Attempts to find a pom.xml within the JAR file. If found it extracts information and adds it to the evidence. This will +245 * attempt to interpolate the strings contained within the pom.properties if one exists. +246 * +247 * @param dependency the dependency being analyzed +248 * @param classes a collection of class name information +249 * @param engine the analysis engine, used to add additional dependencies +250 * @throws AnalysisException is thrown if there is an exception parsing the pom +251 * @return whether or not evidence was added to the dependency +252 */ +253 protected boolean analyzePOM(Dependency dependency, List<ClassNameInformation> classes, Engine engine) throws AnalysisException { +254 boolean foundSomething = false; +255 final JarFile jar; +256 try { +257 jar = new JarFile(dependency.getActualFilePath()); +258 } catch (IOException ex) { +259 LOGGER.warn("Unable to read JarFile '{}'.", dependency.getActualFilePath()); +260 LOGGER.trace("", ex); +261 return false; +262 } +263 List<String> pomEntries; +264 try { +265 pomEntries = retrievePomListing(jar); +266 } catch (IOException ex) { +267 LOGGER.warn("Unable to read Jar file entries in '{}'.", dependency.getActualFilePath()); +268 LOGGER.trace("", ex); +269 return false; +270 } +271 File externalPom = null; +272 if (pomEntries.isEmpty()) { +273 final String pomPath = FilenameUtils.removeExtension(dependency.getActualFilePath()) + ".pom"; 274 externalPom = new File(pomPath); 275 if (externalPom.isFile()) { 276 pomEntries.add(pomPath); diff --git a/xref/org/owasp/dependencycheck/analyzer/NexusAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/NexusAnalyzer.html index a0fc78551..a6ea64452 100644 --- a/xref/org/owasp/dependencycheck/analyzer/NexusAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/NexusAnalyzer.html @@ -112,7 +112,7 @@ 104 */ 105 boolean retval = false; 106 try { -107 if ((!DEFAULT_URL.equals(Settings.getString(Settings.KEYS.ANALYZER_NEXUS_URL))) +107 if (!DEFAULT_URL.equals(Settings.getString(Settings.KEYS.ANALYZER_NEXUS_URL)) 108 && Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED)) { 109 LOGGER.info("Enabling Nexus analyzer"); 110 retval = true; diff --git a/xref/org/owasp/dependencycheck/analyzer/NuspecAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/NuspecAnalyzer.html index b6fa073e9..9895b94ac 100644 --- a/xref/org/owasp/dependencycheck/analyzer/NuspecAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/NuspecAnalyzer.html @@ -134,7 +134,7 @@ 126 */ 127 @Override 128 public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { -129 LOGGER.debug("Checking Nuspec file {}", dependency.toString()); +129 LOGGER.debug("Checking Nuspec file {}", dependency); 130 try { 131 final NuspecParser parser = new XPathNuspecParser(); 132 NugetPackage np = null; diff --git a/xref/org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.html index 09057ff7d..c77fa103b 100644 --- a/xref/org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/NvdCveAnalyzer.html @@ -81,7 +81,7 @@ 73 * @return true or false. 74 */ 75 public boolean isOpen() { -76 return (cveDB != null); +76 return cveDB != null; 77 } 78 79 /** diff --git a/xref/org/owasp/dependencycheck/analyzer/PythonPackageAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/PythonPackageAnalyzer.html index ed63e358c..a583fbba3 100644 --- a/xref/org/owasp/dependencycheck/analyzer/PythonPackageAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/PythonPackageAnalyzer.html @@ -172,7 +172,7 @@ 164 * Analyzes python packages and adds evidence to the dependency. 165 * 166 * @param dependency the dependency being analyzed -167 * @param engine the engine being used to perform the scan +167 * @param engine the engine being used to perform the scan 168 * @throws AnalysisException thrown if there is an unrecoverable error analyzing the dependency 169 */ 170 @Override @@ -183,142 +183,145 @@ 175 final String parentName = parent.getName(); 176 boolean found = false; 177 if (INIT_PY_FILTER.accept(file)) { -178 for (final File sourceFile : parent.listFiles(PY_FILTER)) { -179 found |= analyzeFileContents(dependency, sourceFile); -180 } -181 } -182 if (found) { -183 dependency.setDisplayFileName(parentName + "/__init__.py"); -184 dependency.getProductEvidence().addEvidence(file.getName(), -185 "PackageName", parentName, Confidence.MEDIUM); -186 } else { -187 // copy, alter and set in case some other thread is iterating over -188 final List<Dependency> dependencies = new ArrayList<Dependency>( -189 engine.getDependencies()); -190 dependencies.remove(dependency); -191 engine.setDependencies(dependencies); -192 } -193 } -194 -195 /** -196 * This should gather information from leading docstrings, file comments, and assignments to __version__, __title__, -197 * __summary__, __uri__, __url__, __home*page__, __author__, and their all caps equivalents. -198 * -199 * @param dependency the dependency being analyzed -200 * @param file the file name to analyze -201 * @return whether evidence was found -202 * @throws AnalysisException thrown if there is an unrecoverable error -203 */ -204 private boolean analyzeFileContents(Dependency dependency, File file) -205 throws AnalysisException { -206 String contents; -207 try { -208 contents = FileUtils.readFileToString(file).trim(); -209 } catch (IOException e) { -210 throw new AnalysisException( -211 "Problem occurred while reading dependency file.", e); -212 } -213 boolean found = false; -214 if (!contents.isEmpty()) { -215 final String source = file.getName(); -216 found = gatherEvidence(VERSION_PATTERN, contents, source, -217 dependency.getVersionEvidence(), "SourceVersion", -218 Confidence.MEDIUM); -219 found |= addSummaryInfo(dependency, SUMMARY_PATTERN, 4, contents, -220 source, "summary"); -221 if (INIT_PY_FILTER.accept(file)) { -222 found |= addSummaryInfo(dependency, MODULE_DOCSTRING, 2, -223 contents, source, "docstring"); -224 } -225 found |= gatherEvidence(TITLE_PATTERN, contents, source, -226 dependency.getProductEvidence(), "SourceTitle", -227 Confidence.LOW); -228 final EvidenceCollection vendorEvidence = dependency -229 .getVendorEvidence(); -230 found |= gatherEvidence(AUTHOR_PATTERN, contents, source, -231 vendorEvidence, "SourceAuthor", Confidence.MEDIUM); -232 found |= gatherHomePageEvidence(URI_PATTERN, vendorEvidence, -233 source, "URL", contents); -234 found |= gatherHomePageEvidence(HOMEPAGE_PATTERN, -235 vendorEvidence, source, "HomePage", contents); -236 } -237 return found; -238 } -239 -240 /** -241 * Adds summary information to the dependency -242 * -243 * @param dependency the dependency being analyzed -244 * @param pattern the pattern used to perform analysis -245 * @param group the group from the pattern that indicates the data to use -246 * @param contents the data being analyzed -247 * @param source the source name to use when recording the evidence -248 * @param key the key name to use when recording the evidence -249 * @return true if evidence was collected; otherwise false -250 */ -251 private boolean addSummaryInfo(Dependency dependency, Pattern pattern, -252 int group, String contents, String source, String key) { -253 final Matcher matcher = pattern.matcher(contents); -254 final boolean found = matcher.find(); -255 if (found) { -256 JarAnalyzer.addDescription(dependency, matcher.group(group), -257 source, key); -258 } -259 return found; -260 } -261 -262 /** -263 * Collects evidence from the home page URL. -264 * -265 * @param pattern the pattern to match -266 * @param evidence the evidence collection to add the evidence to -267 * @param source the source of the evidence -268 * @param name the name of the evidence -269 * @param contents the home page URL -270 * @return true if evidence was collected; otherwise false -271 */ -272 private boolean gatherHomePageEvidence(Pattern pattern, -273 EvidenceCollection evidence, String source, String name, -274 String contents) { -275 final Matcher matcher = pattern.matcher(contents); -276 boolean found = false; -277 if (matcher.find()) { -278 final String url = matcher.group(4); -279 if (UrlStringUtils.isUrl(url)) { -280 found = true; -281 evidence.addEvidence(source, name, url, Confidence.MEDIUM); -282 } -283 } -284 return found; -285 } -286 -287 /** -288 * Gather evidence from a Python source file using the given string assignment regex pattern. -289 * -290 * @param pattern to scan contents with -291 * @param contents of Python source file -292 * @param source for storing evidence -293 * @param evidence to store evidence in -294 * @param name of evidence -295 * @param confidence in evidence -296 * @return whether evidence was found -297 */ -298 private boolean gatherEvidence(Pattern pattern, String contents, -299 String source, EvidenceCollection evidence, String name, -300 Confidence confidence) { -301 final Matcher matcher = pattern.matcher(contents); -302 final boolean found = matcher.find(); -303 if (found) { -304 evidence.addEvidence(source, name, matcher.group(4), confidence); -305 } -306 return found; -307 } -308 -309 @Override -310 protected String getAnalyzerEnabledSettingKey() { -311 return Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED; -312 } -313 } +178 final File[] fileList = parent.listFiles(PY_FILTER); +179 if (fileList != null) { +180 for (final File sourceFile : fileList) { +181 found |= analyzeFileContents(dependency, sourceFile); +182 } +183 } +184 } +185 if (found) { +186 dependency.setDisplayFileName(parentName + "/__init__.py"); +187 dependency.getProductEvidence().addEvidence(file.getName(), +188 "PackageName", parentName, Confidence.MEDIUM); +189 } else { +190 // copy, alter and set in case some other thread is iterating over +191 final List<Dependency> dependencies = new ArrayList<Dependency>( +192 engine.getDependencies()); +193 dependencies.remove(dependency); +194 engine.setDependencies(dependencies); +195 } +196 } +197 +198 /** +199 * This should gather information from leading docstrings, file comments, and assignments to __version__, __title__, +200 * __summary__, __uri__, __url__, __home*page__, __author__, and their all caps equivalents. +201 * +202 * @param dependency the dependency being analyzed +203 * @param file the file name to analyze +204 * @return whether evidence was found +205 * @throws AnalysisException thrown if there is an unrecoverable error +206 */ +207 private boolean analyzeFileContents(Dependency dependency, File file) +208 throws AnalysisException { +209 String contents; +210 try { +211 contents = FileUtils.readFileToString(file).trim(); +212 } catch (IOException e) { +213 throw new AnalysisException( +214 "Problem occurred while reading dependency file.", e); +215 } +216 boolean found = false; +217 if (!contents.isEmpty()) { +218 final String source = file.getName(); +219 found = gatherEvidence(VERSION_PATTERN, contents, source, +220 dependency.getVersionEvidence(), "SourceVersion", +221 Confidence.MEDIUM); +222 found |= addSummaryInfo(dependency, SUMMARY_PATTERN, 4, contents, +223 source, "summary"); +224 if (INIT_PY_FILTER.accept(file)) { +225 found |= addSummaryInfo(dependency, MODULE_DOCSTRING, 2, +226 contents, source, "docstring"); +227 } +228 found |= gatherEvidence(TITLE_PATTERN, contents, source, +229 dependency.getProductEvidence(), "SourceTitle", +230 Confidence.LOW); +231 final EvidenceCollection vendorEvidence = dependency +232 .getVendorEvidence(); +233 found |= gatherEvidence(AUTHOR_PATTERN, contents, source, +234 vendorEvidence, "SourceAuthor", Confidence.MEDIUM); +235 found |= gatherHomePageEvidence(URI_PATTERN, vendorEvidence, +236 source, "URL", contents); +237 found |= gatherHomePageEvidence(HOMEPAGE_PATTERN, +238 vendorEvidence, source, "HomePage", contents); +239 } +240 return found; +241 } +242 +243 /** +244 * Adds summary information to the dependency +245 * +246 * @param dependency the dependency being analyzed +247 * @param pattern the pattern used to perform analysis +248 * @param group the group from the pattern that indicates the data to use +249 * @param contents the data being analyzed +250 * @param source the source name to use when recording the evidence +251 * @param key the key name to use when recording the evidence +252 * @return true if evidence was collected; otherwise false +253 */ +254 private boolean addSummaryInfo(Dependency dependency, Pattern pattern, +255 int group, String contents, String source, String key) { +256 final Matcher matcher = pattern.matcher(contents); +257 final boolean found = matcher.find(); +258 if (found) { +259 JarAnalyzer.addDescription(dependency, matcher.group(group), +260 source, key); +261 } +262 return found; +263 } +264 +265 /** +266 * Collects evidence from the home page URL. +267 * +268 * @param pattern the pattern to match +269 * @param evidence the evidence collection to add the evidence to +270 * @param source the source of the evidence +271 * @param name the name of the evidence +272 * @param contents the home page URL +273 * @return true if evidence was collected; otherwise false +274 */ +275 private boolean gatherHomePageEvidence(Pattern pattern, +276 EvidenceCollection evidence, String source, String name, +277 String contents) { +278 final Matcher matcher = pattern.matcher(contents); +279 boolean found = false; +280 if (matcher.find()) { +281 final String url = matcher.group(4); +282 if (UrlStringUtils.isUrl(url)) { +283 found = true; +284 evidence.addEvidence(source, name, url, Confidence.MEDIUM); +285 } +286 } +287 return found; +288 } +289 +290 /** +291 * Gather evidence from a Python source file using the given string assignment regex pattern. +292 * +293 * @param pattern to scan contents with +294 * @param contents of Python source file +295 * @param source for storing evidence +296 * @param evidence to store evidence in +297 * @param name of evidence +298 * @param confidence in evidence +299 * @return whether evidence was found +300 */ +301 private boolean gatherEvidence(Pattern pattern, String contents, +302 String source, EvidenceCollection evidence, String name, +303 Confidence confidence) { +304 final Matcher matcher = pattern.matcher(contents); +305 final boolean found = matcher.find(); +306 if (found) { +307 evidence.addEvidence(source, name, matcher.group(4), confidence); +308 } +309 return found; +310 } +311 +312 @Override +313 protected String getAnalyzerEnabledSettingKey() { +314 return Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED; +315 } +316 }
        diff --git a/xref/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.html new file mode 100644 index 000000000..059ec01a2 --- /dev/null +++ b/xref/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.html @@ -0,0 +1,339 @@ + + + +RubyBundleAuditAnalyzer xref + + + +
        +1   /*
        +2    * This file is part of dependency-check-core.
        +3    *
        +4    * Licensed under the Apache License, Version 2.0 (the "License");
        +5    * you may not use this file except in compliance with the License.
        +6    * You may obtain a copy of the License at
        +7    *
        +8    *     http://www.apache.org/licenses/LICENSE-2.0
        +9    *
        +10   * Unless required by applicable law or agreed to in writing, software
        +11   * distributed under the License is distributed on an "AS IS" BASIS,
        +12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        +13   * See the License for the specific language governing permissions and
        +14   * limitations under the License.
        +15   *
        +16   * Copyright (c) 2015 Institute for Defense Analyses. All Rights Reserved.
        +17   */
        +18  package org.owasp.dependencycheck.analyzer;
        +19  
        +20  import org.apache.commons.io.FileUtils;
        +21  import org.owasp.dependencycheck.Engine;
        +22  import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
        +23  import org.owasp.dependencycheck.dependency.Confidence;
        +24  import org.owasp.dependencycheck.dependency.Dependency;
        +25  import org.owasp.dependencycheck.dependency.Reference;
        +26  import org.owasp.dependencycheck.dependency.Vulnerability;
        +27  import org.owasp.dependencycheck.utils.FileFilterBuilder;
        +28  import org.owasp.dependencycheck.utils.Settings;
        +29  import org.slf4j.Logger;
        +30  import org.slf4j.LoggerFactory;
        +31  
        +32  import java.io.*;
        +33  import java.util.*;
        +34  
        +35  /**
        +36   * Used to analyze Ruby Bundler Gemspec.lock files utilizing the 3rd party bundle-audit tool.
        +37   *
        +38   * @author Dale Visser <dvisser@ida.org>
        +39   */
        +40  public class RubyBundleAuditAnalyzer extends AbstractFileTypeAnalyzer {
        +41  
        +42      private static final Logger LOGGER = LoggerFactory.getLogger(RubyBundleAuditAnalyzer.class);
        +43  
        +44      /**
        +45       * The name of the analyzer.
        +46       */
        +47      private static final String ANALYZER_NAME = "Ruby Bundle Audit Analyzer";
        +48  
        +49      /**
        +50       * The phase that this analyzer is intended to run in.
        +51       */
        +52      private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.PRE_INFORMATION_COLLECTION;
        +53  
        +54      private static final FileFilter FILTER =
        +55              FileFilterBuilder.newInstance().addFilenames("Gemfile.lock").build();
        +56      public static final String NAME = "Name: ";
        +57      public static final String VERSION = "Version: ";
        +58      public static final String ADVISORY = "Advisory: ";
        +59      public static final String CRITICALITY = "Criticality: ";
        +60  
        +61      /**
        +62       * @return a filter that accepts files named Gemfile.lock
        +63       */
        +64      @Override
        +65      protected FileFilter getFileFilter() {
        +66          return FILTER;
        +67      }
        +68  
        +69      /**
        +70       * Launch bundle-audit.
        +71       *
        +72       * @return a handle to the process
        +73       */
        +74      private Process launchBundleAudit(File folder) throws AnalysisException {
        +75          if (!folder.isDirectory()) {
        +76              throw new AnalysisException(String.format("%s should have been a directory.", folder.getAbsolutePath()));
        +77          }
        +78          final List<String> args = new ArrayList<String>();
        +79          final String bundleAuditPath = Settings.getString(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_PATH);
        +80          args.add(null == bundleAuditPath ? "bundle-audit" : bundleAuditPath);
        +81          args.add("check");
        +82          args.add("--verbose");
        +83          final ProcessBuilder builder = new ProcessBuilder(args);
        +84          builder.directory(folder);
        +85          try {
        +86              return builder.start();
        +87          } catch (IOException ioe) {
        +88              throw new AnalysisException("bundle-audit failure", ioe);
        +89          }
        +90      }
        +91  
        +92      /**
        +93       * Initialize the analyzer. In this case, extract GrokAssembly.exe to a temporary location.
        +94       *
        +95       * @throws Exception if anything goes wrong
        +96       */
        +97      @Override
        +98      public void initializeFileTypeAnalyzer() throws Exception {
        +99          // Now, need to see if bundle-audit actually runs from this location.
        +100         Process process = launchBundleAudit(Settings.getTempDirectory());
        +101         int exitValue = process.waitFor();
        +102         if (0 == exitValue) {
        +103             LOGGER.warn("Unexpected exit code from bundle-audit process. Disabling {}: {}", ANALYZER_NAME, exitValue);
        +104             setEnabled(false);
        +105             throw new AnalysisException("Unexpected exit code from bundle-audit process.");
        +106         } else {
        +107             BufferedReader reader = null;
        +108             try {
        +109                 reader = new BufferedReader(new InputStreamReader(process.getErrorStream(), "UTF-8"));
        +110                 if (!reader.ready()) {
        +111                     LOGGER.warn("Bundle-audit error stream unexpectedly not ready. Disabling " + ANALYZER_NAME);
        +112                     setEnabled(false);
        +113                     throw new AnalysisException("Bundle-audit error stream unexpectedly not ready.");
        +114                 } else {
        +115                     final String line = reader.readLine();
        +116                     if (!line.contains("Errno::ENOENT")) {
        +117                         LOGGER.warn("Unexpected bundle-audit output. Disabling {}: {}", ANALYZER_NAME, line);
        +118                         setEnabled(false);
        +119                         throw new AnalysisException("Unexpected bundle-audit output.");
        +120                     }
        +121                 }
        +122             } finally {
        +123                 if (null != reader) {
        +124                     reader.close();
        +125                 }
        +126             }
        +127         }
        +128         if (isEnabled()) {
        +129             LOGGER.info(ANALYZER_NAME + " is enabled. It is necessary to manually run \"bundle-audit update\" " +
        +130                     "occasionally to keep its database up to date.");
        +131         }
        +132     }
        +133 
        +134     /**
        +135      * Returns the name of the analyzer.
        +136      *
        +137      * @return the name of the analyzer.
        +138      */
        +139     @Override
        +140     public String getName() {
        +141         return ANALYZER_NAME;
        +142     }
        +143 
        +144     /**
        +145      * Returns the phase that the analyzer is intended to run in.
        +146      *
        +147      * @return the phase that the analyzer is intended to run in.
        +148      */
        +149     @Override
        +150     public AnalysisPhase getAnalysisPhase() {
        +151         return ANALYSIS_PHASE;
        +152     }
        +153 
        +154     /**
        +155      * Returns the key used in the properties file to reference the analyzer's enabled property.
        +156      *
        +157      * @return the analyzer's enabled property setting key
        +158      */
        +159     @Override
        +160     protected String getAnalyzerEnabledSettingKey() {
        +161         return Settings.KEYS.ANALYZER_BUNDLE_AUDIT_ENABLED;
        +162     }
        +163 
        +164     /**
        +165      * If {@link #analyzeFileType(Dependency, Engine)} is called, then we have successfully initialized, and it will
        +166      * be necessary to disable {@link RubyGemspecAnalyzer}.
        +167      */
        +168     private boolean needToDisableGemspecAnalyzer = true;
        +169 
        +170     @Override
        +171     protected void analyzeFileType(Dependency dependency, Engine engine)
        +172             throws AnalysisException {
        +173         if (needToDisableGemspecAnalyzer) {
        +174             boolean failed = true;
        +175             final String className = RubyGemspecAnalyzer.class.getName();
        +176             for (FileTypeAnalyzer analyzer : engine.getFileTypeAnalyzers()) {
        +177                 if (analyzer instanceof RubyGemspecAnalyzer) {
        +178                     ((RubyGemspecAnalyzer) analyzer).setEnabled(false);
        +179                     LOGGER.info("Disabled " + className + " to avoid noisy duplicate results.");
        +180                     failed = false;
        +181                 }
        +182             }
        +183             if (failed) {
        +184                 LOGGER.warn("Did not find" + className + '.');
        +185             }
        +186             needToDisableGemspecAnalyzer = false;
        +187         }
        +188         final File parentFile = dependency.getActualFile().getParentFile();
        +189         final Process process = launchBundleAudit(parentFile);
        +190         try {
        +191             process.waitFor();
        +192         } catch (InterruptedException ie) {
        +193             throw new AnalysisException("bundle-audit process interrupted", ie);
        +194         }
        +195         BufferedReader rdr = null;
        +196         try {
        +197             rdr = new BufferedReader(new InputStreamReader(process.getInputStream(), "UTF-8"));
        +198             processBundlerAuditOutput(dependency, engine, rdr);
        +199         } catch (IOException ioe) {
        +200             LOGGER.warn("bundle-audit failure", ioe);
        +201         } finally {
        +202             if (null != rdr) {
        +203                 try {
        +204                     rdr.close();
        +205                 } catch (IOException ioe) {
        +206                     LOGGER.warn("bundle-audit close failure", ioe);
        +207                 }
        +208             }
        +209         }
        +210 
        +211     }
        +212 
        +213     private void processBundlerAuditOutput(Dependency original, Engine engine, BufferedReader rdr) throws IOException {
        +214         final String parentName = original.getActualFile().getParentFile().getName();
        +215         final String fileName = original.getFileName();
        +216         Dependency dependency = null;
        +217         Vulnerability vulnerability = null;
        +218         String gem = null;
        +219         final Map<String, Dependency> map = new HashMap<String, Dependency>();
        +220         boolean appendToDescription = false;
        +221         while (rdr.ready()) {
        +222             final String nextLine = rdr.readLine();
        +223             if (null == nextLine) {
        +224                 break;
        +225             } else if (nextLine.startsWith(NAME)) {
        +226                 appendToDescription = false;
        +227                 gem = nextLine.substring(NAME.length());
        +228                 if (!map.containsKey(gem)) {
        +229                     map.put(gem, createDependencyForGem(engine, parentName, fileName, gem));
        +230                 }
        +231                 dependency = map.get(gem);
        +232                 LOGGER.debug(String.format("bundle-audit (%s): %s", parentName, nextLine));
        +233             } else if (nextLine.startsWith(VERSION)) {
        +234                 vulnerability = createVulnerability(parentName, dependency, vulnerability, gem, nextLine);
        +235             } else if (nextLine.startsWith(ADVISORY)) {
        +236                 setVulnerabilityName(parentName, dependency, vulnerability, nextLine);
        +237             } else if (nextLine.startsWith(CRITICALITY)) {
        +238                 addCriticalityToVulnerability(parentName, vulnerability, nextLine);
        +239             } else if (nextLine.startsWith("URL: ")) {
        +240                 addReferenceToVulnerability(parentName, vulnerability, nextLine);
        +241             } else if (nextLine.startsWith("Description:")) {
        +242                 appendToDescription = true;
        +243                 if (null != vulnerability) {
        +244                     vulnerability.setDescription("*** Vulnerability obtained from bundle-audit verbose report. Title link may not work. CPE below is guessed. CVSS score is estimated (-1.0 indicates unknown). See link below for full details. *** ");
        +245                 }
        +246             } else if (appendToDescription) {
        +247                 if (null != vulnerability) {
        +248                     vulnerability.setDescription(vulnerability.getDescription() + nextLine + "\n");
        +249                 }
        +250             }
        +251         }
        +252     }
        +253 
        +254     private void setVulnerabilityName(String parentName, Dependency dependency, Vulnerability vulnerability, String nextLine) {
        +255         final String advisory = nextLine.substring((ADVISORY.length()));
        +256         if (null != vulnerability) {
        +257             vulnerability.setName(advisory);
        +258         }
        +259         if (null != dependency) {
        +260             dependency.getVulnerabilities().add(vulnerability); // needed to wait for vulnerability name to avoid NPE
        +261         }
        +262         LOGGER.debug(String.format("bundle-audit (%s): %s", parentName, nextLine));
        +263     }
        +264 
        +265     private void addReferenceToVulnerability(String parentName, Vulnerability vulnerability, String nextLine) {
        +266         final String url = nextLine.substring(("URL: ").length());
        +267         if (null != vulnerability) {
        +268             Reference ref = new Reference();
        +269             ref.setName(vulnerability.getName());
        +270             ref.setSource("bundle-audit");
        +271             ref.setUrl(url);
        +272             vulnerability.getReferences().add(ref);
        +273         }
        +274         LOGGER.debug(String.format("bundle-audit (%s): %s", parentName, nextLine));
        +275     }
        +276 
        +277     private void addCriticalityToVulnerability(String parentName, Vulnerability vulnerability, String nextLine) {
        +278         if (null != vulnerability) {
        +279             final String criticality = nextLine.substring(CRITICALITY.length()).trim();
        +280             if ("High".equals(criticality)) {
        +281                 vulnerability.setCvssScore(8.5f);
        +282             } else if ("Medium".equals(criticality)) {
        +283                 vulnerability.setCvssScore(5.5f);
        +284             } else if ("Low".equals(criticality)) {
        +285                 vulnerability.setCvssScore(2.0f);
        +286             } else {
        +287                 vulnerability.setCvssScore(-1.0f);
        +288             }
        +289         }
        +290         LOGGER.debug(String.format("bundle-audit (%s): %s", parentName, nextLine));
        +291     }
        +292 
        +293     private Vulnerability createVulnerability(String parentName, Dependency dependency, Vulnerability vulnerability, String gem, String nextLine) {
        +294         if (null != dependency) {
        +295             final String version = nextLine.substring(VERSION.length());
        +296             dependency.getVersionEvidence().addEvidence(
        +297                     "bundler-audit",
        +298                     "Version",
        +299                     version,
        +300                     Confidence.HIGHEST);
        +301             vulnerability = new Vulnerability(); // don't add to dependency until we have name set later
        +302             vulnerability.setMatchedCPE(
        +303                     String.format("cpe:/a:%1$s_project:%1$s:%2$s::~~~ruby~~", gem, version),
        +304                     null);
        +305             vulnerability.setCvssAccessVector("-");
        +306             vulnerability.setCvssAccessComplexity("-");
        +307             vulnerability.setCvssAuthentication("-");
        +308             vulnerability.setCvssAvailabilityImpact("-");
        +309             vulnerability.setCvssConfidentialityImpact("-");
        +310             vulnerability.setCvssIntegrityImpact("-");
        +311         }
        +312         LOGGER.debug(String.format("bundle-audit (%s): %s", parentName, nextLine));
        +313         return vulnerability;
        +314     }
        +315 
        +316     private Dependency createDependencyForGem(Engine engine, String parentName, String fileName, String gem) throws IOException {
        +317         final File tempFile = File.createTempFile("Gemfile-" + gem, ".lock", Settings.getTempDirectory());
        +318         final String displayFileName = String.format("%s%c%s:%s", parentName, File.separatorChar, fileName, gem);
        +319         FileUtils.write(tempFile, displayFileName); // unique contents to avoid dependency bundling
        +320         final Dependency dependency = new Dependency(tempFile);
        +321         dependency.getProductEvidence().addEvidence("bundler-audit", "Name", gem, Confidence.HIGHEST);
        +322         dependency.setDisplayFileName(displayFileName);
        +323         engine.getDependencies().add(dependency);
        +324         return dependency;
        +325     }
        +326 }
        +
        +
        + + + diff --git a/xref/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzer.html b/xref/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzer.html index d167b5d5d..c5874acf8 100644 --- a/xref/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzer.html +++ b/xref/org/owasp/dependencycheck/analyzer/RubyGemspecAnalyzer.html @@ -57,115 +57,116 @@ 49 */ 50 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION; 51 -52 private static final FileFilter FILTER = -53 FileFilterBuilder.newInstance().addExtensions("gemspec").addFilenames("Rakefile").build(); -54 -55 private static final String EMAIL = "email"; -56 private static final String GEMSPEC = "gemspec"; -57 -58 /** -59 * @return a filter that accepts files named Rakefile or matching the glob pattern, *.gemspec -60 */ -61 @Override -62 protected FileFilter getFileFilter() { -63 return FILTER; -64 } -65 -66 @Override -67 protected void initializeFileTypeAnalyzer() throws Exception { -68 // NO-OP -69 } -70 -71 /** -72 * Returns the name of the analyzer. -73 * -74 * @return the name of the analyzer. -75 */ -76 @Override -77 public String getName() { -78 return ANALYZER_NAME; -79 } -80 -81 /** -82 * Returns the phase that the analyzer is intended to run in. -83 * -84 * @return the phase that the analyzer is intended to run in. -85 */ -86 @Override -87 public AnalysisPhase getAnalysisPhase() { -88 return ANALYSIS_PHASE; -89 } -90 -91 /** -92 * Returns the key used in the properties file to reference the analyzer's enabled property. -93 * -94 * @return the analyzer's enabled property setting key -95 */ -96 @Override -97 protected String getAnalyzerEnabledSettingKey() { -98 return Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED; -99 } -100 -101 /** -102 * The capture group #1 is the block variable. -103 */ -104 private static final Pattern GEMSPEC_BLOCK_INIT = -105 Pattern.compile("Gem::Specification\\.new\\s+?do\\s+?\\|(.+?)\\|"); -106 -107 @Override -108 protected void analyzeFileType(Dependency dependency, Engine engine) -109 throws AnalysisException { -110 String contents; -111 try { -112 contents = FileUtils.readFileToString(dependency.getActualFile()); -113 } catch (IOException e) { -114 throw new AnalysisException( -115 "Problem occurred while reading dependency file.", e); -116 } -117 final Matcher matcher = GEMSPEC_BLOCK_INIT.matcher(contents); -118 if (matcher.find()) { -119 contents = contents.substring(matcher.end()); -120 final String blockVariable = matcher.group(1); -121 final EvidenceCollection vendor = dependency.getVendorEvidence(); -122 addStringEvidence(vendor, contents, blockVariable, "author", Confidence.HIGHEST); -123 addListEvidence(vendor, contents, blockVariable, "authors", Confidence.HIGHEST); -124 final String email = addStringEvidence(vendor, contents, blockVariable, EMAIL, Confidence.MEDIUM); -125 if (email.isEmpty()) { -126 addListEvidence(vendor, contents, blockVariable, EMAIL, Confidence.MEDIUM); -127 } -128 addStringEvidence(vendor, contents, blockVariable, "homepage", Confidence.MEDIUM); -129 final EvidenceCollection product = dependency.getProductEvidence(); -130 final String name = addStringEvidence(product, contents, blockVariable, "name", Confidence.HIGHEST); -131 if (!name.isEmpty()) { -132 vendor.addEvidence(GEMSPEC, "name_project", name + "_project", Confidence.LOW); -133 } -134 addStringEvidence(product, contents, blockVariable, "summary", Confidence.LOW); -135 addStringEvidence(dependency.getVersionEvidence(), contents, blockVariable, "version", Confidence.HIGHEST); -136 } -137 } -138 -139 private void addListEvidence(EvidenceCollection evidences, String contents, -140 String blockVariable, String field, Confidence confidence) { -141 final Matcher matcher = Pattern.compile( -142 String.format("\\s+?%s\\.%s\\s*?=\\s*?\\[(.*?)\\]", blockVariable, field)).matcher(contents); -143 if (matcher.find()) { -144 final String value = matcher.group(1).replaceAll("['\"]", " ").trim(); -145 evidences.addEvidence(GEMSPEC, field, value, confidence); -146 } -147 } -148 -149 private String addStringEvidence(EvidenceCollection evidences, String contents, -150 String blockVariable, String field, Confidence confidence) { -151 final Matcher matcher = Pattern.compile( -152 String.format("\\s+?%s\\.%s\\s*?=\\s*?(['\"])(.*?)\\1", blockVariable, field)).matcher(contents); -153 String value = ""; -154 if (matcher.find()) { -155 value = matcher.group(2); -156 evidences.addEvidence(GEMSPEC, field, value, confidence); -157 } -158 return value; -159 } -160 } +52 private static final String GEMSPEC = "gemspec"; +53 +54 private static final FileFilter FILTER = +55 FileFilterBuilder.newInstance().addExtensions(GEMSPEC).addFilenames("Rakefile").build(); +56 +57 private static final String EMAIL = "email"; +58 +59 /** +60 * @return a filter that accepts files named Rakefile or matching the glob pattern, *.gemspec +61 */ +62 @Override +63 protected FileFilter getFileFilter() { +64 return FILTER; +65 } +66 +67 @Override +68 protected void initializeFileTypeAnalyzer() throws Exception { +69 // NO-OP +70 } +71 +72 /** +73 * Returns the name of the analyzer. +74 * +75 * @return the name of the analyzer. +76 */ +77 @Override +78 public String getName() { +79 return ANALYZER_NAME; +80 } +81 +82 /** +83 * Returns the phase that the analyzer is intended to run in. +84 * +85 * @return the phase that the analyzer is intended to run in. +86 */ +87 @Override +88 public AnalysisPhase getAnalysisPhase() { +89 return ANALYSIS_PHASE; +90 } +91 +92 /** +93 * Returns the key used in the properties file to reference the analyzer's enabled property. +94 * +95 * @return the analyzer's enabled property setting key +96 */ +97 @Override +98 protected String getAnalyzerEnabledSettingKey() { +99 return Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED; +100 } +101 +102 /** +103 * The capture group #1 is the block variable. +104 */ +105 private static final Pattern GEMSPEC_BLOCK_INIT = +106 Pattern.compile("Gem::Specification\\.new\\s+?do\\s+?\\|(.+?)\\|"); +107 +108 @Override +109 protected void analyzeFileType(Dependency dependency, Engine engine) +110 throws AnalysisException { +111 String contents; +112 try { +113 contents = FileUtils.readFileToString(dependency.getActualFile()); +114 } catch (IOException e) { +115 throw new AnalysisException( +116 "Problem occurred while reading dependency file.", e); +117 } +118 final Matcher matcher = GEMSPEC_BLOCK_INIT.matcher(contents); +119 if (matcher.find()) { +120 contents = contents.substring(matcher.end()); +121 final String blockVariable = matcher.group(1); +122 final EvidenceCollection vendor = dependency.getVendorEvidence(); +123 addStringEvidence(vendor, contents, blockVariable, "author", Confidence.HIGHEST); +124 addListEvidence(vendor, contents, blockVariable, "authors", Confidence.HIGHEST); +125 final String email = addStringEvidence(vendor, contents, blockVariable, EMAIL, Confidence.MEDIUM); +126 if (email.isEmpty()) { +127 addListEvidence(vendor, contents, blockVariable, EMAIL, Confidence.MEDIUM); +128 } +129 addStringEvidence(vendor, contents, blockVariable, "homepage", Confidence.MEDIUM); +130 final EvidenceCollection product = dependency.getProductEvidence(); +131 final String name = addStringEvidence(product, contents, blockVariable, "name", Confidence.HIGHEST); +132 if (!name.isEmpty()) { +133 vendor.addEvidence(GEMSPEC, "name_project", name + "_project", Confidence.LOW); +134 } +135 addStringEvidence(product, contents, blockVariable, "summary", Confidence.LOW); +136 addStringEvidence(dependency.getVersionEvidence(), contents, blockVariable, "version", Confidence.HIGHEST); +137 } +138 } +139 +140 private void addListEvidence(EvidenceCollection evidences, String contents, +141 String blockVariable, String field, Confidence confidence) { +142 final Matcher matcher = Pattern.compile( +143 String.format("\\s+?%s\\.%s\\s*?=\\s*?\\[(.*?)\\]", blockVariable, field)).matcher(contents); +144 if (matcher.find()) { +145 final String value = matcher.group(1).replaceAll("['\"]", " ").trim(); +146 evidences.addEvidence(GEMSPEC, field, value, confidence); +147 } +148 } +149 +150 private String addStringEvidence(EvidenceCollection evidences, String contents, +151 String blockVariable, String field, Confidence confidence) { +152 final Matcher matcher = Pattern.compile( +153 String.format("\\s+?%s\\.%s\\s*?=\\s*?(['\"])(.*?)\\1", blockVariable, field)).matcher(contents); +154 String value = ""; +155 if (matcher.find()) { +156 value = matcher.group(2); +157 evidences.addEvidence(GEMSPEC, field, value, confidence); +158 } +159 return value; +160 } +161 }
        diff --git a/xref/org/owasp/dependencycheck/analyzer/exception/package-frame.html b/xref/org/owasp/dependencycheck/analyzer/exception/package-frame.html index 9637fed2f..aeb6bf3a2 100644 --- a/xref/org/owasp/dependencycheck/analyzer/exception/package-frame.html +++ b/xref/org/owasp/dependencycheck/analyzer/exception/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.analyzer.exception + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.analyzer.exception diff --git a/xref/org/owasp/dependencycheck/analyzer/exception/package-summary.html b/xref/org/owasp/dependencycheck/analyzer/exception/package-summary.html index 531efa36f..d0407a83d 100644 --- a/xref/org/owasp/dependencycheck/analyzer/exception/package-summary.html +++ b/xref/org/owasp/dependencycheck/analyzer/exception/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.analyzer.exception + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.analyzer.exception diff --git a/xref/org/owasp/dependencycheck/analyzer/package-frame.html b/xref/org/owasp/dependencycheck/analyzer/package-frame.html index 6e69d80e3..b9fe6f599 100644 --- a/xref/org/owasp/dependencycheck/analyzer/package-frame.html +++ b/xref/org/owasp/dependencycheck/analyzer/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.analyzer + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.analyzer @@ -104,6 +104,9 @@
      • PythonPackageAnalyzer +
      • +
      • + RubyBundleAuditAnalyzer
      • RubyGemspecAnalyzer diff --git a/xref/org/owasp/dependencycheck/analyzer/package-summary.html b/xref/org/owasp/dependencycheck/analyzer/package-summary.html index b76eafb3a..997656b9c 100644 --- a/xref/org/owasp/dependencycheck/analyzer/package-summary.html +++ b/xref/org/owasp/dependencycheck/analyzer/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.analyzer + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.analyzer @@ -184,6 +184,11 @@
      • + + + - - - + + +
        PythonPackageAnalyzer
        + RubyBundleAuditAnalyzer +
        diff --git a/xref/org/owasp/dependencycheck/ant/logging/AntLoggerAdapter.html b/xref/org/owasp/dependencycheck/ant/logging/AntLoggerAdapter.html index b5a8a218b..244219cfa 100644 --- a/xref/org/owasp/dependencycheck/ant/logging/AntLoggerAdapter.html +++ b/xref/org/owasp/dependencycheck/ant/logging/AntLoggerAdapter.html @@ -71,212 +71,214 @@ 63 64 @Override 65 public void trace(String msg) { -66 task.log(msg, Project.MSG_VERBOSE); -67 } -68 -69 @Override -70 public void trace(String format, Object arg) { -71 if (task != null) { -72 final FormattingTuple tp = MessageFormatter.format(format, arg); -73 task.log(tp.getMessage(), Project.MSG_VERBOSE); -74 } -75 } -76 -77 @Override -78 public void trace(String format, Object arg1, Object arg2) { -79 if (task != null) { -80 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); -81 task.log(tp.getMessage(), Project.MSG_VERBOSE); -82 } -83 } -84 -85 @Override -86 public void trace(String format, Object... arguments) { -87 if (task != null) { -88 final FormattingTuple tp = MessageFormatter.format(format, arguments); -89 task.log(tp.getMessage(), Project.MSG_VERBOSE); -90 } -91 } -92 -93 @Override -94 public void trace(String msg, Throwable t) { -95 if (task != null) { -96 task.log(msg, t, Project.MSG_VERBOSE); -97 } -98 } -99 -100 @Override -101 public boolean isDebugEnabled() { -102 return true; -103 } -104 -105 @Override -106 public void debug(String msg) { -107 if (task != null) { -108 task.log(msg, Project.MSG_DEBUG); -109 } -110 } -111 -112 @Override -113 public void debug(String format, Object arg) { -114 if (task != null) { -115 final FormattingTuple tp = MessageFormatter.format(format, arg); -116 task.log(tp.getMessage(), Project.MSG_DEBUG); -117 } -118 } -119 -120 @Override -121 public void debug(String format, Object arg1, Object arg2) { -122 if (task != null) { -123 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); -124 task.log(tp.getMessage(), Project.MSG_DEBUG); -125 } -126 } -127 -128 @Override -129 public void debug(String format, Object... arguments) { -130 if (task != null) { -131 final FormattingTuple tp = MessageFormatter.format(format, arguments); -132 task.log(tp.getMessage(), Project.MSG_DEBUG); -133 } -134 } -135 -136 @Override -137 public void debug(String msg, Throwable t) { -138 if (task != null) { -139 task.log(msg, t, Project.MSG_DEBUG); -140 } -141 } -142 -143 @Override -144 public boolean isInfoEnabled() { -145 return true; -146 } -147 -148 @Override -149 public void info(String msg) { -150 if (task != null) { -151 task.log(msg, Project.MSG_INFO); -152 } -153 } -154 -155 @Override -156 public void info(String format, Object arg) { -157 if (task != null) { -158 final FormattingTuple tp = MessageFormatter.format(format, arg); -159 task.log(tp.getMessage(), Project.MSG_INFO); -160 } -161 } -162 -163 @Override -164 public void info(String format, Object arg1, Object arg2) { -165 if (task != null) { -166 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); -167 task.log(tp.getMessage(), Project.MSG_INFO); -168 } -169 } -170 -171 @Override -172 public void info(String format, Object... arguments) { -173 if (task != null) { -174 final FormattingTuple tp = MessageFormatter.format(format, arguments); -175 task.log(tp.getMessage(), Project.MSG_INFO); -176 } -177 } -178 -179 @Override -180 public void info(String msg, Throwable t) { -181 if (task != null) { -182 task.log(msg, t, Project.MSG_INFO); -183 } -184 } -185 -186 @Override -187 public boolean isWarnEnabled() { -188 return true; -189 } -190 -191 @Override -192 public void warn(String msg) { -193 if (task != null) { -194 task.log(msg, Project.MSG_WARN); -195 } -196 } -197 -198 @Override -199 public void warn(String format, Object arg) { -200 if (task != null) { -201 final FormattingTuple tp = MessageFormatter.format(format, arg); -202 task.log(tp.getMessage(), Project.MSG_WARN); -203 } -204 } -205 -206 @Override -207 public void warn(String format, Object... arguments) { -208 if (task != null) { -209 final FormattingTuple tp = MessageFormatter.format(format, arguments); -210 task.log(tp.getMessage(), Project.MSG_WARN); -211 } -212 } -213 -214 @Override -215 public void warn(String format, Object arg1, Object arg2) { -216 if (task != null) { -217 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); -218 task.log(tp.getMessage(), Project.MSG_WARN); -219 } -220 } -221 -222 @Override -223 public void warn(String msg, Throwable t) { -224 if (task != null) { -225 task.log(msg, t, Project.MSG_WARN); -226 } -227 } -228 -229 @Override -230 public boolean isErrorEnabled() { -231 return true; -232 } -233 -234 @Override -235 public void error(String msg) { -236 if (task != null) { -237 task.log(msg, Project.MSG_ERR); -238 } -239 } -240 -241 @Override -242 public void error(String format, Object arg) { -243 if (task != null) { -244 final FormattingTuple tp = MessageFormatter.format(format, arg); -245 task.log(tp.getMessage(), Project.MSG_ERR); -246 } -247 } -248 -249 @Override -250 public void error(String format, Object arg1, Object arg2) { -251 if (task != null) { -252 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); -253 task.log(tp.getMessage(), Project.MSG_ERR); -254 } -255 } -256 -257 @Override -258 public void error(String format, Object... arguments) { -259 if (task != null) { -260 final FormattingTuple tp = MessageFormatter.format(format, arguments); -261 task.log(tp.getMessage(), Project.MSG_ERR); -262 } -263 } -264 -265 @Override -266 public void error(String msg, Throwable t) { -267 if (task != null) { -268 task.log(msg, t, Project.MSG_ERR); -269 } -270 } -271 } +66 if (task != null) { +67 task.log(msg, Project.MSG_VERBOSE); +68 } +69 } +70 +71 @Override +72 public void trace(String format, Object arg) { +73 if (task != null) { +74 final FormattingTuple tp = MessageFormatter.format(format, arg); +75 task.log(tp.getMessage(), Project.MSG_VERBOSE); +76 } +77 } +78 +79 @Override +80 public void trace(String format, Object arg1, Object arg2) { +81 if (task != null) { +82 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); +83 task.log(tp.getMessage(), Project.MSG_VERBOSE); +84 } +85 } +86 +87 @Override +88 public void trace(String format, Object... arguments) { +89 if (task != null) { +90 final FormattingTuple tp = MessageFormatter.format(format, arguments); +91 task.log(tp.getMessage(), Project.MSG_VERBOSE); +92 } +93 } +94 +95 @Override +96 public void trace(String msg, Throwable t) { +97 if (task != null) { +98 task.log(msg, t, Project.MSG_VERBOSE); +99 } +100 } +101 +102 @Override +103 public boolean isDebugEnabled() { +104 return true; +105 } +106 +107 @Override +108 public void debug(String msg) { +109 if (task != null) { +110 task.log(msg, Project.MSG_DEBUG); +111 } +112 } +113 +114 @Override +115 public void debug(String format, Object arg) { +116 if (task != null) { +117 final FormattingTuple tp = MessageFormatter.format(format, arg); +118 task.log(tp.getMessage(), Project.MSG_DEBUG); +119 } +120 } +121 +122 @Override +123 public void debug(String format, Object arg1, Object arg2) { +124 if (task != null) { +125 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); +126 task.log(tp.getMessage(), Project.MSG_DEBUG); +127 } +128 } +129 +130 @Override +131 public void debug(String format, Object... arguments) { +132 if (task != null) { +133 final FormattingTuple tp = MessageFormatter.format(format, arguments); +134 task.log(tp.getMessage(), Project.MSG_DEBUG); +135 } +136 } +137 +138 @Override +139 public void debug(String msg, Throwable t) { +140 if (task != null) { +141 task.log(msg, t, Project.MSG_DEBUG); +142 } +143 } +144 +145 @Override +146 public boolean isInfoEnabled() { +147 return true; +148 } +149 +150 @Override +151 public void info(String msg) { +152 if (task != null) { +153 task.log(msg, Project.MSG_INFO); +154 } +155 } +156 +157 @Override +158 public void info(String format, Object arg) { +159 if (task != null) { +160 final FormattingTuple tp = MessageFormatter.format(format, arg); +161 task.log(tp.getMessage(), Project.MSG_INFO); +162 } +163 } +164 +165 @Override +166 public void info(String format, Object arg1, Object arg2) { +167 if (task != null) { +168 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); +169 task.log(tp.getMessage(), Project.MSG_INFO); +170 } +171 } +172 +173 @Override +174 public void info(String format, Object... arguments) { +175 if (task != null) { +176 final FormattingTuple tp = MessageFormatter.format(format, arguments); +177 task.log(tp.getMessage(), Project.MSG_INFO); +178 } +179 } +180 +181 @Override +182 public void info(String msg, Throwable t) { +183 if (task != null) { +184 task.log(msg, t, Project.MSG_INFO); +185 } +186 } +187 +188 @Override +189 public boolean isWarnEnabled() { +190 return true; +191 } +192 +193 @Override +194 public void warn(String msg) { +195 if (task != null) { +196 task.log(msg, Project.MSG_WARN); +197 } +198 } +199 +200 @Override +201 public void warn(String format, Object arg) { +202 if (task != null) { +203 final FormattingTuple tp = MessageFormatter.format(format, arg); +204 task.log(tp.getMessage(), Project.MSG_WARN); +205 } +206 } +207 +208 @Override +209 public void warn(String format, Object... arguments) { +210 if (task != null) { +211 final FormattingTuple tp = MessageFormatter.format(format, arguments); +212 task.log(tp.getMessage(), Project.MSG_WARN); +213 } +214 } +215 +216 @Override +217 public void warn(String format, Object arg1, Object arg2) { +218 if (task != null) { +219 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); +220 task.log(tp.getMessage(), Project.MSG_WARN); +221 } +222 } +223 +224 @Override +225 public void warn(String msg, Throwable t) { +226 if (task != null) { +227 task.log(msg, t, Project.MSG_WARN); +228 } +229 } +230 +231 @Override +232 public boolean isErrorEnabled() { +233 return true; +234 } +235 +236 @Override +237 public void error(String msg) { +238 if (task != null) { +239 task.log(msg, Project.MSG_ERR); +240 } +241 } +242 +243 @Override +244 public void error(String format, Object arg) { +245 if (task != null) { +246 final FormattingTuple tp = MessageFormatter.format(format, arg); +247 task.log(tp.getMessage(), Project.MSG_ERR); +248 } +249 } +250 +251 @Override +252 public void error(String format, Object arg1, Object arg2) { +253 if (task != null) { +254 final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); +255 task.log(tp.getMessage(), Project.MSG_ERR); +256 } +257 } +258 +259 @Override +260 public void error(String format, Object... arguments) { +261 if (task != null) { +262 final FormattingTuple tp = MessageFormatter.format(format, arguments); +263 task.log(tp.getMessage(), Project.MSG_ERR); +264 } +265 } +266 +267 @Override +268 public void error(String msg, Throwable t) { +269 if (task != null) { +270 task.log(msg, t, Project.MSG_ERR); +271 } +272 } +273 }
        diff --git a/xref/org/owasp/dependencycheck/ant/logging/package-frame.html b/xref/org/owasp/dependencycheck/ant/logging/package-frame.html index 8d5424696..f77c004d6 100644 --- a/xref/org/owasp/dependencycheck/ant/logging/package-frame.html +++ b/xref/org/owasp/dependencycheck/ant/logging/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.ant.logging + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.ant.logging diff --git a/xref/org/owasp/dependencycheck/ant/logging/package-summary.html b/xref/org/owasp/dependencycheck/ant/logging/package-summary.html index 2f28588d4..b9885ce7f 100644 --- a/xref/org/owasp/dependencycheck/ant/logging/package-summary.html +++ b/xref/org/owasp/dependencycheck/ant/logging/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.ant.logging + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.ant.logging diff --git a/xref/org/owasp/dependencycheck/data/central/CentralSearch.html b/xref/org/owasp/dependencycheck/data/central/CentralSearch.html index d5d762529..95f926224 100644 --- a/xref/org/owasp/dependencycheck/data/central/CentralSearch.html +++ b/xref/org/owasp/dependencycheck/data/central/CentralSearch.html @@ -98,7 +98,7 @@ 90 91 final URL url = new URL(rootURL + String.format("?q=1:\"%s\"&wt=xml", sha1)); 92 -93 LOGGER.debug("Searching Central url {}", url.toString()); +93 LOGGER.debug("Searching Central url {}", url); 94 95 // Determine if we need to use a proxy. The rules: 96 // 1) If the proxy is set, AND the setting is set to true, use the proxy diff --git a/xref/org/owasp/dependencycheck/data/central/package-frame.html b/xref/org/owasp/dependencycheck/data/central/package-frame.html index d7a9d2448..0ab757b75 100644 --- a/xref/org/owasp/dependencycheck/data/central/package-frame.html +++ b/xref/org/owasp/dependencycheck/data/central/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.central + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.central diff --git a/xref/org/owasp/dependencycheck/data/central/package-summary.html b/xref/org/owasp/dependencycheck/data/central/package-summary.html index 509b434dd..753d0882e 100644 --- a/xref/org/owasp/dependencycheck/data/central/package-summary.html +++ b/xref/org/owasp/dependencycheck/data/central/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.central + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.central diff --git a/xref/org/owasp/dependencycheck/data/composer/ComposerException.html b/xref/org/owasp/dependencycheck/data/composer/ComposerException.html index 087f8e3d4..4ecd7dd23 100644 --- a/xref/org/owasp/dependencycheck/data/composer/ComposerException.html +++ b/xref/org/owasp/dependencycheck/data/composer/ComposerException.html @@ -33,31 +33,36 @@ 25 public class ComposerException extends RuntimeException { 26 27 /** -28 * Creates a ComposerException with default message. +28 * The serial version UID for serialization. 29 */ -30 public ComposerException() { -31 super(); -32 } -33 -34 /** -35 * Creates a ComposerException with the specified message. -36 * -37 * @param message the exception message -38 */ -39 public ComposerException(String message) { -40 super(message); -41 } -42 -43 /** -44 * Creates a Composer exception with the specified message and cause. -45 * -46 * @param message the message -47 * @param cause the underlying cause -48 */ -49 public ComposerException(String message, Throwable cause) { -50 super(message, cause); -51 } -52 } +30 private static final long serialVersionUID = 1L; +31 +32 /** +33 * Creates a ComposerException with default message. +34 */ +35 public ComposerException() { +36 super(); +37 } +38 +39 /** +40 * Creates a ComposerException with the specified message. +41 * +42 * @param message the exception message +43 */ +44 public ComposerException(String message) { +45 super(message); +46 } +47 +48 /** +49 * Creates a Composer exception with the specified message and cause. +50 * +51 * @param message the message +52 * @param cause the underlying cause +53 */ +54 public ComposerException(String message, Throwable cause) { +55 super(message, cause); +56 } +57 }
        diff --git a/xref/org/owasp/dependencycheck/data/composer/package-frame.html b/xref/org/owasp/dependencycheck/data/composer/package-frame.html index b0f28c365..6108846e8 100644 --- a/xref/org/owasp/dependencycheck/data/composer/package-frame.html +++ b/xref/org/owasp/dependencycheck/data/composer/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.composer + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.composer diff --git a/xref/org/owasp/dependencycheck/data/composer/package-summary.html b/xref/org/owasp/dependencycheck/data/composer/package-summary.html index 41ccf8e03..655ac491e 100644 --- a/xref/org/owasp/dependencycheck/data/composer/package-summary.html +++ b/xref/org/owasp/dependencycheck/data/composer/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.composer + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.composer diff --git a/xref/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.html b/xref/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.html index 4ba9888f2..0ac991659 100644 --- a/xref/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.html +++ b/xref/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.html @@ -157,185 +157,177 @@ 149 * 150 * @return the CPE Analyzer. 151 */ -152 @SuppressWarnings("unchecked") -153 private Analyzer createIndexingAnalyzer() { -154 final Map<String, Analyzer> fieldAnalyzers = new HashMap<String, Analyzer>(); -155 fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer()); -156 return new PerFieldAnalyzerWrapper(new FieldAnalyzer(LuceneUtils.CURRENT_VERSION), fieldAnalyzers); -157 } -158 -159 /** -160 * Creates an Analyzer for searching the CPE Index. -161 * -162 * @return the CPE Analyzer. -163 */ -164 @SuppressWarnings("unchecked") -165 private Analyzer createSearchingAnalyzer() { -166 final Map<String, Analyzer> fieldAnalyzers = new HashMap<String, Analyzer>(); -167 fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer()); -168 productSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION); -169 vendorSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION); -170 fieldAnalyzers.put(Fields.PRODUCT, productSearchFieldAnalyzer); -171 fieldAnalyzers.put(Fields.VENDOR, vendorSearchFieldAnalyzer); -172 -173 return new PerFieldAnalyzerWrapper(new FieldAnalyzer(LuceneUtils.CURRENT_VERSION), fieldAnalyzers); -174 } -175 -176 /** -177 * Saves a CPE IndexEntry into the Lucene index. -178 * -179 * @param vendor the vendor to index -180 * @param product the product to index -181 * @param indexWriter the index writer to write the entry into -182 * @throws CorruptIndexException is thrown if the index is corrupt -183 * @throws IOException is thrown if an IOException occurs -184 */ -185 public void saveEntry(String vendor, String product, IndexWriter indexWriter) throws CorruptIndexException, IOException { -186 final Document doc = new Document(); -187 final Field v = new TextField(Fields.VENDOR, vendor, Field.Store.YES); -188 final Field p = new TextField(Fields.PRODUCT, product, Field.Store.YES); -189 doc.add(v); -190 doc.add(p); -191 indexWriter.addDocument(doc); -192 } -193 -194 /** -195 * Closes the CPE Index. -196 */ -197 public void close() { -198 if (searchingAnalyzer != null) { -199 searchingAnalyzer.close(); -200 searchingAnalyzer = null; -201 } -202 if (indexReader != null) { -203 try { -204 indexReader.close(); -205 } catch (IOException ex) { -206 LOGGER.trace("", ex); -207 } -208 indexReader = null; -209 } -210 queryParser = null; -211 indexSearcher = null; -212 if (index != null) { -213 index.close(); -214 index = null; -215 } -216 openState = false; -217 } -218 -219 /** -220 * Builds the CPE Lucene Index based off of the data within the CveDB. -221 * -222 * @param cve the data base containing the CPE data -223 * @throws IndexException thrown if there is an issue creating the index -224 */ -225 private void buildIndex(CveDB cve) throws IndexException { -226 Analyzer analyzer = null; -227 IndexWriter indexWriter = null; -228 try { -229 analyzer = createIndexingAnalyzer(); -230 final IndexWriterConfig conf = new IndexWriterConfig(LuceneUtils.CURRENT_VERSION, analyzer); -231 indexWriter = new IndexWriter(index, conf); -232 try { -233 final Set<Pair<String, String>> data = cve.getVendorProductList(); -234 for (Pair<String, String> pair : data) { -235 saveEntry(pair.getLeft(), pair.getRight(), indexWriter); -236 } -237 } catch (DatabaseException ex) { -238 LOGGER.debug("", ex); -239 throw new IndexException("Error reading CPE data", ex); -240 } -241 } catch (CorruptIndexException ex) { -242 throw new IndexException("Unable to close an in-memory index", ex); -243 } catch (IOException ex) { -244 throw new IndexException("Unable to close an in-memory index", ex); -245 } finally { -246 if (indexWriter != null) { -247 try { -248 try { -249 indexWriter.commit(); -250 } finally { -251 indexWriter.close(true); -252 } -253 } catch (CorruptIndexException ex) { -254 throw new IndexException("Unable to close an in-memory index", ex); -255 } catch (IOException ex) { -256 throw new IndexException("Unable to close an in-memory index", ex); -257 } -258 if (analyzer != null) { -259 analyzer.close(); -260 } -261 } +152 private Analyzer createIndexingAnalyzer() { +153 final Map<String, Analyzer> fieldAnalyzers = new HashMap<String, Analyzer>(); +154 fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer()); +155 return new PerFieldAnalyzerWrapper(new FieldAnalyzer(LuceneUtils.CURRENT_VERSION), fieldAnalyzers); +156 } +157 +158 /** +159 * Creates an Analyzer for searching the CPE Index. +160 * +161 * @return the CPE Analyzer. +162 */ +163 private Analyzer createSearchingAnalyzer() { +164 final Map<String, Analyzer> fieldAnalyzers = new HashMap<String, Analyzer>(); +165 fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer()); +166 productSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION); +167 vendorSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION); +168 fieldAnalyzers.put(Fields.PRODUCT, productSearchFieldAnalyzer); +169 fieldAnalyzers.put(Fields.VENDOR, vendorSearchFieldAnalyzer); +170 +171 return new PerFieldAnalyzerWrapper(new FieldAnalyzer(LuceneUtils.CURRENT_VERSION), fieldAnalyzers); +172 } +173 +174 /** +175 * Closes the CPE Index. +176 */ +177 public void close() { +178 if (searchingAnalyzer != null) { +179 searchingAnalyzer.close(); +180 searchingAnalyzer = null; +181 } +182 if (indexReader != null) { +183 try { +184 indexReader.close(); +185 } catch (IOException ex) { +186 LOGGER.trace("", ex); +187 } +188 indexReader = null; +189 } +190 queryParser = null; +191 indexSearcher = null; +192 if (index != null) { +193 index.close(); +194 index = null; +195 } +196 openState = false; +197 } +198 +199 /** +200 * Builds the CPE Lucene Index based off of the data within the CveDB. +201 * +202 * @param cve the data base containing the CPE data +203 * @throws IndexException thrown if there is an issue creating the index +204 */ +205 private void buildIndex(CveDB cve) throws IndexException { +206 Analyzer analyzer = null; +207 IndexWriter indexWriter = null; +208 try { +209 analyzer = createIndexingAnalyzer(); +210 final IndexWriterConfig conf = new IndexWriterConfig(LuceneUtils.CURRENT_VERSION, analyzer); +211 indexWriter = new IndexWriter(index, conf); +212 try { +213 // Tip: reuse the Document and Fields for performance... +214 // See "Re-use Document and Field instances" from +215 // http://wiki.apache.org/lucene-java/ImproveIndexingSpeed +216 final Document doc = new Document(); +217 final Field v = new TextField(Fields.VENDOR, Fields.VENDOR, Field.Store.YES); +218 final Field p = new TextField(Fields.PRODUCT, Fields.PRODUCT, Field.Store.YES); +219 doc.add(v); +220 doc.add(p); +221 +222 final Set<Pair<String, String>> data = cve.getVendorProductList(); +223 for (Pair<String, String> pair : data) { +224 v.setStringValue(pair.getLeft()); +225 p.setStringValue(pair.getRight()); +226 indexWriter.addDocument(doc); +227 } +228 } catch (DatabaseException ex) { +229 LOGGER.debug("", ex); +230 throw new IndexException("Error reading CPE data", ex); +231 } +232 } catch (CorruptIndexException ex) { +233 throw new IndexException("Unable to close an in-memory index", ex); +234 } catch (IOException ex) { +235 throw new IndexException("Unable to close an in-memory index", ex); +236 } finally { +237 if (indexWriter != null) { +238 try { +239 try { +240 indexWriter.commit(); +241 } finally { +242 indexWriter.close(true); +243 } +244 } catch (CorruptIndexException ex) { +245 throw new IndexException("Unable to close an in-memory index", ex); +246 } catch (IOException ex) { +247 throw new IndexException("Unable to close an in-memory index", ex); +248 } +249 if (analyzer != null) { +250 analyzer.close(); +251 } +252 } +253 } +254 } +255 +256 /** +257 * Resets the searching analyzers +258 */ +259 private void resetSearchingAnalyzer() { +260 if (productSearchFieldAnalyzer != null) { +261 productSearchFieldAnalyzer.clear(); 262 } -263 } -264 -265 /** -266 * Resets the searching analyzers -267 */ -268 private void resetSearchingAnalyzer() { -269 if (productSearchFieldAnalyzer != null) { -270 productSearchFieldAnalyzer.clear(); -271 } -272 if (vendorSearchFieldAnalyzer != null) { -273 vendorSearchFieldAnalyzer.clear(); -274 } -275 } -276 -277 /** -278 * Searches the index using the given search string. -279 * -280 * @param searchString the query text -281 * @param maxQueryResults the maximum number of documents to return -282 * @return the TopDocs found by the search -283 * @throws ParseException thrown when the searchString is invalid -284 * @throws IOException is thrown if there is an issue with the underlying Index -285 */ -286 public TopDocs search(String searchString, int maxQueryResults) throws ParseException, IOException { -287 if (searchString == null || searchString.trim().isEmpty()) { -288 throw new ParseException("Query is null or empty"); -289 } -290 final Query query = queryParser.parse(searchString); -291 return indexSearcher.search(query, maxQueryResults); -292 } -293 -294 /** -295 * Searches the index using the given query. -296 * -297 * @param query the query used to search the index -298 * @param maxQueryResults the max number of results to return -299 * @return the TopDocs found be the query -300 * @throws CorruptIndexException thrown if the Index is corrupt -301 * @throws IOException thrown if there is an IOException -302 */ -303 public TopDocs search(Query query, int maxQueryResults) throws CorruptIndexException, IOException { -304 resetSearchingAnalyzer(); -305 return indexSearcher.search(query, maxQueryResults); -306 } -307 -308 /** -309 * Retrieves a document from the Index. -310 * -311 * @param documentId the id of the document to retrieve -312 * @return the Document -313 * @throws IOException thrown if there is an IOException -314 */ -315 public Document getDocument(int documentId) throws IOException { -316 return indexSearcher.doc(documentId); -317 } -318 -319 /** -320 * Returns the number of CPE entries stored in the index. -321 * -322 * @return the number of CPE entries stored in the index -323 */ -324 public int numDocs() { -325 if (indexReader == null) { -326 return -1; -327 } -328 return indexReader.numDocs(); -329 } -330 } +263 if (vendorSearchFieldAnalyzer != null) { +264 vendorSearchFieldAnalyzer.clear(); +265 } +266 } +267 +268 /** +269 * Searches the index using the given search string. +270 * +271 * @param searchString the query text +272 * @param maxQueryResults the maximum number of documents to return +273 * @return the TopDocs found by the search +274 * @throws ParseException thrown when the searchString is invalid +275 * @throws IOException is thrown if there is an issue with the underlying Index +276 */ +277 public TopDocs search(String searchString, int maxQueryResults) throws ParseException, IOException { +278 if (searchString == null || searchString.trim().isEmpty()) { +279 throw new ParseException("Query is null or empty"); +280 } +281 LOGGER.debug(searchString); +282 final Query query = queryParser.parse(searchString); +283 return search(query, maxQueryResults); +284 } +285 +286 /** +287 * Searches the index using the given query. +288 * +289 * @param query the query used to search the index +290 * @param maxQueryResults the max number of results to return +291 * @return the TopDocs found be the query +292 * @throws CorruptIndexException thrown if the Index is corrupt +293 * @throws IOException thrown if there is an IOException +294 */ +295 public TopDocs search(Query query, int maxQueryResults) throws CorruptIndexException, IOException { +296 resetSearchingAnalyzer(); +297 return indexSearcher.search(query, maxQueryResults); +298 } +299 +300 /** +301 * Retrieves a document from the Index. +302 * +303 * @param documentId the id of the document to retrieve +304 * @return the Document +305 * @throws IOException thrown if there is an IOException +306 */ +307 public Document getDocument(int documentId) throws IOException { +308 return indexSearcher.doc(documentId); +309 } +310 +311 /** +312 * Returns the number of CPE entries stored in the index. +313 * +314 * @return the number of CPE entries stored in the index +315 */ +316 public int numDocs() { +317 if (indexReader == null) { +318 return -1; +319 } +320 return indexReader.numDocs(); +321 } +322 }
        diff --git a/xref/org/owasp/dependencycheck/data/cpe/IndexEntry.html b/xref/org/owasp/dependencycheck/data/cpe/IndexEntry.html index daf3733bc..77af07139 100644 --- a/xref/org/owasp/dependencycheck/data/cpe/IndexEntry.html +++ b/xref/org/owasp/dependencycheck/data/cpe/IndexEntry.html @@ -56,7 +56,7 @@ 48 */ 49 public String getDocumentId() { 50 if (documentId == null && vendor != null && product != null) { -51 documentId = vendor + ":" + product; +51 documentId = vendor + ':' + product; 52 } 53 return documentId; 54 } diff --git a/xref/org/owasp/dependencycheck/data/cpe/package-frame.html b/xref/org/owasp/dependencycheck/data/cpe/package-frame.html index 407cefaf2..02d9c7f5a 100644 --- a/xref/org/owasp/dependencycheck/data/cpe/package-frame.html +++ b/xref/org/owasp/dependencycheck/data/cpe/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.cpe + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.cpe diff --git a/xref/org/owasp/dependencycheck/data/cpe/package-summary.html b/xref/org/owasp/dependencycheck/data/cpe/package-summary.html index 90f45aef9..83ea08bac 100644 --- a/xref/org/owasp/dependencycheck/data/cpe/package-summary.html +++ b/xref/org/owasp/dependencycheck/data/cpe/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.cpe + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.cpe diff --git a/xref/org/owasp/dependencycheck/data/cwe/package-frame.html b/xref/org/owasp/dependencycheck/data/cwe/package-frame.html index 6e14ed262..718260ff0 100644 --- a/xref/org/owasp/dependencycheck/data/cwe/package-frame.html +++ b/xref/org/owasp/dependencycheck/data/cwe/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.cwe + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.cwe diff --git a/xref/org/owasp/dependencycheck/data/cwe/package-summary.html b/xref/org/owasp/dependencycheck/data/cwe/package-summary.html index 53d379d10..745d86be3 100644 --- a/xref/org/owasp/dependencycheck/data/cwe/package-summary.html +++ b/xref/org/owasp/dependencycheck/data/cwe/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.cwe + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.cwe diff --git a/xref/org/owasp/dependencycheck/data/lucene/LuceneUtils.html b/xref/org/owasp/dependencycheck/data/lucene/LuceneUtils.html index 3961455fe..c0079b677 100644 --- a/xref/org/owasp/dependencycheck/data/lucene/LuceneUtils.html +++ b/xref/org/owasp/dependencycheck/data/lucene/LuceneUtils.html @@ -85,31 +85,32 @@ 77 case '*': 78 case '?': 79 case ':': -80 case '\\': //it is supposed to fall through here -81 buf.append('\\'); -82 default: -83 buf.append(c); -84 break; -85 } -86 } -87 } -88 -89 /** -90 * Escapes the text passed in so that it is treated as data instead of control characters. -91 * -92 * @param text data to be escaped -93 * @return the escaped text. -94 */ -95 public static String escapeLuceneQuery(final CharSequence text) { -96 if (text == null) { -97 return null; -98 } -99 final int size = text.length() << 1; -100 final StringBuilder buf = new StringBuilder(size); -101 appendEscapedLuceneQuery(buf, text); -102 return buf.toString(); -103 } -104 } +80 case '/': +81 case '\\': //it is supposed to fall through here +82 buf.append('\\'); +83 default: +84 buf.append(c); +85 break; +86 } +87 } +88 } +89 +90 /** +91 * Escapes the text passed in so that it is treated as data instead of control characters. +92 * +93 * @param text data to be escaped +94 * @return the escaped text. +95 */ +96 public static String escapeLuceneQuery(final CharSequence text) { +97 if (text == null) { +98 return null; +99 } +100 final int size = text.length() << 1; +101 final StringBuilder buf = new StringBuilder(size); +102 appendEscapedLuceneQuery(buf, text); +103 return buf.toString(); +104 } +105 }
        diff --git a/xref/org/owasp/dependencycheck/data/lucene/package-frame.html b/xref/org/owasp/dependencycheck/data/lucene/package-frame.html index 472d28998..6ec40a8ea 100644 --- a/xref/org/owasp/dependencycheck/data/lucene/package-frame.html +++ b/xref/org/owasp/dependencycheck/data/lucene/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.lucene + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.lucene diff --git a/xref/org/owasp/dependencycheck/data/lucene/package-summary.html b/xref/org/owasp/dependencycheck/data/lucene/package-summary.html index 1c2b13fb1..44032e5ac 100644 --- a/xref/org/owasp/dependencycheck/data/lucene/package-summary.html +++ b/xref/org/owasp/dependencycheck/data/lucene/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.lucene + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.lucene diff --git a/xref/org/owasp/dependencycheck/data/nexus/MavenArtifact.html b/xref/org/owasp/dependencycheck/data/nexus/MavenArtifact.html index f7785fb88..ae7153b9e 100644 --- a/xref/org/owasp/dependencycheck/data/nexus/MavenArtifact.html +++ b/xref/org/owasp/dependencycheck/data/nexus/MavenArtifact.html @@ -102,13 +102,13 @@ 94 } 95 if (jarAvailable) { 96 //org/springframework/spring-core/3.2.0.RELEASE/spring-core-3.2.0.RELEASE.pom -97 this.artifactUrl = base + groupId.replace('.', '/') + "/" + artifactId + "/" -98 + version + "/" + artifactId + "-" + version + ".jar"; +97 this.artifactUrl = base + groupId.replace('.', '/') + '/' + artifactId + '/' +98 + version + '/' + artifactId + '-' + version + ".jar"; 99 } 100 if (pomAvailable) { 101 //org/springframework/spring-core/3.2.0.RELEASE/spring-core-3.2.0.RELEASE.pom -102 this.pomUrl = base + groupId.replace('.', '/') + "/" + artifactId + "/" -103 + version + "/" + artifactId + "-" + version + ".pom"; +102 this.pomUrl = base + groupId.replace('.', '/') + '/' + artifactId + '/' +103 + version + '/' + artifactId + '-' + version + ".pom"; 104 } 105 } 106 diff --git a/xref/org/owasp/dependencycheck/data/nexus/NexusSearch.html b/xref/org/owasp/dependencycheck/data/nexus/NexusSearch.html index e0cb9e61f..90af5b8ea 100644 --- a/xref/org/owasp/dependencycheck/data/nexus/NexusSearch.html +++ b/xref/org/owasp/dependencycheck/data/nexus/NexusSearch.html @@ -71,7 +71,7 @@ 63 this.rootURL = rootURL; 64 try { 65 if (null != Settings.getString(Settings.KEYS.PROXY_SERVER) -66 && Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY)) { +66 && Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY)) { 67 useProxy = true; 68 LOGGER.debug("Using proxy"); 69 } else { diff --git a/xref/org/owasp/dependencycheck/data/nexus/package-frame.html b/xref/org/owasp/dependencycheck/data/nexus/package-frame.html index 1fda5258c..ed0421ea6 100644 --- a/xref/org/owasp/dependencycheck/data/nexus/package-frame.html +++ b/xref/org/owasp/dependencycheck/data/nexus/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.nexus + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.nexus diff --git a/xref/org/owasp/dependencycheck/data/nexus/package-summary.html b/xref/org/owasp/dependencycheck/data/nexus/package-summary.html index 2306e7c8a..030243780 100644 --- a/xref/org/owasp/dependencycheck/data/nexus/package-summary.html +++ b/xref/org/owasp/dependencycheck/data/nexus/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.nexus + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.nexus diff --git a/xref/org/owasp/dependencycheck/data/nuget/package-frame.html b/xref/org/owasp/dependencycheck/data/nuget/package-frame.html index ac3b9842e..41586e34a 100644 --- a/xref/org/owasp/dependencycheck/data/nuget/package-frame.html +++ b/xref/org/owasp/dependencycheck/data/nuget/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.nuget + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.nuget diff --git a/xref/org/owasp/dependencycheck/data/nuget/package-summary.html b/xref/org/owasp/dependencycheck/data/nuget/package-summary.html index e47426207..8d35e8886 100644 --- a/xref/org/owasp/dependencycheck/data/nuget/package-summary.html +++ b/xref/org/owasp/dependencycheck/data/nuget/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.nuget + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.nuget diff --git a/xref/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.html b/xref/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.html index d61c01ae9..937de68c8 100644 --- a/xref/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.html +++ b/xref/org/owasp/dependencycheck/data/nvdcve/ConnectionFactory.html @@ -25,350 +25,353 @@ 17 */ 18 package org.owasp.dependencycheck.data.nvdcve; 19 -20 import java.io.BufferedReader; -21 import java.io.File; -22 import java.io.IOException; -23 import java.io.InputStream; -24 import java.io.InputStreamReader; -25 import java.sql.CallableStatement; -26 import java.sql.Connection; -27 import java.sql.Driver; -28 import java.sql.DriverManager; -29 import java.sql.ResultSet; -30 import java.sql.SQLException; -31 import java.sql.Statement; -32 import org.owasp.dependencycheck.utils.DBUtils; -33 import org.owasp.dependencycheck.utils.Settings; -34 import org.slf4j.Logger; -35 import org.slf4j.LoggerFactory; -36 -37 /** -38 * Loads the configured database driver and returns the database connection. If the embedded H2 database is used obtaining a -39 * connection will ensure the database file exists and that the appropriate table structure has been created. -40 * -41 * @author Jeremy Long -42 */ -43 public final class ConnectionFactory { -44 -45 /** -46 * The Logger. -47 */ -48 private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionFactory.class); -49 /** -50 * The version of the current DB Schema. -51 */ -52 public static final String DB_SCHEMA_VERSION = Settings.getString(Settings.KEYS.DB_VERSION); -53 /** -54 * Resource location for SQL file used to create the database schema. -55 */ -56 public static final String DB_STRUCTURE_RESOURCE = "data/initialize.sql"; -57 /** -58 * Resource location for SQL file used to create the database schema. -59 */ -60 public static final String DB_STRUCTURE_UPDATE_RESOURCE = "data/upgrade_%s.sql"; -61 /** -62 * The database driver used to connect to the database. -63 */ -64 private static Driver driver = null; -65 /** -66 * The database connection string. -67 */ -68 private static String connectionString = null; -69 /** -70 * The username to connect to the database. -71 */ -72 private static String userName = null; -73 /** -74 * The password for the database. -75 */ -76 private static String password = null; -77 +20 import java.io.File; +21 import java.io.IOException; +22 import java.io.InputStream; +23 import java.sql.CallableStatement; +24 import java.sql.Connection; +25 import java.sql.Driver; +26 import java.sql.DriverManager; +27 import java.sql.ResultSet; +28 import java.sql.SQLException; +29 import java.sql.Statement; +30 import org.apache.commons.io.IOUtils; +31 import org.owasp.dependencycheck.utils.DBUtils; +32 import org.owasp.dependencycheck.utils.DependencyVersion; +33 import org.owasp.dependencycheck.utils.DependencyVersionUtil; +34 import org.owasp.dependencycheck.utils.Settings; +35 import org.slf4j.Logger; +36 import org.slf4j.LoggerFactory; +37 +38 /** +39 * Loads the configured database driver and returns the database connection. If the embedded H2 database is used obtaining a +40 * connection will ensure the database file exists and that the appropriate table structure has been created. +41 * +42 * @author Jeremy Long +43 */ +44 public final class ConnectionFactory { +45 +46 /** +47 * The Logger. +48 */ +49 private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionFactory.class); +50 /** +51 * The version of the current DB Schema. +52 */ +53 public static final String DB_SCHEMA_VERSION = Settings.getString(Settings.KEYS.DB_VERSION); +54 /** +55 * Resource location for SQL file used to create the database schema. +56 */ +57 public static final String DB_STRUCTURE_RESOURCE = "data/initialize.sql"; +58 /** +59 * Resource location for SQL file used to create the database schema. +60 */ +61 public static final String DB_STRUCTURE_UPDATE_RESOURCE = "data/upgrade_%s.sql"; +62 /** +63 * The URL that discusses upgrading non-H2 databases. +64 */ +65 public static final String UPGRADE_HELP_URL = "http://jeremylong.github.io/DependencyCheck/data/upgrade.html"; +66 /** +67 * The database driver used to connect to the database. +68 */ +69 private static Driver driver = null; +70 /** +71 * The database connection string. +72 */ +73 private static String connectionString = null; +74 /** +75 * The username to connect to the database. +76 */ +77 private static String userName = null; 78 /** -79 * Private constructor for this factory class; no instance is ever needed. +79 * The password for the database. 80 */ -81 private ConnectionFactory() { -82 } -83 -84 /** -85 * Initializes the connection factory. Ensuring that the appropriate drivers are loaded and that a connection can be made -86 * successfully. -87 * -88 * @throws DatabaseException thrown if we are unable to connect to the database -89 */ -90 public static synchronized void initialize() throws DatabaseException { -91 //this only needs to be called once. -92 if (connectionString != null) { -93 return; -94 } -95 Connection conn = null; -96 try { -97 //load the driver if necessary -98 final String driverName = Settings.getString(Settings.KEYS.DB_DRIVER_NAME, ""); -99 if (!driverName.isEmpty()) { //likely need to load the correct driver -100 LOGGER.debug("Loading driver: {}", driverName); -101 final String driverPath = Settings.getString(Settings.KEYS.DB_DRIVER_PATH, ""); -102 try { -103 if (!driverPath.isEmpty()) { -104 LOGGER.debug("Loading driver from: {}", driverPath); -105 driver = DriverLoader.load(driverName, driverPath); -106 } else { -107 driver = DriverLoader.load(driverName); -108 } -109 } catch (DriverLoadException ex) { -110 LOGGER.debug("Unable to load database driver", ex); -111 throw new DatabaseException("Unable to load database driver"); -112 } -113 } -114 userName = Settings.getString(Settings.KEYS.DB_USER, "dcuser"); -115 //yes, yes - hard-coded password - only if there isn't one in the properties file. -116 password = Settings.getString(Settings.KEYS.DB_PASSWORD, "DC-Pass1337!"); -117 try { -118 connectionString = Settings.getConnectionString( -119 Settings.KEYS.DB_CONNECTION_STRING, -120 Settings.KEYS.DB_FILE_NAME); -121 } catch (IOException ex) { -122 LOGGER.debug( -123 "Unable to retrieve the database connection string", ex); -124 throw new DatabaseException("Unable to retrieve the database connection string"); -125 } -126 boolean shouldCreateSchema = false; -127 try { -128 if (connectionString.startsWith("jdbc:h2:file:")) { //H2 -129 shouldCreateSchema = !h2DataFileExists(); -130 LOGGER.debug("Need to create DB Structure: {}", shouldCreateSchema); -131 } -132 } catch (IOException ioex) { -133 LOGGER.debug("Unable to verify database exists", ioex); -134 throw new DatabaseException("Unable to verify database exists"); -135 } -136 LOGGER.debug("Loading database connection"); -137 LOGGER.debug("Connection String: {}", connectionString); -138 LOGGER.debug("Database User: {}", userName); -139 -140 try { -141 conn = DriverManager.getConnection(connectionString, userName, password); -142 } catch (SQLException ex) { -143 if (ex.getMessage().contains("java.net.UnknownHostException") && connectionString.contains("AUTO_SERVER=TRUE;")) { -144 connectionString = connectionString.replace("AUTO_SERVER=TRUE;", ""); -145 try { -146 conn = DriverManager.getConnection(connectionString, userName, password); -147 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString); -148 LOGGER.debug( -149 "Unable to start the database in server mode; reverting to single user mode"); -150 } catch (SQLException sqlex) { -151 LOGGER.debug("Unable to connect to the database", ex); -152 throw new DatabaseException("Unable to connect to the database"); -153 } -154 } else { -155 LOGGER.debug("Unable to connect to the database", ex); -156 throw new DatabaseException("Unable to connect to the database"); -157 } -158 } -159 -160 if (shouldCreateSchema) { -161 try { -162 createTables(conn); -163 } catch (DatabaseException dex) { -164 LOGGER.debug("", dex); -165 throw new DatabaseException("Unable to create the database structure"); -166 } -167 } -168 try { -169 ensureSchemaVersion(conn); -170 } catch (DatabaseException dex) { -171 LOGGER.debug("", dex); -172 throw new DatabaseException("Database schema does not match this version of dependency-check", dex); -173 } -174 } finally { -175 if (conn != null) { -176 try { -177 conn.close(); -178 } catch (SQLException ex) { -179 LOGGER.debug("An error occurred closing the connection", ex); -180 } -181 } -182 } -183 } -184 -185 /** -186 * Cleans up resources and unloads any registered database drivers. This needs to be called to ensure the driver is -187 * unregistered prior to the finalize method being called as during shutdown the class loader used to load the driver may be -188 * unloaded prior to the driver being de-registered. -189 */ -190 public static synchronized void cleanup() { -191 if (driver != null) { -192 try { -193 DriverManager.deregisterDriver(driver); -194 } catch (SQLException ex) { -195 LOGGER.debug("An error occurred unloading the database driver", ex); -196 } catch (Throwable unexpected) { -197 LOGGER.debug( -198 "An unexpected throwable occurred unloading the database driver", unexpected); -199 } -200 driver = null; -201 } -202 connectionString = null; -203 userName = null; -204 password = null; -205 } -206 -207 /** -208 * Constructs a new database connection object per the database configuration. -209 * -210 * @return a database connection object -211 * @throws DatabaseException thrown if there is an exception loading the database connection -212 */ -213 public static Connection getConnection() throws DatabaseException { -214 initialize(); -215 Connection conn = null; -216 try { -217 conn = DriverManager.getConnection(connectionString, userName, password); -218 } catch (SQLException ex) { -219 LOGGER.debug("", ex); -220 throw new DatabaseException("Unable to connect to the database"); -221 } -222 return conn; -223 } -224 -225 /** -226 * Determines if the H2 database file exists. If it does not exist then the data structure will need to be created. -227 * -228 * @return true if the H2 database file does not exist; otherwise false -229 * @throws IOException thrown if the data directory does not exist and cannot be created -230 */ -231 private static boolean h2DataFileExists() throws IOException { -232 final File dir = Settings.getDataDirectory(); -233 final String fileName = Settings.getString(Settings.KEYS.DB_FILE_NAME); -234 final File file = new File(dir, fileName); -235 return file.exists(); -236 } -237 -238 /** -239 * Creates the database structure (tables and indexes) to store the CVE data. -240 * -241 * @param conn the database connection -242 * @throws DatabaseException thrown if there is a Database Exception -243 */ -244 private static void createTables(Connection conn) throws DatabaseException { -245 LOGGER.debug("Creating database structure"); -246 InputStream is; -247 InputStreamReader reader; -248 BufferedReader in = null; -249 try { -250 is = ConnectionFactory.class.getClassLoader().getResourceAsStream(DB_STRUCTURE_RESOURCE); -251 reader = new InputStreamReader(is, "UTF-8"); -252 in = new BufferedReader(reader); -253 final StringBuilder sb = new StringBuilder(2110); -254 String tmp; -255 while ((tmp = in.readLine()) != null) { -256 sb.append(tmp); -257 } -258 Statement statement = null; -259 try { -260 statement = conn.createStatement(); -261 statement.execute(sb.toString()); -262 } catch (SQLException ex) { -263 LOGGER.debug("", ex); -264 throw new DatabaseException("Unable to create database statement", ex); -265 } finally { -266 DBUtils.closeStatement(statement); -267 } -268 } catch (IOException ex) { -269 throw new DatabaseException("Unable to create database schema", ex); -270 } finally { -271 if (in != null) { -272 try { -273 in.close(); -274 } catch (IOException ex) { -275 LOGGER.trace("", ex); -276 } -277 } -278 } -279 } -280 -281 /** -282 * Updates the database schema by loading the upgrade script for the version specified. The intended use is that if the -283 * current schema version is 2.9 then we would call updateSchema(conn, "2.9"). This would load the upgrade_2.9.sql file and -284 * execute it against the database. The upgrade script must update the 'version' in the properties table. -285 * -286 * @param conn the database connection object -287 * @param schema the current schema version that is being upgraded -288 * @throws DatabaseException thrown if there is an exception upgrading the database schema -289 */ -290 private static void updateSchema(Connection conn, String schema) throws DatabaseException { -291 LOGGER.debug("Updating database structure"); -292 InputStream is; -293 InputStreamReader reader; -294 BufferedReader in = null; -295 String updateFile = null; -296 try { -297 updateFile = String.format(DB_STRUCTURE_UPDATE_RESOURCE, schema); -298 is = ConnectionFactory.class.getClassLoader().getResourceAsStream(updateFile); -299 if (is == null) { -300 throw new DatabaseException(String.format("Unable to load update file '%s'", updateFile)); -301 } -302 reader = new InputStreamReader(is, "UTF-8"); -303 in = new BufferedReader(reader); -304 final StringBuilder sb = new StringBuilder(2110); -305 String tmp; -306 while ((tmp = in.readLine()) != null) { -307 sb.append(tmp); -308 } -309 Statement statement = null; -310 try { -311 statement = conn.createStatement(); -312 statement.execute(sb.toString()); -313 } catch (SQLException ex) { -314 LOGGER.debug("", ex); -315 throw new DatabaseException("Unable to update database schema", ex); -316 } finally { -317 DBUtils.closeStatement(statement); -318 } -319 } catch (IOException ex) { -320 final String msg = String.format("Upgrade SQL file does not exist: %s", updateFile); -321 throw new DatabaseException(msg, ex); -322 } finally { -323 if (in != null) { -324 try { -325 in.close(); -326 } catch (IOException ex) { -327 LOGGER.trace("", ex); -328 } -329 } -330 } -331 } -332 -333 /** -334 * Uses the provided connection to check the specified schema version within the database. -335 * -336 * @param conn the database connection object -337 * @throws DatabaseException thrown if the schema version is not compatible with this version of dependency-check -338 */ -339 private static void ensureSchemaVersion(Connection conn) throws DatabaseException { -340 ResultSet rs = null; -341 CallableStatement cs = null; -342 try { -343 //TODO convert this to use DatabaseProperties -344 cs = conn.prepareCall("SELECT value FROM properties WHERE id = 'version'"); -345 rs = cs.executeQuery(); -346 if (rs.next()) { -347 if (!DB_SCHEMA_VERSION.equals(rs.getString(1))) { +81 private static String password = null; +82 +83 /** +84 * Private constructor for this factory class; no instance is ever needed. +85 */ +86 private ConnectionFactory() { +87 } +88 +89 /** +90 * Initializes the connection factory. Ensuring that the appropriate drivers are loaded and that a connection can be made +91 * successfully. +92 * +93 * @throws DatabaseException thrown if we are unable to connect to the database +94 */ +95 public static synchronized void initialize() throws DatabaseException { +96 //this only needs to be called once. +97 if (connectionString != null) { +98 return; +99 } +100 Connection conn = null; +101 try { +102 //load the driver if necessary +103 final String driverName = Settings.getString(Settings.KEYS.DB_DRIVER_NAME, ""); +104 if (!driverName.isEmpty()) { //likely need to load the correct driver +105 LOGGER.debug("Loading driver: {}", driverName); +106 final String driverPath = Settings.getString(Settings.KEYS.DB_DRIVER_PATH, ""); +107 try { +108 if (!driverPath.isEmpty()) { +109 LOGGER.debug("Loading driver from: {}", driverPath); +110 driver = DriverLoader.load(driverName, driverPath); +111 } else { +112 driver = DriverLoader.load(driverName); +113 } +114 } catch (DriverLoadException ex) { +115 LOGGER.debug("Unable to load database driver", ex); +116 throw new DatabaseException("Unable to load database driver"); +117 } +118 } +119 userName = Settings.getString(Settings.KEYS.DB_USER, "dcuser"); +120 //yes, yes - hard-coded password - only if there isn't one in the properties file. +121 password = Settings.getString(Settings.KEYS.DB_PASSWORD, "DC-Pass1337!"); +122 try { +123 connectionString = Settings.getConnectionString( +124 Settings.KEYS.DB_CONNECTION_STRING, +125 Settings.KEYS.DB_FILE_NAME); +126 } catch (IOException ex) { +127 LOGGER.debug( +128 "Unable to retrieve the database connection string", ex); +129 throw new DatabaseException("Unable to retrieve the database connection string"); +130 } +131 boolean shouldCreateSchema = false; +132 try { +133 if (connectionString.startsWith("jdbc:h2:file:")) { //H2 +134 shouldCreateSchema = !h2DataFileExists(); +135 LOGGER.debug("Need to create DB Structure: {}", shouldCreateSchema); +136 } +137 } catch (IOException ioex) { +138 LOGGER.debug("Unable to verify database exists", ioex); +139 throw new DatabaseException("Unable to verify database exists"); +140 } +141 LOGGER.debug("Loading database connection"); +142 LOGGER.debug("Connection String: {}", connectionString); +143 LOGGER.debug("Database User: {}", userName); +144 +145 try { +146 conn = DriverManager.getConnection(connectionString, userName, password); +147 } catch (SQLException ex) { +148 if (ex.getMessage().contains("java.net.UnknownHostException") && connectionString.contains("AUTO_SERVER=TRUE;")) { +149 connectionString = connectionString.replace("AUTO_SERVER=TRUE;", ""); +150 try { +151 conn = DriverManager.getConnection(connectionString, userName, password); +152 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString); +153 LOGGER.debug( +154 "Unable to start the database in server mode; reverting to single user mode"); +155 } catch (SQLException sqlex) { +156 LOGGER.debug("Unable to connect to the database", ex); +157 throw new DatabaseException("Unable to connect to the database"); +158 } +159 } else { +160 LOGGER.debug("Unable to connect to the database", ex); +161 throw new DatabaseException("Unable to connect to the database"); +162 } +163 } +164 +165 if (shouldCreateSchema) { +166 try { +167 createTables(conn); +168 } catch (DatabaseException dex) { +169 LOGGER.debug("", dex); +170 throw new DatabaseException("Unable to create the database structure"); +171 } +172 } +173 try { +174 ensureSchemaVersion(conn); +175 } catch (DatabaseException dex) { +176 LOGGER.debug("", dex); +177 throw new DatabaseException("Database schema does not match this version of dependency-check", dex); +178 } +179 } finally { +180 if (conn != null) { +181 try { +182 conn.close(); +183 } catch (SQLException ex) { +184 LOGGER.debug("An error occurred closing the connection", ex); +185 } +186 } +187 } +188 } +189 +190 /** +191 * Cleans up resources and unloads any registered database drivers. This needs to be called to ensure the driver is +192 * unregistered prior to the finalize method being called as during shutdown the class loader used to load the driver may be +193 * unloaded prior to the driver being de-registered. +194 */ +195 public static synchronized void cleanup() { +196 if (driver != null) { +197 try { +198 DriverManager.deregisterDriver(driver); +199 } catch (SQLException ex) { +200 LOGGER.debug("An error occurred unloading the database driver", ex); +201 } catch (Throwable unexpected) { +202 LOGGER.debug( +203 "An unexpected throwable occurred unloading the database driver", unexpected); +204 } +205 driver = null; +206 } +207 connectionString = null; +208 userName = null; +209 password = null; +210 } +211 +212 /** +213 * Constructs a new database connection object per the database configuration. +214 * +215 * @return a database connection object +216 * @throws DatabaseException thrown if there is an exception loading the database connection +217 */ +218 public static Connection getConnection() throws DatabaseException { +219 initialize(); +220 Connection conn = null; +221 try { +222 conn = DriverManager.getConnection(connectionString, userName, password); +223 } catch (SQLException ex) { +224 LOGGER.debug("", ex); +225 throw new DatabaseException("Unable to connect to the database"); +226 } +227 return conn; +228 } +229 +230 /** +231 * Determines if the H2 database file exists. If it does not exist then the data structure will need to be created. +232 * +233 * @return true if the H2 database file does not exist; otherwise false +234 * @throws IOException thrown if the data directory does not exist and cannot be created +235 */ +236 private static boolean h2DataFileExists() throws IOException { +237 final File dir = Settings.getDataDirectory(); +238 final String fileName = Settings.getString(Settings.KEYS.DB_FILE_NAME); +239 final File file = new File(dir, fileName); +240 return file.exists(); +241 } +242 +243 /** +244 * Creates the database structure (tables and indexes) to store the CVE data. +245 * +246 * @param conn the database connection +247 * @throws DatabaseException thrown if there is a Database Exception +248 */ +249 private static void createTables(Connection conn) throws DatabaseException { +250 LOGGER.debug("Creating database structure"); +251 InputStream is = null; +252 try { +253 is = ConnectionFactory.class.getClassLoader().getResourceAsStream(DB_STRUCTURE_RESOURCE); +254 final String dbStructure = IOUtils.toString(is, "UTF-8"); +255 +256 Statement statement = null; +257 try { +258 statement = conn.createStatement(); +259 statement.execute(dbStructure); +260 } catch (SQLException ex) { +261 LOGGER.debug("", ex); +262 throw new DatabaseException("Unable to create database statement", ex); +263 } finally { +264 DBUtils.closeStatement(statement); +265 } +266 } catch (IOException ex) { +267 throw new DatabaseException("Unable to create database schema", ex); +268 } finally { +269 IOUtils.closeQuietly(is); +270 } +271 } +272 +273 /** +274 * Updates the database schema by loading the upgrade script for the version specified. The intended use is that if the +275 * current schema version is 2.9 then we would call updateSchema(conn, "2.9"). This would load the upgrade_2.9.sql file and +276 * execute it against the database. The upgrade script must update the 'version' in the properties table. +277 * +278 * @param conn the database connection object +279 * @param schema the current schema version that is being upgraded +280 * @throws DatabaseException thrown if there is an exception upgrading the database schema +281 */ +282 private static void updateSchema(Connection conn, String schema) throws DatabaseException { +283 final String databaseProductName; +284 try { +285 databaseProductName = conn.getMetaData().getDatabaseProductName(); +286 } catch (SQLException ex) { +287 throw new DatabaseException("Unable to get the database product name"); +288 } +289 if ("h2".equalsIgnoreCase(databaseProductName)) { +290 LOGGER.debug("Updating database structure"); +291 InputStream is = null; +292 String updateFile = null; +293 try { +294 updateFile = String.format(DB_STRUCTURE_UPDATE_RESOURCE, schema); +295 is = ConnectionFactory.class.getClassLoader().getResourceAsStream(updateFile); +296 if (is == null) { +297 throw new DatabaseException(String.format("Unable to load update file '%s'", updateFile)); +298 } +299 final String dbStructureUpdate = IOUtils.toString(is, "UTF-8"); +300 +301 Statement statement = null; +302 try { +303 statement = conn.createStatement(); +304 final boolean success = statement.execute(dbStructureUpdate); +305 if (!success && statement.getUpdateCount() <= 0) { +306 throw new DatabaseException(String.format("Unable to upgrade the database schema to %s", schema)); +307 } +308 } catch (SQLException ex) { +309 LOGGER.debug("", ex); +310 throw new DatabaseException("Unable to update database schema", ex); +311 } finally { +312 DBUtils.closeStatement(statement); +313 } +314 } catch (IOException ex) { +315 final String msg = String.format("Upgrade SQL file does not exist: %s", updateFile); +316 throw new DatabaseException(msg, ex); +317 } finally { +318 IOUtils.closeQuietly(is); +319 } +320 } else { +321 LOGGER.error("The database schema must be upgraded to use this version of dependency-check. Please see {} for more information.", UPGRADE_HELP_URL); +322 throw new DatabaseException("Database schema is out of date"); +323 } +324 } +325 +326 /** +327 * Counter to ensure that calls to ensureSchemaVersion does not end up in an endless loop. +328 */ +329 private static int callDepth = 0; +330 +331 /** +332 * Uses the provided connection to check the specified schema version within the database. +333 * +334 * @param conn the database connection object +335 * @throws DatabaseException thrown if the schema version is not compatible with this version of dependency-check +336 */ +337 private static void ensureSchemaVersion(Connection conn) throws DatabaseException { +338 ResultSet rs = null; +339 CallableStatement cs = null; +340 try { +341 //TODO convert this to use DatabaseProperties +342 cs = conn.prepareCall("SELECT value FROM properties WHERE id = 'version'"); +343 rs = cs.executeQuery(); +344 if (rs.next()) { +345 final DependencyVersion current = DependencyVersionUtil.parseVersion(DB_SCHEMA_VERSION); +346 final DependencyVersion db = DependencyVersionUtil.parseVersion(rs.getString(1)); +347 if (current.compareTo(db) > 0) { 348 LOGGER.debug("Current Schema: " + DB_SCHEMA_VERSION); 349 LOGGER.debug("DB Schema: " + rs.getString(1)); 350 updateSchema(conn, rs.getString(1)); -351 } -352 } else { -353 throw new DatabaseException("Database schema is missing"); -354 } -355 } catch (SQLException ex) { -356 LOGGER.debug("", ex); -357 throw new DatabaseException("Unable to check the database schema version"); -358 } finally { -359 DBUtils.closeResultSet(rs); -360 DBUtils.closeStatement(cs); -361 } -362 } -363 } +351 if (++callDepth < 10) { +352 ensureSchemaVersion(conn); +353 } +354 } +355 } else { +356 throw new DatabaseException("Database schema is missing"); +357 } +358 } catch (SQLException ex) { +359 LOGGER.debug("", ex); +360 throw new DatabaseException("Unable to check the database schema version"); +361 } finally { +362 DBUtils.closeResultSet(rs); +363 DBUtils.closeStatement(cs); +364 } +365 } +366 }
        diff --git a/xref/org/owasp/dependencycheck/data/nvdcve/CorruptDatabaseException.html b/xref/org/owasp/dependencycheck/data/nvdcve/CorruptDatabaseException.html index dd658f644..8c3ce8b0b 100644 --- a/xref/org/owasp/dependencycheck/data/nvdcve/CorruptDatabaseException.html +++ b/xref/org/owasp/dependencycheck/data/nvdcve/CorruptDatabaseException.html @@ -26,37 +26,36 @@ 18 package org.owasp.dependencycheck.data.nvdcve; 19 20 /** -21 * An exception used to indicate the db4o database is corrupt. This could be due to invalid data or a complete failure -22 * of the db. -23 * -24 * @author Jeremy Long -25 */ -26 class CorruptDatabaseException extends DatabaseException { -27 -28 /** -29 * the serial version uid. -30 */ -31 private static final long serialVersionUID = 1L; -32 -33 /** -34 * Creates an CorruptDatabaseException -35 * -36 * @param msg the exception message -37 */ -38 public CorruptDatabaseException(String msg) { -39 super(msg); -40 } -41 -42 /** -43 * Creates an CorruptDatabaseException -44 * -45 * @param msg the exception message -46 * @param ex the cause of the exception -47 */ -48 public CorruptDatabaseException(String msg, Exception ex) { -49 super(msg, ex); -50 } -51 } +21 * An exception used to indicate the db4o database is corrupt. This could be due to invalid data or a complete failure of the db. +22 * +23 * @author Jeremy Long +24 */ +25 public class CorruptDatabaseException extends DatabaseException { +26 +27 /** +28 * the serial version uid. +29 */ +30 private static final long serialVersionUID = 1L; +31 +32 /** +33 * Creates an CorruptDatabaseException. +34 * +35 * @param msg the exception message +36 */ +37 public CorruptDatabaseException(String msg) { +38 super(msg); +39 } +40 +41 /** +42 * Creates an CorruptDatabaseException. +43 * +44 * @param msg the exception message +45 * @param ex the cause of the exception +46 */ +47 public CorruptDatabaseException(String msg, Exception ex) { +48 super(msg, ex); +49 } +50 }
        diff --git a/xref/org/owasp/dependencycheck/data/nvdcve/CveDB.html b/xref/org/owasp/dependencycheck/data/nvdcve/CveDB.html index 6674fc18f..5c4576343 100644 --- a/xref/org/owasp/dependencycheck/data/nvdcve/CveDB.html +++ b/xref/org/owasp/dependencycheck/data/nvdcve/CveDB.html @@ -37,799 +37,771 @@ 29 import java.util.HashMap; 30 import java.util.HashSet; 31 import java.util.List; -32 import java.util.Map; -33 import java.util.Map.Entry; -34 import java.util.Properties; -35 import java.util.ResourceBundle; -36 import java.util.Set; -37 import org.owasp.dependencycheck.data.cwe.CweDB; -38 import org.owasp.dependencycheck.dependency.Reference; -39 import org.owasp.dependencycheck.dependency.Vulnerability; -40 import org.owasp.dependencycheck.dependency.VulnerableSoftware; -41 import org.owasp.dependencycheck.utils.DBUtils; -42 import org.owasp.dependencycheck.utils.DependencyVersion; -43 import org.owasp.dependencycheck.utils.DependencyVersionUtil; -44 import org.owasp.dependencycheck.utils.Pair; -45 import org.owasp.dependencycheck.utils.Settings; -46 import org.slf4j.Logger; -47 import org.slf4j.LoggerFactory; -48 -49 /** -50 * The database holding information about the NVD CVE data. -51 * -52 * @author Jeremy Long -53 */ -54 public class CveDB { -55 -56 /** -57 * The logger. -58 */ -59 private static final Logger LOGGER = LoggerFactory.getLogger(CveDB.class); -60 /** -61 * Database connection -62 */ -63 private Connection conn; -64 /** -65 * The bundle of statements used when accessing the database. -66 */ -67 private ResourceBundle statementBundle = null; -68 -69 /** -70 * Creates a new CveDB object and opens the database connection. Note, the connection must be closed by the caller by calling -71 * the close method. -72 * -73 * @throws DatabaseException thrown if there is an exception opening the database. -74 */ -75 public CveDB() throws DatabaseException { -76 super(); -77 statementBundle = ResourceBundle.getBundle("data/dbStatements"); -78 try { -79 open(); -80 databaseProperties = new DatabaseProperties(this); -81 } catch (DatabaseException ex) { -82 throw ex; -83 } -84 } -85 -86 /** -87 * Returns the database connection. -88 * -89 * @return the database connection -90 */ -91 protected Connection getConnection() { -92 return conn; -93 } -94 -95 /** -96 * Opens the database connection. If the database does not exist, it will create a new one. -97 * -98 * @throws DatabaseException thrown if there is an error opening the database connection -99 */ -100 public final void open() throws DatabaseException { -101 if (!isOpen()) { -102 conn = ConnectionFactory.getConnection(); -103 } -104 } -105 -106 /** -107 * Closes the DB4O database. Close should be called on this object when it is done being used. -108 */ -109 public void close() { -110 if (conn != null) { -111 try { -112 conn.close(); -113 } catch (SQLException ex) { -114 LOGGER.error("There was an error attempting to close the CveDB, see the log for more details."); -115 LOGGER.debug("", ex); -116 } catch (Throwable ex) { -117 LOGGER.error("There was an exception attempting to close the CveDB, see the log for more details."); -118 LOGGER.debug("", ex); -119 } -120 conn = null; -121 } -122 } -123 -124 /** -125 * Returns whether the database connection is open or closed. -126 * -127 * @return whether the database connection is open or closed -128 */ -129 public boolean isOpen() { -130 return conn != null; -131 } -132 -133 /** -134 * Commits all completed transactions. -135 * -136 * @throws SQLException thrown if a SQL Exception occurs -137 */ -138 public void commit() throws SQLException { -139 //temporary remove this as autocommit is on. -140 //if (conn != null) { -141 // conn.commit(); -142 //} -143 } -144 -145 /** -146 * Cleans up the object and ensures that "close" has been called. -147 * -148 * @throws Throwable thrown if there is a problem -149 */ -150 @Override -151 @SuppressWarnings("FinalizeDeclaration") -152 protected void finalize() throws Throwable { -153 LOGGER.debug("Entering finalize"); -154 close(); -155 super.finalize(); -156 } -157 /** -158 * Database properties object containing the 'properties' from the database table. +32 import java.util.Locale; +33 import java.util.Map; +34 import java.util.Map.Entry; +35 import java.util.MissingResourceException; +36 import java.util.Properties; +37 import java.util.ResourceBundle; +38 import java.util.Set; +39 import org.owasp.dependencycheck.data.cwe.CweDB; +40 import org.owasp.dependencycheck.dependency.Reference; +41 import org.owasp.dependencycheck.dependency.Vulnerability; +42 import org.owasp.dependencycheck.dependency.VulnerableSoftware; +43 import org.owasp.dependencycheck.utils.DBUtils; +44 import org.owasp.dependencycheck.utils.DependencyVersion; +45 import org.owasp.dependencycheck.utils.DependencyVersionUtil; +46 import org.owasp.dependencycheck.utils.Pair; +47 import org.owasp.dependencycheck.utils.Settings; +48 import org.slf4j.Logger; +49 import org.slf4j.LoggerFactory; +50 +51 /** +52 * The database holding information about the NVD CVE data. +53 * +54 * @author Jeremy Long +55 */ +56 public class CveDB { +57 +58 /** +59 * The logger. +60 */ +61 private static final Logger LOGGER = LoggerFactory.getLogger(CveDB.class); +62 /** +63 * Database connection +64 */ +65 private Connection conn; +66 /** +67 * The bundle of statements used when accessing the database. +68 */ +69 private ResourceBundle statementBundle = null; +70 +71 /** +72 * Creates a new CveDB object and opens the database connection. Note, the connection must be closed by the caller by calling +73 * the close method. +74 * +75 * @throws DatabaseException thrown if there is an exception opening the database. +76 */ +77 public CveDB() throws DatabaseException { +78 super(); +79 try { +80 open(); +81 try { +82 final String databaseProductName = conn.getMetaData().getDatabaseProductName(); +83 LOGGER.debug("Database dialect: {}", databaseProductName); +84 final Locale dbDialect = new Locale(databaseProductName); +85 statementBundle = ResourceBundle.getBundle("data/dbStatements", dbDialect); +86 } catch (SQLException se) { +87 LOGGER.warn("Problem loading database specific dialect!", se); +88 statementBundle = ResourceBundle.getBundle("data/dbStatements"); +89 } +90 databaseProperties = new DatabaseProperties(this); +91 } catch (DatabaseException ex) { +92 throw ex; +93 } +94 } +95 +96 /** +97 * Returns the database connection. +98 * +99 * @return the database connection +100 */ +101 protected Connection getConnection() { +102 return conn; +103 } +104 +105 /** +106 * Opens the database connection. If the database does not exist, it will create a new one. +107 * +108 * @throws DatabaseException thrown if there is an error opening the database connection +109 */ +110 public final void open() throws DatabaseException { +111 if (!isOpen()) { +112 conn = ConnectionFactory.getConnection(); +113 } +114 } +115 +116 /** +117 * Closes the DB4O database. Close should be called on this object when it is done being used. +118 */ +119 public void close() { +120 if (conn != null) { +121 try { +122 conn.close(); +123 } catch (SQLException ex) { +124 LOGGER.error("There was an error attempting to close the CveDB, see the log for more details."); +125 LOGGER.debug("", ex); +126 } catch (Throwable ex) { +127 LOGGER.error("There was an exception attempting to close the CveDB, see the log for more details."); +128 LOGGER.debug("", ex); +129 } +130 conn = null; +131 } +132 } +133 +134 /** +135 * Returns whether the database connection is open or closed. +136 * +137 * @return whether the database connection is open or closed +138 */ +139 public boolean isOpen() { +140 return conn != null; +141 } +142 +143 /** +144 * Commits all completed transactions. +145 * +146 * @throws SQLException thrown if a SQL Exception occurs +147 */ +148 public void commit() throws SQLException { +149 //temporary remove this as autocommit is on. +150 //if (conn != null) { +151 // conn.commit(); +152 //} +153 } +154 +155 /** +156 * Cleans up the object and ensures that "close" has been called. +157 * +158 * @throws Throwable thrown if there is a problem 159 */ -160 private DatabaseProperties databaseProperties; -161 -162 /** -163 * Get the value of databaseProperties. -164 * -165 * @return the value of databaseProperties -166 */ -167 public DatabaseProperties getDatabaseProperties() { -168 return databaseProperties; -169 } -170 -171 /** -172 * Searches the CPE entries in the database and retrieves all entries for a given vendor and product combination. The returned -173 * list will include all versions of the product that are registered in the NVD CVE data. +160 @Override +161 @SuppressWarnings("FinalizeDeclaration") +162 protected void finalize() throws Throwable { +163 LOGGER.debug("Entering finalize"); +164 close(); +165 super.finalize(); +166 } +167 /** +168 * Database properties object containing the 'properties' from the database table. +169 */ +170 private DatabaseProperties databaseProperties; +171 +172 /** +173 * Get the value of databaseProperties. 174 * -175 * @param vendor the identified vendor name of the dependency being analyzed -176 * @param product the identified name of the product of the dependency being analyzed -177 * @return a set of vulnerable software -178 */ -179 public Set<VulnerableSoftware> getCPEs(String vendor, String product) { -180 final Set<VulnerableSoftware> cpe = new HashSet<VulnerableSoftware>(); -181 ResultSet rs = null; -182 PreparedStatement ps = null; -183 try { -184 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_CPE_ENTRIES")); -185 ps.setString(1, vendor); -186 ps.setString(2, product); -187 rs = ps.executeQuery(); -188 -189 while (rs.next()) { -190 final VulnerableSoftware vs = new VulnerableSoftware(); -191 vs.setCpe(rs.getString(1)); -192 cpe.add(vs); -193 } -194 } catch (SQLException ex) { -195 LOGGER.error("An unexpected SQL Exception occurred; please see the verbose log for more details."); -196 LOGGER.debug("", ex); -197 } finally { -198 DBUtils.closeResultSet(rs); -199 DBUtils.closeStatement(ps); -200 } -201 return cpe; -202 } -203 -204 /** -205 * Returns the entire list of vendor/product combinations. -206 * -207 * @return the entire list of vendor/product combinations -208 * @throws DatabaseException thrown when there is an error retrieving the data from the DB -209 */ -210 public Set<Pair<String, String>> getVendorProductList() throws DatabaseException { -211 final Set<Pair<String, String>> data = new HashSet<Pair<String, String>>(); -212 ResultSet rs = null; -213 PreparedStatement ps = null; -214 try { -215 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_VENDOR_PRODUCT_LIST")); -216 rs = ps.executeQuery(); -217 while (rs.next()) { -218 data.add(new Pair<String, String>(rs.getString(1), rs.getString(2))); -219 } -220 } catch (SQLException ex) { -221 final String msg = "An unexpected SQL Exception occurred; please see the verbose log for more details."; -222 throw new DatabaseException(msg, ex); -223 } finally { -224 DBUtils.closeResultSet(rs); -225 DBUtils.closeStatement(ps); -226 } -227 return data; -228 } -229 -230 /** -231 * Returns a set of properties. -232 * -233 * @return the properties from the database -234 */ -235 Properties getProperties() { -236 final Properties prop = new Properties(); -237 PreparedStatement ps = null; -238 ResultSet rs = null; -239 try { -240 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_PROPERTIES")); -241 rs = ps.executeQuery(); -242 while (rs.next()) { -243 prop.setProperty(rs.getString(1), rs.getString(2)); -244 } -245 } catch (SQLException ex) { -246 LOGGER.error("An unexpected SQL Exception occurred; please see the verbose log for more details."); -247 LOGGER.debug("", ex); -248 } finally { -249 DBUtils.closeStatement(ps); -250 DBUtils.closeResultSet(rs); -251 } -252 return prop; -253 } -254 -255 /** -256 * Saves a set of properties to the database. -257 * -258 * @param props a collection of properties -259 */ -260 void saveProperties(Properties props) { -261 PreparedStatement updateProperty = null; -262 PreparedStatement insertProperty = null; -263 try { -264 try { -265 updateProperty = getConnection().prepareStatement(statementBundle.getString("UPDATE_PROPERTY")); -266 insertProperty = getConnection().prepareStatement(statementBundle.getString("INSERT_PROPERTY")); -267 } catch (SQLException ex) { -268 LOGGER.warn("Unable to save properties to the database"); -269 LOGGER.debug("Unable to save properties to the database", ex); -270 return; -271 } -272 for (Entry<Object, Object> entry : props.entrySet()) { -273 final String key = entry.getKey().toString(); -274 final String value = entry.getValue().toString(); +175 * @return the value of databaseProperties +176 */ +177 public DatabaseProperties getDatabaseProperties() { +178 return databaseProperties; +179 } +180 +181 /** +182 * Searches the CPE entries in the database and retrieves all entries for a given vendor and product combination. The returned +183 * list will include all versions of the product that are registered in the NVD CVE data. +184 * +185 * @param vendor the identified vendor name of the dependency being analyzed +186 * @param product the identified name of the product of the dependency being analyzed +187 * @return a set of vulnerable software +188 */ +189 public Set<VulnerableSoftware> getCPEs(String vendor, String product) { +190 final Set<VulnerableSoftware> cpe = new HashSet<VulnerableSoftware>(); +191 ResultSet rs = null; +192 PreparedStatement ps = null; +193 try { +194 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_CPE_ENTRIES")); +195 ps.setString(1, vendor); +196 ps.setString(2, product); +197 rs = ps.executeQuery(); +198 +199 while (rs.next()) { +200 final VulnerableSoftware vs = new VulnerableSoftware(); +201 vs.setCpe(rs.getString(1)); +202 cpe.add(vs); +203 } +204 } catch (SQLException ex) { +205 LOGGER.error("An unexpected SQL Exception occurred; please see the verbose log for more details."); +206 LOGGER.debug("", ex); +207 } finally { +208 DBUtils.closeResultSet(rs); +209 DBUtils.closeStatement(ps); +210 } +211 return cpe; +212 } +213 +214 /** +215 * Returns the entire list of vendor/product combinations. +216 * +217 * @return the entire list of vendor/product combinations +218 * @throws DatabaseException thrown when there is an error retrieving the data from the DB +219 */ +220 public Set<Pair<String, String>> getVendorProductList() throws DatabaseException { +221 final Set<Pair<String, String>> data = new HashSet<Pair<String, String>>(); +222 ResultSet rs = null; +223 PreparedStatement ps = null; +224 try { +225 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_VENDOR_PRODUCT_LIST")); +226 rs = ps.executeQuery(); +227 while (rs.next()) { +228 data.add(new Pair<String, String>(rs.getString(1), rs.getString(2))); +229 } +230 } catch (SQLException ex) { +231 final String msg = "An unexpected SQL Exception occurred; please see the verbose log for more details."; +232 throw new DatabaseException(msg, ex); +233 } finally { +234 DBUtils.closeResultSet(rs); +235 DBUtils.closeStatement(ps); +236 } +237 return data; +238 } +239 +240 /** +241 * Returns a set of properties. +242 * +243 * @return the properties from the database +244 */ +245 Properties getProperties() { +246 final Properties prop = new Properties(); +247 PreparedStatement ps = null; +248 ResultSet rs = null; +249 try { +250 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_PROPERTIES")); +251 rs = ps.executeQuery(); +252 while (rs.next()) { +253 prop.setProperty(rs.getString(1), rs.getString(2)); +254 } +255 } catch (SQLException ex) { +256 LOGGER.error("An unexpected SQL Exception occurred; please see the verbose log for more details."); +257 LOGGER.debug("", ex); +258 } finally { +259 DBUtils.closeStatement(ps); +260 DBUtils.closeResultSet(rs); +261 } +262 return prop; +263 } +264 +265 /** +266 * Saves a property to the database. +267 * +268 * @param key the property key +269 * @param value the property value +270 */ +271 void saveProperty(String key, String value) { +272 try { +273 try { +274 final PreparedStatement mergeProperty = getConnection().prepareStatement(statementBundle.getString("MERGE_PROPERTY")); 275 try { -276 updateProperty.setString(1, value); -277 updateProperty.setString(2, key); -278 if (updateProperty.executeUpdate() == 0) { -279 insertProperty.setString(1, key); -280 insertProperty.setString(2, value); -281 } -282 } catch (SQLException ex) { -283 LOGGER.warn("Unable to save property '{}' with a value of '{}' to the database", key, value); -284 LOGGER.debug("", ex); -285 } -286 } -287 } finally { -288 DBUtils.closeStatement(updateProperty); -289 DBUtils.closeStatement(insertProperty); -290 } -291 } -292 -293 /** -294 * Saves a property to the database. -295 * -296 * @param key the property key -297 * @param value the property value -298 */ -299 void saveProperty(String key, String value) { -300 PreparedStatement updateProperty = null; -301 PreparedStatement insertProperty = null; -302 try { -303 try { -304 updateProperty = getConnection().prepareStatement(statementBundle.getString("UPDATE_PROPERTY")); -305 } catch (SQLException ex) { -306 LOGGER.warn("Unable to save properties to the database"); -307 LOGGER.debug("Unable to save properties to the database", ex); -308 return; -309 } -310 try { -311 updateProperty.setString(1, value); -312 updateProperty.setString(2, key); -313 if (updateProperty.executeUpdate() == 0) { -314 try { -315 insertProperty = getConnection().prepareStatement(statementBundle.getString("INSERT_PROPERTY")); -316 } catch (SQLException ex) { -317 LOGGER.warn("Unable to save properties to the database"); -318 LOGGER.debug("Unable to save properties to the database", ex); -319 return; -320 } -321 insertProperty.setString(1, key); -322 insertProperty.setString(2, value); -323 insertProperty.execute(); -324 } -325 } catch (SQLException ex) { -326 LOGGER.warn("Unable to save property '{}' with a value of '{}' to the database", key, value); -327 LOGGER.debug("", ex); -328 } -329 } finally { -330 DBUtils.closeStatement(updateProperty); -331 DBUtils.closeStatement(insertProperty); -332 } -333 } -334 -335 /** -336 * Retrieves the vulnerabilities associated with the specified CPE. -337 * -338 * @param cpeStr the CPE name -339 * @return a list of Vulnerabilities -340 * @throws DatabaseException thrown if there is an exception retrieving data -341 */ -342 public List<Vulnerability> getVulnerabilities(String cpeStr) throws DatabaseException { -343 final VulnerableSoftware cpe = new VulnerableSoftware(); -344 try { -345 cpe.parseName(cpeStr); -346 } catch (UnsupportedEncodingException ex) { -347 LOGGER.trace("", ex); -348 } -349 final DependencyVersion detectedVersion = parseDependencyVersion(cpe); -350 final List<Vulnerability> vulnerabilities = new ArrayList<Vulnerability>(); -351 -352 PreparedStatement ps = null; -353 ResultSet rs = null; -354 try { -355 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_CVE_FROM_SOFTWARE")); -356 ps.setString(1, cpe.getVendor()); -357 ps.setString(2, cpe.getProduct()); -358 rs = ps.executeQuery(); -359 String currentCVE = ""; -360 -361 final Map<String, Boolean> vulnSoftware = new HashMap<String, Boolean>(); -362 while (rs.next()) { -363 final String cveId = rs.getString(1); -364 if (!currentCVE.equals(cveId)) { //check for match and add -365 final Entry<String, Boolean> matchedCPE = getMatchingSoftware(vulnSoftware, cpe.getVendor(), cpe.getProduct(), detectedVersion); -366 if (matchedCPE != null) { -367 final Vulnerability v = getVulnerability(currentCVE); -368 v.setMatchedCPE(matchedCPE.getKey(), matchedCPE.getValue() ? "Y" : null); -369 vulnerabilities.add(v); -370 } -371 vulnSoftware.clear(); -372 currentCVE = cveId; -373 } -374 -375 final String cpeId = rs.getString(2); -376 final String previous = rs.getString(3); -377 final Boolean p = previous != null && !previous.isEmpty(); -378 vulnSoftware.put(cpeId, p); -379 } -380 //remember to process the last set of CVE/CPE entries -381 final Entry<String, Boolean> matchedCPE = getMatchingSoftware(vulnSoftware, cpe.getVendor(), cpe.getProduct(), detectedVersion); -382 if (matchedCPE != null) { -383 final Vulnerability v = getVulnerability(currentCVE); -384 v.setMatchedCPE(matchedCPE.getKey(), matchedCPE.getValue() ? "Y" : null); -385 vulnerabilities.add(v); -386 } -387 } catch (SQLException ex) { -388 throw new DatabaseException("Exception retrieving vulnerability for " + cpeStr, ex); -389 } finally { -390 DBUtils.closeResultSet(rs); -391 DBUtils.closeStatement(ps); -392 } -393 return vulnerabilities; -394 } -395 -396 /** -397 * Gets a vulnerability for the provided CVE. -398 * -399 * @param cve the CVE to lookup -400 * @return a vulnerability object -401 * @throws DatabaseException if an exception occurs -402 */ -403 private Vulnerability getVulnerability(String cve) throws DatabaseException { -404 PreparedStatement psV = null; -405 PreparedStatement psR = null; -406 PreparedStatement psS = null; -407 ResultSet rsV = null; -408 ResultSet rsR = null; -409 ResultSet rsS = null; -410 Vulnerability vuln = null; -411 try { -412 psV = getConnection().prepareStatement(statementBundle.getString("SELECT_VULNERABILITY")); -413 psV.setString(1, cve); -414 rsV = psV.executeQuery(); -415 if (rsV.next()) { -416 vuln = new Vulnerability(); -417 vuln.setName(cve); -418 vuln.setDescription(rsV.getString(2)); -419 String cwe = rsV.getString(3); -420 if (cwe != null) { -421 final String name = CweDB.getCweName(cwe); -422 if (name != null) { -423 cwe += " " + name; +276 mergeProperty.setString(1, key); +277 mergeProperty.setString(2, value); +278 mergeProperty.executeUpdate(); +279 } finally { +280 DBUtils.closeStatement(mergeProperty); +281 } +282 } catch (MissingResourceException mre) { +283 // No Merge statement, so doing an Update/Insert... +284 PreparedStatement updateProperty = null; +285 PreparedStatement insertProperty = null; +286 try { +287 updateProperty = getConnection().prepareStatement(statementBundle.getString("UPDATE_PROPERTY")); +288 updateProperty.setString(1, value); +289 updateProperty.setString(2, key); +290 if (updateProperty.executeUpdate() == 0) { +291 insertProperty = getConnection().prepareStatement(statementBundle.getString("INSERT_PROPERTY")); +292 insertProperty.setString(1, key); +293 insertProperty.setString(2, value); +294 insertProperty.executeUpdate(); +295 } +296 } finally { +297 DBUtils.closeStatement(updateProperty); +298 DBUtils.closeStatement(insertProperty); +299 } +300 } +301 } catch (SQLException ex) { +302 LOGGER.warn("Unable to save property '{}' with a value of '{}' to the database", key, value); +303 LOGGER.debug("", ex); +304 } +305 } +306 +307 /** +308 * Retrieves the vulnerabilities associated with the specified CPE. +309 * +310 * @param cpeStr the CPE name +311 * @return a list of Vulnerabilities +312 * @throws DatabaseException thrown if there is an exception retrieving data +313 */ +314 public List<Vulnerability> getVulnerabilities(String cpeStr) throws DatabaseException { +315 final VulnerableSoftware cpe = new VulnerableSoftware(); +316 try { +317 cpe.parseName(cpeStr); +318 } catch (UnsupportedEncodingException ex) { +319 LOGGER.trace("", ex); +320 } +321 final DependencyVersion detectedVersion = parseDependencyVersion(cpe); +322 final List<Vulnerability> vulnerabilities = new ArrayList<Vulnerability>(); +323 +324 PreparedStatement ps = null; +325 ResultSet rs = null; +326 try { +327 ps = getConnection().prepareStatement(statementBundle.getString("SELECT_CVE_FROM_SOFTWARE")); +328 ps.setString(1, cpe.getVendor()); +329 ps.setString(2, cpe.getProduct()); +330 rs = ps.executeQuery(); +331 String currentCVE = ""; +332 +333 final Map<String, Boolean> vulnSoftware = new HashMap<String, Boolean>(); +334 while (rs.next()) { +335 final String cveId = rs.getString(1); +336 if (!currentCVE.equals(cveId)) { //check for match and add +337 final Entry<String, Boolean> matchedCPE = getMatchingSoftware(vulnSoftware, cpe.getVendor(), cpe.getProduct(), detectedVersion); +338 if (matchedCPE != null) { +339 final Vulnerability v = getVulnerability(currentCVE); +340 v.setMatchedCPE(matchedCPE.getKey(), matchedCPE.getValue() ? "Y" : null); +341 vulnerabilities.add(v); +342 } +343 vulnSoftware.clear(); +344 currentCVE = cveId; +345 } +346 +347 final String cpeId = rs.getString(2); +348 final String previous = rs.getString(3); +349 final Boolean p = previous != null && !previous.isEmpty(); +350 vulnSoftware.put(cpeId, p); +351 } +352 //remember to process the last set of CVE/CPE entries +353 final Entry<String, Boolean> matchedCPE = getMatchingSoftware(vulnSoftware, cpe.getVendor(), cpe.getProduct(), detectedVersion); +354 if (matchedCPE != null) { +355 final Vulnerability v = getVulnerability(currentCVE); +356 v.setMatchedCPE(matchedCPE.getKey(), matchedCPE.getValue() ? "Y" : null); +357 vulnerabilities.add(v); +358 } +359 } catch (SQLException ex) { +360 throw new DatabaseException("Exception retrieving vulnerability for " + cpeStr, ex); +361 } finally { +362 DBUtils.closeResultSet(rs); +363 DBUtils.closeStatement(ps); +364 } +365 return vulnerabilities; +366 } +367 +368 /** +369 * Gets a vulnerability for the provided CVE. +370 * +371 * @param cve the CVE to lookup +372 * @return a vulnerability object +373 * @throws DatabaseException if an exception occurs +374 */ +375 private Vulnerability getVulnerability(String cve) throws DatabaseException { +376 PreparedStatement psV = null; +377 PreparedStatement psR = null; +378 PreparedStatement psS = null; +379 ResultSet rsV = null; +380 ResultSet rsR = null; +381 ResultSet rsS = null; +382 Vulnerability vuln = null; +383 try { +384 psV = getConnection().prepareStatement(statementBundle.getString("SELECT_VULNERABILITY")); +385 psV.setString(1, cve); +386 rsV = psV.executeQuery(); +387 if (rsV.next()) { +388 vuln = new Vulnerability(); +389 vuln.setName(cve); +390 vuln.setDescription(rsV.getString(2)); +391 String cwe = rsV.getString(3); +392 if (cwe != null) { +393 final String name = CweDB.getCweName(cwe); +394 if (name != null) { +395 cwe += ' ' + name; +396 } +397 } +398 final int cveId = rsV.getInt(1); +399 vuln.setCwe(cwe); +400 vuln.setCvssScore(rsV.getFloat(4)); +401 vuln.setCvssAccessVector(rsV.getString(5)); +402 vuln.setCvssAccessComplexity(rsV.getString(6)); +403 vuln.setCvssAuthentication(rsV.getString(7)); +404 vuln.setCvssConfidentialityImpact(rsV.getString(8)); +405 vuln.setCvssIntegrityImpact(rsV.getString(9)); +406 vuln.setCvssAvailabilityImpact(rsV.getString(10)); +407 +408 psR = getConnection().prepareStatement(statementBundle.getString("SELECT_REFERENCES")); +409 psR.setInt(1, cveId); +410 rsR = psR.executeQuery(); +411 while (rsR.next()) { +412 vuln.addReference(rsR.getString(1), rsR.getString(2), rsR.getString(3)); +413 } +414 psS = getConnection().prepareStatement(statementBundle.getString("SELECT_SOFTWARE")); +415 psS.setInt(1, cveId); +416 rsS = psS.executeQuery(); +417 while (rsS.next()) { +418 final String cpe = rsS.getString(1); +419 final String prevVersion = rsS.getString(2); +420 if (prevVersion == null) { +421 vuln.addVulnerableSoftware(cpe); +422 } else { +423 vuln.addVulnerableSoftware(cpe, prevVersion); 424 } 425 } -426 final int cveId = rsV.getInt(1); -427 vuln.setCwe(cwe); -428 vuln.setCvssScore(rsV.getFloat(4)); -429 vuln.setCvssAccessVector(rsV.getString(5)); -430 vuln.setCvssAccessComplexity(rsV.getString(6)); -431 vuln.setCvssAuthentication(rsV.getString(7)); -432 vuln.setCvssConfidentialityImpact(rsV.getString(8)); -433 vuln.setCvssIntegrityImpact(rsV.getString(9)); -434 vuln.setCvssAvailabilityImpact(rsV.getString(10)); -435 -436 psR = getConnection().prepareStatement(statementBundle.getString("SELECT_REFERENCES")); -437 psR.setInt(1, cveId); -438 rsR = psR.executeQuery(); -439 while (rsR.next()) { -440 vuln.addReference(rsR.getString(1), rsR.getString(2), rsR.getString(3)); -441 } -442 psS = getConnection().prepareStatement(statementBundle.getString("SELECT_SOFTWARE")); -443 psS.setInt(1, cveId); -444 rsS = psS.executeQuery(); -445 while (rsS.next()) { -446 final String cpe = rsS.getString(1); -447 final String prevVersion = rsS.getString(2); -448 if (prevVersion == null) { -449 vuln.addVulnerableSoftware(cpe); -450 } else { -451 vuln.addVulnerableSoftware(cpe, prevVersion); -452 } -453 } -454 } -455 } catch (SQLException ex) { -456 throw new DatabaseException("Error retrieving " + cve, ex); -457 } finally { -458 DBUtils.closeResultSet(rsV); -459 DBUtils.closeResultSet(rsR); -460 DBUtils.closeResultSet(rsS); -461 DBUtils.closeStatement(psV); -462 DBUtils.closeStatement(psR); -463 DBUtils.closeStatement(psS); -464 } -465 return vuln; -466 } -467 -468 /** -469 * Updates the vulnerability within the database. If the vulnerability does not exist it will be added. -470 * -471 * @param vuln the vulnerability to add to the database -472 * @throws DatabaseException is thrown if the database -473 */ -474 public void updateVulnerability(Vulnerability vuln) throws DatabaseException { -475 PreparedStatement selectVulnerabilityId = null; -476 PreparedStatement deleteVulnerability = null; -477 PreparedStatement deleteReferences = null; -478 PreparedStatement deleteSoftware = null; -479 PreparedStatement updateVulnerability = null; -480 PreparedStatement insertVulnerability = null; -481 PreparedStatement insertReference = null; -482 PreparedStatement selectCpeId = null; -483 PreparedStatement insertCpe = null; -484 PreparedStatement insertSoftware = null; -485 -486 try { -487 selectVulnerabilityId = getConnection().prepareStatement(statementBundle.getString("SELECT_VULNERABILITY_ID")); -488 deleteVulnerability = getConnection().prepareStatement(statementBundle.getString("DELETE_VULNERABILITY")); -489 deleteReferences = getConnection().prepareStatement(statementBundle.getString("DELETE_REFERENCE")); -490 deleteSoftware = getConnection().prepareStatement(statementBundle.getString("DELETE_SOFTWARE")); -491 updateVulnerability = getConnection().prepareStatement(statementBundle.getString("UPDATE_VULNERABILITY")); -492 final String[] ids = {"id"}; -493 insertVulnerability = getConnection().prepareStatement(statementBundle.getString("INSERT_VULNERABILITY"), -494 //Statement.RETURN_GENERATED_KEYS); -495 ids); -496 insertReference = getConnection().prepareStatement(statementBundle.getString("INSERT_REFERENCE")); -497 selectCpeId = getConnection().prepareStatement(statementBundle.getString("SELECT_CPE_ID")); -498 insertCpe = getConnection().prepareStatement(statementBundle.getString("INSERT_CPE"), -499 //Statement.RETURN_GENERATED_KEYS); -500 ids); -501 insertSoftware = getConnection().prepareStatement(statementBundle.getString("INSERT_SOFTWARE")); -502 int vulnerabilityId = 0; -503 selectVulnerabilityId.setString(1, vuln.getName()); -504 ResultSet rs = selectVulnerabilityId.executeQuery(); -505 if (rs.next()) { -506 vulnerabilityId = rs.getInt(1); -507 // first delete any existing vulnerability info. We don't know what was updated. yes, slower but atm easier. -508 deleteReferences.setInt(1, vulnerabilityId); -509 deleteReferences.execute(); -510 deleteSoftware.setInt(1, vulnerabilityId); -511 deleteSoftware.execute(); -512 } -513 DBUtils.closeResultSet(rs); -514 rs = null; -515 if (vulnerabilityId != 0) { -516 if (vuln.getDescription().contains("** REJECT **")) { -517 deleteVulnerability.setInt(1, vulnerabilityId); -518 deleteVulnerability.executeUpdate(); -519 } else { -520 updateVulnerability.setString(1, vuln.getDescription()); -521 updateVulnerability.setString(2, vuln.getCwe()); -522 updateVulnerability.setFloat(3, vuln.getCvssScore()); -523 updateVulnerability.setString(4, vuln.getCvssAccessVector()); -524 updateVulnerability.setString(5, vuln.getCvssAccessComplexity()); -525 updateVulnerability.setString(6, vuln.getCvssAuthentication()); -526 updateVulnerability.setString(7, vuln.getCvssConfidentialityImpact()); -527 updateVulnerability.setString(8, vuln.getCvssIntegrityImpact()); -528 updateVulnerability.setString(9, vuln.getCvssAvailabilityImpact()); -529 updateVulnerability.setInt(10, vulnerabilityId); -530 updateVulnerability.executeUpdate(); -531 } -532 } else { -533 insertVulnerability.setString(1, vuln.getName()); -534 insertVulnerability.setString(2, vuln.getDescription()); -535 insertVulnerability.setString(3, vuln.getCwe()); -536 insertVulnerability.setFloat(4, vuln.getCvssScore()); -537 insertVulnerability.setString(5, vuln.getCvssAccessVector()); -538 insertVulnerability.setString(6, vuln.getCvssAccessComplexity()); -539 insertVulnerability.setString(7, vuln.getCvssAuthentication()); -540 insertVulnerability.setString(8, vuln.getCvssConfidentialityImpact()); -541 insertVulnerability.setString(9, vuln.getCvssIntegrityImpact()); -542 insertVulnerability.setString(10, vuln.getCvssAvailabilityImpact()); -543 insertVulnerability.execute(); -544 try { -545 rs = insertVulnerability.getGeneratedKeys(); -546 rs.next(); -547 vulnerabilityId = rs.getInt(1); -548 } catch (SQLException ex) { -549 final String msg = String.format("Unable to retrieve id for new vulnerability for '%s'", vuln.getName()); -550 throw new DatabaseException(msg, ex); -551 } finally { -552 DBUtils.closeResultSet(rs); -553 rs = null; -554 } -555 } -556 insertReference.setInt(1, vulnerabilityId); -557 for (Reference r : vuln.getReferences()) { -558 insertReference.setString(2, r.getName()); -559 insertReference.setString(3, r.getUrl()); -560 insertReference.setString(4, r.getSource()); -561 insertReference.execute(); -562 } -563 for (VulnerableSoftware s : vuln.getVulnerableSoftware()) { -564 int cpeProductId = 0; -565 selectCpeId.setString(1, s.getName()); -566 try { -567 rs = selectCpeId.executeQuery(); -568 if (rs.next()) { -569 cpeProductId = rs.getInt(1); -570 } -571 } catch (SQLException ex) { -572 throw new DatabaseException("Unable to get primary key for new cpe: " + s.getName(), ex); -573 } finally { -574 DBUtils.closeResultSet(rs); -575 rs = null; -576 } -577 -578 if (cpeProductId == 0) { -579 insertCpe.setString(1, s.getName()); -580 insertCpe.setString(2, s.getVendor()); -581 insertCpe.setString(3, s.getProduct()); -582 insertCpe.executeUpdate(); -583 cpeProductId = DBUtils.getGeneratedKey(insertCpe); -584 } -585 if (cpeProductId == 0) { -586 throw new DatabaseException("Unable to retrieve cpeProductId - no data returned"); -587 } +426 } +427 } catch (SQLException ex) { +428 throw new DatabaseException("Error retrieving " + cve, ex); +429 } finally { +430 DBUtils.closeResultSet(rsV); +431 DBUtils.closeResultSet(rsR); +432 DBUtils.closeResultSet(rsS); +433 DBUtils.closeStatement(psV); +434 DBUtils.closeStatement(psR); +435 DBUtils.closeStatement(psS); +436 } +437 return vuln; +438 } +439 +440 /** +441 * Updates the vulnerability within the database. If the vulnerability does not exist it will be added. +442 * +443 * @param vuln the vulnerability to add to the database +444 * @throws DatabaseException is thrown if the database +445 */ +446 public void updateVulnerability(Vulnerability vuln) throws DatabaseException { +447 PreparedStatement selectVulnerabilityId = null; +448 PreparedStatement deleteVulnerability = null; +449 PreparedStatement deleteReferences = null; +450 PreparedStatement deleteSoftware = null; +451 PreparedStatement updateVulnerability = null; +452 PreparedStatement insertVulnerability = null; +453 PreparedStatement insertReference = null; +454 PreparedStatement selectCpeId = null; +455 PreparedStatement insertCpe = null; +456 PreparedStatement insertSoftware = null; +457 +458 try { +459 selectVulnerabilityId = getConnection().prepareStatement(statementBundle.getString("SELECT_VULNERABILITY_ID")); +460 deleteVulnerability = getConnection().prepareStatement(statementBundle.getString("DELETE_VULNERABILITY")); +461 deleteReferences = getConnection().prepareStatement(statementBundle.getString("DELETE_REFERENCE")); +462 deleteSoftware = getConnection().prepareStatement(statementBundle.getString("DELETE_SOFTWARE")); +463 updateVulnerability = getConnection().prepareStatement(statementBundle.getString("UPDATE_VULNERABILITY")); +464 final String[] ids = {"id"}; +465 insertVulnerability = getConnection().prepareStatement(statementBundle.getString("INSERT_VULNERABILITY"), +466 //Statement.RETURN_GENERATED_KEYS); +467 ids); +468 insertReference = getConnection().prepareStatement(statementBundle.getString("INSERT_REFERENCE")); +469 selectCpeId = getConnection().prepareStatement(statementBundle.getString("SELECT_CPE_ID")); +470 insertCpe = getConnection().prepareStatement(statementBundle.getString("INSERT_CPE"), +471 //Statement.RETURN_GENERATED_KEYS); +472 ids); +473 insertSoftware = getConnection().prepareStatement(statementBundle.getString("INSERT_SOFTWARE")); +474 int vulnerabilityId = 0; +475 selectVulnerabilityId.setString(1, vuln.getName()); +476 ResultSet rs = selectVulnerabilityId.executeQuery(); +477 if (rs.next()) { +478 vulnerabilityId = rs.getInt(1); +479 // first delete any existing vulnerability info. We don't know what was updated. yes, slower but atm easier. +480 deleteReferences.setInt(1, vulnerabilityId); +481 deleteReferences.execute(); +482 deleteSoftware.setInt(1, vulnerabilityId); +483 deleteSoftware.execute(); +484 } +485 DBUtils.closeResultSet(rs); +486 rs = null; +487 if (vulnerabilityId != 0) { +488 if (vuln.getDescription().contains("** REJECT **")) { +489 deleteVulnerability.setInt(1, vulnerabilityId); +490 deleteVulnerability.executeUpdate(); +491 } else { +492 updateVulnerability.setString(1, vuln.getDescription()); +493 updateVulnerability.setString(2, vuln.getCwe()); +494 updateVulnerability.setFloat(3, vuln.getCvssScore()); +495 updateVulnerability.setString(4, vuln.getCvssAccessVector()); +496 updateVulnerability.setString(5, vuln.getCvssAccessComplexity()); +497 updateVulnerability.setString(6, vuln.getCvssAuthentication()); +498 updateVulnerability.setString(7, vuln.getCvssConfidentialityImpact()); +499 updateVulnerability.setString(8, vuln.getCvssIntegrityImpact()); +500 updateVulnerability.setString(9, vuln.getCvssAvailabilityImpact()); +501 updateVulnerability.setInt(10, vulnerabilityId); +502 updateVulnerability.executeUpdate(); +503 } +504 } else { +505 insertVulnerability.setString(1, vuln.getName()); +506 insertVulnerability.setString(2, vuln.getDescription()); +507 insertVulnerability.setString(3, vuln.getCwe()); +508 insertVulnerability.setFloat(4, vuln.getCvssScore()); +509 insertVulnerability.setString(5, vuln.getCvssAccessVector()); +510 insertVulnerability.setString(6, vuln.getCvssAccessComplexity()); +511 insertVulnerability.setString(7, vuln.getCvssAuthentication()); +512 insertVulnerability.setString(8, vuln.getCvssConfidentialityImpact()); +513 insertVulnerability.setString(9, vuln.getCvssIntegrityImpact()); +514 insertVulnerability.setString(10, vuln.getCvssAvailabilityImpact()); +515 insertVulnerability.execute(); +516 try { +517 rs = insertVulnerability.getGeneratedKeys(); +518 rs.next(); +519 vulnerabilityId = rs.getInt(1); +520 } catch (SQLException ex) { +521 final String msg = String.format("Unable to retrieve id for new vulnerability for '%s'", vuln.getName()); +522 throw new DatabaseException(msg, ex); +523 } finally { +524 DBUtils.closeResultSet(rs); +525 rs = null; +526 } +527 } +528 insertReference.setInt(1, vulnerabilityId); +529 for (Reference r : vuln.getReferences()) { +530 insertReference.setString(2, r.getName()); +531 insertReference.setString(3, r.getUrl()); +532 insertReference.setString(4, r.getSource()); +533 insertReference.execute(); +534 } +535 for (VulnerableSoftware s : vuln.getVulnerableSoftware()) { +536 int cpeProductId = 0; +537 selectCpeId.setString(1, s.getName()); +538 try { +539 rs = selectCpeId.executeQuery(); +540 if (rs.next()) { +541 cpeProductId = rs.getInt(1); +542 } +543 } catch (SQLException ex) { +544 throw new DatabaseException("Unable to get primary key for new cpe: " + s.getName(), ex); +545 } finally { +546 DBUtils.closeResultSet(rs); +547 rs = null; +548 } +549 +550 if (cpeProductId == 0) { +551 insertCpe.setString(1, s.getName()); +552 insertCpe.setString(2, s.getVendor()); +553 insertCpe.setString(3, s.getProduct()); +554 insertCpe.executeUpdate(); +555 cpeProductId = DBUtils.getGeneratedKey(insertCpe); +556 } +557 if (cpeProductId == 0) { +558 throw new DatabaseException("Unable to retrieve cpeProductId - no data returned"); +559 } +560 +561 insertSoftware.setInt(1, vulnerabilityId); +562 insertSoftware.setInt(2, cpeProductId); +563 if (s.getPreviousVersion() == null) { +564 insertSoftware.setNull(3, java.sql.Types.VARCHAR); +565 } else { +566 insertSoftware.setString(3, s.getPreviousVersion()); +567 } +568 insertSoftware.execute(); +569 } +570 +571 } catch (SQLException ex) { +572 final String msg = String.format("Error updating '%s'", vuln.getName()); +573 LOGGER.debug("", ex); +574 throw new DatabaseException(msg, ex); +575 } finally { +576 DBUtils.closeStatement(selectVulnerabilityId); +577 DBUtils.closeStatement(deleteReferences); +578 DBUtils.closeStatement(deleteSoftware); +579 DBUtils.closeStatement(updateVulnerability); +580 DBUtils.closeStatement(deleteVulnerability); +581 DBUtils.closeStatement(insertVulnerability); +582 DBUtils.closeStatement(insertReference); +583 DBUtils.closeStatement(selectCpeId); +584 DBUtils.closeStatement(insertCpe); +585 DBUtils.closeStatement(insertSoftware); +586 } +587 } 588 -589 insertSoftware.setInt(1, vulnerabilityId); -590 insertSoftware.setInt(2, cpeProductId); -591 if (s.getPreviousVersion() == null) { -592 insertSoftware.setNull(3, java.sql.Types.VARCHAR); -593 } else { -594 insertSoftware.setString(3, s.getPreviousVersion()); -595 } -596 insertSoftware.execute(); -597 } -598 -599 } catch (SQLException ex) { -600 final String msg = String.format("Error updating '%s'", vuln.getName()); -601 LOGGER.debug("", ex); -602 throw new DatabaseException(msg, ex); -603 } finally { -604 DBUtils.closeStatement(selectVulnerabilityId); -605 DBUtils.closeStatement(deleteReferences); -606 DBUtils.closeStatement(deleteSoftware); -607 DBUtils.closeStatement(updateVulnerability); -608 DBUtils.closeStatement(deleteVulnerability); -609 DBUtils.closeStatement(insertVulnerability); -610 DBUtils.closeStatement(insertReference); -611 DBUtils.closeStatement(selectCpeId); -612 DBUtils.closeStatement(insertCpe); -613 DBUtils.closeStatement(insertSoftware); -614 } -615 } -616 -617 /** -618 * Checks to see if data exists so that analysis can be performed. -619 * -620 * @return <code>true</code> if data exists; otherwise <code>false</code> -621 */ -622 public boolean dataExists() { -623 Statement cs = null; -624 ResultSet rs = null; -625 try { -626 cs = conn.createStatement(); -627 rs = cs.executeQuery("SELECT COUNT(*) records FROM cpeEntry"); -628 if (rs.next()) { -629 if (rs.getInt(1) > 0) { -630 return true; -631 } -632 } -633 } catch (SQLException ex) { -634 String dd; -635 try { -636 dd = Settings.getDataDirectory().getAbsolutePath(); -637 } catch (IOException ex1) { -638 dd = Settings.getString(Settings.KEYS.DATA_DIRECTORY); -639 } -640 LOGGER.error("Unable to access the local database.\n\nEnsure that '{}' is a writable directory. " -641 + "If the problem persist try deleting the files in '{}' and running {} again. If the problem continues, please " -642 + "create a log file (see documentation at http://jeremylong.github.io/DependencyCheck/) and open a ticket at " -643 + "https://github.com/jeremylong/DependencyCheck/issues and include the log file.\n\n", -644 dd, dd, Settings.getString(Settings.KEYS.APPLICATION_VAME)); -645 LOGGER.debug("", ex); -646 } finally { -647 DBUtils.closeResultSet(rs); -648 DBUtils.closeStatement(cs); -649 } -650 return false; -651 } -652 -653 /** -654 * It is possible that orphaned rows may be generated during database updates. This should be called after all updates have -655 * been completed to ensure orphan entries are removed. -656 */ -657 public void cleanupDatabase() { -658 PreparedStatement ps = null; -659 try { -660 ps = getConnection().prepareStatement(statementBundle.getString("CLEANUP_ORPHANS")); -661 if (ps != null) { -662 ps.executeUpdate(); -663 } -664 } catch (SQLException ex) { -665 LOGGER.error("An unexpected SQL Exception occurred; please see the verbose log for more details."); -666 LOGGER.debug("", ex); -667 } finally { -668 DBUtils.closeStatement(ps); -669 } -670 } -671 -672 /** -673 * Determines if the given identifiedVersion is affected by the given cpeId and previous version flag. A non-null, non-empty -674 * string passed to the previous version argument indicates that all previous versions are affected. -675 * -676 * @param vendor the vendor of the dependency being analyzed -677 * @param product the product name of the dependency being analyzed -678 * @param vulnerableSoftware a map of the vulnerable software with a boolean indicating if all previous versions are affected -679 * @param identifiedVersion the identified version of the dependency being analyzed -680 * @return true if the identified version is affected, otherwise false -681 */ -682 Entry<String, Boolean> getMatchingSoftware(Map<String, Boolean> vulnerableSoftware, String vendor, String product, -683 DependencyVersion identifiedVersion) { -684 -685 final boolean isVersionTwoADifferentProduct = "apache".equals(vendor) && "struts".equals(product); -686 -687 final Set<String> majorVersionsAffectingAllPrevious = new HashSet<String>(); -688 final boolean matchesAnyPrevious = identifiedVersion == null || "-".equals(identifiedVersion.toString()); -689 String majorVersionMatch = null; -690 for (Entry<String, Boolean> entry : vulnerableSoftware.entrySet()) { -691 final DependencyVersion v = parseDependencyVersion(entry.getKey()); -692 if (v == null || "-".equals(v.toString())) { //all versions -693 return entry; -694 } -695 if (entry.getValue()) { -696 if (matchesAnyPrevious) { -697 return entry; -698 } -699 if (identifiedVersion != null && identifiedVersion.getVersionParts().get(0).equals(v.getVersionParts().get(0))) { -700 majorVersionMatch = v.getVersionParts().get(0); -701 } -702 majorVersionsAffectingAllPrevious.add(v.getVersionParts().get(0)); -703 } -704 } -705 if (matchesAnyPrevious) { -706 return null; -707 } -708 -709 final boolean canSkipVersions = majorVersionMatch != null && majorVersionsAffectingAllPrevious.size() > 1; -710 //yes, we are iterating over this twice. The first time we are skipping versions those that affect all versions -711 //then later we process those that affect all versions. This could be done with sorting... -712 for (Entry<String, Boolean> entry : vulnerableSoftware.entrySet()) { -713 if (!entry.getValue()) { -714 final DependencyVersion v = parseDependencyVersion(entry.getKey()); -715 //this can't dereference a null 'majorVersionMatch' as canSkipVersions accounts for this. -716 if (canSkipVersions && !majorVersionMatch.equals(v.getVersionParts().get(0))) { -717 continue; -718 } -719 //this can't dereference a null 'identifiedVersion' because if it was null we would have exited -720 //in the above loop or just after loop (if matchesAnyPrevious return null). -721 if (identifiedVersion.equals(v)) { -722 return entry; -723 } -724 } -725 } -726 for (Entry<String, Boolean> entry : vulnerableSoftware.entrySet()) { -727 if (entry.getValue()) { -728 final DependencyVersion v = parseDependencyVersion(entry.getKey()); -729 //this can't dereference a null 'majorVersionMatch' as canSkipVersions accounts for this. -730 if (canSkipVersions && !majorVersionMatch.equals(v.getVersionParts().get(0))) { -731 continue; -732 } -733 //this can't dereference a null 'identifiedVersion' because if it was null we would have exited -734 //in the above loop or just after loop (if matchesAnyPrevious return null). -735 if (entry.getValue() && identifiedVersion.compareTo(v) <= 0) { -736 if (!(isVersionTwoADifferentProduct && !identifiedVersion.getVersionParts().get(0).equals(v.getVersionParts().get(0)))) { -737 return entry; -738 } -739 } -740 } -741 } -742 return null; -743 } -744 -745 /** -746 * Parses the version (including revision) from a CPE identifier. If no version is identified then a '-' is returned. -747 * -748 * @param cpeStr a cpe identifier -749 * @return a dependency version -750 */ -751 private DependencyVersion parseDependencyVersion(String cpeStr) { -752 final VulnerableSoftware cpe = new VulnerableSoftware(); -753 try { -754 cpe.parseName(cpeStr); -755 } catch (UnsupportedEncodingException ex) { -756 //never going to happen. -757 LOGGER.trace("", ex); -758 } -759 return parseDependencyVersion(cpe); -760 } -761 -762 /** -763 * Takes a CPE and parses out the version number. If no version is identified then a '-' is returned. -764 * -765 * @param cpe a cpe object -766 * @return a dependency version -767 */ -768 private DependencyVersion parseDependencyVersion(VulnerableSoftware cpe) { -769 final DependencyVersion cpeVersion; -770 if (cpe.getVersion() != null && !cpe.getVersion().isEmpty()) { -771 final String versionText; -772 if (cpe.getUpdate() != null && !cpe.getUpdate().isEmpty()) { -773 versionText = String.format("%s.%s", cpe.getVersion(), cpe.getUpdate()); -774 } else { -775 versionText = cpe.getVersion(); -776 } -777 cpeVersion = DependencyVersionUtil.parseVersion(versionText); -778 } else { -779 cpeVersion = new DependencyVersion("-"); -780 } -781 return cpeVersion; -782 } -783 -784 /** -785 * This method is only referenced in unused code. -786 * -787 * Deletes unused dictionary entries from the database. -788 */ -789 public void deleteUnusedCpe() { -790 CallableStatement cs = null; -791 try { -792 cs = getConnection().prepareCall(statementBundle.getString("DELETE_UNUSED_DICT_CPE")); -793 cs.executeUpdate(); -794 } catch (SQLException ex) { -795 LOGGER.error("Unable to delete CPE dictionary entries", ex); -796 } finally { -797 DBUtils.closeStatement(cs); -798 } -799 } -800 -801 /** -802 * This method is only referenced in unused code and will likely break on MySQL if ever used due to the MERGE statement. -803 * -804 * Merges CPE entries into the database. -805 * -806 * @param cpe the CPE identifier -807 * @param vendor the CPE vendor -808 * @param product the CPE product -809 */ -810 public void addCpe(String cpe, String vendor, String product) { -811 PreparedStatement ps = null; -812 try { -813 ps = getConnection().prepareCall(statementBundle.getString("ADD_DICT_CPE")); -814 ps.setString(1, cpe); -815 ps.setString(2, vendor); -816 ps.setString(3, product); -817 ps.executeUpdate(); -818 } catch (SQLException ex) { -819 LOGGER.error("Unable to add CPE dictionary entry", ex); -820 } finally { -821 DBUtils.closeStatement(ps); -822 } -823 } -824 } +589 /** +590 * Checks to see if data exists so that analysis can be performed. +591 * +592 * @return <code>true</code> if data exists; otherwise <code>false</code> +593 */ +594 public boolean dataExists() { +595 Statement cs = null; +596 ResultSet rs = null; +597 try { +598 cs = conn.createStatement(); +599 rs = cs.executeQuery("SELECT COUNT(*) records FROM cpeEntry"); +600 if (rs.next()) { +601 if (rs.getInt(1) > 0) { +602 return true; +603 } +604 } +605 } catch (SQLException ex) { +606 String dd; +607 try { +608 dd = Settings.getDataDirectory().getAbsolutePath(); +609 } catch (IOException ex1) { +610 dd = Settings.getString(Settings.KEYS.DATA_DIRECTORY); +611 } +612 LOGGER.error("Unable to access the local database.\n\nEnsure that '{}' is a writable directory. " +613 + "If the problem persist try deleting the files in '{}' and running {} again. If the problem continues, please " +614 + "create a log file (see documentation at http://jeremylong.github.io/DependencyCheck/) and open a ticket at " +615 + "https://github.com/jeremylong/DependencyCheck/issues and include the log file.\n\n", +616 dd, dd, Settings.getString(Settings.KEYS.APPLICATION_VAME)); +617 LOGGER.debug("", ex); +618 } finally { +619 DBUtils.closeResultSet(rs); +620 DBUtils.closeStatement(cs); +621 } +622 return false; +623 } +624 +625 /** +626 * It is possible that orphaned rows may be generated during database updates. This should be called after all updates have +627 * been completed to ensure orphan entries are removed. +628 */ +629 public void cleanupDatabase() { +630 PreparedStatement ps = null; +631 try { +632 ps = getConnection().prepareStatement(statementBundle.getString("CLEANUP_ORPHANS")); +633 if (ps != null) { +634 ps.executeUpdate(); +635 } +636 } catch (SQLException ex) { +637 LOGGER.error("An unexpected SQL Exception occurred; please see the verbose log for more details."); +638 LOGGER.debug("", ex); +639 } finally { +640 DBUtils.closeStatement(ps); +641 } +642 } +643 +644 /** +645 * Determines if the given identifiedVersion is affected by the given cpeId and previous version flag. A non-null, non-empty +646 * string passed to the previous version argument indicates that all previous versions are affected. +647 * +648 * @param vendor the vendor of the dependency being analyzed +649 * @param product the product name of the dependency being analyzed +650 * @param vulnerableSoftware a map of the vulnerable software with a boolean indicating if all previous versions are affected +651 * @param identifiedVersion the identified version of the dependency being analyzed +652 * @return true if the identified version is affected, otherwise false +653 */ +654 Entry<String, Boolean> getMatchingSoftware(Map<String, Boolean> vulnerableSoftware, String vendor, String product, +655 DependencyVersion identifiedVersion) { +656 +657 final boolean isVersionTwoADifferentProduct = "apache".equals(vendor) && "struts".equals(product); +658 +659 final Set<String> majorVersionsAffectingAllPrevious = new HashSet<String>(); +660 final boolean matchesAnyPrevious = identifiedVersion == null || "-".equals(identifiedVersion.toString()); +661 String majorVersionMatch = null; +662 for (Entry<String, Boolean> entry : vulnerableSoftware.entrySet()) { +663 final DependencyVersion v = parseDependencyVersion(entry.getKey()); +664 if (v == null || "-".equals(v.toString())) { //all versions +665 return entry; +666 } +667 if (entry.getValue()) { +668 if (matchesAnyPrevious) { +669 return entry; +670 } +671 if (identifiedVersion != null && identifiedVersion.getVersionParts().get(0).equals(v.getVersionParts().get(0))) { +672 majorVersionMatch = v.getVersionParts().get(0); +673 } +674 majorVersionsAffectingAllPrevious.add(v.getVersionParts().get(0)); +675 } +676 } +677 if (matchesAnyPrevious) { +678 return null; +679 } +680 +681 final boolean canSkipVersions = majorVersionMatch != null && majorVersionsAffectingAllPrevious.size() > 1; +682 //yes, we are iterating over this twice. The first time we are skipping versions those that affect all versions +683 //then later we process those that affect all versions. This could be done with sorting... +684 for (Entry<String, Boolean> entry : vulnerableSoftware.entrySet()) { +685 if (!entry.getValue()) { +686 final DependencyVersion v = parseDependencyVersion(entry.getKey()); +687 //this can't dereference a null 'majorVersionMatch' as canSkipVersions accounts for this. +688 if (canSkipVersions && !majorVersionMatch.equals(v.getVersionParts().get(0))) { +689 continue; +690 } +691 //this can't dereference a null 'identifiedVersion' because if it was null we would have exited +692 //in the above loop or just after loop (if matchesAnyPrevious return null). +693 if (identifiedVersion.equals(v)) { +694 return entry; +695 } +696 } +697 } +698 for (Entry<String, Boolean> entry : vulnerableSoftware.entrySet()) { +699 if (entry.getValue()) { +700 final DependencyVersion v = parseDependencyVersion(entry.getKey()); +701 //this can't dereference a null 'majorVersionMatch' as canSkipVersions accounts for this. +702 if (canSkipVersions && !majorVersionMatch.equals(v.getVersionParts().get(0))) { +703 continue; +704 } +705 //this can't dereference a null 'identifiedVersion' because if it was null we would have exited +706 //in the above loop or just after loop (if matchesAnyPrevious return null). +707 if (entry.getValue() && identifiedVersion.compareTo(v) <= 0) { +708 if (!(isVersionTwoADifferentProduct && !identifiedVersion.getVersionParts().get(0).equals(v.getVersionParts().get(0)))) { +709 return entry; +710 } +711 } +712 } +713 } +714 return null; +715 } +716 +717 /** +718 * Parses the version (including revision) from a CPE identifier. If no version is identified then a '-' is returned. +719 * +720 * @param cpeStr a cpe identifier +721 * @return a dependency version +722 */ +723 private DependencyVersion parseDependencyVersion(String cpeStr) { +724 final VulnerableSoftware cpe = new VulnerableSoftware(); +725 try { +726 cpe.parseName(cpeStr); +727 } catch (UnsupportedEncodingException ex) { +728 //never going to happen. +729 LOGGER.trace("", ex); +730 } +731 return parseDependencyVersion(cpe); +732 } +733 +734 /** +735 * Takes a CPE and parses out the version number. If no version is identified then a '-' is returned. +736 * +737 * @param cpe a cpe object +738 * @return a dependency version +739 */ +740 private DependencyVersion parseDependencyVersion(VulnerableSoftware cpe) { +741 final DependencyVersion cpeVersion; +742 if (cpe.getVersion() != null && !cpe.getVersion().isEmpty()) { +743 final String versionText; +744 if (cpe.getUpdate() != null && !cpe.getUpdate().isEmpty()) { +745 versionText = String.format("%s.%s", cpe.getVersion(), cpe.getUpdate()); +746 } else { +747 versionText = cpe.getVersion(); +748 } +749 cpeVersion = DependencyVersionUtil.parseVersion(versionText); +750 } else { +751 cpeVersion = new DependencyVersion("-"); +752 } +753 return cpeVersion; +754 } +755 +756 /** +757 * This method is only referenced in unused code. +758 * +759 * Deletes unused dictionary entries from the database. +760 */ +761 public void deleteUnusedCpe() { +762 CallableStatement cs = null; +763 try { +764 cs = getConnection().prepareCall(statementBundle.getString("DELETE_UNUSED_DICT_CPE")); +765 cs.executeUpdate(); +766 } catch (SQLException ex) { +767 LOGGER.error("Unable to delete CPE dictionary entries", ex); +768 } finally { +769 DBUtils.closeStatement(cs); +770 } +771 } +772 +773 /** +774 * This method is only referenced in unused code and will likely break on MySQL if ever used due to the MERGE statement. +775 * +776 * Merges CPE entries into the database. +777 * +778 * @param cpe the CPE identifier +779 * @param vendor the CPE vendor +780 * @param product the CPE product +781 */ +782 public void addCpe(String cpe, String vendor, String product) { +783 PreparedStatement ps = null; +784 try { +785 ps = getConnection().prepareCall(statementBundle.getString("ADD_DICT_CPE")); +786 ps.setString(1, cpe); +787 ps.setString(2, vendor); +788 ps.setString(3, product); +789 ps.executeUpdate(); +790 } catch (SQLException ex) { +791 LOGGER.error("Unable to add CPE dictionary entry", ex); +792 } finally { +793 DBUtils.closeStatement(ps); +794 } +795 } +796 }
        diff --git a/xref/org/owasp/dependencycheck/data/nvdcve/DatabaseProperties.html b/xref/org/owasp/dependencycheck/data/nvdcve/DatabaseProperties.html index 922117e5a..1f03b5eef 100644 --- a/xref/org/owasp/dependencycheck/data/nvdcve/DatabaseProperties.html +++ b/xref/org/owasp/dependencycheck/data/nvdcve/DatabaseProperties.html @@ -54,144 +54,148 @@ 46 */ 47 public static final String MODIFIED = "Modified"; 48 /** -49 * The properties file key for the last updated field - used to store the last updated time of the Modified NVD CVE xml file. +49 * The properties file key for the last checked field - used to store the last check time of the Modified NVD CVE xml file. 50 */ -51 public static final String LAST_UPDATED = "NVD CVE Modified"; +51 public static final String LAST_CHECKED = "NVD CVE Checked"; 52 /** -53 * Stores the last updated time for each of the NVD CVE files. These timestamps should be updated if we process the modified -54 * file within 7 days of the last update. -55 */ -56 public static final String LAST_UPDATED_BASE = "NVD CVE "; -57 /** -58 * The key for the last time the CPE data was updated. +53 * The properties file key for the last updated field - used to store the last updated time of the Modified NVD CVE xml file. +54 */ +55 public static final String LAST_UPDATED = "NVD CVE Modified"; +56 /** +57 * Stores the last updated time for each of the NVD CVE files. These timestamps should be updated if we process the modified +58 * file within 7 days of the last update. 59 */ -60 public static final String LAST_CPE_UPDATE = "LAST_CPE_UPDATE"; +60 public static final String LAST_UPDATED_BASE = "NVD CVE "; 61 /** -62 * The key for the database schema version. +62 * The key for the last time the CPE data was updated. 63 */ -64 public static final String VERSION = "version"; -65 -66 /** -67 * A collection of properties about the data. -68 */ -69 private Properties properties; +64 public static final String LAST_CPE_UPDATE = "LAST_CPE_UPDATE"; +65 /** +66 * The key for the database schema version. +67 */ +68 public static final String VERSION = "version"; +69 70 /** -71 * A reference to the database. +71 * A collection of properties about the data. 72 */ -73 private CveDB cveDB; -74 -75 /** -76 * Constructs a new data properties object. -77 * -78 * @param cveDB the database object holding the properties -79 */ -80 DatabaseProperties(CveDB cveDB) { -81 this.cveDB = cveDB; -82 loadProperties(); -83 } -84 -85 /** -86 * Loads the properties from the database. -87 */ -88 private void loadProperties() { -89 this.properties = cveDB.getProperties(); -90 } -91 -92 /** -93 * Returns whether or not any properties are set. -94 * -95 * @return whether or not any properties are set -96 */ -97 public boolean isEmpty() { -98 return properties == null || properties.isEmpty(); -99 } -100 -101 /** -102 * Saves the last updated information to the properties file. -103 * -104 * @param updatedValue the updated NVD CVE entry -105 * @throws UpdateException is thrown if there is an update exception -106 */ -107 public void save(NvdCveInfo updatedValue) throws UpdateException { -108 if (updatedValue == null) { -109 return; -110 } -111 save(LAST_UPDATED_BASE + updatedValue.getId(), String.valueOf(updatedValue.getTimestamp())); -112 } -113 -114 /** -115 * Saves the key value pair to the properties store. -116 * -117 * @param key the property key -118 * @param value the property value -119 * @throws UpdateException is thrown if there is an update exception -120 */ -121 public void save(String key, String value) throws UpdateException { -122 properties.put(key, value); -123 cveDB.saveProperty(key, value); -124 } -125 -126 /** -127 * Returns the property value for the given key. If the key is not contained in the underlying properties null is returned. -128 * -129 * @param key the property key -130 * @return the value of the property -131 */ -132 public String getProperty(String key) { -133 return properties.getProperty(key); -134 } -135 -136 /** -137 * Returns the property value for the given key. If the key is not contained in the underlying properties the default value is -138 * returned. -139 * -140 * @param key the property key -141 * @param defaultValue the default value -142 * @return the value of the property -143 */ -144 public String getProperty(String key, String defaultValue) { -145 return properties.getProperty(key, defaultValue); -146 } -147 -148 /** -149 * Returns the collection of Database Properties as a properties collection. -150 * -151 * @return the collection of Database Properties -152 */ -153 public Properties getProperties() { -154 return properties; -155 } -156 -157 /** -158 * Returns a map of the meta data from the database properties. This primarily contains timestamps of when the NVD CVE -159 * information was last updated. -160 * -161 * @return a map of the database meta data -162 */ -163 public Map<String, String> getMetaData() { -164 final Map<String, String> map = new TreeMap<String, String>(); -165 for (Entry<Object, Object> entry : properties.entrySet()) { -166 final String key = (String) entry.getKey(); -167 if (!"version".equals(key)) { -168 if (key.startsWith("NVD CVE ")) { -169 try { -170 final long epoch = Long.parseLong((String) entry.getValue()); -171 final Date date = new Date(epoch); -172 final DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); -173 final String formatted = format.format(date); -174 map.put(key, formatted); -175 } catch (Throwable ex) { //deliberately being broad in this catch clause -176 LOGGER.debug("Unable to parse timestamp from DB", ex); -177 map.put(key, (String) entry.getValue()); -178 } -179 } else { -180 map.put(key, (String) entry.getValue()); -181 } -182 } -183 } -184 return map; -185 } -186 } +73 private Properties properties; +74 /** +75 * A reference to the database. +76 */ +77 private CveDB cveDB; +78 +79 /** +80 * Constructs a new data properties object. +81 * +82 * @param cveDB the database object holding the properties +83 */ +84 DatabaseProperties(CveDB cveDB) { +85 this.cveDB = cveDB; +86 loadProperties(); +87 } +88 +89 /** +90 * Loads the properties from the database. +91 */ +92 private void loadProperties() { +93 this.properties = cveDB.getProperties(); +94 } +95 +96 /** +97 * Returns whether or not any properties are set. +98 * +99 * @return whether or not any properties are set +100 */ +101 public boolean isEmpty() { +102 return properties == null || properties.isEmpty(); +103 } +104 +105 /** +106 * Saves the last updated information to the properties file. +107 * +108 * @param updatedValue the updated NVD CVE entry +109 * @throws UpdateException is thrown if there is an update exception +110 */ +111 public void save(NvdCveInfo updatedValue) throws UpdateException { +112 if (updatedValue == null) { +113 return; +114 } +115 save(LAST_UPDATED_BASE + updatedValue.getId(), String.valueOf(updatedValue.getTimestamp())); +116 } +117 +118 /** +119 * Saves the key value pair to the properties store. +120 * +121 * @param key the property key +122 * @param value the property value +123 * @throws UpdateException is thrown if there is an update exception +124 */ +125 public void save(String key, String value) throws UpdateException { +126 properties.put(key, value); +127 cveDB.saveProperty(key, value); +128 } +129 +130 /** +131 * Returns the property value for the given key. If the key is not contained in the underlying properties null is returned. +132 * +133 * @param key the property key +134 * @return the value of the property +135 */ +136 public String getProperty(String key) { +137 return properties.getProperty(key); +138 } +139 +140 /** +141 * Returns the property value for the given key. If the key is not contained in the underlying properties the default value is +142 * returned. +143 * +144 * @param key the property key +145 * @param defaultValue the default value +146 * @return the value of the property +147 */ +148 public String getProperty(String key, String defaultValue) { +149 return properties.getProperty(key, defaultValue); +150 } +151 +152 /** +153 * Returns the collection of Database Properties as a properties collection. +154 * +155 * @return the collection of Database Properties +156 */ +157 public Properties getProperties() { +158 return properties; +159 } +160 +161 /** +162 * Returns a map of the meta data from the database properties. This primarily contains timestamps of when the NVD CVE +163 * information was last updated. +164 * +165 * @return a map of the database meta data +166 */ +167 public Map<String, String> getMetaData() { +168 final Map<String, String> map = new TreeMap<String, String>(); +169 for (Entry<Object, Object> entry : properties.entrySet()) { +170 final String key = (String) entry.getKey(); +171 if (!"version".equals(key)) { +172 if (key.startsWith("NVD CVE ")) { +173 try { +174 final long epoch = Long.parseLong((String) entry.getValue()); +175 final Date date = new Date(epoch); +176 final DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); +177 final String formatted = format.format(date); +178 map.put(key, formatted); +179 } catch (Throwable ex) { //deliberately being broad in this catch clause +180 LOGGER.debug("Unable to parse timestamp from DB", ex); +181 map.put(key, (String) entry.getValue()); +182 } +183 } else { +184 map.put(key, (String) entry.getValue()); +185 } +186 } +187 } +188 return map; +189 } +190 }
        diff --git a/xref/org/owasp/dependencycheck/data/nvdcve/DriverLoader.html b/xref/org/owasp/dependencycheck/data/nvdcve/DriverLoader.html index 3385d85be..02e50b401 100644 --- a/xref/org/owasp/dependencycheck/data/nvdcve/DriverLoader.html +++ b/xref/org/owasp/dependencycheck/data/nvdcve/DriverLoader.html @@ -71,92 +71,91 @@ 63 } 64 65 /** -66 * Loads the specified class by registering the supplied paths to the class loader and then registers the driver -67 * with the driver manager. The pathToDriver argument is added to the class loader so that an external driver can be -68 * loaded. Note, the pathToDriver can contain a semi-colon separated list of paths so any dependencies can be added -69 * as needed. If a path in the pathToDriver argument is a directory all files in the directory are added to the -70 * class path. -71 * -72 * @param className the fully qualified name of the desired class -73 * @param pathToDriver the path to the JAR file containing the driver; note, this can be a semi-colon separated list -74 * of paths -75 * @return the loaded Driver -76 * @throws DriverLoadException thrown if the driver cannot be loaded -77 */ -78 public static Driver load(String className, String pathToDriver) throws DriverLoadException { -79 final URLClassLoader parent = (URLClassLoader) ClassLoader.getSystemClassLoader(); -80 final List<URL> urls = new ArrayList<URL>(); -81 final String[] paths = pathToDriver.split(File.pathSeparator); -82 for (String path : paths) { -83 final File file = new File(path); -84 if (file.isDirectory()) { -85 final File[] files = file.listFiles(); -86 -87 for (File f : files) { -88 try { -89 urls.add(f.toURI().toURL()); -90 } catch (MalformedURLException ex) { -91 LOGGER.debug("Unable to load database driver '{}'; invalid path provided '{}'", -92 className, f.getAbsoluteFile(), ex); -93 throw new DriverLoadException("Unable to load database driver. Invalid path provided", ex); -94 } -95 } -96 } else if (file.exists()) { -97 try { -98 urls.add(file.toURI().toURL()); -99 } catch (MalformedURLException ex) { -100 LOGGER.debug("Unable to load database driver '{}'; invalid path provided '{}'", -101 className, file.getAbsoluteFile(), ex); -102 throw new DriverLoadException("Unable to load database driver. Invalid path provided", ex); -103 } -104 } -105 } -106 final URLClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() { -107 @Override -108 public URLClassLoader run() { -109 return new URLClassLoader(urls.toArray(new URL[urls.size()]), parent); -110 } -111 }); -112 -113 return load(className, loader); -114 } -115 -116 /** -117 * Loads the specified class using the supplied class loader and registers the driver with the driver manager. -118 * -119 * @param className the fully qualified name of the desired class -120 * @param loader the class loader to use when loading the driver -121 * @return the loaded Driver -122 * @throws DriverLoadException thrown if the driver cannot be loaded -123 */ -124 private static Driver load(String className, ClassLoader loader) throws DriverLoadException { -125 try { -126 final Class c = Class.forName(className, true, loader); -127 //final Class c = loader.loadClass(className); -128 final Driver driver = (Driver) c.newInstance(); -129 final Driver shim = new DriverShim(driver); -130 //using the DriverShim to get around the fact that the DriverManager won't register a driver not in the base class path -131 DriverManager.registerDriver(shim); -132 return shim; -133 } catch (ClassNotFoundException ex) { -134 final String msg = String.format("Unable to load database driver '%s'", className); -135 LOGGER.debug(msg, ex); -136 throw new DriverLoadException(msg, ex); -137 } catch (InstantiationException ex) { -138 final String msg = String.format("Unable to load database driver '%s'", className); -139 LOGGER.debug(msg, ex); -140 throw new DriverLoadException(msg, ex); -141 } catch (IllegalAccessException ex) { -142 final String msg = String.format("Unable to load database driver '%s'", className); -143 LOGGER.debug(msg, ex); -144 throw new DriverLoadException(msg, ex); -145 } catch (SQLException ex) { -146 final String msg = String.format("Unable to load database driver '%s'", className); -147 LOGGER.debug(msg, ex); -148 throw new DriverLoadException(msg, ex); -149 } -150 } -151 } +66 * Loads the specified class by registering the supplied paths to the class loader and then registers the driver with the +67 * driver manager. The pathToDriver argument is added to the class loader so that an external driver can be loaded. Note, the +68 * pathToDriver can contain a semi-colon separated list of paths so any dependencies can be added as needed. If a path in the +69 * pathToDriver argument is a directory all files in the directory are added to the class path. +70 * +71 * @param className the fully qualified name of the desired class +72 * @param pathToDriver the path to the JAR file containing the driver; note, this can be a semi-colon separated list of paths +73 * @return the loaded Driver +74 * @throws DriverLoadException thrown if the driver cannot be loaded +75 */ +76 public static Driver load(String className, String pathToDriver) throws DriverLoadException { +77 final URLClassLoader parent = (URLClassLoader) ClassLoader.getSystemClassLoader(); +78 final List<URL> urls = new ArrayList<URL>(); +79 final String[] paths = pathToDriver.split(File.pathSeparator); +80 for (String path : paths) { +81 final File file = new File(path); +82 if (file.isDirectory()) { +83 final File[] files = file.listFiles(); +84 if (files != null) { +85 for (File f : files) { +86 try { +87 urls.add(f.toURI().toURL()); +88 } catch (MalformedURLException ex) { +89 LOGGER.debug("Unable to load database driver '{}'; invalid path provided '{}'", +90 className, f.getAbsoluteFile(), ex); +91 throw new DriverLoadException("Unable to load database driver. Invalid path provided", ex); +92 } +93 } +94 } +95 } else if (file.exists()) { +96 try { +97 urls.add(file.toURI().toURL()); +98 } catch (MalformedURLException ex) { +99 LOGGER.debug("Unable to load database driver '{}'; invalid path provided '{}'", +100 className, file.getAbsoluteFile(), ex); +101 throw new DriverLoadException("Unable to load database driver. Invalid path provided", ex); +102 } +103 } +104 } +105 final URLClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() { +106 @Override +107 public URLClassLoader run() { +108 return new URLClassLoader(urls.toArray(new URL[urls.size()]), parent); +109 } +110 }); +111 +112 return load(className, loader); +113 } +114 +115 /** +116 * Loads the specified class using the supplied class loader and registers the driver with the driver manager. +117 * +118 * @param className the fully qualified name of the desired class +119 * @param loader the class loader to use when loading the driver +120 * @return the loaded Driver +121 * @throws DriverLoadException thrown if the driver cannot be loaded +122 */ +123 private static Driver load(String className, ClassLoader loader) throws DriverLoadException { +124 try { +125 final Class c = Class.forName(className, true, loader); +126 //final Class c = loader.loadClass(className); +127 final Driver driver = (Driver) c.newInstance(); +128 final Driver shim = new DriverShim(driver); +129 //using the DriverShim to get around the fact that the DriverManager won't register a driver not in the base class path +130 DriverManager.registerDriver(shim); +131 return shim; +132 } catch (ClassNotFoundException ex) { +133 final String msg = String.format("Unable to load database driver '%s'", className); +134 LOGGER.debug(msg, ex); +135 throw new DriverLoadException(msg, ex); +136 } catch (InstantiationException ex) { +137 final String msg = String.format("Unable to load database driver '%s'", className); +138 LOGGER.debug(msg, ex); +139 throw new DriverLoadException(msg, ex); +140 } catch (IllegalAccessException ex) { +141 final String msg = String.format("Unable to load database driver '%s'", className); +142 LOGGER.debug(msg, ex); +143 throw new DriverLoadException(msg, ex); +144 } catch (SQLException ex) { +145 final String msg = String.format("Unable to load database driver '%s'", className); +146 LOGGER.debug(msg, ex); +147 throw new DriverLoadException(msg, ex); +148 } +149 } +150 }
        diff --git a/xref/org/owasp/dependencycheck/data/nvdcve/package-frame.html b/xref/org/owasp/dependencycheck/data/nvdcve/package-frame.html index d6044696d..2de11c771 100644 --- a/xref/org/owasp/dependencycheck/data/nvdcve/package-frame.html +++ b/xref/org/owasp/dependencycheck/data/nvdcve/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.nvdcve + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.nvdcve diff --git a/xref/org/owasp/dependencycheck/data/nvdcve/package-summary.html b/xref/org/owasp/dependencycheck/data/nvdcve/package-summary.html index 535d76757..c397a07b2 100644 --- a/xref/org/owasp/dependencycheck/data/nvdcve/package-summary.html +++ b/xref/org/owasp/dependencycheck/data/nvdcve/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.nvdcve + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.nvdcve diff --git a/xref/org/owasp/dependencycheck/data/update/CpeUpdater.html b/xref/org/owasp/dependencycheck/data/update/CpeUpdater.html index 25e85f441..b5e038900 100644 --- a/xref/org/owasp/dependencycheck/data/update/CpeUpdater.html +++ b/xref/org/owasp/dependencycheck/data/update/CpeUpdater.html @@ -145,7 +145,7 @@ 137 */ 138 private boolean updateNeeded() { 139 final long now = System.currentTimeMillis(); -140 final int days = Settings.getInt(Settings.KEYS.CVE_MODIFIED_VALID_FOR_DAYS, 30); +140 final int days = Settings.getInt(Settings.KEYS.CPE_MODIFIED_VALID_FOR_DAYS, 30); 141 long timestamp = 0; 142 final String ts = getProperties().getProperty(LAST_CPE_UPDATE); 143 if (ts != null && ts.matches("^[0-9]+$")) { diff --git a/xref/org/owasp/dependencycheck/data/update/NvdCveUpdater.html b/xref/org/owasp/dependencycheck/data/update/NvdCveUpdater.html index 2dd447038..67f9584f7 100644 --- a/xref/org/owasp/dependencycheck/data/update/NvdCveUpdater.html +++ b/xref/org/owasp/dependencycheck/data/update/NvdCveUpdater.html @@ -74,222 +74,253 @@ 66 public void update() throws UpdateException { 67 try { 68 openDataStores(); -69 final UpdateableNvdCve updateable = getUpdatesNeeded(); -70 if (updateable.isUpdateNeeded()) { -71 performUpdate(updateable); -72 } -73 } catch (MalformedURLException ex) { -74 LOGGER.warn( -75 "NVD CVE properties files contain an invalid URL, unable to update the data to use the most current data."); -76 LOGGER.debug("", ex); -77 } catch (DownloadFailedException ex) { -78 LOGGER.warn( -79 "Unable to download the NVD CVE data; the results may not include the most recent CPE/CVEs from the NVD."); -80 if (Settings.getString(Settings.KEYS.PROXY_SERVER) == null) { -81 LOGGER.info( -82 "If you are behind a proxy you may need to configure dependency-check to use the proxy."); -83 } -84 LOGGER.debug("", ex); -85 } finally { -86 closeDataStores(); -87 } -88 } -89 -90 /** -91 * Downloads the latest NVD CVE XML file from the web and imports it into the current CVE Database. -92 * -93 * @param updateable a collection of NVD CVE data file references that need to be downloaded and processed to update the -94 * database -95 * @throws UpdateException is thrown if there is an error updating the database -96 */ -97 public void performUpdate(UpdateableNvdCve updateable) throws UpdateException { -98 int maxUpdates = 0; -99 try { -100 for (NvdCveInfo cve : updateable) { -101 if (cve.getNeedsUpdate()) { -102 maxUpdates += 1; -103 } -104 } -105 if (maxUpdates <= 0) { -106 return; -107 } -108 if (maxUpdates > 3) { -109 LOGGER.info( -110 "NVD CVE requires several updates; this could take a couple of minutes."); -111 } -112 if (maxUpdates > 0) { -113 openDataStores(); -114 } -115 -116 final int poolSize = (MAX_THREAD_POOL_SIZE < maxUpdates) ? MAX_THREAD_POOL_SIZE : maxUpdates; -117 -118 final ExecutorService downloadExecutors = Executors.newFixedThreadPool(poolSize); -119 final ExecutorService processExecutor = Executors.newSingleThreadExecutor(); -120 final Set<Future<Future<ProcessTask>>> downloadFutures = new HashSet<Future<Future<ProcessTask>>>(maxUpdates); -121 for (NvdCveInfo cve : updateable) { -122 if (cve.getNeedsUpdate()) { -123 final DownloadTask call = new DownloadTask(cve, processExecutor, getCveDB(), Settings.getInstance()); -124 downloadFutures.add(downloadExecutors.submit(call)); -125 } -126 } -127 downloadExecutors.shutdown(); -128 -129 //next, move the future future processTasks to just future processTasks -130 final Set<Future<ProcessTask>> processFutures = new HashSet<Future<ProcessTask>>(maxUpdates); -131 for (Future<Future<ProcessTask>> future : downloadFutures) { -132 Future<ProcessTask> task = null; -133 try { -134 task = future.get(); -135 } catch (InterruptedException ex) { -136 downloadExecutors.shutdownNow(); -137 processExecutor.shutdownNow(); -138 -139 LOGGER.debug("Thread was interrupted during download", ex); -140 throw new UpdateException("The download was interrupted", ex); -141 } catch (ExecutionException ex) { -142 downloadExecutors.shutdownNow(); -143 processExecutor.shutdownNow(); -144 -145 LOGGER.debug("Thread was interrupted during download execution", ex); -146 throw new UpdateException("The execution of the download was interrupted", ex); -147 } -148 if (task == null) { -149 downloadExecutors.shutdownNow(); -150 processExecutor.shutdownNow(); -151 LOGGER.debug("Thread was interrupted during download"); -152 throw new UpdateException("The download was interrupted; unable to complete the update"); -153 } else { -154 processFutures.add(task); -155 } -156 } -157 -158 for (Future<ProcessTask> future : processFutures) { -159 try { -160 final ProcessTask task = future.get(); -161 if (task.getException() != null) { -162 throw task.getException(); -163 } -164 } catch (InterruptedException ex) { -165 processExecutor.shutdownNow(); -166 LOGGER.debug("Thread was interrupted during processing", ex); -167 throw new UpdateException(ex); -168 } catch (ExecutionException ex) { -169 processExecutor.shutdownNow(); -170 LOGGER.debug("Execution Exception during process", ex); -171 throw new UpdateException(ex); -172 } finally { -173 processExecutor.shutdown(); -174 } -175 } -176 -177 if (maxUpdates >= 1) { //ensure the modified file date gets written (we may not have actually updated it) -178 getProperties().save(updateable.get(MODIFIED)); -179 LOGGER.info("Begin database maintenance."); -180 getCveDB().cleanupDatabase(); -181 LOGGER.info("End database maintenance."); -182 } -183 } finally { -184 closeDataStores(); -185 } -186 } -187 -188 /** -189 * Determines if the index needs to be updated. This is done by fetching the NVD CVE meta data and checking the last update -190 * date. If the data needs to be refreshed this method will return the NvdCveUrl for the files that need to be updated. -191 * -192 * @return the collection of files that need to be updated -193 * @throws MalformedURLException is thrown if the URL for the NVD CVE Meta data is incorrect -194 * @throws DownloadFailedException is thrown if there is an error. downloading the NVD CVE download data file -195 * @throws UpdateException Is thrown if there is an issue with the last updated properties file -196 */ -197 protected final UpdateableNvdCve getUpdatesNeeded() throws MalformedURLException, DownloadFailedException, UpdateException { -198 UpdateableNvdCve updates = null; -199 try { -200 updates = retrieveCurrentTimestampsFromWeb(); -201 } catch (InvalidDataException ex) { -202 final String msg = "Unable to retrieve valid timestamp from nvd cve downloads page"; -203 LOGGER.debug(msg, ex); -204 throw new DownloadFailedException(msg, ex); -205 } catch (InvalidSettingException ex) { -206 LOGGER.debug("Invalid setting found when retrieving timestamps", ex); -207 throw new DownloadFailedException("Invalid settings", ex); -208 } -209 -210 if (updates == null) { -211 throw new DownloadFailedException("Unable to retrieve the timestamps of the currently published NVD CVE data"); -212 } -213 if (!getProperties().isEmpty()) { -214 try { -215 final long lastUpdated = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_UPDATED, "0")); -216 final long now = System.currentTimeMillis(); -217 final int days = Settings.getInt(Settings.KEYS.CVE_MODIFIED_VALID_FOR_DAYS, 7); -218 if (lastUpdated == updates.getTimeStamp(MODIFIED)) { -219 updates.clear(); //we don't need to update anything. -220 } else if (DateUtil.withinDateRange(lastUpdated, now, days)) { -221 for (NvdCveInfo entry : updates) { -222 if (MODIFIED.equals(entry.getId())) { -223 entry.setNeedsUpdate(true); -224 } else { -225 entry.setNeedsUpdate(false); -226 } -227 } -228 } else { //we figure out which of the several XML files need to be downloaded. -229 for (NvdCveInfo entry : updates) { -230 if (MODIFIED.equals(entry.getId())) { -231 entry.setNeedsUpdate(true); -232 } else { -233 long currentTimestamp = 0; -234 try { -235 currentTimestamp = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_UPDATED_BASE -236 + entry.getId(), "0")); -237 } catch (NumberFormatException ex) { -238 LOGGER.debug("Error parsing '{}' '{}' from nvdcve.lastupdated", -239 DatabaseProperties.LAST_UPDATED_BASE, entry.getId(), ex); -240 } -241 if (currentTimestamp == entry.getTimestamp()) { -242 entry.setNeedsUpdate(false); -243 } -244 } -245 } -246 } -247 } catch (NumberFormatException ex) { -248 LOGGER.warn("An invalid schema version or timestamp exists in the data.properties file."); -249 LOGGER.debug("", ex); -250 } -251 } -252 return updates; -253 } -254 -255 /** -256 * Retrieves the timestamps from the NVD CVE meta data file. -257 * -258 * @return the timestamp from the currently published nvdcve downloads page -259 * @throws MalformedURLException thrown if the URL for the NVD CCE Meta data is incorrect. -260 * @throws DownloadFailedException thrown if there is an error downloading the nvd cve meta data file -261 * @throws InvalidDataException thrown if there is an exception parsing the timestamps -262 * @throws InvalidSettingException thrown if the settings are invalid -263 */ -264 private UpdateableNvdCve retrieveCurrentTimestampsFromWeb() -265 throws MalformedURLException, DownloadFailedException, InvalidDataException, InvalidSettingException { -266 -267 final UpdateableNvdCve updates = new UpdateableNvdCve(); -268 updates.add(MODIFIED, Settings.getString(Settings.KEYS.CVE_MODIFIED_20_URL), -269 Settings.getString(Settings.KEYS.CVE_MODIFIED_12_URL), -270 false); -271 -272 final int start = Settings.getInt(Settings.KEYS.CVE_START_YEAR); -273 final int end = Calendar.getInstance().get(Calendar.YEAR); -274 final String baseUrl20 = Settings.getString(Settings.KEYS.CVE_SCHEMA_2_0); -275 final String baseUrl12 = Settings.getString(Settings.KEYS.CVE_SCHEMA_1_2); -276 for (int i = start; i <= end; i++) { -277 updates.add(Integer.toString(i), String.format(baseUrl20, i), -278 String.format(baseUrl12, i), -279 true); -280 } -281 return updates; -282 } -283 -284 } +69 if (checkUpdate()) { +70 final UpdateableNvdCve updateable = getUpdatesNeeded(); +71 if (updateable.isUpdateNeeded()) { +72 performUpdate(updateable); +73 } +74 } +75 } catch (MalformedURLException ex) { +76 LOGGER.warn( +77 "NVD CVE properties files contain an invalid URL, unable to update the data to use the most current data."); +78 LOGGER.debug("", ex); +79 } catch (DownloadFailedException ex) { +80 LOGGER.warn( +81 "Unable to download the NVD CVE data; the results may not include the most recent CPE/CVEs from the NVD."); +82 if (Settings.getString(Settings.KEYS.PROXY_SERVER) == null) { +83 LOGGER.info( +84 "If you are behind a proxy you may need to configure dependency-check to use the proxy."); +85 } +86 LOGGER.debug("", ex); +87 } finally { +88 closeDataStores(); +89 } +90 } +91 +92 /** +93 * Checks if the NVD CVE XML files were last checked recently. As an optimization, we can avoid repetitive checks against the +94 * NVD. Setting CVE_CHECK_VALID_FOR_HOURS determines the duration since last check before checking again. A database property +95 * stores the timestamp of the last check. +96 * +97 * @return true to proceed with the check, or false to skip. +98 * @throws UpdateException thrown when there is an issue checking for updates. +99 */ +100 private boolean checkUpdate() throws UpdateException { +101 boolean proceed = true; +102 // If the valid setting has not been specified, then we proceed to check... +103 final int validForHours = Settings.getInt(Settings.KEYS.CVE_CHECK_VALID_FOR_HOURS, 0); +104 if (0 < validForHours) { +105 // ms Valid = valid (hours) x 60 min/hour x 60 sec/min x 1000 ms/sec +106 final long msValid = validForHours * 60L * 60L * 1000L; +107 final long lastChecked = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_CHECKED, "0")); +108 final long now = System.currentTimeMillis(); +109 proceed = (now - lastChecked) > msValid; +110 if (proceed) { +111 getProperties().save(DatabaseProperties.LAST_CHECKED, Long.toString(now)); +112 } else { +113 LOGGER.info("Skipping NVD check since last check was within {} hours.", validForHours); +114 LOGGER.debug("Last NVD was at {}, and now {} is within {} ms.", +115 lastChecked, now, msValid); +116 } +117 } +118 return proceed; +119 } +120 +121 /** +122 * Downloads the latest NVD CVE XML file from the web and imports it into the current CVE Database. +123 * +124 * @param updateable a collection of NVD CVE data file references that need to be downloaded and processed to update the +125 * database +126 * @throws UpdateException is thrown if there is an error updating the database +127 */ +128 public void performUpdate(UpdateableNvdCve updateable) throws UpdateException { +129 int maxUpdates = 0; +130 try { +131 for (NvdCveInfo cve : updateable) { +132 if (cve.getNeedsUpdate()) { +133 maxUpdates += 1; +134 } +135 } +136 if (maxUpdates <= 0) { +137 return; +138 } +139 if (maxUpdates > 3) { +140 LOGGER.info( +141 "NVD CVE requires several updates; this could take a couple of minutes."); +142 } +143 if (maxUpdates > 0) { +144 openDataStores(); +145 } +146 +147 final int poolSize = (MAX_THREAD_POOL_SIZE < maxUpdates) ? MAX_THREAD_POOL_SIZE : maxUpdates; +148 +149 final ExecutorService downloadExecutors = Executors.newFixedThreadPool(poolSize); +150 final ExecutorService processExecutor = Executors.newSingleThreadExecutor(); +151 final Set<Future<Future<ProcessTask>>> downloadFutures = new HashSet<Future<Future<ProcessTask>>>(maxUpdates); +152 for (NvdCveInfo cve : updateable) { +153 if (cve.getNeedsUpdate()) { +154 final DownloadTask call = new DownloadTask(cve, processExecutor, getCveDB(), Settings.getInstance()); +155 downloadFutures.add(downloadExecutors.submit(call)); +156 } +157 } +158 downloadExecutors.shutdown(); +159 +160 //next, move the future future processTasks to just future processTasks +161 final Set<Future<ProcessTask>> processFutures = new HashSet<Future<ProcessTask>>(maxUpdates); +162 for (Future<Future<ProcessTask>> future : downloadFutures) { +163 Future<ProcessTask> task = null; +164 try { +165 task = future.get(); +166 } catch (InterruptedException ex) { +167 downloadExecutors.shutdownNow(); +168 processExecutor.shutdownNow(); +169 +170 LOGGER.debug("Thread was interrupted during download", ex); +171 throw new UpdateException("The download was interrupted", ex); +172 } catch (ExecutionException ex) { +173 downloadExecutors.shutdownNow(); +174 processExecutor.shutdownNow(); +175 +176 LOGGER.debug("Thread was interrupted during download execution", ex); +177 throw new UpdateException("The execution of the download was interrupted", ex); +178 } +179 if (task == null) { +180 downloadExecutors.shutdownNow(); +181 processExecutor.shutdownNow(); +182 LOGGER.debug("Thread was interrupted during download"); +183 throw new UpdateException("The download was interrupted; unable to complete the update"); +184 } else { +185 processFutures.add(task); +186 } +187 } +188 +189 for (Future<ProcessTask> future : processFutures) { +190 try { +191 final ProcessTask task = future.get(); +192 if (task.getException() != null) { +193 throw task.getException(); +194 } +195 } catch (InterruptedException ex) { +196 processExecutor.shutdownNow(); +197 LOGGER.debug("Thread was interrupted during processing", ex); +198 throw new UpdateException(ex); +199 } catch (ExecutionException ex) { +200 processExecutor.shutdownNow(); +201 LOGGER.debug("Execution Exception during process", ex); +202 throw new UpdateException(ex); +203 } finally { +204 processExecutor.shutdown(); +205 } +206 } +207 +208 if (maxUpdates >= 1) { //ensure the modified file date gets written (we may not have actually updated it) +209 getProperties().save(updateable.get(MODIFIED)); +210 LOGGER.info("Begin database maintenance."); +211 getCveDB().cleanupDatabase(); +212 LOGGER.info("End database maintenance."); +213 } +214 } finally { +215 closeDataStores(); +216 } +217 } +218 +219 /** +220 * Determines if the index needs to be updated. This is done by fetching the NVD CVE meta data and checking the last update +221 * date. If the data needs to be refreshed this method will return the NvdCveUrl for the files that need to be updated. +222 * +223 * @return the collection of files that need to be updated +224 * @throws MalformedURLException is thrown if the URL for the NVD CVE Meta data is incorrect +225 * @throws DownloadFailedException is thrown if there is an error. downloading the NVD CVE download data file +226 * @throws UpdateException Is thrown if there is an issue with the last updated properties file +227 */ +228 protected final UpdateableNvdCve getUpdatesNeeded() throws MalformedURLException, DownloadFailedException, UpdateException { +229 UpdateableNvdCve updates = null; +230 try { +231 updates = retrieveCurrentTimestampsFromWeb(); +232 } catch (InvalidDataException ex) { +233 final String msg = "Unable to retrieve valid timestamp from nvd cve downloads page"; +234 LOGGER.debug(msg, ex); +235 throw new DownloadFailedException(msg, ex); +236 } catch (InvalidSettingException ex) { +237 LOGGER.debug("Invalid setting found when retrieving timestamps", ex); +238 throw new DownloadFailedException("Invalid settings", ex); +239 } +240 +241 if (updates == null) { +242 throw new DownloadFailedException("Unable to retrieve the timestamps of the currently published NVD CVE data"); +243 } +244 if (!getProperties().isEmpty()) { +245 try { +246 final long lastUpdated = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_UPDATED, "0")); +247 final long now = System.currentTimeMillis(); +248 final int days = Settings.getInt(Settings.KEYS.CVE_MODIFIED_VALID_FOR_DAYS, 7); +249 if (lastUpdated == updates.getTimeStamp(MODIFIED)) { +250 updates.clear(); //we don't need to update anything. +251 } else if (DateUtil.withinDateRange(lastUpdated, now, days)) { +252 for (NvdCveInfo entry : updates) { +253 if (MODIFIED.equals(entry.getId())) { +254 entry.setNeedsUpdate(true); +255 } else { +256 entry.setNeedsUpdate(false); +257 } +258 } +259 } else { //we figure out which of the several XML files need to be downloaded. +260 for (NvdCveInfo entry : updates) { +261 if (MODIFIED.equals(entry.getId())) { +262 entry.setNeedsUpdate(true); +263 } else { +264 long currentTimestamp = 0; +265 try { +266 currentTimestamp = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_UPDATED_BASE +267 + entry.getId(), "0")); +268 } catch (NumberFormatException ex) { +269 LOGGER.debug("Error parsing '{}' '{}' from nvdcve.lastupdated", +270 DatabaseProperties.LAST_UPDATED_BASE, entry.getId(), ex); +271 } +272 if (currentTimestamp == entry.getTimestamp()) { +273 entry.setNeedsUpdate(false); +274 } +275 } +276 } +277 } +278 } catch (NumberFormatException ex) { +279 LOGGER.warn("An invalid schema version or timestamp exists in the data.properties file."); +280 LOGGER.debug("", ex); +281 } +282 } +283 return updates; +284 } +285 +286 /** +287 * Retrieves the timestamps from the NVD CVE meta data file. +288 * +289 * @return the timestamp from the currently published nvdcve downloads page +290 * @throws MalformedURLException thrown if the URL for the NVD CCE Meta data is incorrect. +291 * @throws DownloadFailedException thrown if there is an error downloading the nvd cve meta data file +292 * @throws InvalidDataException thrown if there is an exception parsing the timestamps +293 * @throws InvalidSettingException thrown if the settings are invalid +294 */ +295 private UpdateableNvdCve retrieveCurrentTimestampsFromWeb() +296 throws MalformedURLException, DownloadFailedException, InvalidDataException, InvalidSettingException { +297 +298 final UpdateableNvdCve updates = new UpdateableNvdCve(); +299 updates.add(MODIFIED, Settings.getString(Settings.KEYS.CVE_MODIFIED_20_URL), +300 Settings.getString(Settings.KEYS.CVE_MODIFIED_12_URL), +301 false); +302 +303 final int start = Settings.getInt(Settings.KEYS.CVE_START_YEAR); +304 final int end = Calendar.getInstance().get(Calendar.YEAR); +305 final String baseUrl20 = Settings.getString(Settings.KEYS.CVE_SCHEMA_2_0); +306 final String baseUrl12 = Settings.getString(Settings.KEYS.CVE_SCHEMA_1_2); +307 for (int i = start; i <= end; i++) { +308 updates.add(Integer.toString(i), String.format(baseUrl20, i), +309 String.format(baseUrl12, i), +310 true); +311 } +312 return updates; +313 } +314 +315 }
        diff --git a/xref/org/owasp/dependencycheck/data/update/cpe/package-frame.html b/xref/org/owasp/dependencycheck/data/update/cpe/package-frame.html index 4b15ef4d7..736020698 100644 --- a/xref/org/owasp/dependencycheck/data/update/cpe/package-frame.html +++ b/xref/org/owasp/dependencycheck/data/update/cpe/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.update.cpe + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.update.cpe diff --git a/xref/org/owasp/dependencycheck/data/update/cpe/package-summary.html b/xref/org/owasp/dependencycheck/data/update/cpe/package-summary.html index 448cf0dcd..2d8c75612 100644 --- a/xref/org/owasp/dependencycheck/data/update/cpe/package-summary.html +++ b/xref/org/owasp/dependencycheck/data/update/cpe/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.update.cpe + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.update.cpe diff --git a/xref/org/owasp/dependencycheck/data/update/exception/package-frame.html b/xref/org/owasp/dependencycheck/data/update/exception/package-frame.html index e976f5314..913cc2ab1 100644 --- a/xref/org/owasp/dependencycheck/data/update/exception/package-frame.html +++ b/xref/org/owasp/dependencycheck/data/update/exception/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.update.exception + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.update.exception diff --git a/xref/org/owasp/dependencycheck/data/update/exception/package-summary.html b/xref/org/owasp/dependencycheck/data/update/exception/package-summary.html index 41fd5c75d..d746f87f1 100644 --- a/xref/org/owasp/dependencycheck/data/update/exception/package-summary.html +++ b/xref/org/owasp/dependencycheck/data/update/exception/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.update.exception + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.update.exception diff --git a/xref/org/owasp/dependencycheck/data/update/nvd/DownloadTask.html b/xref/org/owasp/dependencycheck/data/update/nvd/DownloadTask.html index a343588c2..1ad6a5284 100644 --- a/xref/org/owasp/dependencycheck/data/update/nvd/DownloadTask.html +++ b/xref/org/owasp/dependencycheck/data/update/nvd/DownloadTask.html @@ -76,8 +76,8 @@ 68 final File file2; 69 70 try { -71 file1 = File.createTempFile("cve" + nvdCveInfo.getId() + "_", ".xml", Settings.getTempDirectory()); -72 file2 = File.createTempFile("cve_1_2_" + nvdCveInfo.getId() + "_", ".xml", Settings.getTempDirectory()); +71 file1 = File.createTempFile("cve" + nvdCveInfo.getId() + '_', ".xml", Settings.getTempDirectory()); +72 file2 = File.createTempFile("cve_1_2_" + nvdCveInfo.getId() + '_', ".xml", Settings.getTempDirectory()); 73 } catch (IOException ex) { 74 throw new UpdateException("Unable to create temporary files", ex); 75 } diff --git a/xref/org/owasp/dependencycheck/data/update/nvd/NvdCve12Handler.html b/xref/org/owasp/dependencycheck/data/update/nvd/NvdCve12Handler.html index f0cad8fd9..f450e64f2 100644 --- a/xref/org/owasp/dependencycheck/data/update/nvd/NvdCve12Handler.html +++ b/xref/org/owasp/dependencycheck/data/update/nvd/NvdCve12Handler.html @@ -122,10 +122,10 @@ 114 in the nvd cve 2.0. */ 115 String cpe = "cpe:/a:" + vendor + ":" + product; 116 if (num != null) { -117 cpe += ":" + num; +117 cpe += ':' + num; 118 } 119 if (edition != null) { -120 cpe += ":" + edition; +120 cpe += ':' + edition; 121 } 122 final VulnerableSoftware vs = new VulnerableSoftware(); 123 vs.setCpe(cpe); diff --git a/xref/org/owasp/dependencycheck/data/update/nvd/package-frame.html b/xref/org/owasp/dependencycheck/data/update/nvd/package-frame.html index b1f67a5c6..8535fdbfd 100644 --- a/xref/org/owasp/dependencycheck/data/update/nvd/package-frame.html +++ b/xref/org/owasp/dependencycheck/data/update/nvd/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.update.nvd + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.update.nvd diff --git a/xref/org/owasp/dependencycheck/data/update/nvd/package-summary.html b/xref/org/owasp/dependencycheck/data/update/nvd/package-summary.html index bcfb60c7a..22e4f694d 100644 --- a/xref/org/owasp/dependencycheck/data/update/nvd/package-summary.html +++ b/xref/org/owasp/dependencycheck/data/update/nvd/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.update.nvd + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.update.nvd diff --git a/xref/org/owasp/dependencycheck/data/update/package-frame.html b/xref/org/owasp/dependencycheck/data/update/package-frame.html index 218e425bd..e03742230 100644 --- a/xref/org/owasp/dependencycheck/data/update/package-frame.html +++ b/xref/org/owasp/dependencycheck/data/update/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.update + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.update diff --git a/xref/org/owasp/dependencycheck/data/update/package-summary.html b/xref/org/owasp/dependencycheck/data/update/package-summary.html index 4b6918cd6..5b0f52f25 100644 --- a/xref/org/owasp/dependencycheck/data/update/package-summary.html +++ b/xref/org/owasp/dependencycheck/data/update/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.data.update + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.data.update diff --git a/xref/org/owasp/dependencycheck/dependency/Dependency.html b/xref/org/owasp/dependencycheck/dependency/Dependency.html index e0fd33c81..96d73b20a 100644 --- a/xref/org/owasp/dependencycheck/dependency/Dependency.html +++ b/xref/org/owasp/dependencycheck/dependency/Dependency.html @@ -349,7 +349,7 @@ 341 } 342 } 343 if (!found) { -344 LOGGER.debug("Adding new maven identifier {}", mavenArtifact.toString()); +344 LOGGER.debug("Adding new maven identifier {}", mavenArtifact); 345 this.addIdentifier("maven", mavenArtifact.toString(), mavenArtifact.getArtifactUrl(), Confidence.HIGHEST); 346 } 347 } diff --git a/xref/org/owasp/dependencycheck/dependency/package-frame.html b/xref/org/owasp/dependencycheck/dependency/package-frame.html index 23767ce62..a10ce5c4e 100644 --- a/xref/org/owasp/dependencycheck/dependency/package-frame.html +++ b/xref/org/owasp/dependencycheck/dependency/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.dependency + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.dependency diff --git a/xref/org/owasp/dependencycheck/dependency/package-summary.html b/xref/org/owasp/dependencycheck/dependency/package-summary.html index 9f15b7e7f..8b999175b 100644 --- a/xref/org/owasp/dependencycheck/dependency/package-summary.html +++ b/xref/org/owasp/dependencycheck/dependency/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.dependency + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.dependency diff --git a/xref/org/owasp/dependencycheck/exception/package-frame.html b/xref/org/owasp/dependencycheck/exception/package-frame.html index 1d5d2a1eb..7c47075ae 100644 --- a/xref/org/owasp/dependencycheck/exception/package-frame.html +++ b/xref/org/owasp/dependencycheck/exception/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.exception + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.exception diff --git a/xref/org/owasp/dependencycheck/exception/package-summary.html b/xref/org/owasp/dependencycheck/exception/package-summary.html index 9457a84de..389364368 100644 --- a/xref/org/owasp/dependencycheck/exception/package-summary.html +++ b/xref/org/owasp/dependencycheck/exception/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.exception + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.exception diff --git a/xref/org/owasp/dependencycheck/maven/AggregateMojo.html b/xref/org/owasp/dependencycheck/maven/AggregateMojo.html index 12ce89a90..d9554c928 100644 --- a/xref/org/owasp/dependencycheck/maven/AggregateMojo.html +++ b/xref/org/owasp/dependencycheck/maven/AggregateMojo.html @@ -37,258 +37,268 @@ 29 import org.apache.maven.plugin.MojoFailureException; 30 import org.apache.maven.plugins.annotations.LifecyclePhase; 31 import org.apache.maven.plugins.annotations.Mojo; -32 import org.apache.maven.plugins.annotations.ResolutionScope; -33 import org.apache.maven.project.MavenProject; -34 import org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzer; -35 import org.owasp.dependencycheck.analyzer.exception.AnalysisException; -36 import org.owasp.dependencycheck.data.nvdcve.DatabaseException; -37 import org.owasp.dependencycheck.dependency.Dependency; -38 import org.owasp.dependencycheck.utils.Settings; -39 -40 /** -41 * Maven Plugin that checks project dependencies and the dependencies of all child modules to see if they have any known published -42 * vulnerabilities. -43 * -44 * @author Jeremy Long -45 */ -46 @Mojo( -47 name = "aggregate", -48 defaultPhase = LifecyclePhase.COMPILE, -49 /*aggregator = true,*/ -50 threadSafe = true, -51 requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, -52 requiresOnline = true -53 ) -54 public class AggregateMojo extends BaseDependencyCheckMojo { -55 -56 /** -57 * Executes the aggregate dependency-check goal. This runs dependency-check and generates the subsequent reports. -58 * -59 * @throws MojoExecutionException thrown if there is ane exception running the mojo -60 * @throws MojoFailureException thrown if dependency-check is configured to fail the build -61 */ -62 @Override -63 public void runCheck() throws MojoExecutionException, MojoFailureException { -64 final Engine engine = generateDataFile(); -65 -66 if (getProject() == getReactorProjects().get(getReactorProjects().size() - 1)) { -67 -68 //ensure that the .ser file was created for each. -69 for (MavenProject current : getReactorProjects()) { -70 final File dataFile = getDataFile(current); -71 if (dataFile == null) { //dc was never run on this project. write the ser to the target. -72 getLog().error(String.format("Module '%s' did not execute dependency-check; an attempt will be made to perform " -73 + "the check but dependencies may be missed resulting in false negatives.", current.getName())); -74 generateDataFile(engine, current); -75 } -76 } -77 -78 for (MavenProject current : getReactorProjects()) { -79 List<Dependency> dependencies = readDataFile(current); -80 if (dependencies == null) { -81 dependencies = new ArrayList<Dependency>(); -82 } -83 final Set<MavenProject> childProjects = getDescendants(current); -84 for (MavenProject reportOn : childProjects) { -85 final List<Dependency> childDeps = readDataFile(reportOn); -86 if (childDeps != null && !childDeps.isEmpty()) { -87 if (getLog().isDebugEnabled()) { -88 getLog().debug(String.format("Adding %d dependencies from %s", childDeps.size(), reportOn.getName())); -89 } -90 dependencies.addAll(childDeps); -91 } else { -92 if (getLog().isDebugEnabled()) { -93 getLog().debug(String.format("No dependencies read for %s", reportOn.getName())); -94 } -95 } -96 } -97 engine.getDependencies().clear(); -98 engine.getDependencies().addAll(dependencies); -99 final DependencyBundlingAnalyzer bundler = new DependencyBundlingAnalyzer(); -100 try { -101 if (getLog().isDebugEnabled()) { -102 getLog().debug(String.format("Dependency count pre-bundler: %s", engine.getDependencies().size())); -103 } -104 bundler.analyze(null, engine); -105 if (getLog().isDebugEnabled()) { -106 getLog().debug(String.format("Dependency count post-bundler: %s", engine.getDependencies().size())); -107 } -108 } catch (AnalysisException ex) { -109 getLog().warn("An error occured grouping the dependencies; duplicate entries may exist in the report", ex); -110 getLog().debug("Bundling Exception", ex); -111 } -112 -113 File outputDir = getCorrectOutputDirectory(current); -114 if (outputDir == null) { -115 //in some regards we shouldn't be writting this, but we are anyway. -116 //we shouldn't write this because nothing is configured to generate this report. -117 outputDir = new File(current.getBuild().getDirectory()); -118 } -119 writeReports(engine, current, outputDir); -120 } -121 } -122 engine.cleanup(); -123 Settings.cleanup(); -124 } -125 -126 /** -127 * Returns a set containing all the descendant projects of the given project. -128 * -129 * @param project the project for which all descendants will be returned -130 * @return the set of descendant projects -131 */ -132 protected Set<MavenProject> getDescendants(MavenProject project) { -133 if (project == null) { -134 return Collections.emptySet(); -135 } -136 final Set<MavenProject> descendants = new HashSet<MavenProject>(); -137 int size = 0; -138 if (getLog().isDebugEnabled()) { -139 getLog().debug(String.format("Collecting descendants of %s", project.getName())); -140 } -141 for (String m : project.getModules()) { -142 for (MavenProject mod : getReactorProjects()) { -143 try { -144 File mpp = new File(project.getBasedir(), m); -145 mpp = mpp.getCanonicalFile(); -146 if (mpp.compareTo(mod.getBasedir()) == 0 && descendants.add(mod)) { -147 if (getLog().isDebugEnabled()) { -148 getLog().debug(String.format("Decendent module %s added", mod.getName())); -149 } -150 } -151 } catch (IOException ex) { -152 if (getLog().isDebugEnabled()) { -153 getLog().debug("Unable to determine module path", ex); -154 } -155 } -156 } -157 } -158 do { -159 size = descendants.size(); -160 for (MavenProject p : getReactorProjects()) { -161 if (project.equals(p.getParent()) || descendants.contains(p.getParent())) { -162 if (descendants.add(p)) { -163 if (getLog().isDebugEnabled()) { -164 getLog().debug(String.format("Decendent %s added", p.getName())); -165 } +32 import org.apache.maven.plugins.annotations.Parameter; +33 import org.apache.maven.plugins.annotations.ResolutionScope; +34 import org.apache.maven.project.MavenProject; +35 import org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzer; +36 import org.owasp.dependencycheck.analyzer.exception.AnalysisException; +37 import org.owasp.dependencycheck.data.nvdcve.DatabaseException; +38 import org.owasp.dependencycheck.dependency.Dependency; +39 import org.owasp.dependencycheck.utils.Settings; +40 +41 /** +42 * Maven Plugin that checks project dependencies and the dependencies of all child modules to see if they have any known published +43 * vulnerabilities. +44 * +45 * @author Jeremy Long +46 */ +47 @Mojo( +48 name = "aggregate", +49 defaultPhase = LifecyclePhase.VERIFY, +50 /*aggregator = true,*/ +51 threadSafe = true, +52 requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, +53 requiresOnline = true +54 ) +55 public class AggregateMojo extends BaseDependencyCheckMojo { +56 +57 /** +58 * Executes the aggregate dependency-check goal. This runs dependency-check and generates the subsequent reports. +59 * +60 * @throws MojoExecutionException thrown if there is ane exception running the mojo +61 * @throws MojoFailureException thrown if dependency-check is configured to fail the build +62 */ +63 @Override +64 public void runCheck() throws MojoExecutionException, MojoFailureException { +65 final Engine engine = generateDataFile(); +66 +67 if (getProject() == getReactorProjects().get(getReactorProjects().size() - 1)) { +68 +69 //ensure that the .ser file was created for each. +70 for (MavenProject current : getReactorProjects()) { +71 final File dataFile = getDataFile(current); +72 if (dataFile == null) { //dc was never run on this project. write the ser to the target. +73 getLog().error(String.format("Module '%s' did not execute dependency-check; an attempt will be made to perform " +74 + "the check but dependencies may be missed resulting in false negatives.", current.getName())); +75 generateDataFile(engine, current); +76 } +77 } +78 +79 for (MavenProject current : getReactorProjects()) { +80 List<Dependency> dependencies = readDataFile(current); +81 if (dependencies == null) { +82 dependencies = new ArrayList<Dependency>(); +83 } +84 final Set<MavenProject> childProjects = getDescendants(current); +85 for (MavenProject reportOn : childProjects) { +86 final List<Dependency> childDeps = readDataFile(reportOn); +87 if (childDeps != null && !childDeps.isEmpty()) { +88 if (getLog().isDebugEnabled()) { +89 getLog().debug(String.format("Adding %d dependencies from %s", childDeps.size(), reportOn.getName())); +90 } +91 dependencies.addAll(childDeps); +92 } else { +93 if (getLog().isDebugEnabled()) { +94 getLog().debug(String.format("No dependencies read for %s", reportOn.getName())); +95 } +96 } +97 } +98 engine.getDependencies().clear(); +99 engine.getDependencies().addAll(dependencies); +100 final DependencyBundlingAnalyzer bundler = new DependencyBundlingAnalyzer(); +101 try { +102 if (getLog().isDebugEnabled()) { +103 getLog().debug(String.format("Dependency count pre-bundler: %s", engine.getDependencies().size())); +104 } +105 bundler.analyze(null, engine); +106 if (getLog().isDebugEnabled()) { +107 getLog().debug(String.format("Dependency count post-bundler: %s", engine.getDependencies().size())); +108 } +109 } catch (AnalysisException ex) { +110 getLog().warn("An error occured grouping the dependencies; duplicate entries may exist in the report", ex); +111 getLog().debug("Bundling Exception", ex); +112 } +113 +114 File outputDir = getCorrectOutputDirectory(current); +115 if (outputDir == null) { +116 //in some regards we shouldn't be writting this, but we are anyway. +117 //we shouldn't write this because nothing is configured to generate this report. +118 outputDir = new File(current.getBuild().getDirectory()); +119 } +120 writeReports(engine, current, outputDir); +121 } +122 } +123 engine.cleanup(); +124 Settings.cleanup(); +125 } +126 +127 /** +128 * Returns a set containing all the descendant projects of the given project. +129 * +130 * @param project the project for which all descendants will be returned +131 * @return the set of descendant projects +132 */ +133 protected Set<MavenProject> getDescendants(MavenProject project) { +134 if (project == null) { +135 return Collections.emptySet(); +136 } +137 final Set<MavenProject> descendants = new HashSet<MavenProject>(); +138 int size = 0; +139 if (getLog().isDebugEnabled()) { +140 getLog().debug(String.format("Collecting descendants of %s", project.getName())); +141 } +142 for (String m : project.getModules()) { +143 for (MavenProject mod : getReactorProjects()) { +144 try { +145 File mpp = new File(project.getBasedir(), m); +146 mpp = mpp.getCanonicalFile(); +147 if (mpp.compareTo(mod.getBasedir()) == 0 && descendants.add(mod) +148 && getLog().isDebugEnabled()) { +149 getLog().debug(String.format("Decendent module %s added", mod.getName())); +150 +151 } +152 } catch (IOException ex) { +153 if (getLog().isDebugEnabled()) { +154 getLog().debug("Unable to determine module path", ex); +155 } +156 } +157 } +158 } +159 do { +160 size = descendants.size(); +161 for (MavenProject p : getReactorProjects()) { +162 if (project.equals(p.getParent()) || descendants.contains(p.getParent())) { +163 if (descendants.add(p) && getLog().isDebugEnabled()) { +164 getLog().debug(String.format("Decendent %s added", p.getName())); +165 166 } 167 for (MavenProject modTest : getReactorProjects()) { 168 if (p.getModules() != null && p.getModules().contains(modTest.getName()) -169 && descendants.add(modTest)) { -170 if (getLog().isDebugEnabled()) { -171 getLog().debug(String.format("Decendent %s added", modTest.getName())); -172 } -173 } -174 } -175 } +169 && descendants.add(modTest) +170 && getLog().isDebugEnabled()) { +171 getLog().debug(String.format("Decendent %s added", modTest.getName())); +172 } +173 } +174 } +175 final Set<MavenProject> addedDescendants = new HashSet<MavenProject>(); 176 for (MavenProject dec : descendants) { 177 for (String mod : dec.getModules()) { 178 try { 179 File mpp = new File(dec.getBasedir(), mod); 180 mpp = mpp.getCanonicalFile(); -181 if (mpp.compareTo(p.getBasedir()) == 0 && descendants.add(p)) { -182 if (getLog().isDebugEnabled()) { -183 getLog().debug(String.format("Decendent module %s added", p.getName())); -184 } -185 } -186 } catch (IOException ex) { -187 if (getLog().isDebugEnabled()) { -188 getLog().debug("Unable to determine module path", ex); -189 } -190 } -191 } -192 } -193 } -194 } while (size != 0 && size != descendants.size()); -195 if (getLog().isDebugEnabled()) { -196 getLog().debug(String.format("%s has %d children", project, descendants.size())); -197 } -198 return descendants; -199 } -200 -201 /** -202 * Test if the project has pom packaging -203 * -204 * @param mavenProject Project to test -205 * @return <code>true</code> if it has a pom packaging; otherwise <code>false</code> -206 */ -207 protected boolean isMultiModule(MavenProject mavenProject) { -208 return "pom".equals(mavenProject.getPackaging()); -209 } -210 -211 /** -212 * Initilizes the engine, runs a scan, and writes the serialized dependencies to disk. -213 * -214 * @return the Engine used to execute dependency-check -215 * @throws MojoExecutionException thrown if there is an exception running the mojo -216 * @throws MojoFailureException thrown if dependency-check is configured to fail the build if severe CVEs are identified. -217 */ -218 protected Engine generateDataFile() throws MojoExecutionException, MojoFailureException { -219 final Engine engine; -220 try { -221 engine = initializeEngine(); -222 } catch (DatabaseException ex) { -223 if (getLog().isDebugEnabled()) { -224 getLog().debug("Database connection error", ex); -225 } -226 throw new MojoExecutionException("An exception occured connecting to the local database. Please see the log file for more details.", ex); -227 } -228 return generateDataFile(engine, getProject()); -229 } -230 -231 /** -232 * Runs dependency-check's Engine and writes the serialized dependencies to disk. -233 * -234 * @param engine the Engine to use when scanning. -235 * @param project the project to scan and generate the data file for -236 * @return the Engine used to execute dependency-check -237 * @throws MojoExecutionException thrown if there is an exception running the mojo -238 * @throws MojoFailureException thrown if dependency-check is configured to fail the build if severe CVEs are identified. -239 */ -240 protected Engine generateDataFile(Engine engine, MavenProject project) throws MojoExecutionException, MojoFailureException { -241 if (getLog().isDebugEnabled()) { -242 getLog().debug(String.format("Begin Scanning: %s", project.getName())); -243 } -244 engine.getDependencies().clear(); -245 engine.resetFileTypeAnalyzers(); -246 scanArtifacts(project, engine); -247 engine.analyzeDependencies(); -248 final File target = new File(project.getBuild().getDirectory()); -249 writeDataFile(project, target, engine.getDependencies()); -250 showSummary(project, engine.getDependencies()); -251 checkForFailure(engine.getDependencies()); -252 return engine; -253 } -254 -255 @Override -256 public boolean canGenerateReport() { -257 return true; //aggregate always returns true for now - we can look at a more complicated/acurate solution later -258 } -259 -260 /** -261 * Returns the report name. -262 * -263 * @param locale the location -264 * @return the report name +181 if (mpp.compareTo(p.getBasedir()) == 0) { +182 addedDescendants.add(p); +183 } +184 } catch (IOException ex) { +185 if (getLog().isDebugEnabled()) { +186 getLog().debug("Unable to determine module path", ex); +187 } +188 } +189 } +190 } +191 for (MavenProject addedDescendant : addedDescendants) { +192 if (descendants.add(addedDescendant) && getLog().isDebugEnabled()) { +193 getLog().debug(String.format("Decendent module %s added", addedDescendant.getName())); +194 } +195 } +196 } +197 } while (size != 0 && size != descendants.size()); +198 if (getLog().isDebugEnabled()) { +199 getLog().debug(String.format("%s has %d children", project, descendants.size())); +200 } +201 return descendants; +202 } +203 +204 /** +205 * Test if the project has pom packaging +206 * +207 * @param mavenProject Project to test +208 * @return <code>true</code> if it has a pom packaging; otherwise <code>false</code> +209 */ +210 protected boolean isMultiModule(MavenProject mavenProject) { +211 return "pom".equals(mavenProject.getPackaging()); +212 } +213 +214 /** +215 * Initilizes the engine, runs a scan, and writes the serialized dependencies to disk. +216 * +217 * @return the Engine used to execute dependency-check +218 * @throws MojoExecutionException thrown if there is an exception running the mojo +219 * @throws MojoFailureException thrown if dependency-check is configured to fail the build if severe CVEs are identified. +220 */ +221 protected Engine generateDataFile() throws MojoExecutionException, MojoFailureException { +222 final Engine engine; +223 try { +224 engine = initializeEngine(); +225 } catch (DatabaseException ex) { +226 if (getLog().isDebugEnabled()) { +227 getLog().debug("Database connection error", ex); +228 } +229 throw new MojoExecutionException("An exception occured connecting to the local database. Please see the log file for more details.", ex); +230 } +231 return generateDataFile(engine, getProject()); +232 } +233 +234 /** +235 * Runs dependency-check's Engine and writes the serialized dependencies to disk. +236 * +237 * @param engine the Engine to use when scanning. +238 * @param project the project to scan and generate the data file for +239 * @return the Engine used to execute dependency-check +240 * @throws MojoExecutionException thrown if there is an exception running the mojo +241 * @throws MojoFailureException thrown if dependency-check is configured to fail the build if severe CVEs are identified. +242 */ +243 protected Engine generateDataFile(Engine engine, MavenProject project) throws MojoExecutionException, MojoFailureException { +244 if (getLog().isDebugEnabled()) { +245 getLog().debug(String.format("Begin Scanning: %s", project.getName())); +246 } +247 engine.getDependencies().clear(); +248 engine.resetFileTypeAnalyzers(); +249 scanArtifacts(project, engine); +250 engine.analyzeDependencies(); +251 final File target = new File(project.getBuild().getDirectory()); +252 writeDataFile(project, target, engine.getDependencies()); +253 showSummary(project, engine.getDependencies()); +254 checkForFailure(engine.getDependencies()); +255 return engine; +256 } +257 +258 @Override +259 public boolean canGenerateReport() { +260 return true; //aggregate always returns true for now - we can look at a more complicated/acurate solution later +261 } +262 +263 /** +264 * The name of the report in the site. 265 */ -266 @Override -267 public String getName(Locale locale) { -268 return "dependency-check:aggregate"; -269 } -270 -271 /** -272 * Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page. -273 * -274 * @param locale The Locale to get the description for -275 * @return the description -276 */ -277 @Override -278 public String getDescription(Locale locale) { -279 return "Generates an aggregate report of all child Maven projects providing details on any " -280 + "published vulnerabilities within project dependencies. This report is a best " -281 + "effort and may contain false positives and false negatives."; -282 } -283 } +266 @SuppressWarnings("CanBeFinal") +267 @Parameter(property = "name", defaultValue = "dependency-check:aggregate", required = true) +268 private String name = "dependency-check:aggregate"; +269 +270 /** +271 * Returns the report name. +272 * +273 * @param locale the location +274 * @return the report name +275 */ +276 @Override +277 public String getName(Locale locale) { +278 return name; +279 } +280 +281 /** +282 * Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page. +283 * +284 * @param locale The Locale to get the description for +285 * @return the description +286 */ +287 @Override +288 public String getDescription(Locale locale) { +289 return "Generates an aggregate report of all child Maven projects providing details on any " +290 + "published vulnerabilities within project dependencies. This report is a best " +291 + "effort and may contain false positives and false negatives."; +292 } +293 }
        diff --git a/xref/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.html b/xref/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.html index 10c2aadf2..db08f2fb6 100644 --- a/xref/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.html +++ b/xref/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.html @@ -34,995 +34,978 @@ 26 import java.io.InputStream; 27 import java.io.ObjectInputStream; 28 import java.io.ObjectOutputStream; -29 import java.io.OutputStream; -30 import java.util.List; -31 import java.util.Locale; -32 import org.apache.maven.artifact.Artifact; -33 import org.apache.maven.doxia.sink.Sink; -34 import org.apache.maven.plugin.AbstractMojo; -35 import org.apache.maven.plugin.MojoExecutionException; -36 import org.apache.maven.plugin.MojoFailureException; -37 import org.apache.maven.plugins.annotations.Parameter; -38 import org.apache.maven.project.MavenProject; -39 import org.apache.maven.reporting.MavenReport; -40 import org.apache.maven.reporting.MavenReportException; -41 import org.apache.maven.settings.Proxy; -42 import org.owasp.dependencycheck.data.nexus.MavenArtifact; -43 import org.owasp.dependencycheck.data.nvdcve.CveDB; -44 import org.owasp.dependencycheck.data.nvdcve.DatabaseException; -45 import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties; -46 import org.owasp.dependencycheck.dependency.Confidence; -47 import org.owasp.dependencycheck.dependency.Dependency; -48 import org.owasp.dependencycheck.dependency.Identifier; -49 import org.owasp.dependencycheck.dependency.Vulnerability; -50 import org.owasp.dependencycheck.reporting.ReportGenerator; -51 import org.owasp.dependencycheck.utils.Settings; -52 -53 /** -54 * -55 * @author Jeremy Long -56 */ -57 public abstract class BaseDependencyCheckMojo extends AbstractMojo implements MavenReport { -58 -59 //<editor-fold defaultstate="collapsed" desc="Private fields"> -60 /** -61 * The properties file location. -62 */ -63 private static final String PROPERTIES_FILE = "mojo.properties"; -64 /** -65 * System specific new line character. -66 */ -67 private static final String NEW_LINE = System.getProperty("line.separator", "\n").intern(); -68 /** -69 * Sets whether or not the external report format should be used. -70 */ -71 @Parameter(property = "metaFileName", defaultValue = "dependency-check.ser", required = true) -72 private String dataFileName; -73 -74 //</editor-fold> -75 // <editor-fold defaultstate="collapsed" desc="Maven bound parameters and components"> -76 /** -77 * The Maven Project Object. -78 */ -79 @Parameter(property = "project", required = true, readonly = true) -80 private MavenProject project; -81 /** -82 * List of Maven project of the current build -83 */ -84 @Parameter(readonly = true, required = true, property = "reactorProjects") -85 private List<MavenProject> reactorProjects; -86 -87 /** -88 * The output directory. This generally maps to "target". -89 */ -90 @Parameter(defaultValue = "${project.build.directory}", required = true) -91 private File outputDirectory; -92 /** -93 * Specifies the destination directory for the generated Dependency-Check report. This generally maps to "target/site". -94 */ -95 @Parameter(property = "project.reporting.outputDirectory", required = true) -96 private File reportOutputDirectory; -97 /** -98 * Specifies if the build should be failed if a CVSS score above a specified level is identified. The default is 11 which -99 * means since the CVSS scores are 0-10, by default the build will never fail. -100 */ -101 @SuppressWarnings("CanBeFinal") -102 @Parameter(property = "failBuildOnCVSS", defaultValue = "11", required = true) -103 private float failBuildOnCVSS = 11; -104 /** -105 * Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not recommended that this be turned to false. Default -106 * is true. -107 */ -108 @SuppressWarnings("CanBeFinal") -109 @Parameter(property = "autoupdate", defaultValue = "true", required = true) -110 private boolean autoUpdate = true; -111 /** -112 * Generate aggregate reports in multi-module projects. -113 * -114 * @deprecated use the aggregate goal instead -115 */ -116 @Parameter(property = "aggregate", defaultValue = "false") -117 @Deprecated -118 private boolean aggregate; -119 /** -120 * The report format to be generated (HTML, XML, VULN, ALL). This configuration option has no affect if using this within the -121 * Site plug-in unless the externalReport is set to true. Default is HTML. -122 */ -123 @SuppressWarnings("CanBeFinal") -124 @Parameter(property = "format", defaultValue = "HTML", required = true) -125 private String format = "HTML"; -126 /** -127 * The Maven settings. -128 */ -129 @Parameter(property = "mavenSettings", defaultValue = "${settings}", required = false) -130 private org.apache.maven.settings.Settings mavenSettings; -131 -132 /** -133 * The maven settings proxy id. -134 */ -135 @SuppressWarnings("CanBeFinal") -136 @Parameter(property = "mavenSettingsProxyId", required = false) -137 private String mavenSettingsProxyId; -138 -139 /** -140 * The Connection Timeout. -141 */ -142 @SuppressWarnings("CanBeFinal") -143 @Parameter(property = "connectionTimeout", defaultValue = "", required = false) -144 private String connectionTimeout = null; -145 /** -146 * The path to the suppression file. -147 */ -148 @SuppressWarnings("CanBeFinal") -149 @Parameter(property = "suppressionFile", defaultValue = "", required = false) -150 private String suppressionFile = null; -151 /** -152 * Flag indicating whether or not to show a summary in the output. -153 */ -154 @SuppressWarnings("CanBeFinal") -155 @Parameter(property = "showSummary", defaultValue = "true", required = false) -156 private boolean showSummary = true; -157 -158 /** -159 * Whether or not the Jar Analyzer is enabled. -160 */ -161 @SuppressWarnings("CanBeFinal") -162 @Parameter(property = "jarAnalyzerEnabled", defaultValue = "true", required = false) -163 private boolean jarAnalyzerEnabled = true; -164 -165 /** -166 * Whether or not the Archive Analyzer is enabled. -167 */ -168 @SuppressWarnings("CanBeFinal") -169 @Parameter(property = "archiveAnalyzerEnabled", defaultValue = "true", required = false) -170 private boolean archiveAnalyzerEnabled = true; -171 -172 /** -173 * Whether or not the .NET Assembly Analyzer is enabled. -174 */ -175 @SuppressWarnings("CanBeFinal") -176 @Parameter(property = "assemblyAnalyzerEnabled", defaultValue = "true", required = false) -177 private boolean assemblyAnalyzerEnabled = true; -178 -179 /** -180 * Whether or not the .NET Nuspec Analyzer is enabled. -181 */ -182 @SuppressWarnings("CanBeFinal") -183 @Parameter(property = "nuspecAnalyzerEnabled", defaultValue = "true", required = false) -184 private boolean nuspecAnalyzerEnabled = true; -185 +29 import java.util.List; +30 import java.util.Locale; +31 import org.apache.maven.artifact.Artifact; +32 import org.apache.maven.doxia.sink.Sink; +33 import org.apache.maven.plugin.AbstractMojo; +34 import org.apache.maven.plugin.MojoExecutionException; +35 import org.apache.maven.plugin.MojoFailureException; +36 import org.apache.maven.plugins.annotations.Parameter; +37 import org.apache.maven.project.MavenProject; +38 import org.apache.maven.reporting.MavenReport; +39 import org.apache.maven.reporting.MavenReportException; +40 import org.apache.maven.settings.Proxy; +41 import org.owasp.dependencycheck.data.nexus.MavenArtifact; +42 import org.owasp.dependencycheck.data.nvdcve.CveDB; +43 import org.owasp.dependencycheck.data.nvdcve.DatabaseException; +44 import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties; +45 import org.owasp.dependencycheck.dependency.Confidence; +46 import org.owasp.dependencycheck.dependency.Dependency; +47 import org.owasp.dependencycheck.dependency.Identifier; +48 import org.owasp.dependencycheck.dependency.Vulnerability; +49 import org.owasp.dependencycheck.reporting.ReportGenerator; +50 import org.owasp.dependencycheck.utils.Settings; +51 +52 /** +53 * +54 * @author Jeremy Long +55 */ +56 public abstract class BaseDependencyCheckMojo extends AbstractMojo implements MavenReport { +57 +58 //<editor-fold defaultstate="collapsed" desc="Private fields"> +59 /** +60 * The properties file location. +61 */ +62 private static final String PROPERTIES_FILE = "mojo.properties"; +63 /** +64 * System specific new line character. +65 */ +66 private static final String NEW_LINE = System.getProperty("line.separator", "\n").intern(); +67 /** +68 * Sets whether or not the external report format should be used. +69 */ +70 @Parameter(property = "metaFileName", defaultValue = "dependency-check.ser", required = true) +71 private String dataFileName; +72 +73 //</editor-fold> +74 // <editor-fold defaultstate="collapsed" desc="Maven bound parameters and components"> +75 /** +76 * The Maven Project Object. +77 */ +78 @Parameter(property = "project", required = true, readonly = true) +79 private MavenProject project; +80 /** +81 * List of Maven project of the current build +82 */ +83 @Parameter(readonly = true, required = true, property = "reactorProjects") +84 private List<MavenProject> reactorProjects; +85 +86 /** +87 * The output directory. This generally maps to "target". +88 */ +89 @Parameter(defaultValue = "${project.build.directory}", required = true) +90 private File outputDirectory; +91 /** +92 * Specifies the destination directory for the generated Dependency-Check report. This generally maps to "target/site". +93 */ +94 @Parameter(property = "project.reporting.outputDirectory", required = true) +95 private File reportOutputDirectory; +96 /** +97 * Specifies if the build should be failed if a CVSS score above a specified level is identified. The default is 11 which +98 * means since the CVSS scores are 0-10, by default the build will never fail. +99 */ +100 @SuppressWarnings("CanBeFinal") +101 @Parameter(property = "failBuildOnCVSS", defaultValue = "11", required = true) +102 private float failBuildOnCVSS = 11; +103 /** +104 * Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not recommended that this be turned to false. Default +105 * is true. +106 */ +107 @SuppressWarnings("CanBeFinal") +108 @Parameter(property = "autoupdate") +109 private Boolean autoUpdate; +110 /** +111 * Generate aggregate reports in multi-module projects. +112 * +113 * @deprecated use the aggregate goal instead +114 */ +115 @Parameter(property = "aggregate") +116 @Deprecated +117 private Boolean aggregate; +118 /** +119 * The report format to be generated (HTML, XML, VULN, ALL). This configuration option has no affect if using this within the +120 * Site plug-in unless the externalReport is set to true. Default is HTML. +121 */ +122 @SuppressWarnings("CanBeFinal") +123 @Parameter(property = "format", defaultValue = "HTML", required = true) +124 private String format = "HTML"; +125 /** +126 * The Maven settings. +127 */ +128 @Parameter(property = "mavenSettings", defaultValue = "${settings}", required = false) +129 private org.apache.maven.settings.Settings mavenSettings; +130 +131 /** +132 * The maven settings proxy id. +133 */ +134 @SuppressWarnings("CanBeFinal") +135 @Parameter(property = "mavenSettingsProxyId", required = false) +136 private String mavenSettingsProxyId; +137 +138 /** +139 * The Connection Timeout. +140 */ +141 @Parameter(property = "connectionTimeout", defaultValue = "", required = false) +142 private String connectionTimeout; +143 /** +144 * The path to the suppression file. +145 */ +146 @Parameter(property = "suppressionFile", defaultValue = "", required = false) +147 private String suppressionFile; +148 /** +149 * Flag indicating whether or not to show a summary in the output. +150 */ +151 @Parameter(property = "showSummary", defaultValue = "true", required = false) +152 private boolean showSummary = true; +153 +154 /** +155 * Whether or not the Jar Analyzer is enabled. +156 */ +157 @Parameter(property = "jarAnalyzerEnabled", required = false) +158 private Boolean jarAnalyzerEnabled; +159 +160 /** +161 * Whether or not the Archive Analyzer is enabled. +162 */ +163 @Parameter(property = "archiveAnalyzerEnabled", required = false) +164 private Boolean archiveAnalyzerEnabled; +165 +166 /** +167 * Sets whether the Python Distribution Analyzer will be used. +168 */ +169 @Parameter(property = "pyDistributionAnalyzerEnabled", required = false) +170 private Boolean pyDistributionAnalyzerEnabled; +171 /** +172 * Sets whether the Python Package Analyzer will be used. +173 */ +174 @Parameter(property = "pyPackageAnalyzerEnabled", required = false) +175 private Boolean pyPackageAnalyzerEnabled; +176 /** +177 * Sets whether the Ruby Gemspec Analyzer will be used. +178 */ +179 @Parameter(property = "rubygemsAnalyzerEnabled", required = false) +180 private Boolean rubygemsAnalyzerEnabled; +181 /** +182 * Sets whether or not the openssl Analyzer should be used. +183 */ +184 @Parameter(property = "opensslAnalyzerEnabled", required = false) +185 private Boolean opensslAnalyzerEnabled; 186 /** -187 * Whether or not the Central Analyzer is enabled. +187 * Sets whether or not the CMake Analyzer should be used. 188 */ -189 @SuppressWarnings("CanBeFinal") -190 @Parameter(property = "centralAnalyzerEnabled", defaultValue = "true", required = false) -191 private boolean centralAnalyzerEnabled = true; -192 -193 /** -194 * Whether or not the Nexus Analyzer is enabled. -195 */ -196 @SuppressWarnings("CanBeFinal") -197 @Parameter(property = "nexusAnalyzerEnabled", defaultValue = "true", required = false) -198 private boolean nexusAnalyzerEnabled = true; -199 -200 /** -201 * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local). -202 */ -203 @Parameter(property = "nexusUrl", defaultValue = "", required = false) -204 private String nexusUrl; -205 /** -206 * Whether or not the configured proxy is used to connect to Nexus. -207 */ -208 @Parameter(property = "nexusUsesProxy", defaultValue = "true", required = false) -209 private boolean nexusUsesProxy = true; -210 /** -211 * The database connection string. -212 */ -213 @Parameter(property = "connectionString", defaultValue = "", required = false) -214 private String connectionString; -215 -216 /** -217 * Returns the connection string. -218 * -219 * @return the connection string -220 */ -221 protected String getConnectionString() { -222 return connectionString; -223 } -224 /** -225 * The database driver name. An example would be org.h2.Driver. -226 */ -227 @Parameter(property = "databaseDriverName", defaultValue = "", required = false) -228 private String databaseDriverName; -229 /** -230 * The path to the database driver if it is not on the class path. -231 */ -232 @Parameter(property = "databaseDriverPath", defaultValue = "", required = false) -233 private String databaseDriverPath; -234 /** -235 * The database user name. -236 */ -237 @Parameter(property = "databaseUser", defaultValue = "", required = false) -238 private String databaseUser; -239 /** -240 * The password to use when connecting to the database. -241 */ -242 @Parameter(property = "databasePassword", defaultValue = "", required = false) -243 private String databasePassword; -244 /** -245 * A comma-separated list of file extensions to add to analysis next to jar, zip, .... -246 */ -247 @Parameter(property = "zipExtensions", required = false) -248 private String zipExtensions; -249 /** -250 * Skip Analysis for Test Scope Dependencies. +189 @Parameter(property = "cmakeAnalyzerEnabled", required = false) +190 private Boolean cmakeAnalyzerEnabled; +191 /** +192 * Sets whether or not the autoconf Analyzer should be used. +193 */ +194 @Parameter(property = "autoconfAnalyzerEnabled", required = false) +195 private Boolean autoconfAnalyzerEnabled; +196 /** +197 * Sets whether or not the PHP Composer Lock File Analyzer should be used. +198 */ +199 @Parameter(property = "composerAnalyzerEnabled", required = false) +200 private Boolean composerAnalyzerEnabled; +201 /** +202 * Sets whether or not the Node.js Analyzer should be used. +203 */ +204 @Parameter(property = "nodeAnalyzerEnabled", required = false) +205 private Boolean nodeAnalyzerEnabled; +206 +207 /** +208 * Whether or not the .NET Assembly Analyzer is enabled. +209 */ +210 @Parameter(property = "assemblyAnalyzerEnabled", required = false) +211 private Boolean assemblyAnalyzerEnabled; +212 +213 /** +214 * Whether or not the .NET Nuspec Analyzer is enabled. +215 */ +216 @Parameter(property = "nuspecAnalyzerEnabled", required = false) +217 private Boolean nuspecAnalyzerEnabled; +218 +219 /** +220 * Whether or not the Central Analyzer is enabled. +221 */ +222 @Parameter(property = "centralAnalyzerEnabled", required = false) +223 private Boolean centralAnalyzerEnabled; +224 +225 /** +226 * Whether or not the Nexus Analyzer is enabled. +227 */ +228 @Parameter(property = "nexusAnalyzerEnabled", required = false) +229 private Boolean nexusAnalyzerEnabled; +230 +231 /** +232 * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local). +233 */ +234 @Parameter(property = "nexusUrl", required = false) +235 private String nexusUrl; +236 /** +237 * Whether or not the configured proxy is used to connect to Nexus. +238 */ +239 @Parameter(property = "nexusUsesProxy", required = false) +240 private Boolean nexusUsesProxy; +241 /** +242 * The database connection string. +243 */ +244 @Parameter(property = "connectionString", defaultValue = "", required = false) +245 private String connectionString; +246 +247 /** +248 * Returns the connection string. +249 * +250 * @return the connection string 251 */ -252 @SuppressWarnings("CanBeFinal") -253 @Parameter(property = "skipTestScope", defaultValue = "true", required = false) -254 private boolean skipTestScope = true; +252 protected String getConnectionString() { +253 return connectionString; +254 } 255 /** -256 * Skip Analysis for Runtime Scope Dependencies. +256 * The database driver name. An example would be org.h2.Driver. 257 */ -258 @SuppressWarnings("CanBeFinal") -259 @Parameter(property = "skipRuntimeScope", defaultValue = "false", required = false) -260 private boolean skipRuntimeScope = false; -261 /** -262 * Skip Analysis for Provided Scope Dependencies. -263 */ -264 @SuppressWarnings("CanBeFinal") -265 @Parameter(property = "skipProvidedScope", defaultValue = "false", required = false) -266 private boolean skipProvidedScope = false; -267 /** -268 * The data directory, hold DC SQL DB. -269 */ -270 @Parameter(property = "dataDirectory", defaultValue = "", required = false) -271 private String dataDirectory; -272 /** -273 * Data Mirror URL for CVE 1.2. -274 */ -275 @Parameter(property = "cveUrl12Modified", defaultValue = "", required = false) -276 private String cveUrl12Modified; -277 /** -278 * Data Mirror URL for CVE 2.0. -279 */ -280 @Parameter(property = "cveUrl20Modified", defaultValue = "", required = false) -281 private String cveUrl20Modified; -282 /** -283 * Base Data Mirror URL for CVE 1.2. -284 */ -285 @Parameter(property = "cveUrl12Base", defaultValue = "", required = false) -286 private String cveUrl12Base; -287 /** -288 * Data Mirror URL for CVE 2.0. -289 */ -290 @Parameter(property = "cveUrl20Base", defaultValue = "", required = false) -291 private String cveUrl20Base; -292 -293 /** -294 * The path to mono for .NET Assembly analysis on non-windows systems. -295 */ -296 @Parameter(property = "pathToMono", defaultValue = "", required = false) -297 private String pathToMono; -298 -299 /** -300 * The Proxy URL. -301 * -302 * @deprecated Please use mavenSettings instead -303 */ -304 @SuppressWarnings("CanBeFinal") -305 @Parameter(property = "proxyUrl", defaultValue = "", required = false) -306 @Deprecated -307 private String proxyUrl = null; -308 /** -309 * Sets whether or not the external report format should be used. -310 * -311 * @deprecated the internal report is no longer supported -312 */ -313 @SuppressWarnings("CanBeFinal") -314 @Parameter(property = "externalReport") -315 @Deprecated -316 private String externalReport = null; -317 // </editor-fold> -318 //<editor-fold defaultstate="collapsed" desc="Base Maven implementation"> -319 -320 /** -321 * Executes dependency-check. -322 * -323 * @throws MojoExecutionException thrown if there is an exception executing the mojo -324 * @throws MojoFailureException thrown if dependency-check failed the build -325 */ -326 @Override -327 public void execute() throws MojoExecutionException, MojoFailureException { -328 validateAggregate(); -329 project.setContextValue(getOutputDirectoryContextKey(), this.outputDirectory); -330 runCheck(); -331 } -332 -333 /** -334 * Checks if the aggregate configuration parameter has been set to true. If it has a MojoExecutionException is thrown because -335 * the aggregate configuration parameter is no longer supported. -336 * -337 * @throws MojoExecutionException thrown if aggregate is set to true -338 */ -339 private void validateAggregate() throws MojoExecutionException { -340 if (aggregate) { -341 final String msg = "Aggregate configuration detected - as of dependency-check 1.2.8 this no longer supported. " -342 + "Please use the aggregate goal instead."; -343 throw new MojoExecutionException(msg); -344 } -345 } -346 -347 /** -348 * Generates the Dependency-Check Site Report. -349 * -350 * @param sink the sink to write the report to -351 * @param locale the locale to use when generating the report -352 * @throws MavenReportException if a maven report exception occurs -353 * @deprecated use {@link #generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)} instead. +258 @Parameter(property = "databaseDriverName", defaultValue = "", required = false) +259 private String databaseDriverName; +260 /** +261 * The path to the database driver if it is not on the class path. +262 */ +263 @Parameter(property = "databaseDriverPath", defaultValue = "", required = false) +264 private String databaseDriverPath; +265 /** +266 * The database user name. +267 */ +268 @Parameter(property = "databaseUser", defaultValue = "", required = false) +269 private String databaseUser; +270 /** +271 * The password to use when connecting to the database. +272 */ +273 @Parameter(property = "databasePassword", defaultValue = "", required = false) +274 private String databasePassword; +275 /** +276 * A comma-separated list of file extensions to add to analysis next to jar, zip, .... +277 */ +278 @Parameter(property = "zipExtensions", required = false) +279 private String zipExtensions; +280 /** +281 * Skip Dependency Check altogether. +282 */ +283 @SuppressWarnings("CanBeFinal") +284 @Parameter(property = "dependency-check.skip", defaultValue = "false", required = false) +285 private boolean skip = false; +286 /** +287 * Skip Analysis for Test Scope Dependencies. +288 */ +289 @SuppressWarnings("CanBeFinal") +290 @Parameter(property = "skipTestScope", defaultValue = "true", required = false) +291 private boolean skipTestScope = true; +292 /** +293 * Skip Analysis for Runtime Scope Dependencies. +294 */ +295 @SuppressWarnings("CanBeFinal") +296 @Parameter(property = "skipRuntimeScope", defaultValue = "false", required = false) +297 private boolean skipRuntimeScope = false; +298 /** +299 * Skip Analysis for Provided Scope Dependencies. +300 */ +301 @SuppressWarnings("CanBeFinal") +302 @Parameter(property = "skipProvidedScope", defaultValue = "false", required = false) +303 private boolean skipProvidedScope = false; +304 /** +305 * The data directory, hold DC SQL DB. +306 */ +307 @Parameter(property = "dataDirectory", defaultValue = "", required = false) +308 private String dataDirectory; +309 /** +310 * Data Mirror URL for CVE 1.2. +311 */ +312 @Parameter(property = "cveUrl12Modified", defaultValue = "", required = false) +313 private String cveUrl12Modified; +314 /** +315 * Data Mirror URL for CVE 2.0. +316 */ +317 @Parameter(property = "cveUrl20Modified", defaultValue = "", required = false) +318 private String cveUrl20Modified; +319 /** +320 * Base Data Mirror URL for CVE 1.2. +321 */ +322 @Parameter(property = "cveUrl12Base", defaultValue = "", required = false) +323 private String cveUrl12Base; +324 /** +325 * Data Mirror URL for CVE 2.0. +326 */ +327 @Parameter(property = "cveUrl20Base", defaultValue = "", required = false) +328 private String cveUrl20Base; +329 /** +330 * Optionally skip excessive CVE update checks for a designated duration in hours. +331 */ +332 @Parameter(property = "cveValidForHours", defaultValue = "", required = false) +333 private Integer cveValidForHours; +334 +335 /** +336 * The path to mono for .NET Assembly analysis on non-windows systems. +337 */ +338 @Parameter(property = "pathToMono", defaultValue = "", required = false) +339 private String pathToMono; +340 +341 /** +342 * The Proxy URL. +343 * +344 * @deprecated Please use mavenSettings instead +345 */ +346 @SuppressWarnings("CanBeFinal") +347 @Parameter(property = "proxyUrl", defaultValue = "", required = false) +348 @Deprecated +349 private String proxyUrl = null; +350 /** +351 * Sets whether or not the external report format should be used. +352 * +353 * @deprecated the internal report is no longer supported 354 */ -355 @Override -356 @Deprecated -357 public final void generate(@SuppressWarnings("deprecation") org.codehaus.doxia.sink.Sink sink, Locale locale) throws MavenReportException { -358 generate((Sink) sink, locale); -359 } -360 -361 /** -362 * Generates the Dependency-Check Site Report. -363 * -364 * @param sink the sink to write the report to -365 * @param locale the locale to use when generating the report -366 * @throws MavenReportException if a maven report exception occurs +355 @SuppressWarnings("CanBeFinal") +356 @Parameter(property = "externalReport") +357 @Deprecated +358 private String externalReport = null; +359 // </editor-fold> +360 //<editor-fold defaultstate="collapsed" desc="Base Maven implementation"> +361 +362 /** +363 * Executes dependency-check. +364 * +365 * @throws MojoExecutionException thrown if there is an exception executing the mojo +366 * @throws MojoFailureException thrown if dependency-check failed the build 367 */ -368 public void generate(Sink sink, Locale locale) throws MavenReportException { -369 try { -370 validateAggregate(); -371 } catch (MojoExecutionException ex) { -372 throw new MavenReportException(ex.getMessage()); -373 } -374 project.setContextValue(getOutputDirectoryContextKey(), getReportOutputDirectory()); -375 try { -376 runCheck(); -377 } catch (MojoExecutionException ex) { -378 throw new MavenReportException(ex.getMessage(), ex); -379 } catch (MojoFailureException ex) { -380 getLog().warn("Vulnerabilities were identifies that exceed the CVSS threshold for failing the build"); -381 } -382 } -383 -384 /** -385 * Returns the correct output directory depending on if a site is being executed or not. -386 * -387 * @return the directory to write the report(s) -388 * @throws MojoExecutionException thrown if there is an error loading the file path -389 */ -390 protected File getCorrectOutputDirectory() throws MojoExecutionException { -391 return getCorrectOutputDirectory(this.project); -392 } -393 -394 /** -395 * Returns the correct output directory depending on if a site is being executed or not. -396 * -397 * @param current the Maven project to get the output directory from -398 * @return the directory to write the report(s) -399 */ -400 protected File getCorrectOutputDirectory(MavenProject current) { -401 final Object obj = current.getContextValue(getOutputDirectoryContextKey()); -402 if (obj != null && obj instanceof File) { -403 return (File) obj; -404 } -405 File target = new File(current.getBuild().getDirectory()); -406 if (target.getParentFile() != null && "target".equals(target.getParentFile().getName())) { -407 target = target.getParentFile(); -408 } -409 return target; -410 } -411 -412 /** -413 * Returns the correct output directory depending on if a site is being executed or not. -414 * -415 * @param current the Maven project to get the output directory from -416 * @return the directory to write the report(s) -417 */ -418 protected File getDataFile(MavenProject current) { -419 if (getLog().isDebugEnabled()) { -420 getLog().debug(String.format("Getting data filefor %s using key '%s'", current.getName(), getDataFileContextKey())); -421 } -422 final Object obj = current.getContextValue(getDataFileContextKey()); -423 if (obj != null) { -424 if (obj instanceof String) { -425 final File f = new File((String) obj); -426 return f; -427 } -428 } else { -429 if (getLog().isDebugEnabled()) { -430 getLog().debug("Context value not found"); -431 } -432 } -433 return null; -434 } -435 -436 /** -437 * Scans the project's artifacts and adds them to the engine's dependency list. -438 * -439 * @param project the project to scan the dependencies of -440 * @param engine the engine to use to scan the dependencies -441 */ -442 protected void scanArtifacts(MavenProject project, Engine engine) { -443 for (Artifact a : project.getArtifacts()) { -444 if (excludeFromScan(a)) { -445 continue; -446 } -447 final List<Dependency> deps = engine.scan(a.getFile().getAbsoluteFile()); -448 if (deps != null) { -449 if (deps.size() == 1) { -450 final Dependency d = deps.get(0); -451 if (d != null) { -452 final MavenArtifact ma = new MavenArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion()); -453 d.addAsEvidence("pom", ma, Confidence.HIGHEST); -454 d.addProjectReference(project.getName()); -455 if (getLog().isDebugEnabled()) { -456 getLog().debug(String.format("Adding project reference %s on dependency %s", project.getName(), -457 d.getDisplayFileName())); -458 } -459 } -460 } else { -461 if (getLog().isDebugEnabled()) { -462 final String msg = String.format("More then 1 dependency was identified in first pass scan of '%s:%s:%s'", -463 a.getGroupId(), a.getArtifactId(), a.getVersion()); -464 getLog().debug(msg); -465 } -466 } -467 } -468 } -469 } -470 -471 /** -472 * Executes the dependency-check scan and generates the necassary report. -473 * -474 * @throws MojoExecutionException thrown if there is an exception running the scan -475 * @throws MojoFailureException thrown if dependency-check is configured to fail the build -476 */ -477 public abstract void runCheck() throws MojoExecutionException, MojoFailureException; -478 -479 /** -480 * Sets the Reporting output directory. -481 * -482 * @param directory the output directory -483 */ -484 @Override -485 public void setReportOutputDirectory(File directory) { -486 reportOutputDirectory = directory; -487 } -488 -489 /** -490 * Returns the report output directory. -491 * -492 * @return the report output directory -493 */ -494 @Override -495 public File getReportOutputDirectory() { -496 return reportOutputDirectory; -497 } -498 -499 /** -500 * Returns the output directory. -501 * -502 * @return the output directory -503 */ -504 public File getOutputDirectory() { -505 return outputDirectory; -506 } -507 -508 /** -509 * Returns whether this is an external report. This method always returns true. -510 * -511 * @return <code>true</code> -512 */ -513 @Override -514 public final boolean isExternalReport() { -515 return true; -516 } -517 -518 /** -519 * Returns the output name. -520 * -521 * @return the output name +368 @Override +369 public void execute() throws MojoExecutionException, MojoFailureException { +370 if (skip) { +371 getLog().info("Skipping " + getName(Locale.US)); +372 } else { +373 validateAggregate(); +374 project.setContextValue(getOutputDirectoryContextKey(), this.outputDirectory); +375 runCheck(); +376 } +377 } +378 +379 /** +380 * Checks if the aggregate configuration parameter has been set to true. If it has a MojoExecutionException is thrown because +381 * the aggregate configuration parameter is no longer supported. +382 * +383 * @throws MojoExecutionException thrown if aggregate is set to true +384 */ +385 private void validateAggregate() throws MojoExecutionException { +386 if (aggregate != null && aggregate) { +387 final String msg = "Aggregate configuration detected - as of dependency-check 1.2.8 this no longer supported. " +388 + "Please use the aggregate goal instead."; +389 throw new MojoExecutionException(msg); +390 } +391 } +392 +393 /** +394 * Generates the Dependency-Check Site Report. +395 * +396 * @param sink the sink to write the report to +397 * @param locale the locale to use when generating the report +398 * @throws MavenReportException if a maven report exception occurs +399 * @deprecated use {@link #generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)} instead. +400 */ +401 @Override +402 @Deprecated +403 public final void generate(@SuppressWarnings("deprecation") org.codehaus.doxia.sink.Sink sink, Locale locale) throws MavenReportException { +404 generate((Sink) sink, locale); +405 } +406 +407 /** +408 * Generates the Dependency-Check Site Report. +409 * +410 * @param sink the sink to write the report to +411 * @param locale the locale to use when generating the report +412 * @throws MavenReportException if a maven report exception occurs +413 */ +414 public void generate(Sink sink, Locale locale) throws MavenReportException { +415 try { +416 validateAggregate(); +417 } catch (MojoExecutionException ex) { +418 throw new MavenReportException(ex.getMessage()); +419 } +420 project.setContextValue(getOutputDirectoryContextKey(), getReportOutputDirectory()); +421 try { +422 runCheck(); +423 } catch (MojoExecutionException ex) { +424 throw new MavenReportException(ex.getMessage(), ex); +425 } catch (MojoFailureException ex) { +426 getLog().warn("Vulnerabilities were identifies that exceed the CVSS threshold for failing the build"); +427 } +428 } +429 +430 /** +431 * Returns the correct output directory depending on if a site is being executed or not. +432 * +433 * @return the directory to write the report(s) +434 * @throws MojoExecutionException thrown if there is an error loading the file path +435 */ +436 protected File getCorrectOutputDirectory() throws MojoExecutionException { +437 return getCorrectOutputDirectory(this.project); +438 } +439 +440 /** +441 * Returns the correct output directory depending on if a site is being executed or not. +442 * +443 * @param current the Maven project to get the output directory from +444 * @return the directory to write the report(s) +445 */ +446 protected File getCorrectOutputDirectory(MavenProject current) { +447 final Object obj = current.getContextValue(getOutputDirectoryContextKey()); +448 if (obj != null && obj instanceof File) { +449 return (File) obj; +450 } +451 File target = new File(current.getBuild().getDirectory()); +452 if (target.getParentFile() != null && "target".equals(target.getParentFile().getName())) { +453 target = target.getParentFile(); +454 } +455 return target; +456 } +457 +458 /** +459 * Returns the correct output directory depending on if a site is being executed or not. +460 * +461 * @param current the Maven project to get the output directory from +462 * @return the directory to write the report(s) +463 */ +464 protected File getDataFile(MavenProject current) { +465 if (getLog().isDebugEnabled()) { +466 getLog().debug(String.format("Getting data filefor %s using key '%s'", current.getName(), getDataFileContextKey())); +467 } +468 final Object obj = current.getContextValue(getDataFileContextKey()); +469 if (obj != null) { +470 if (obj instanceof String) { +471 final File f = new File((String) obj); +472 return f; +473 } +474 } else { +475 if (getLog().isDebugEnabled()) { +476 getLog().debug("Context value not found"); +477 } +478 } +479 return null; +480 } +481 +482 /** +483 * Scans the project's artifacts and adds them to the engine's dependency list. +484 * +485 * @param project the project to scan the dependencies of +486 * @param engine the engine to use to scan the dependencies +487 */ +488 protected void scanArtifacts(MavenProject project, Engine engine) { +489 for (Artifact a : project.getArtifacts()) { +490 if (excludeFromScan(a)) { +491 continue; +492 } +493 final List<Dependency> deps = engine.scan(a.getFile().getAbsoluteFile()); +494 if (deps != null) { +495 if (deps.size() == 1) { +496 final Dependency d = deps.get(0); +497 if (d != null) { +498 final MavenArtifact ma = new MavenArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion()); +499 d.addAsEvidence("pom", ma, Confidence.HIGHEST); +500 d.addProjectReference(project.getName()); +501 if (getLog().isDebugEnabled()) { +502 getLog().debug(String.format("Adding project reference %s on dependency %s", project.getName(), +503 d.getDisplayFileName())); +504 } +505 } +506 } else { +507 if (getLog().isDebugEnabled()) { +508 final String msg = String.format("More then 1 dependency was identified in first pass scan of '%s:%s:%s'", +509 a.getGroupId(), a.getArtifactId(), a.getVersion()); +510 getLog().debug(msg); +511 } +512 } +513 } +514 } +515 } +516 +517 /** +518 * Executes the dependency-check scan and generates the necassary report. +519 * +520 * @throws MojoExecutionException thrown if there is an exception running the scan +521 * @throws MojoFailureException thrown if dependency-check is configured to fail the build 522 */ -523 @Override -524 public String getOutputName() { -525 if ("HTML".equalsIgnoreCase(this.format) || "ALL".equalsIgnoreCase(this.format)) { -526 return "dependency-check-report"; -527 } else if ("XML".equalsIgnoreCase(this.format)) { -528 return "dependency-check-report.xml#"; -529 } else if ("VULN".equalsIgnoreCase(this.format)) { -530 return "dependency-check-vulnerability"; -531 } else { -532 getLog().warn("Unknown report format used during site generation."); -533 return "dependency-check-report"; -534 } -535 } -536 -537 /** -538 * Returns the category name. -539 * -540 * @return the category name -541 */ -542 @Override -543 public String getCategoryName() { -544 return MavenReport.CATEGORY_PROJECT_REPORTS; -545 } -546 //</editor-fold> -547 -548 /** -549 * Initializes a new <code>Engine</code> that can be used for scanning. -550 * -551 * @return a newly instantiated <code>Engine</code> -552 * @throws DatabaseException thrown if there is a database exception -553 */ -554 protected Engine initializeEngine() throws DatabaseException { -555 populateSettings(); -556 return new Engine(this.project, -557 this.reactorProjects); -558 } -559 -560 /** -561 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties -562 * required to change the proxy url, port, and connection timeout. -563 */ -564 protected void populateSettings() { -565 Settings.initialize(); -566 InputStream mojoProperties = null; -567 try { -568 mojoProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE); -569 Settings.mergeProperties(mojoProperties); -570 } catch (IOException ex) { -571 getLog().warn("Unable to load the dependency-check ant task.properties file."); -572 if (getLog().isDebugEnabled()) { -573 getLog().debug("", ex); -574 } -575 } finally { -576 if (mojoProperties != null) { -577 try { -578 mojoProperties.close(); -579 } catch (IOException ex) { -580 if (getLog().isDebugEnabled()) { -581 getLog().debug("", ex); -582 } -583 } -584 } -585 } -586 -587 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); -588 if (externalReport != null) { -589 getLog().warn("The 'externalReport' option was set; this configuration option has been removed. " -590 + "Please update the dependency-check-maven plugin's configuration"); -591 } -592 -593 if (proxyUrl != null && !proxyUrl.isEmpty()) { -594 getLog().warn("Deprecated configuration detected, proxyUrl will be ignored; use the maven settings " + "to configure the proxy instead"); -595 } -596 final Proxy proxy = getMavenProxy(); -597 if (proxy != null) { -598 Settings.setString(Settings.KEYS.PROXY_SERVER, proxy.getHost()); -599 Settings.setString(Settings.KEYS.PROXY_PORT, Integer.toString(proxy.getPort())); -600 final String userName = proxy.getUsername(); -601 final String password = proxy.getPassword(); -602 if (userName != null) { -603 Settings.setString(Settings.KEYS.PROXY_USERNAME, userName); -604 } -605 if (password != null) { -606 Settings.setString(Settings.KEYS.PROXY_PASSWORD, password); -607 } -608 -609 } -610 -611 if (connectionTimeout != null && !connectionTimeout.isEmpty()) { -612 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); -613 } -614 if (suppressionFile != null && !suppressionFile.isEmpty()) { -615 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); -616 } -617 -618 //File Type Analyzer Settings -619 //JAR ANALYZER -620 Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled); -621 //NUSPEC ANALYZER -622 Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled); -623 //NEXUS ANALYZER -624 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); -625 //NEXUS ANALYZER -626 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); -627 if (nexusUrl != null && !nexusUrl.isEmpty()) { -628 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); -629 } -630 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy); -631 //ARCHIVE ANALYZER -632 Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled); -633 if (zipExtensions != null && !zipExtensions.isEmpty()) { -634 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); -635 } -636 //ASSEMBLY ANALYZER -637 Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled); -638 if (pathToMono != null && !pathToMono.isEmpty()) { -639 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); -640 } -641 -642 //Database configuration -643 if (databaseDriverName != null && !databaseDriverName.isEmpty()) { -644 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); -645 } -646 if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) { -647 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); -648 } -649 if (connectionString != null && !connectionString.isEmpty()) { -650 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString); -651 } -652 if (databaseUser != null && !databaseUser.isEmpty()) { -653 Settings.setString(Settings.KEYS.DB_USER, databaseUser); -654 } -655 if (databasePassword != null && !databasePassword.isEmpty()) { -656 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword); -657 } -658 // Data Directory -659 if (dataDirectory != null && !dataDirectory.isEmpty()) { -660 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory); -661 } -662 -663 // Scope Exclusion -664 Settings.setBoolean(Settings.KEYS.SKIP_TEST_SCOPE, skipTestScope); -665 Settings.setBoolean(Settings.KEYS.SKIP_RUNTIME_SCOPE, skipRuntimeScope); -666 Settings.setBoolean(Settings.KEYS.SKIP_PROVIDED_SCOPE, skipProvidedScope); -667 -668 // CVE Data Mirroring -669 if (cveUrl12Modified != null && !cveUrl12Modified.isEmpty()) { -670 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); -671 } -672 if (cveUrl20Modified != null && !cveUrl20Modified.isEmpty()) { -673 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); -674 } -675 if (cveUrl12Base != null && !cveUrl12Base.isEmpty()) { -676 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); -677 } -678 if (cveUrl20Base != null && !cveUrl20Base.isEmpty()) { -679 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); -680 } -681 } +523 public abstract void runCheck() throws MojoExecutionException, MojoFailureException; +524 +525 /** +526 * Sets the Reporting output directory. +527 * +528 * @param directory the output directory +529 */ +530 @Override +531 public void setReportOutputDirectory(File directory) { +532 reportOutputDirectory = directory; +533 } +534 +535 /** +536 * Returns the report output directory. +537 * +538 * @return the report output directory +539 */ +540 @Override +541 public File getReportOutputDirectory() { +542 return reportOutputDirectory; +543 } +544 +545 /** +546 * Returns the output directory. +547 * +548 * @return the output directory +549 */ +550 public File getOutputDirectory() { +551 return outputDirectory; +552 } +553 +554 /** +555 * Returns whether this is an external report. This method always returns true. +556 * +557 * @return <code>true</code> +558 */ +559 @Override +560 public final boolean isExternalReport() { +561 return true; +562 } +563 +564 /** +565 * Returns the output name. +566 * +567 * @return the output name +568 */ +569 @Override +570 public String getOutputName() { +571 if ("HTML".equalsIgnoreCase(this.format) || "ALL".equalsIgnoreCase(this.format)) { +572 return "dependency-check-report"; +573 } else if ("XML".equalsIgnoreCase(this.format)) { +574 return "dependency-check-report.xml#"; +575 } else if ("VULN".equalsIgnoreCase(this.format)) { +576 return "dependency-check-vulnerability"; +577 } else { +578 getLog().warn("Unknown report format used during site generation."); +579 return "dependency-check-report"; +580 } +581 } +582 +583 /** +584 * Returns the category name. +585 * +586 * @return the category name +587 */ +588 @Override +589 public String getCategoryName() { +590 return MavenReport.CATEGORY_PROJECT_REPORTS; +591 } +592 //</editor-fold> +593 +594 /** +595 * Initializes a new <code>Engine</code> that can be used for scanning. +596 * +597 * @return a newly instantiated <code>Engine</code> +598 * @throws DatabaseException thrown if there is a database exception +599 */ +600 protected Engine initializeEngine() throws DatabaseException { +601 populateSettings(); +602 return new Engine(this.project, +603 this.reactorProjects); +604 } +605 +606 /** +607 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties +608 * required to change the proxy url, port, and connection timeout. +609 */ +610 protected void populateSettings() { +611 Settings.initialize(); +612 InputStream mojoProperties = null; +613 try { +614 mojoProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE); +615 Settings.mergeProperties(mojoProperties); +616 } catch (IOException ex) { +617 getLog().warn("Unable to load the dependency-check ant task.properties file."); +618 if (getLog().isDebugEnabled()) { +619 getLog().debug("", ex); +620 } +621 } finally { +622 if (mojoProperties != null) { +623 try { +624 mojoProperties.close(); +625 } catch (IOException ex) { +626 if (getLog().isDebugEnabled()) { +627 getLog().debug("", ex); +628 } +629 } +630 } +631 } +632 Settings.setBooleanIfNotNull(Settings.KEYS.AUTO_UPDATE, autoUpdate); +633 +634 if (externalReport != null) { +635 getLog().warn("The 'externalReport' option was set; this configuration option has been removed. " +636 + "Please update the dependency-check-maven plugin's configuration"); +637 } +638 +639 if (proxyUrl != null && !proxyUrl.isEmpty()) { +640 getLog().warn("Deprecated configuration detected, proxyUrl will be ignored; use the maven settings " + "to configure the proxy instead"); +641 } +642 final Proxy proxy = getMavenProxy(); +643 if (proxy != null) { +644 Settings.setString(Settings.KEYS.PROXY_SERVER, proxy.getHost()); +645 Settings.setString(Settings.KEYS.PROXY_PORT, Integer.toString(proxy.getPort())); +646 final String userName = proxy.getUsername(); +647 final String password = proxy.getPassword(); +648 Settings.setStringIfNotNull(Settings.KEYS.PROXY_USERNAME, userName); +649 Settings.setStringIfNotNull(Settings.KEYS.PROXY_PASSWORD, password); +650 } +651 +652 Settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); +653 Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); +654 +655 //File Type Analyzer Settings +656 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled); +657 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled); +658 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); +659 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); +660 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); +661 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy); +662 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled); +663 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled); +664 Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); +665 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); +666 +667 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, pyDistributionAnalyzerEnabled); +668 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, pyPackageAnalyzerEnabled); +669 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, rubygemsAnalyzerEnabled); +670 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, opensslAnalyzerEnabled); +671 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CMAKE_ENABLED, cmakeAnalyzerEnabled); +672 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, autoconfAnalyzerEnabled); +673 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, composerAnalyzerEnabled); +674 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, nodeAnalyzerEnabled); +675 +676 //Database configuration +677 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); +678 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); +679 Settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString); +680 Settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser); +681 Settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword); 682 -683 /** -684 * Returns the maven proxy. -685 * -686 * @return the maven proxy -687 */ -688 private Proxy getMavenProxy() { -689 if (mavenSettings != null) { -690 final List<Proxy> proxies = mavenSettings.getProxies(); -691 if (proxies != null && !proxies.isEmpty()) { -692 if (mavenSettingsProxyId != null) { -693 for (Proxy proxy : proxies) { -694 if (mavenSettingsProxyId.equalsIgnoreCase(proxy.getId())) { -695 return proxy; -696 } -697 } -698 } else if (proxies.size() == 1) { -699 return proxies.get(0); -700 } else { -701 getLog().warn("Multiple proxy definitions exist in the Maven settings. In the dependency-check " -702 + "configuration set the mavenSettingsProxyId so that the correct proxy will be used."); -703 throw new IllegalStateException("Ambiguous proxy definition"); -704 } -705 } -706 } -707 return null; -708 } -709 -710 /** -711 * Tests is the artifact should be included in the scan (i.e. is the dependency in a scope that is being scanned). -712 * -713 * @param a the Artifact to test -714 * @return <code>true</code> if the artifact is in an excluded scope; otherwise <code>false</code> -715 */ -716 protected boolean excludeFromScan(Artifact a) { -717 if (skipTestScope && Artifact.SCOPE_TEST.equals(a.getScope())) { -718 return true; -719 } -720 if (skipProvidedScope && Artifact.SCOPE_PROVIDED.equals(a.getScope())) { -721 return true; -722 } -723 if (skipRuntimeScope && !Artifact.SCOPE_RUNTIME.equals(a.getScope())) { -724 return true; -725 } -726 return false; -727 } -728 -729 /** -730 * Returns a reference to the current project. This method is used instead of auto-binding the project via component -731 * annotation in concrete implementations of this. If the child has a <code>@Component MavenProject project;</code> defined -732 * then the abstract class (i.e. this class) will not have access to the current project (just the way Maven works with the -733 * binding). -734 * -735 * @return returns a reference to the current project -736 */ -737 protected MavenProject getProject() { -738 return project; -739 } -740 -741 /** -742 * Returns the list of Maven Projects in this build. -743 * -744 * @return the list of Maven Projects in this build -745 */ -746 protected List<MavenProject> getReactorProjects() { -747 return reactorProjects; -748 } -749 -750 /** -751 * Returns the report format. -752 * -753 * @return the report format -754 */ -755 protected String getFormat() { -756 return format; -757 } -758 -759 /** -760 * Generates the reports for a given dependency-check engine. -761 * -762 * @param engine a dependency-check engine -763 * @param p the maven project -764 * @param outputDir the directory path to write the report(s). -765 */ -766 protected void writeReports(Engine engine, MavenProject p, File outputDir) { -767 DatabaseProperties prop = null; -768 CveDB cve = null; -769 try { -770 cve = new CveDB(); -771 cve.open(); -772 prop = cve.getDatabaseProperties(); -773 } catch (DatabaseException ex) { -774 if (getLog().isDebugEnabled()) { -775 getLog().debug("Unable to retrieve DB Properties", ex); -776 } -777 } finally { -778 if (cve != null) { -779 cve.close(); -780 } -781 } -782 final ReportGenerator r = new ReportGenerator(p.getName(), engine.getDependencies(), engine.getAnalyzers(), prop); -783 try { -784 r.generateReports(outputDir.getAbsolutePath(), format); -785 } catch (IOException ex) { -786 getLog().error( -787 "Unexpected exception occurred during analysis; please see the verbose error log for more details."); -788 if (getLog().isDebugEnabled()) { -789 getLog().debug("", ex); +683 Settings.setStringIfNotEmpty(Settings.KEYS.DATA_DIRECTORY, dataDirectory); +684 +685 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); +686 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); +687 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); +688 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); +689 Settings.setIntIfNotNull(Settings.KEYS.CVE_CHECK_VALID_FOR_HOURS, cveValidForHours); +690 +691 } +692 +693 /** +694 * Returns the maven proxy. +695 * +696 * @return the maven proxy +697 */ +698 private Proxy getMavenProxy() { +699 if (mavenSettings != null) { +700 final List<Proxy> proxies = mavenSettings.getProxies(); +701 if (proxies != null && !proxies.isEmpty()) { +702 if (mavenSettingsProxyId != null) { +703 for (Proxy proxy : proxies) { +704 if (mavenSettingsProxyId.equalsIgnoreCase(proxy.getId())) { +705 return proxy; +706 } +707 } +708 } else if (proxies.size() == 1) { +709 return proxies.get(0); +710 } else { +711 getLog().warn("Multiple proxy definitions exist in the Maven settings. In the dependency-check " +712 + "configuration set the mavenSettingsProxyId so that the correct proxy will be used."); +713 throw new IllegalStateException("Ambiguous proxy definition"); +714 } +715 } +716 } +717 return null; +718 } +719 +720 /** +721 * Tests is the artifact should be included in the scan (i.e. is the dependency in a scope that is being scanned). +722 * +723 * @param a the Artifact to test +724 * @return <code>true</code> if the artifact is in an excluded scope; otherwise <code>false</code> +725 */ +726 protected boolean excludeFromScan(Artifact a) { +727 if (skipTestScope && Artifact.SCOPE_TEST.equals(a.getScope())) { +728 return true; +729 } +730 if (skipProvidedScope && Artifact.SCOPE_PROVIDED.equals(a.getScope())) { +731 return true; +732 } +733 if (skipRuntimeScope && !Artifact.SCOPE_RUNTIME.equals(a.getScope())) { +734 return true; +735 } +736 return false; +737 } +738 +739 /** +740 * Returns a reference to the current project. This method is used instead of auto-binding the project via component +741 * annotation in concrete implementations of this. If the child has a <code>@Component MavenProject project;</code> defined +742 * then the abstract class (i.e. this class) will not have access to the current project (just the way Maven works with the +743 * binding). +744 * +745 * @return returns a reference to the current project +746 */ +747 protected MavenProject getProject() { +748 return project; +749 } +750 +751 /** +752 * Returns the list of Maven Projects in this build. +753 * +754 * @return the list of Maven Projects in this build +755 */ +756 protected List<MavenProject> getReactorProjects() { +757 return reactorProjects; +758 } +759 +760 /** +761 * Returns the report format. +762 * +763 * @return the report format +764 */ +765 protected String getFormat() { +766 return format; +767 } +768 +769 /** +770 * Generates the reports for a given dependency-check engine. +771 * +772 * @param engine a dependency-check engine +773 * @param p the maven project +774 * @param outputDir the directory path to write the report(s). +775 */ +776 protected void writeReports(Engine engine, MavenProject p, File outputDir) { +777 DatabaseProperties prop = null; +778 CveDB cve = null; +779 try { +780 cve = new CveDB(); +781 cve.open(); +782 prop = cve.getDatabaseProperties(); +783 } catch (DatabaseException ex) { +784 if (getLog().isDebugEnabled()) { +785 getLog().debug("Unable to retrieve DB Properties", ex); +786 } +787 } finally { +788 if (cve != null) { +789 cve.close(); 790 } -791 } catch (Throwable ex) { -792 getLog().error( -793 "Unexpected exception occurred during analysis; please see the verbose error log for more details."); -794 if (getLog().isDebugEnabled()) { -795 getLog().debug("", ex); -796 } -797 } -798 } -799 -800 //<editor-fold defaultstate="collapsed" desc="Methods to fail build or show summary"> -801 /** -802 * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the -803 * configuration. -804 * -805 * @param dependencies the list of dependency objects -806 * @throws MojoFailureException thrown if a CVSS score is found that is higher then the threshold set -807 */ -808 protected void checkForFailure(List<Dependency> dependencies) throws MojoFailureException { -809 if (failBuildOnCVSS <= 10) { -810 final StringBuilder ids = new StringBuilder(); -811 for (Dependency d : dependencies) { -812 boolean addName = true; -813 for (Vulnerability v : d.getVulnerabilities()) { -814 if (v.getCvssScore() >= failBuildOnCVSS) { -815 if (addName) { -816 addName = false; -817 ids.append(NEW_LINE).append(d.getFileName()).append(": "); -818 ids.append(v.getName()); -819 } else { -820 ids.append(", ").append(v.getName()); -821 } -822 } -823 } -824 } -825 if (ids.length() > 0) { -826 final String msg = String.format("%n%nDependency-Check Failure:%n" -827 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" -828 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); -829 throw new MojoFailureException(msg); -830 } -831 } -832 } -833 -834 /** -835 * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. -836 * -837 * @param mp the Maven project for which the summary is shown -838 * @param dependencies a list of dependency objects -839 */ -840 protected void showSummary(MavenProject mp, List<Dependency> dependencies) { -841 if (showSummary) { -842 final StringBuilder summary = new StringBuilder(); -843 for (Dependency d : dependencies) { -844 boolean firstEntry = true; -845 final StringBuilder ids = new StringBuilder(); -846 for (Vulnerability v : d.getVulnerabilities()) { -847 if (firstEntry) { -848 firstEntry = false; -849 } else { -850 ids.append(", "); -851 } -852 ids.append(v.getName()); -853 } -854 if (ids.length() > 0) { -855 summary.append(d.getFileName()).append(" ("); -856 firstEntry = true; -857 for (Identifier id : d.getIdentifiers()) { -858 if (firstEntry) { -859 firstEntry = false; -860 } else { -861 summary.append(", "); -862 } -863 summary.append(id.getValue()); -864 } -865 summary.append(") : ").append(ids).append(NEW_LINE); -866 } -867 } -868 if (summary.length() > 0) { -869 final String msg = String.format("%n%n" + "One or more dependencies were identified with known vulnerabilities in %s:%n%n%s" -870 + "%n%nSee the dependency-check report for more details.%n%n", mp.getName(), summary.toString()); -871 getLog().warn(msg); -872 } -873 } -874 } -875 -876 //</editor-fold> -877 //<editor-fold defaultstate="collapsed" desc="Methods to read/write the serialized data file"> -878 /** -879 * Returns the key used to store the path to the data file that is saved by <code>writeDataFile()</code>. This key is used in -880 * the <code>MavenProject.(set|get)ContextValue</code>. -881 * -882 * @return the key used to store the path to the data file -883 */ -884 protected String getDataFileContextKey() { -885 return "dependency-check-path-" + dataFileName; -886 } -887 +791 } +792 final ReportGenerator r = new ReportGenerator(p.getName(), engine.getDependencies(), engine.getAnalyzers(), prop); +793 try { +794 r.generateReports(outputDir.getAbsolutePath(), format); +795 } catch (IOException ex) { +796 getLog().error( +797 "Unexpected exception occurred during analysis; please see the verbose error log for more details."); +798 if (getLog().isDebugEnabled()) { +799 getLog().debug("", ex); +800 } +801 } catch (Throwable ex) { +802 getLog().error( +803 "Unexpected exception occurred during analysis; please see the verbose error log for more details."); +804 if (getLog().isDebugEnabled()) { +805 getLog().debug("", ex); +806 } +807 } +808 } +809 +810 //<editor-fold defaultstate="collapsed" desc="Methods to fail build or show summary"> +811 /** +812 * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the +813 * configuration. +814 * +815 * @param dependencies the list of dependency objects +816 * @throws MojoFailureException thrown if a CVSS score is found that is higher then the threshold set +817 */ +818 protected void checkForFailure(List<Dependency> dependencies) throws MojoFailureException { +819 if (failBuildOnCVSS <= 10) { +820 final StringBuilder ids = new StringBuilder(); +821 for (Dependency d : dependencies) { +822 boolean addName = true; +823 for (Vulnerability v : d.getVulnerabilities()) { +824 if (v.getCvssScore() >= failBuildOnCVSS) { +825 if (addName) { +826 addName = false; +827 ids.append(NEW_LINE).append(d.getFileName()).append(": "); +828 ids.append(v.getName()); +829 } else { +830 ids.append(", ").append(v.getName()); +831 } +832 } +833 } +834 } +835 if (ids.length() > 0) { +836 final String msg = String.format("%n%nDependency-Check Failure:%n" +837 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" +838 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); +839 throw new MojoFailureException(msg); +840 } +841 } +842 } +843 +844 /** +845 * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. +846 * +847 * @param mp the Maven project for which the summary is shown +848 * @param dependencies a list of dependency objects +849 */ +850 protected void showSummary(MavenProject mp, List<Dependency> dependencies) { +851 if (showSummary) { +852 final StringBuilder summary = new StringBuilder(); +853 for (Dependency d : dependencies) { +854 boolean firstEntry = true; +855 final StringBuilder ids = new StringBuilder(); +856 for (Vulnerability v : d.getVulnerabilities()) { +857 if (firstEntry) { +858 firstEntry = false; +859 } else { +860 ids.append(", "); +861 } +862 ids.append(v.getName()); +863 } +864 if (ids.length() > 0) { +865 summary.append(d.getFileName()).append(" ("); +866 firstEntry = true; +867 for (Identifier id : d.getIdentifiers()) { +868 if (firstEntry) { +869 firstEntry = false; +870 } else { +871 summary.append(", "); +872 } +873 summary.append(id.getValue()); +874 } +875 summary.append(") : ").append(ids).append(NEW_LINE); +876 } +877 } +878 if (summary.length() > 0) { +879 final String msg = String.format("%n%n" + "One or more dependencies were identified with known vulnerabilities in %s:%n%n%s" +880 + "%n%nSee the dependency-check report for more details.%n%n", mp.getName(), summary.toString()); +881 getLog().warn(msg); +882 } +883 } +884 } +885 +886 //</editor-fold> +887 //<editor-fold defaultstate="collapsed" desc="Methods to read/write the serialized data file"> 888 /** -889 * Returns the key used to store the path to the output directory. When generating the report in the -890 * <code>executeAggregateReport()</code> the output directory should be obtained by using this key. +889 * Returns the key used to store the path to the data file that is saved by <code>writeDataFile()</code>. This key is used in +890 * the <code>MavenProject.(set|get)ContextValue</code>. 891 * -892 * @return the key used to store the path to the output directory +892 * @return the key used to store the path to the data file 893 */ -894 protected String getOutputDirectoryContextKey() { -895 return "dependency-output-dir-" + dataFileName; +894 protected String getDataFileContextKey() { +895 return "dependency-check-path-" + dataFileName; 896 } 897 898 /** -899 * Writes the scan data to disk. This is used to serialize the scan data between the "check" and "aggregate" phase. -900 * -901 * @param mp the mMven project for which the data file was created -902 * @param writeTo the directory to write the data file -903 * @param dependencies the list of dependencies to serialize -904 */ -905 protected void writeDataFile(MavenProject mp, File writeTo, List<Dependency> dependencies) { -906 File file; -907 //check to see if this was already written out -908 if (mp.getContextValue(this.getDataFileContextKey()) == null) { -909 if (writeTo == null) { -910 file = new File(mp.getBuild().getDirectory()); -911 file = new File(file, dataFileName); -912 } else { -913 file = new File(writeTo, dataFileName); -914 } -915 final File parent = file.getParentFile(); -916 if (!parent.isDirectory() && parent.mkdirs()) { -917 getLog().error(String.format("Directory '%s' does not exist and cannot be created; unable to write data file.", -918 parent.getAbsolutePath())); -919 } -920 -921 OutputStream os = null; -922 OutputStream bos = null; -923 ObjectOutputStream out = null; -924 try { -925 if (dependencies != null) { -926 os = new FileOutputStream(file); -927 bos = new BufferedOutputStream(os); -928 out = new ObjectOutputStream(bos); -929 out.writeObject(dependencies); -930 out.flush(); -931 -932 //call reset to prevent resource leaks per -933 //https://www.securecoding.cert.org/confluence/display/java/SER10-J.+Avoid+memory+and+resource+leaks+during+serialization -934 out.reset(); -935 } -936 if (getLog().isDebugEnabled()) { -937 getLog().debug(String.format("Serialized data file written to '%s' for %s, referenced by key %s", -938 file.getAbsolutePath(), mp.getName(), this.getDataFileContextKey())); -939 } -940 mp.setContextValue(this.getDataFileContextKey(), file.getAbsolutePath()); -941 } catch (IOException ex) { -942 getLog().warn("Unable to create data file used for report aggregation; " -943 + "if report aggregation is being used the results may be incomplete."); -944 if (getLog().isDebugEnabled()) { -945 getLog().debug(ex.getMessage(), ex); -946 } -947 } finally { -948 if (out != null) { -949 try { -950 out.close(); -951 } catch (IOException ex) { -952 if (getLog().isDebugEnabled()) { -953 getLog().debug("ignore", ex); -954 } -955 } -956 } -957 if (bos != null) { -958 try { -959 bos.close(); -960 } catch (IOException ex) { -961 if (getLog().isDebugEnabled()) { -962 getLog().debug("ignore", ex); -963 } -964 } -965 } -966 if (os != null) { -967 try { -968 os.close(); -969 } catch (IOException ex) { -970 if (getLog().isDebugEnabled()) { -971 getLog().debug("ignore", ex); -972 } -973 } -974 } -975 } -976 } -977 } -978 -979 /** -980 * Reads the serialized scan data from disk. This is used to serialize the scan data between the "check" and "aggregate" -981 * phase. -982 * -983 * @param project the Maven project to read the data file from -984 * @return a <code>Engine</code> object populated with dependencies if the serialized data file exists; otherwise -985 * <code>null</code> is returned -986 */ -987 protected List<Dependency> readDataFile(MavenProject project) { -988 final Object oPath = project.getContextValue(this.getDataFileContextKey()); -989 if (oPath == null) { -990 return null; -991 } -992 List<Dependency> ret = null; -993 final String path = (String) oPath; -994 ObjectInputStream ois = null; -995 try { -996 ois = new ObjectInputStream(new FileInputStream(path)); -997 ret = (List<Dependency>) ois.readObject(); -998 } catch (FileNotFoundException ex) { -999 //TODO fix logging -1000 getLog().error("", ex); -1001 } catch (IOException ex) { -1002 getLog().error("", ex); -1003 } catch (ClassNotFoundException ex) { -1004 getLog().error("", ex); -1005 } finally { -1006 if (ois != null) { -1007 try { -1008 ois.close(); -1009 } catch (IOException ex) { -1010 getLog().error("", ex); -1011 } -1012 } -1013 } -1014 return ret; -1015 } -1016 //</editor-fold> -1017 } +899 * Returns the key used to store the path to the output directory. When generating the report in the +900 * <code>executeAggregateReport()</code> the output directory should be obtained by using this key. +901 * +902 * @return the key used to store the path to the output directory +903 */ +904 protected String getOutputDirectoryContextKey() { +905 return "dependency-output-dir-" + dataFileName; +906 } +907 +908 /** +909 * Writes the scan data to disk. This is used to serialize the scan data between the "check" and "aggregate" phase. +910 * +911 * @param mp the mMven project for which the data file was created +912 * @param writeTo the directory to write the data file +913 * @param dependencies the list of dependencies to serialize +914 */ +915 protected void writeDataFile(MavenProject mp, File writeTo, List<Dependency> dependencies) { +916 File file; +917 //check to see if this was already written out +918 if (mp.getContextValue(this.getDataFileContextKey()) == null) { +919 if (writeTo == null) { +920 file = new File(mp.getBuild().getDirectory()); +921 file = new File(file, dataFileName); +922 } else { +923 file = new File(writeTo, dataFileName); +924 } +925 final File parent = file.getParentFile(); +926 if (!parent.isDirectory() && parent.mkdirs()) { +927 getLog().error(String.format("Directory '%s' does not exist and cannot be created; unable to write data file.", +928 parent.getAbsolutePath())); +929 } +930 +931 ObjectOutputStream out = null; +932 try { +933 if (dependencies != null) { +934 out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file))); +935 out.writeObject(dependencies); +936 } +937 if (getLog().isDebugEnabled()) { +938 getLog().debug(String.format("Serialized data file written to '%s' for %s, referenced by key %s", +939 file.getAbsolutePath(), mp.getName(), this.getDataFileContextKey())); +940 } +941 mp.setContextValue(this.getDataFileContextKey(), file.getAbsolutePath()); +942 } catch (IOException ex) { +943 getLog().warn("Unable to create data file used for report aggregation; " +944 + "if report aggregation is being used the results may be incomplete."); +945 if (getLog().isDebugEnabled()) { +946 getLog().debug(ex.getMessage(), ex); +947 } +948 } finally { +949 if (out != null) { +950 try { +951 out.close(); +952 } catch (IOException ex) { +953 if (getLog().isDebugEnabled()) { +954 getLog().debug("ignore", ex); +955 } +956 } +957 } +958 } +959 } +960 } +961 +962 /** +963 * Reads the serialized scan data from disk. This is used to serialize the scan data between the "check" and "aggregate" +964 * phase. +965 * +966 * @param project the Maven project to read the data file from +967 * @return a <code>Engine</code> object populated with dependencies if the serialized data file exists; otherwise +968 * <code>null</code> is returned +969 */ +970 protected List<Dependency> readDataFile(MavenProject project) { +971 final Object oPath = project.getContextValue(this.getDataFileContextKey()); +972 if (oPath == null) { +973 return null; +974 } +975 List<Dependency> ret = null; +976 final String path = (String) oPath; +977 ObjectInputStream ois = null; +978 try { +979 ois = new ObjectInputStream(new FileInputStream(path)); +980 ret = (List<Dependency>) ois.readObject(); +981 } catch (FileNotFoundException ex) { +982 //TODO fix logging +983 getLog().error("", ex); +984 } catch (IOException ex) { +985 getLog().error("", ex); +986 } catch (ClassNotFoundException ex) { +987 getLog().error("", ex); +988 } finally { +989 if (ois != null) { +990 try { +991 ois.close(); +992 } catch (IOException ex) { +993 getLog().error("", ex); +994 } +995 } +996 } +997 return ret; +998 } +999 //</editor-fold> +1000 }
        diff --git a/xref/org/owasp/dependencycheck/maven/CheckMojo.html b/xref/org/owasp/dependencycheck/maven/CheckMojo.html index ceafcb000..ff7382a91 100644 --- a/xref/org/owasp/dependencycheck/maven/CheckMojo.html +++ b/xref/org/owasp/dependencycheck/maven/CheckMojo.html @@ -31,96 +31,104 @@ 23 import org.apache.maven.plugin.MojoFailureException; 24 import org.apache.maven.plugins.annotations.LifecyclePhase; 25 import org.apache.maven.plugins.annotations.Mojo; -26 import org.apache.maven.plugins.annotations.ResolutionScope; -27 import org.owasp.dependencycheck.data.nvdcve.DatabaseException; -28 import org.owasp.dependencycheck.utils.Settings; -29 -30 /** -31 * Maven Plugin that checks the project dependencies to see if they have any known published vulnerabilities. -32 * -33 * @author Jeremy Long -34 */ -35 @Mojo( -36 name = "check", -37 defaultPhase = LifecyclePhase.COMPILE, -38 threadSafe = true, -39 requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, -40 requiresOnline = true -41 ) -42 public class CheckMojo extends BaseDependencyCheckMojo { -43 -44 /** -45 * Returns whether or not a the report can be generated. -46 * -47 * @return <code>true</code> if the report can be generated; otherwise <code>false</code> -48 */ -49 @Override -50 public boolean canGenerateReport() { -51 boolean isCapable = false; -52 for (Artifact a : getProject().getArtifacts()) { -53 if (!excludeFromScan(a)) { -54 isCapable = true; -55 break; -56 } -57 } -58 return isCapable; -59 } -60 -61 /** -62 * Executes the dependency-check engine on the project's dependencies and generates the report. -63 * -64 * @throws MojoExecutionException thrown if there is an exception executing the goal -65 * @throws MojoFailureException thrown if dependency-check is configured to fail the build -66 */ -67 @Override -68 public void runCheck() throws MojoExecutionException, MojoFailureException { -69 final Engine engine; -70 try { -71 engine = initializeEngine(); -72 } catch (DatabaseException ex) { -73 if (getLog().isDebugEnabled()) { -74 getLog().debug("Database connection error", ex); -75 } -76 throw new MojoExecutionException("An exception occured connecting to the local database. Please see the log file for more details.", ex); -77 } -78 scanArtifacts(getProject(), engine); -79 if (engine.getDependencies().isEmpty()) { -80 getLog().info("No dependencies were identified that could be analyzed by dependency-check"); -81 } else { -82 engine.analyzeDependencies(); -83 writeReports(engine, getProject(), getCorrectOutputDirectory()); -84 writeDataFile(getProject(), null, engine.getDependencies()); -85 showSummary(getProject(), engine.getDependencies()); -86 checkForFailure(engine.getDependencies()); -87 } -88 engine.cleanup(); -89 Settings.cleanup(); -90 } -91 -92 /** -93 * Returns the report name. -94 * -95 * @param locale the location -96 * @return the report name -97 */ -98 @Override -99 public String getName(Locale locale) { -100 return "dependency-check"; -101 } -102 -103 /** -104 * Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page. -105 * -106 * @param locale The Locale to get the description for -107 * @return the description -108 */ -109 @Override -110 public String getDescription(Locale locale) { -111 return "Generates a report providing details on any published vulnerabilities within project dependencies. " -112 + "This report is a best effort and may contain false positives and false negatives."; -113 } -114 -115 } +26 import org.apache.maven.plugins.annotations.Parameter; +27 import org.apache.maven.plugins.annotations.ResolutionScope; +28 import org.owasp.dependencycheck.data.nvdcve.DatabaseException; +29 import org.owasp.dependencycheck.utils.Settings; +30 +31 /** +32 * Maven Plugin that checks the project dependencies to see if they have any known published vulnerabilities. +33 * +34 * @author Jeremy Long +35 */ +36 @Mojo( +37 name = "check", +38 defaultPhase = LifecyclePhase.VERIFY, +39 threadSafe = true, +40 requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, +41 requiresOnline = true +42 ) +43 public class CheckMojo extends BaseDependencyCheckMojo { +44 +45 /** +46 * Returns whether or not a the report can be generated. +47 * +48 * @return <code>true</code> if the report can be generated; otherwise <code>false</code> +49 */ +50 @Override +51 public boolean canGenerateReport() { +52 boolean isCapable = false; +53 for (Artifact a : getProject().getArtifacts()) { +54 if (!excludeFromScan(a)) { +55 isCapable = true; +56 break; +57 } +58 } +59 return isCapable; +60 } +61 +62 /** +63 * Executes the dependency-check engine on the project's dependencies and generates the report. +64 * +65 * @throws MojoExecutionException thrown if there is an exception executing the goal +66 * @throws MojoFailureException thrown if dependency-check is configured to fail the build +67 */ +68 @Override +69 public void runCheck() throws MojoExecutionException, MojoFailureException { +70 final Engine engine; +71 try { +72 engine = initializeEngine(); +73 } catch (DatabaseException ex) { +74 if (getLog().isDebugEnabled()) { +75 getLog().debug("Database connection error", ex); +76 } +77 throw new MojoExecutionException("An exception occured connecting to the local database. Please see the log file for more details.", ex); +78 } +79 scanArtifacts(getProject(), engine); +80 if (engine.getDependencies().isEmpty()) { +81 getLog().info("No dependencies were identified that could be analyzed by dependency-check"); +82 } else { +83 engine.analyzeDependencies(); +84 writeReports(engine, getProject(), getCorrectOutputDirectory()); +85 writeDataFile(getProject(), null, engine.getDependencies()); +86 showSummary(getProject(), engine.getDependencies()); +87 checkForFailure(engine.getDependencies()); +88 } +89 engine.cleanup(); +90 Settings.cleanup(); +91 } +92 +93 /** +94 * The name of the report in the site. +95 */ +96 @SuppressWarnings("CanBeFinal") +97 @Parameter(property = "name", defaultValue = "dependency-check", required = true) +98 private String name = "dependency-check"; +99 +100 /** +101 * Returns the report name. +102 * +103 * @param locale the location +104 * @return the report name +105 */ +106 @Override +107 public String getName(Locale locale) { +108 return name; +109 } +110 +111 /** +112 * Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page. +113 * +114 * @param locale The Locale to get the description for +115 * @return the description +116 */ +117 @Override +118 public String getDescription(Locale locale) { +119 return "Generates a report providing details on any published vulnerabilities within project dependencies. " +120 + "This report is a best effort and may contain false positives and false negatives."; +121 } +122 +123 }
        diff --git a/xref/org/owasp/dependencycheck/maven/package-frame.html b/xref/org/owasp/dependencycheck/maven/package-frame.html index b706e841d..1d5d4f097 100644 --- a/xref/org/owasp/dependencycheck/maven/package-frame.html +++ b/xref/org/owasp/dependencycheck/maven/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.maven + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.maven diff --git a/xref/org/owasp/dependencycheck/maven/package-summary.html b/xref/org/owasp/dependencycheck/maven/package-summary.html index 160106810..46215efd6 100644 --- a/xref/org/owasp/dependencycheck/maven/package-summary.html +++ b/xref/org/owasp/dependencycheck/maven/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.maven + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.maven diff --git a/xref/org/owasp/dependencycheck/maven/slf4j/package-frame.html b/xref/org/owasp/dependencycheck/maven/slf4j/package-frame.html index dfd39e64a..f0ef06242 100644 --- a/xref/org/owasp/dependencycheck/maven/slf4j/package-frame.html +++ b/xref/org/owasp/dependencycheck/maven/slf4j/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.maven.slf4j + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.maven.slf4j diff --git a/xref/org/owasp/dependencycheck/maven/slf4j/package-summary.html b/xref/org/owasp/dependencycheck/maven/slf4j/package-summary.html index 54adb0df8..f32500bea 100644 --- a/xref/org/owasp/dependencycheck/maven/slf4j/package-summary.html +++ b/xref/org/owasp/dependencycheck/maven/slf4j/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.maven.slf4j + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.maven.slf4j diff --git a/xref/org/owasp/dependencycheck/package-frame.html b/xref/org/owasp/dependencycheck/package-frame.html index 396b9c92d..0e1866e10 100644 --- a/xref/org/owasp/dependencycheck/package-frame.html +++ b/xref/org/owasp/dependencycheck/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck diff --git a/xref/org/owasp/dependencycheck/package-summary.html b/xref/org/owasp/dependencycheck/package-summary.html index 8c4b5a4c6..46886364d 100644 --- a/xref/org/owasp/dependencycheck/package-summary.html +++ b/xref/org/owasp/dependencycheck/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck diff --git a/xref/org/owasp/dependencycheck/reporting/package-frame.html b/xref/org/owasp/dependencycheck/reporting/package-frame.html index ac02cd893..03fe4d60b 100644 --- a/xref/org/owasp/dependencycheck/reporting/package-frame.html +++ b/xref/org/owasp/dependencycheck/reporting/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.reporting + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.reporting diff --git a/xref/org/owasp/dependencycheck/reporting/package-summary.html b/xref/org/owasp/dependencycheck/reporting/package-summary.html index b2c32e619..3d2eabef2 100644 --- a/xref/org/owasp/dependencycheck/reporting/package-summary.html +++ b/xref/org/owasp/dependencycheck/reporting/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.reporting + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.reporting diff --git a/xref/org/owasp/dependencycheck/suppression/SuppressionRule.html b/xref/org/owasp/dependencycheck/suppression/SuppressionRule.html index e8efe2522..20835f97e 100644 --- a/xref/org/owasp/dependencycheck/suppression/SuppressionRule.html +++ b/xref/org/owasp/dependencycheck/suppression/SuppressionRule.html @@ -28,468 +28,446 @@ 20 import java.util.ArrayList; 21 import java.util.Iterator; 22 import java.util.List; -23 import org.owasp.dependencycheck.dependency.Dependency; -24 import org.owasp.dependencycheck.dependency.Identifier; -25 import org.owasp.dependencycheck.dependency.Vulnerability; -26 -27 /** -28 * -29 * @author Jeremy Long -30 */ -31 public class SuppressionRule { -32 -33 /** -34 * The file path for the suppression. -35 */ -36 private PropertyType filePath; -37 -38 /** -39 * Get the value of filePath. -40 * -41 * @return the value of filePath -42 */ -43 public PropertyType getFilePath() { -44 return filePath; -45 } -46 -47 /** -48 * Set the value of filePath. -49 * -50 * @param filePath new value of filePath -51 */ -52 public void setFilePath(PropertyType filePath) { -53 this.filePath = filePath; -54 } -55 /** -56 * The sha1 hash. -57 */ -58 private String sha1; -59 -60 /** -61 * Get the value of sha1. -62 * -63 * @return the value of sha1 -64 */ -65 public String getSha1() { -66 return sha1; -67 } -68 -69 /** -70 * Set the value of sha1. -71 * -72 * @param sha1 new value of sha1 -73 */ -74 public void setSha1(String sha1) { -75 this.sha1 = sha1; -76 } -77 /** -78 * A list of CPEs to suppression -79 */ -80 private List<PropertyType> cpe = new ArrayList<PropertyType>(); -81 -82 /** -83 * Get the value of cpe. -84 * -85 * @return the value of cpe -86 */ -87 public List<PropertyType> getCpe() { -88 return cpe; -89 } -90 -91 /** -92 * Set the value of cpe. -93 * -94 * @param cpe new value of cpe -95 */ -96 public void setCpe(List<PropertyType> cpe) { -97 this.cpe = cpe; -98 } -99 -100 /** -101 * Adds the cpe to the cpe list. -102 * -103 * @param cpe the cpe to add -104 */ -105 public void addCpe(PropertyType cpe) { -106 this.cpe.add(cpe); -107 } -108 -109 /** -110 * Returns whether or not this suppression rule as CPE entries. -111 * -112 * @return whether or not this suppression rule as CPE entries -113 */ -114 public boolean hasCpe() { -115 return !cpe.isEmpty(); -116 } -117 /** -118 * The list of cvssBelow scores. -119 */ -120 private List<Float> cvssBelow = new ArrayList<Float>(); -121 -122 /** -123 * Get the value of cvssBelow. -124 * -125 * @return the value of cvssBelow -126 */ -127 public List<Float> getCvssBelow() { -128 return cvssBelow; -129 } -130 -131 /** -132 * Set the value of cvssBelow. -133 * -134 * @param cvssBelow new value of cvssBelow -135 */ -136 public void setCvssBelow(List<Float> cvssBelow) { -137 this.cvssBelow = cvssBelow; -138 } -139 -140 /** -141 * Adds the cvss to the cvssBelow list. -142 * -143 * @param cvss the cvss to add -144 */ -145 public void addCvssBelow(Float cvss) { -146 this.cvssBelow.add(cvss); -147 } -148 -149 /** -150 * Returns whether or not this suppression rule has cvss suppressions. -151 * -152 * @return whether or not this suppression rule has cvss suppressions -153 */ -154 public boolean hasCvssBelow() { -155 return !cvssBelow.isEmpty(); -156 } -157 /** -158 * The list of cwe entries to suppress. -159 */ -160 private List<String> cwe = new ArrayList<String>(); -161 -162 /** -163 * Get the value of cwe. -164 * -165 * @return the value of cwe -166 */ -167 public List<String> getCwe() { -168 return cwe; -169 } -170 -171 /** -172 * Set the value of cwe. -173 * -174 * @param cwe new value of cwe -175 */ -176 public void setCwe(List<String> cwe) { -177 this.cwe = cwe; -178 } -179 -180 /** -181 * Adds the cwe to the cwe list. -182 * -183 * @param cwe the cwe to add -184 */ -185 public void addCwe(String cwe) { -186 this.cwe.add(cwe); -187 } -188 -189 /** -190 * Returns whether this suppression rule has CWE entries. -191 * -192 * @return whether this suppression rule has CWE entries -193 */ -194 public boolean hasCwe() { -195 return !cwe.isEmpty(); -196 } -197 /** -198 * The list of cve entries to suppress. -199 */ -200 private List<String> cve = new ArrayList<String>(); -201 -202 /** -203 * Get the value of cve. -204 * -205 * @return the value of cve -206 */ -207 public List<String> getCve() { -208 return cve; -209 } -210 -211 /** -212 * Set the value of cve. -213 * -214 * @param cve new value of cve -215 */ -216 public void setCve(List<String> cve) { -217 this.cve = cve; -218 } -219 -220 /** -221 * Adds the cve to the cve list. -222 * -223 * @param cve the cve to add -224 */ -225 public void addCve(String cve) { -226 this.cve.add(cve); -227 } -228 -229 /** -230 * Returns whether this suppression rule has CVE entries. -231 * -232 * @return whether this suppression rule has CVE entries -233 */ -234 public boolean hasCve() { -235 return !cve.isEmpty(); -236 } -237 /** -238 * A Maven GAV to suppression. -239 */ -240 private PropertyType gav = null; -241 -242 /** -243 * Get the value of Maven GAV. -244 * -245 * @return the value of gav -246 */ -247 public PropertyType getGav() { -248 return gav; -249 } -250 -251 /** -252 * Set the value of Maven GAV. -253 * -254 * @param gav new value of Maven gav -255 */ -256 public void setGav(PropertyType gav) { -257 this.gav = gav; -258 } -259 -260 /** -261 * Returns whether or not this suppression rule as GAV entries. -262 * -263 * @return whether or not this suppression rule as GAV entries -264 */ -265 public boolean hasGav() { -266 return gav != null; -267 } -268 -269 /** -270 * A flag indicating whether or not the suppression rule is a core/base rule that should not be included in the -271 * resulting report in the "suppressed" section. -272 */ -273 private boolean base; -274 -275 /** -276 * Get the value of base. -277 * -278 * @return the value of base -279 */ -280 public boolean isBase() { -281 return base; -282 } -283 -284 /** -285 * Set the value of base. -286 * -287 * @param base new value of base -288 */ -289 public void setBase(boolean base) { -290 this.base = base; -291 } -292 -293 /** -294 * Processes a given dependency to determine if any CPE, CVE, CWE, or CVSS scores should be suppressed. If any -295 * should be, they are removed from the dependency. -296 * -297 * @param dependency a project dependency to analyze -298 */ -299 public void process(Dependency dependency) { -300 if (filePath != null && !filePath.matches(dependency.getFilePath())) { -301 return; -302 } -303 if (sha1 != null && !sha1.equalsIgnoreCase(dependency.getSha1sum())) { -304 return; -305 } -306 if (gav != null) { -307 final Iterator<Identifier> itr = dependency.getIdentifiers().iterator(); -308 boolean gavFound = false; -309 while (itr.hasNext()) { -310 final Identifier i = itr.next(); -311 if (identifierMatches("maven", this.gav, i)) { -312 gavFound = true; -313 break; -314 } -315 } -316 if (!gavFound) { -317 return; -318 } -319 } -320 -321 if (this.hasCpe()) { -322 final Iterator<Identifier> itr = dependency.getIdentifiers().iterator(); -323 while (itr.hasNext()) { -324 final Identifier i = itr.next(); -325 for (PropertyType c : this.cpe) { -326 if (identifierMatches("cpe", c, i)) { -327 if (!isBase()) { -328 dependency.addSuppressedIdentifier(i); -329 } -330 itr.remove(); -331 break; -332 } -333 } -334 } -335 } -336 if (hasCve() || hasCwe() || hasCvssBelow()) { -337 final Iterator<Vulnerability> itr = dependency.getVulnerabilities().iterator(); -338 while (itr.hasNext()) { -339 boolean remove = false; -340 final Vulnerability v = itr.next(); -341 for (String entry : this.cve) { -342 if (entry.equalsIgnoreCase(v.getName())) { -343 remove = true; -344 break; -345 } -346 } -347 if (!remove) { -348 for (String entry : this.cwe) { -349 if (v.getCwe() != null) { -350 final String toMatch = String.format("CWE-%s ", entry); -351 final String toTest = v.getCwe().substring(0, toMatch.length()).toUpperCase(); -352 if (toTest.equals(toMatch)) { -353 remove = true; -354 break; -355 } -356 } -357 } -358 } -359 if (!remove) { -360 for (float cvss : this.cvssBelow) { -361 if (v.getCvssScore() < cvss) { -362 remove = true; -363 break; -364 } -365 } -366 } -367 if (remove) { -368 if (!isBase()) { -369 dependency.addSuppressedVulnerability(v); -370 } -371 itr.remove(); -372 } -373 } -374 } -375 } -376 -377 /** -378 * Identifies if the cpe specified by the cpe suppression rule does not specify a version. -379 * -380 * @param c a suppression rule identifier -381 * @return true if the property type does not specify a version; otherwise false -382 */ -383 boolean cpeHasNoVersion(PropertyType c) { -384 if (c.isRegex()) { -385 return false; -386 } -387 if (countCharacter(c.getValue(), ':') == 3) { -388 return true; -389 } -390 return false; -391 } -392 -393 /** -394 * Counts the number of occurrences of the character found within the string. -395 * -396 * @param str the string to check -397 * @param c the character to count -398 * @return the number of times the character is found in the string -399 */ -400 int countCharacter(String str, char c) { -401 int count = 0; -402 int pos = str.indexOf(c) + 1; -403 while (pos > 0) { -404 count += 1; -405 pos = str.indexOf(c, pos) + 1; -406 } -407 return count; -408 } -409 -410 /** -411 * Determines if the cpeEntry specified as a PropertyType matches the given Identifier. -412 * -413 * @param identifierType the type of identifier ("cpe", "maven", etc.) -414 * @param suppressionEntry a suppression rule entry -415 * @param identifier a CPE identifier to check -416 * @return true if the entry matches; otherwise false +23 import org.apache.commons.lang3.StringUtils; +24 import org.owasp.dependencycheck.dependency.Dependency; +25 import org.owasp.dependencycheck.dependency.Identifier; +26 import org.owasp.dependencycheck.dependency.Vulnerability; +27 +28 /** +29 * +30 * @author Jeremy Long +31 */ +32 public class SuppressionRule { +33 +34 /** +35 * The file path for the suppression. +36 */ +37 private PropertyType filePath; +38 +39 /** +40 * Get the value of filePath. +41 * +42 * @return the value of filePath +43 */ +44 public PropertyType getFilePath() { +45 return filePath; +46 } +47 +48 /** +49 * Set the value of filePath. +50 * +51 * @param filePath new value of filePath +52 */ +53 public void setFilePath(PropertyType filePath) { +54 this.filePath = filePath; +55 } +56 /** +57 * The sha1 hash. +58 */ +59 private String sha1; +60 +61 /** +62 * Get the value of sha1. +63 * +64 * @return the value of sha1 +65 */ +66 public String getSha1() { +67 return sha1; +68 } +69 +70 /** +71 * Set the value of sha1. +72 * +73 * @param sha1 new value of sha1 +74 */ +75 public void setSha1(String sha1) { +76 this.sha1 = sha1; +77 } +78 /** +79 * A list of CPEs to suppression +80 */ +81 private List<PropertyType> cpe = new ArrayList<PropertyType>(); +82 +83 /** +84 * Get the value of cpe. +85 * +86 * @return the value of cpe +87 */ +88 public List<PropertyType> getCpe() { +89 return cpe; +90 } +91 +92 /** +93 * Set the value of cpe. +94 * +95 * @param cpe new value of cpe +96 */ +97 public void setCpe(List<PropertyType> cpe) { +98 this.cpe = cpe; +99 } +100 +101 /** +102 * Adds the cpe to the cpe list. +103 * +104 * @param cpe the cpe to add +105 */ +106 public void addCpe(PropertyType cpe) { +107 this.cpe.add(cpe); +108 } +109 +110 /** +111 * Returns whether or not this suppression rule as CPE entries. +112 * +113 * @return whether or not this suppression rule as CPE entries +114 */ +115 public boolean hasCpe() { +116 return !cpe.isEmpty(); +117 } +118 /** +119 * The list of cvssBelow scores. +120 */ +121 private List<Float> cvssBelow = new ArrayList<Float>(); +122 +123 /** +124 * Get the value of cvssBelow. +125 * +126 * @return the value of cvssBelow +127 */ +128 public List<Float> getCvssBelow() { +129 return cvssBelow; +130 } +131 +132 /** +133 * Set the value of cvssBelow. +134 * +135 * @param cvssBelow new value of cvssBelow +136 */ +137 public void setCvssBelow(List<Float> cvssBelow) { +138 this.cvssBelow = cvssBelow; +139 } +140 +141 /** +142 * Adds the cvss to the cvssBelow list. +143 * +144 * @param cvss the cvss to add +145 */ +146 public void addCvssBelow(Float cvss) { +147 this.cvssBelow.add(cvss); +148 } +149 +150 /** +151 * Returns whether or not this suppression rule has cvss suppressions. +152 * +153 * @return whether or not this suppression rule has cvss suppressions +154 */ +155 public boolean hasCvssBelow() { +156 return !cvssBelow.isEmpty(); +157 } +158 /** +159 * The list of cwe entries to suppress. +160 */ +161 private List<String> cwe = new ArrayList<String>(); +162 +163 /** +164 * Get the value of cwe. +165 * +166 * @return the value of cwe +167 */ +168 public List<String> getCwe() { +169 return cwe; +170 } +171 +172 /** +173 * Set the value of cwe. +174 * +175 * @param cwe new value of cwe +176 */ +177 public void setCwe(List<String> cwe) { +178 this.cwe = cwe; +179 } +180 +181 /** +182 * Adds the cwe to the cwe list. +183 * +184 * @param cwe the cwe to add +185 */ +186 public void addCwe(String cwe) { +187 this.cwe.add(cwe); +188 } +189 +190 /** +191 * Returns whether this suppression rule has CWE entries. +192 * +193 * @return whether this suppression rule has CWE entries +194 */ +195 public boolean hasCwe() { +196 return !cwe.isEmpty(); +197 } +198 /** +199 * The list of cve entries to suppress. +200 */ +201 private List<String> cve = new ArrayList<String>(); +202 +203 /** +204 * Get the value of cve. +205 * +206 * @return the value of cve +207 */ +208 public List<String> getCve() { +209 return cve; +210 } +211 +212 /** +213 * Set the value of cve. +214 * +215 * @param cve new value of cve +216 */ +217 public void setCve(List<String> cve) { +218 this.cve = cve; +219 } +220 +221 /** +222 * Adds the cve to the cve list. +223 * +224 * @param cve the cve to add +225 */ +226 public void addCve(String cve) { +227 this.cve.add(cve); +228 } +229 +230 /** +231 * Returns whether this suppression rule has CVE entries. +232 * +233 * @return whether this suppression rule has CVE entries +234 */ +235 public boolean hasCve() { +236 return !cve.isEmpty(); +237 } +238 /** +239 * A Maven GAV to suppression. +240 */ +241 private PropertyType gav = null; +242 +243 /** +244 * Get the value of Maven GAV. +245 * +246 * @return the value of gav +247 */ +248 public PropertyType getGav() { +249 return gav; +250 } +251 +252 /** +253 * Set the value of Maven GAV. +254 * +255 * @param gav new value of Maven gav +256 */ +257 public void setGav(PropertyType gav) { +258 this.gav = gav; +259 } +260 +261 /** +262 * Returns whether or not this suppression rule as GAV entries. +263 * +264 * @return whether or not this suppression rule as GAV entries +265 */ +266 public boolean hasGav() { +267 return gav != null; +268 } +269 +270 /** +271 * A flag indicating whether or not the suppression rule is a core/base rule that should not be included in the +272 * resulting report in the "suppressed" section. +273 */ +274 private boolean base; +275 +276 /** +277 * Get the value of base. +278 * +279 * @return the value of base +280 */ +281 public boolean isBase() { +282 return base; +283 } +284 +285 /** +286 * Set the value of base. +287 * +288 * @param base new value of base +289 */ +290 public void setBase(boolean base) { +291 this.base = base; +292 } +293 +294 /** +295 * Processes a given dependency to determine if any CPE, CVE, CWE, or CVSS scores should be suppressed. If any +296 * should be, they are removed from the dependency. +297 * +298 * @param dependency a project dependency to analyze +299 */ +300 public void process(Dependency dependency) { +301 if (filePath != null && !filePath.matches(dependency.getFilePath())) { +302 return; +303 } +304 if (sha1 != null && !sha1.equalsIgnoreCase(dependency.getSha1sum())) { +305 return; +306 } +307 if (gav != null) { +308 final Iterator<Identifier> itr = dependency.getIdentifiers().iterator(); +309 boolean gavFound = false; +310 while (itr.hasNext()) { +311 final Identifier i = itr.next(); +312 if (identifierMatches("maven", this.gav, i)) { +313 gavFound = true; +314 break; +315 } +316 } +317 if (!gavFound) { +318 return; +319 } +320 } +321 +322 if (this.hasCpe()) { +323 final Iterator<Identifier> itr = dependency.getIdentifiers().iterator(); +324 while (itr.hasNext()) { +325 final Identifier i = itr.next(); +326 for (PropertyType c : this.cpe) { +327 if (identifierMatches("cpe", c, i)) { +328 if (!isBase()) { +329 dependency.addSuppressedIdentifier(i); +330 } +331 itr.remove(); +332 break; +333 } +334 } +335 } +336 } +337 if (hasCve() || hasCwe() || hasCvssBelow()) { +338 final Iterator<Vulnerability> itr = dependency.getVulnerabilities().iterator(); +339 while (itr.hasNext()) { +340 boolean remove = false; +341 final Vulnerability v = itr.next(); +342 for (String entry : this.cve) { +343 if (entry.equalsIgnoreCase(v.getName())) { +344 remove = true; +345 break; +346 } +347 } +348 if (!remove) { +349 for (String entry : this.cwe) { +350 if (v.getCwe() != null) { +351 final String toMatch = String.format("CWE-%s ", entry); +352 final String toTest = v.getCwe().substring(0, toMatch.length()).toUpperCase(); +353 if (toTest.equals(toMatch)) { +354 remove = true; +355 break; +356 } +357 } +358 } +359 } +360 if (!remove) { +361 for (float cvss : this.cvssBelow) { +362 if (v.getCvssScore() < cvss) { +363 remove = true; +364 break; +365 } +366 } +367 } +368 if (remove) { +369 if (!isBase()) { +370 dependency.addSuppressedVulnerability(v); +371 } +372 itr.remove(); +373 } +374 } +375 } +376 } +377 +378 /** +379 * Identifies if the cpe specified by the cpe suppression rule does not specify a version. +380 * +381 * @param c a suppression rule identifier +382 * @return true if the property type does not specify a version; otherwise false +383 */ +384 boolean cpeHasNoVersion(PropertyType c) { +385 return !c.isRegex() && StringUtils.countMatches(c.getValue(), ':') == 3; +386 } +387 +388 /** +389 * Determines if the cpeEntry specified as a PropertyType matches the given Identifier. +390 * +391 * @param identifierType the type of identifier ("cpe", "maven", etc.) +392 * @param suppressionEntry a suppression rule entry +393 * @param identifier a CPE identifier to check +394 * @return true if the entry matches; otherwise false +395 */ +396 boolean identifierMatches(String identifierType, PropertyType suppressionEntry, Identifier identifier) { +397 if (identifierType.equals(identifier.getType())) { +398 if (suppressionEntry.matches(identifier.getValue())) { +399 return true; +400 } else if ("cpe".equals(identifierType) && cpeHasNoVersion(suppressionEntry)) { +401 if (suppressionEntry.isCaseSensitive()) { +402 return identifier.getValue().startsWith(suppressionEntry.getValue()); +403 } else { +404 final String id = identifier.getValue().toLowerCase(); +405 final String check = suppressionEntry.getValue().toLowerCase(); +406 return id.startsWith(check); +407 } +408 } +409 } +410 return false; +411 } +412 +413 /** +414 * Standard toString implementation. +415 * +416 * @return a string representation of this object 417 */ -418 boolean identifierMatches(String identifierType, PropertyType suppressionEntry, Identifier identifier) { -419 if (identifierType.equals(identifier.getType())) { -420 if (suppressionEntry.matches(identifier.getValue())) { -421 return true; -422 } else if ("cpe".equals(identifierType) && cpeHasNoVersion(suppressionEntry)) { -423 if (suppressionEntry.isCaseSensitive()) { -424 return identifier.getValue().startsWith(suppressionEntry.getValue()); -425 } else { -426 final String id = identifier.getValue().toLowerCase(); -427 final String check = suppressionEntry.getValue().toLowerCase(); -428 return id.startsWith(check); -429 } -430 } -431 } -432 return false; -433 } -434 -435 /** -436 * Standard toString implementation. -437 * -438 * @return a string representation of this object -439 */ -440 @Override -441 public String toString() { -442 final StringBuilder sb = new StringBuilder(); -443 sb.append("SuppressionRule{"); -444 if (filePath != null) { -445 sb.append("filePath=").append(filePath).append(","); -446 } -447 if (sha1 != null) { -448 sb.append("sha1=").append(sha1).append(","); -449 } -450 if (gav != null) { -451 sb.append("gav=").append(gav).append(","); -452 } -453 if (cpe != null && !cpe.isEmpty()) { -454 sb.append("cpe={"); -455 for (PropertyType pt : cpe) { -456 sb.append(pt).append(","); -457 } -458 sb.append("}"); -459 } -460 if (cwe != null && !cwe.isEmpty()) { -461 sb.append("cwe={"); -462 for (String s : cwe) { -463 sb.append(s).append(","); -464 } -465 sb.append("}"); -466 } -467 if (cve != null && !cve.isEmpty()) { -468 sb.append("cve={"); -469 for (String s : cve) { -470 sb.append(s).append(","); -471 } -472 sb.append("}"); -473 } -474 if (cvssBelow != null && !cvssBelow.isEmpty()) { -475 sb.append("cvssBelow={"); -476 for (Float s : cvssBelow) { -477 sb.append(s).append(","); -478 } -479 sb.append("}"); -480 } -481 sb.append("}"); -482 return sb.toString(); -483 } -484 } +418 @Override +419 public String toString() { +420 final StringBuilder sb = new StringBuilder(); +421 sb.append("SuppressionRule{"); +422 if (filePath != null) { +423 sb.append("filePath=").append(filePath).append(','); +424 } +425 if (sha1 != null) { +426 sb.append("sha1=").append(sha1).append(','); +427 } +428 if (gav != null) { +429 sb.append("gav=").append(gav).append(','); +430 } +431 if (cpe != null && !cpe.isEmpty()) { +432 sb.append("cpe={"); +433 for (PropertyType pt : cpe) { +434 sb.append(pt).append(','); +435 } +436 sb.append('}'); +437 } +438 if (cwe != null && !cwe.isEmpty()) { +439 sb.append("cwe={"); +440 for (String s : cwe) { +441 sb.append(s).append(','); +442 } +443 sb.append('}'); +444 } +445 if (cve != null && !cve.isEmpty()) { +446 sb.append("cve={"); +447 for (String s : cve) { +448 sb.append(s).append(','); +449 } +450 sb.append('}'); +451 } +452 if (cvssBelow != null && !cvssBelow.isEmpty()) { +453 sb.append("cvssBelow={"); +454 for (Float s : cvssBelow) { +455 sb.append(s).append(','); +456 } +457 sb.append('}'); +458 } +459 sb.append('}'); +460 return sb.toString(); +461 } +462 }
        diff --git a/xref/org/owasp/dependencycheck/suppression/package-frame.html b/xref/org/owasp/dependencycheck/suppression/package-frame.html index 879acf47b..e7bd2574a 100644 --- a/xref/org/owasp/dependencycheck/suppression/package-frame.html +++ b/xref/org/owasp/dependencycheck/suppression/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.suppression + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.suppression diff --git a/xref/org/owasp/dependencycheck/suppression/package-summary.html b/xref/org/owasp/dependencycheck/suppression/package-summary.html index a97bab362..5b22c967b 100644 --- a/xref/org/owasp/dependencycheck/suppression/package-summary.html +++ b/xref/org/owasp/dependencycheck/suppression/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.suppression + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.suppression diff --git a/xref/org/owasp/dependencycheck/taskdefs/Check.html b/xref/org/owasp/dependencycheck/taskdefs/Check.html index 9ed1ed535..6de31e890 100644 --- a/xref/org/owasp/dependencycheck/taskdefs/Check.html +++ b/xref/org/owasp/dependencycheck/taskdefs/Check.html @@ -253,14 +253,14 @@ 245 * Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not recommended that this be turned to false. Default 246 * is true. 247 */ -248 private boolean autoUpdate = true; +248 private Boolean autoUpdate; 249 250 /** 251 * Get the value of autoUpdate. 252 * 253 * @return the value of autoUpdate 254 */ -255 public boolean isAutoUpdate() { +255 public Boolean isAutoUpdate() { 256 return autoUpdate; 257 } 258 @@ -269,712 +269,709 @@ 261 * 262 * @param autoUpdate new value of autoUpdate 263 */ -264 public void setAutoUpdate(boolean autoUpdate) { +264 public void setAutoUpdate(Boolean autoUpdate) { 265 this.autoUpdate = autoUpdate; 266 } 267 /** 268 * Whether only the update phase should be executed. -269 */ -270 private boolean updateOnly = false; -271 -272 /** -273 * Get the value of updateOnly. -274 * -275 * @return the value of updateOnly -276 */ -277 public boolean isUpdateOnly() { -278 return updateOnly; -279 } -280 -281 /** -282 * Set the value of updateOnly. -283 * -284 * @param updateOnly new value of updateOnly -285 */ -286 public void setUpdateOnly(boolean updateOnly) { -287 this.updateOnly = updateOnly; -288 } -289 -290 /** -291 * The report format to be generated (HTML, XML, VULN, ALL). Default is HTML. -292 */ -293 private String reportFormat = "HTML"; -294 -295 /** -296 * Get the value of reportFormat. -297 * -298 * @return the value of reportFormat +269 * +270 * @deprecated Use the update task instead +271 */ +272 @Deprecated +273 private boolean updateOnly = false; +274 +275 /** +276 * Get the value of updateOnly. +277 * +278 * @return the value of updateOnly +279 * @deprecated Use the update task instead +280 */ +281 @Deprecated +282 public boolean isUpdateOnly() { +283 return updateOnly; +284 } +285 +286 /** +287 * Set the value of updateOnly. +288 * +289 * @param updateOnly new value of updateOnly +290 * @deprecated Use the update task instead +291 */ +292 @Deprecated +293 public void setUpdateOnly(boolean updateOnly) { +294 this.updateOnly = updateOnly; +295 } +296 +297 /** +298 * The report format to be generated (HTML, XML, VULN, ALL). Default is HTML. 299 */ -300 public String getReportFormat() { -301 return reportFormat; -302 } -303 -304 /** -305 * Set the value of reportFormat. -306 * -307 * @param reportFormat new value of reportFormat -308 */ -309 public void setReportFormat(ReportFormats reportFormat) { -310 this.reportFormat = reportFormat.getValue(); -311 } -312 /** -313 * The path to the suppression file. -314 */ -315 private String suppressionFile; -316 -317 /** -318 * Get the value of suppressionFile. -319 * -320 * @return the value of suppressionFile +300 private String reportFormat = "HTML"; +301 +302 /** +303 * Get the value of reportFormat. +304 * +305 * @return the value of reportFormat +306 */ +307 public String getReportFormat() { +308 return reportFormat; +309 } +310 +311 /** +312 * Set the value of reportFormat. +313 * +314 * @param reportFormat new value of reportFormat +315 */ +316 public void setReportFormat(ReportFormats reportFormat) { +317 this.reportFormat = reportFormat.getValue(); +318 } +319 /** +320 * The path to the suppression file. 321 */ -322 public String getSuppressionFile() { -323 return suppressionFile; -324 } -325 -326 /** -327 * Set the value of suppressionFile. -328 * -329 * @param suppressionFile new value of suppressionFile -330 */ -331 public void setSuppressionFile(String suppressionFile) { -332 this.suppressionFile = suppressionFile; -333 } -334 /** -335 * flag indicating whether or not to show a summary of findings. -336 */ -337 private boolean showSummary = true; -338 -339 /** -340 * Get the value of showSummary. -341 * -342 * @return the value of showSummary +322 private String suppressionFile; +323 +324 /** +325 * Get the value of suppressionFile. +326 * +327 * @return the value of suppressionFile +328 */ +329 public String getSuppressionFile() { +330 return suppressionFile; +331 } +332 +333 /** +334 * Set the value of suppressionFile. +335 * +336 * @param suppressionFile new value of suppressionFile +337 */ +338 public void setSuppressionFile(String suppressionFile) { +339 this.suppressionFile = suppressionFile; +340 } +341 /** +342 * flag indicating whether or not to show a summary of findings. 343 */ -344 public boolean isShowSummary() { -345 return showSummary; -346 } -347 -348 /** -349 * Set the value of showSummary. -350 * -351 * @param showSummary new value of showSummary -352 */ -353 public void setShowSummary(boolean showSummary) { -354 this.showSummary = showSummary; -355 } -356 -357 /** -358 * Whether or not the Jar Analyzer is enabled. +344 private boolean showSummary = true; +345 +346 /** +347 * Get the value of showSummary. +348 * +349 * @return the value of showSummary +350 */ +351 public boolean isShowSummary() { +352 return showSummary; +353 } +354 +355 /** +356 * Set the value of showSummary. +357 * +358 * @param showSummary new value of showSummary 359 */ -360 private boolean jarAnalyzerEnabled = true; -361 -362 /** -363 * Returns whether or not the analyzer is enabled. -364 * -365 * @return true if the analyzer is enabled +360 public void setShowSummary(boolean showSummary) { +361 this.showSummary = showSummary; +362 } +363 +364 /** +365 * Whether or not the Jar Analyzer is enabled. 366 */ -367 public boolean isJarAnalyzerEnabled() { -368 return jarAnalyzerEnabled; -369 } -370 -371 /** -372 * Sets whether or not the analyzer is enabled. -373 * -374 * @param jarAnalyzerEnabled the value of the new setting -375 */ -376 public void setJarAnalyzerEnabled(boolean jarAnalyzerEnabled) { -377 this.jarAnalyzerEnabled = jarAnalyzerEnabled; -378 } -379 /** -380 * Whether or not the Archive Analyzer is enabled. -381 */ -382 private boolean archiveAnalyzerEnabled = true; -383 -384 /** -385 * Returns whether or not the analyzer is enabled. -386 * -387 * @return true if the analyzer is enabled +367 private Boolean jarAnalyzerEnabled; +368 +369 /** +370 * Returns whether or not the analyzer is enabled. +371 * +372 * @return true if the analyzer is enabled +373 */ +374 public Boolean isJarAnalyzerEnabled() { +375 return jarAnalyzerEnabled; +376 } +377 +378 /** +379 * Sets whether or not the analyzer is enabled. +380 * +381 * @param jarAnalyzerEnabled the value of the new setting +382 */ +383 public void setJarAnalyzerEnabled(Boolean jarAnalyzerEnabled) { +384 this.jarAnalyzerEnabled = jarAnalyzerEnabled; +385 } +386 /** +387 * Whether or not the Archive Analyzer is enabled. 388 */ -389 public boolean isArchiveAnalyzerEnabled() { -390 return archiveAnalyzerEnabled; -391 } -392 /** -393 * Whether or not the .NET Assembly Analyzer is enabled. -394 */ -395 private boolean assemblyAnalyzerEnabled = true; -396 -397 /** -398 * Sets whether or not the analyzer is enabled. -399 * -400 * @param archiveAnalyzerEnabled the value of the new setting +389 private Boolean archiveAnalyzerEnabled; +390 +391 /** +392 * Returns whether or not the analyzer is enabled. +393 * +394 * @return true if the analyzer is enabled +395 */ +396 public Boolean isArchiveAnalyzerEnabled() { +397 return archiveAnalyzerEnabled; +398 } +399 /** +400 * Whether or not the .NET Assembly Analyzer is enabled. 401 */ -402 public void setArchiveAnalyzerEnabled(boolean archiveAnalyzerEnabled) { -403 this.archiveAnalyzerEnabled = archiveAnalyzerEnabled; -404 } -405 -406 /** -407 * Returns whether or not the analyzer is enabled. -408 * -409 * @return true if the analyzer is enabled -410 */ -411 public boolean isAssemblyAnalyzerEnabled() { -412 return assemblyAnalyzerEnabled; -413 } -414 -415 /** -416 * Sets whether or not the analyzer is enabled. -417 * -418 * @param assemblyAnalyzerEnabled the value of the new setting -419 */ -420 public void setAssemblyAnalyzerEnabled(boolean assemblyAnalyzerEnabled) { -421 this.assemblyAnalyzerEnabled = assemblyAnalyzerEnabled; -422 } -423 /** -424 * Whether or not the .NET Nuspec Analyzer is enabled. -425 */ -426 private boolean nuspecAnalyzerEnabled = true; -427 -428 /** -429 * Returns whether or not the analyzer is enabled. -430 * -431 * @return true if the analyzer is enabled +402 private Boolean assemblyAnalyzerEnabled; +403 +404 /** +405 * Sets whether or not the analyzer is enabled. +406 * +407 * @param archiveAnalyzerEnabled the value of the new setting +408 */ +409 public void setArchiveAnalyzerEnabled(Boolean archiveAnalyzerEnabled) { +410 this.archiveAnalyzerEnabled = archiveAnalyzerEnabled; +411 } +412 +413 /** +414 * Returns whether or not the analyzer is enabled. +415 * +416 * @return true if the analyzer is enabled +417 */ +418 public Boolean isAssemblyAnalyzerEnabled() { +419 return assemblyAnalyzerEnabled; +420 } +421 +422 /** +423 * Sets whether or not the analyzer is enabled. +424 * +425 * @param assemblyAnalyzerEnabled the value of the new setting +426 */ +427 public void setAssemblyAnalyzerEnabled(Boolean assemblyAnalyzerEnabled) { +428 this.assemblyAnalyzerEnabled = assemblyAnalyzerEnabled; +429 } +430 /** +431 * Whether or not the .NET Nuspec Analyzer is enabled. 432 */ -433 public boolean isNuspecAnalyzerEnabled() { -434 return nuspecAnalyzerEnabled; -435 } -436 -437 /** -438 * Sets whether or not the analyzer is enabled. -439 * -440 * @param nuspecAnalyzerEnabled the value of the new setting -441 */ -442 public void setNuspecAnalyzerEnabled(boolean nuspecAnalyzerEnabled) { -443 this.nuspecAnalyzerEnabled = nuspecAnalyzerEnabled; -444 } -445 /** -446 * Whether or not the PHP Composer Analyzer is enabled. -447 */ -448 private boolean composerAnalyzerEnabled = true; -449 -450 /** -451 * Get the value of composerAnalyzerEnabled. -452 * -453 * @return the value of composerAnalyzerEnabled +433 private Boolean nuspecAnalyzerEnabled; +434 +435 /** +436 * Returns whether or not the analyzer is enabled. +437 * +438 * @return true if the analyzer is enabled +439 */ +440 public Boolean isNuspecAnalyzerEnabled() { +441 return nuspecAnalyzerEnabled; +442 } +443 +444 /** +445 * Sets whether or not the analyzer is enabled. +446 * +447 * @param nuspecAnalyzerEnabled the value of the new setting +448 */ +449 public void setNuspecAnalyzerEnabled(Boolean nuspecAnalyzerEnabled) { +450 this.nuspecAnalyzerEnabled = nuspecAnalyzerEnabled; +451 } +452 /** +453 * Whether or not the PHP Composer Analyzer is enabled. 454 */ -455 public boolean isComposerAnalyzerEnabled() { -456 return composerAnalyzerEnabled; -457 } -458 -459 /** -460 * Set the value of composerAnalyzerEnabled. -461 * -462 * @param composerAnalyzerEnabled new value of composerAnalyzerEnabled -463 */ -464 public void setComposerAnalyzerEnabled(boolean composerAnalyzerEnabled) { -465 this.composerAnalyzerEnabled = composerAnalyzerEnabled; -466 } -467 /** -468 * Whether the autoconf analyzer should be enabled. -469 */ -470 private boolean autoconfAnalyzerEnabled = true; -471 -472 /** -473 * Get the value of autoconfAnalyzerEnabled. -474 * -475 * @return the value of autoconfAnalyzerEnabled +455 private Boolean composerAnalyzerEnabled; +456 +457 /** +458 * Get the value of composerAnalyzerEnabled. +459 * +460 * @return the value of composerAnalyzerEnabled +461 */ +462 public Boolean isComposerAnalyzerEnabled() { +463 return composerAnalyzerEnabled; +464 } +465 +466 /** +467 * Set the value of composerAnalyzerEnabled. +468 * +469 * @param composerAnalyzerEnabled new value of composerAnalyzerEnabled +470 */ +471 public void setComposerAnalyzerEnabled(Boolean composerAnalyzerEnabled) { +472 this.composerAnalyzerEnabled = composerAnalyzerEnabled; +473 } +474 /** +475 * Whether the autoconf analyzer should be enabled. 476 */ -477 public boolean isAutoconfAnalyzerEnabled() { -478 return autoconfAnalyzerEnabled; -479 } -480 -481 /** -482 * Set the value of autoconfAnalyzerEnabled. -483 * -484 * @param autoconfAnalyzerEnabled new value of autoconfAnalyzerEnabled -485 */ -486 public void setAutoconfAnalyzerEnabled(boolean autoconfAnalyzerEnabled) { -487 this.autoconfAnalyzerEnabled = autoconfAnalyzerEnabled; -488 } -489 /** -490 * Whether the CMake analyzer should be enabled. -491 */ -492 private boolean cmakeAnalyzerEnabled = true; -493 -494 /** -495 * Get the value of cmakeAnalyzerEnabled. -496 * -497 * @return the value of cmakeAnalyzerEnabled +477 private Boolean autoconfAnalyzerEnabled; +478 +479 /** +480 * Get the value of autoconfAnalyzerEnabled. +481 * +482 * @return the value of autoconfAnalyzerEnabled +483 */ +484 public Boolean isAutoconfAnalyzerEnabled() { +485 return autoconfAnalyzerEnabled; +486 } +487 +488 /** +489 * Set the value of autoconfAnalyzerEnabled. +490 * +491 * @param autoconfAnalyzerEnabled new value of autoconfAnalyzerEnabled +492 */ +493 public void setAutoconfAnalyzerEnabled(Boolean autoconfAnalyzerEnabled) { +494 this.autoconfAnalyzerEnabled = autoconfAnalyzerEnabled; +495 } +496 /** +497 * Whether the CMake analyzer should be enabled. 498 */ -499 public boolean isCMakeAnalyzerEnabled() { -500 return cmakeAnalyzerEnabled; -501 } -502 -503 /** -504 * Set the value of cmakeAnalyzerEnabled. -505 * -506 * @param cmakeAnalyzerEnabled new value of cmakeAnalyzerEnabled -507 */ -508 public void setCMakeAnalyzerEnabled(boolean cmakeAnalyzerEnabled) { -509 this.cmakeAnalyzerEnabled = cmakeAnalyzerEnabled; -510 } -511 /** -512 * Whether or not the openssl analyzer is enabled. -513 */ -514 private boolean opensslAnalyzerEnabled = true; -515 -516 /** -517 * Get the value of opensslAnalyzerEnabled. -518 * -519 * @return the value of opensslAnalyzerEnabled +499 private Boolean cmakeAnalyzerEnabled; +500 +501 /** +502 * Get the value of cmakeAnalyzerEnabled. +503 * +504 * @return the value of cmakeAnalyzerEnabled +505 */ +506 public Boolean isCMakeAnalyzerEnabled() { +507 return cmakeAnalyzerEnabled; +508 } +509 +510 /** +511 * Set the value of cmakeAnalyzerEnabled. +512 * +513 * @param cmakeAnalyzerEnabled new value of cmakeAnalyzerEnabled +514 */ +515 public void setCMakeAnalyzerEnabled(Boolean cmakeAnalyzerEnabled) { +516 this.cmakeAnalyzerEnabled = cmakeAnalyzerEnabled; +517 } +518 /** +519 * Whether or not the openssl analyzer is enabled. 520 */ -521 public boolean isOpensslAnalyzerEnabled() { -522 return opensslAnalyzerEnabled; -523 } -524 -525 /** -526 * Set the value of opensslAnalyzerEnabled. -527 * -528 * @param opensslAnalyzerEnabled new value of opensslAnalyzerEnabled -529 */ -530 public void setOpensslAnalyzerEnabled(boolean opensslAnalyzerEnabled) { -531 this.opensslAnalyzerEnabled = opensslAnalyzerEnabled; -532 } -533 /** -534 * Whether or not the Node.js Analyzer is enabled. -535 */ -536 private boolean nodeAnalyzerEnabled = true; -537 -538 /** -539 * Get the value of nodeAnalyzerEnabled. -540 * -541 * @return the value of nodeAnalyzerEnabled +521 private Boolean opensslAnalyzerEnabled; +522 +523 /** +524 * Get the value of opensslAnalyzerEnabled. +525 * +526 * @return the value of opensslAnalyzerEnabled +527 */ +528 public Boolean isOpensslAnalyzerEnabled() { +529 return opensslAnalyzerEnabled; +530 } +531 +532 /** +533 * Set the value of opensslAnalyzerEnabled. +534 * +535 * @param opensslAnalyzerEnabled new value of opensslAnalyzerEnabled +536 */ +537 public void setOpensslAnalyzerEnabled(Boolean opensslAnalyzerEnabled) { +538 this.opensslAnalyzerEnabled = opensslAnalyzerEnabled; +539 } +540 /** +541 * Whether or not the Node.js Analyzer is enabled. 542 */ -543 public boolean isNodeAnalyzerEnabled() { -544 return nodeAnalyzerEnabled; -545 } -546 -547 /** -548 * Set the value of nodeAnalyzerEnabled. -549 * -550 * @param nodeAnalyzerEnabled new value of nodeAnalyzerEnabled -551 */ -552 public void setNodeAnalyzerEnabled(boolean nodeAnalyzerEnabled) { -553 this.nodeAnalyzerEnabled = nodeAnalyzerEnabled; -554 } -555 /** -556 * Whether the ruby gemspec analyzer should be enabled. -557 */ -558 private boolean rubygemsAnalyzerEnabled = true; -559 -560 /** -561 * Get the value of rubygemsAnalyzerEnabled. -562 * -563 * @return the value of rubygemsAnalyzerEnabled +543 private Boolean nodeAnalyzerEnabled; +544 +545 /** +546 * Get the value of nodeAnalyzerEnabled. +547 * +548 * @return the value of nodeAnalyzerEnabled +549 */ +550 public Boolean isNodeAnalyzerEnabled() { +551 return nodeAnalyzerEnabled; +552 } +553 +554 /** +555 * Set the value of nodeAnalyzerEnabled. +556 * +557 * @param nodeAnalyzerEnabled new value of nodeAnalyzerEnabled +558 */ +559 public void setNodeAnalyzerEnabled(Boolean nodeAnalyzerEnabled) { +560 this.nodeAnalyzerEnabled = nodeAnalyzerEnabled; +561 } +562 /** +563 * Whether the ruby gemspec analyzer should be enabled. 564 */ -565 public boolean isRubygemsAnalyzerEnabled() { -566 return rubygemsAnalyzerEnabled; -567 } -568 -569 /** -570 * Set the value of rubygemsAnalyzerEnabled. -571 * -572 * @param rubygemsAnalyzerEnabled new value of rubygemsAnalyzerEnabled -573 */ -574 public void setRubygemsAnalyzerEnabled(boolean rubygemsAnalyzerEnabled) { -575 this.rubygemsAnalyzerEnabled = rubygemsAnalyzerEnabled; -576 } -577 /** -578 * Whether the python package analyzer should be enabled. -579 */ -580 private boolean pyPackageAnalyzerEnabled = true; -581 -582 /** -583 * Get the value of pyPackageAnalyzerEnabled. -584 * -585 * @return the value of pyPackageAnalyzerEnabled +565 private Boolean rubygemsAnalyzerEnabled; +566 +567 /** +568 * Get the value of rubygemsAnalyzerEnabled. +569 * +570 * @return the value of rubygemsAnalyzerEnabled +571 */ +572 public Boolean isRubygemsAnalyzerEnabled() { +573 return rubygemsAnalyzerEnabled; +574 } +575 +576 /** +577 * Set the value of rubygemsAnalyzerEnabled. +578 * +579 * @param rubygemsAnalyzerEnabled new value of rubygemsAnalyzerEnabled +580 */ +581 public void setRubygemsAnalyzerEnabled(Boolean rubygemsAnalyzerEnabled) { +582 this.rubygemsAnalyzerEnabled = rubygemsAnalyzerEnabled; +583 } +584 /** +585 * Whether the python package analyzer should be enabled. 586 */ -587 public boolean isPyPackageAnalyzerEnabled() { -588 return pyPackageAnalyzerEnabled; -589 } -590 -591 /** -592 * Set the value of pyPackageAnalyzerEnabled. -593 * -594 * @param pyPackageAnalyzerEnabled new value of pyPackageAnalyzerEnabled -595 */ -596 public void setPyPackageAnalyzerEnabled(boolean pyPackageAnalyzerEnabled) { -597 this.pyPackageAnalyzerEnabled = pyPackageAnalyzerEnabled; -598 } -599 -600 /** -601 * Whether the python distribution analyzer should be enabled. +587 private Boolean pyPackageAnalyzerEnabled; +588 +589 /** +590 * Get the value of pyPackageAnalyzerEnabled. +591 * +592 * @return the value of pyPackageAnalyzerEnabled +593 */ +594 public Boolean isPyPackageAnalyzerEnabled() { +595 return pyPackageAnalyzerEnabled; +596 } +597 +598 /** +599 * Set the value of pyPackageAnalyzerEnabled. +600 * +601 * @param pyPackageAnalyzerEnabled new value of pyPackageAnalyzerEnabled 602 */ -603 private boolean pyDistributionAnalyzerEnabled = true; -604 -605 /** -606 * Get the value of pyDistributionAnalyzerEnabled. -607 * -608 * @return the value of pyDistributionAnalyzerEnabled +603 public void setPyPackageAnalyzerEnabled(Boolean pyPackageAnalyzerEnabled) { +604 this.pyPackageAnalyzerEnabled = pyPackageAnalyzerEnabled; +605 } +606 +607 /** +608 * Whether the python distribution analyzer should be enabled. 609 */ -610 public boolean isPyDistributionAnalyzerEnabled() { -611 return pyDistributionAnalyzerEnabled; -612 } -613 -614 /** -615 * Set the value of pyDistributionAnalyzerEnabled. -616 * -617 * @param pyDistributionAnalyzerEnabled new value of pyDistributionAnalyzerEnabled -618 */ -619 public void setPyDistributionAnalyzerEnabled(boolean pyDistributionAnalyzerEnabled) { -620 this.pyDistributionAnalyzerEnabled = pyDistributionAnalyzerEnabled; -621 } -622 -623 /** -624 * Whether or not the central analyzer is enabled. +610 private Boolean pyDistributionAnalyzerEnabled; +611 +612 /** +613 * Get the value of pyDistributionAnalyzerEnabled. +614 * +615 * @return the value of pyDistributionAnalyzerEnabled +616 */ +617 public Boolean isPyDistributionAnalyzerEnabled() { +618 return pyDistributionAnalyzerEnabled; +619 } +620 +621 /** +622 * Set the value of pyDistributionAnalyzerEnabled. +623 * +624 * @param pyDistributionAnalyzerEnabled new value of pyDistributionAnalyzerEnabled 625 */ -626 private boolean centralAnalyzerEnabled = false; -627 -628 /** -629 * Get the value of centralAnalyzerEnabled. -630 * -631 * @return the value of centralAnalyzerEnabled +626 public void setPyDistributionAnalyzerEnabled(Boolean pyDistributionAnalyzerEnabled) { +627 this.pyDistributionAnalyzerEnabled = pyDistributionAnalyzerEnabled; +628 } +629 +630 /** +631 * Whether or not the central analyzer is enabled. 632 */ -633 public boolean isCentralAnalyzerEnabled() { -634 return centralAnalyzerEnabled; -635 } -636 -637 /** -638 * Set the value of centralAnalyzerEnabled. -639 * -640 * @param centralAnalyzerEnabled new value of centralAnalyzerEnabled -641 */ -642 public void setCentralAnalyzerEnabled(boolean centralAnalyzerEnabled) { -643 this.centralAnalyzerEnabled = centralAnalyzerEnabled; -644 } -645 -646 /** -647 * Whether or not the nexus analyzer is enabled. +633 private Boolean centralAnalyzerEnabled; +634 +635 /** +636 * Get the value of centralAnalyzerEnabled. +637 * +638 * @return the value of centralAnalyzerEnabled +639 */ +640 public Boolean isCentralAnalyzerEnabled() { +641 return centralAnalyzerEnabled; +642 } +643 +644 /** +645 * Set the value of centralAnalyzerEnabled. +646 * +647 * @param centralAnalyzerEnabled new value of centralAnalyzerEnabled 648 */ -649 private boolean nexusAnalyzerEnabled = true; -650 -651 /** -652 * Get the value of nexusAnalyzerEnabled. -653 * -654 * @return the value of nexusAnalyzerEnabled +649 public void setCentralAnalyzerEnabled(Boolean centralAnalyzerEnabled) { +650 this.centralAnalyzerEnabled = centralAnalyzerEnabled; +651 } +652 +653 /** +654 * Whether or not the nexus analyzer is enabled. 655 */ -656 public boolean isNexusAnalyzerEnabled() { -657 return nexusAnalyzerEnabled; -658 } -659 -660 /** -661 * Set the value of nexusAnalyzerEnabled. -662 * -663 * @param nexusAnalyzerEnabled new value of nexusAnalyzerEnabled -664 */ -665 public void setNexusAnalyzerEnabled(boolean nexusAnalyzerEnabled) { -666 this.nexusAnalyzerEnabled = nexusAnalyzerEnabled; -667 } -668 -669 /** -670 * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local). +656 private Boolean nexusAnalyzerEnabled; +657 +658 /** +659 * Get the value of nexusAnalyzerEnabled. +660 * +661 * @return the value of nexusAnalyzerEnabled +662 */ +663 public Boolean isNexusAnalyzerEnabled() { +664 return nexusAnalyzerEnabled; +665 } +666 +667 /** +668 * Set the value of nexusAnalyzerEnabled. +669 * +670 * @param nexusAnalyzerEnabled new value of nexusAnalyzerEnabled 671 */ -672 private String nexusUrl; -673 -674 /** -675 * Get the value of nexusUrl. -676 * -677 * @return the value of nexusUrl +672 public void setNexusAnalyzerEnabled(Boolean nexusAnalyzerEnabled) { +673 this.nexusAnalyzerEnabled = nexusAnalyzerEnabled; +674 } +675 +676 /** +677 * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local). 678 */ -679 public String getNexusUrl() { -680 return nexusUrl; -681 } -682 -683 /** -684 * Set the value of nexusUrl. -685 * -686 * @param nexusUrl new value of nexusUrl -687 */ -688 public void setNexusUrl(String nexusUrl) { -689 this.nexusUrl = nexusUrl; -690 } -691 /** -692 * Whether or not the defined proxy should be used when connecting to Nexus. -693 */ -694 private boolean nexusUsesProxy = true; -695 -696 /** -697 * Get the value of nexusUsesProxy. -698 * -699 * @return the value of nexusUsesProxy +679 private String nexusUrl; +680 +681 /** +682 * Get the value of nexusUrl. +683 * +684 * @return the value of nexusUrl +685 */ +686 public String getNexusUrl() { +687 return nexusUrl; +688 } +689 +690 /** +691 * Set the value of nexusUrl. +692 * +693 * @param nexusUrl new value of nexusUrl +694 */ +695 public void setNexusUrl(String nexusUrl) { +696 this.nexusUrl = nexusUrl; +697 } +698 /** +699 * Whether or not the defined proxy should be used when connecting to Nexus. 700 */ -701 public boolean isNexusUsesProxy() { -702 return nexusUsesProxy; -703 } -704 -705 /** -706 * Set the value of nexusUsesProxy. -707 * -708 * @param nexusUsesProxy new value of nexusUsesProxy -709 */ -710 public void setNexusUsesProxy(boolean nexusUsesProxy) { -711 this.nexusUsesProxy = nexusUsesProxy; -712 } -713 -714 /** -715 * Additional ZIP File extensions to add analyze. This should be a comma-separated list of file extensions to treat like ZIP -716 * files. -717 */ -718 private String zipExtensions; -719 -720 /** -721 * Get the value of zipExtensions. -722 * -723 * @return the value of zipExtensions +701 private Boolean nexusUsesProxy; +702 +703 /** +704 * Get the value of nexusUsesProxy. +705 * +706 * @return the value of nexusUsesProxy +707 */ +708 public Boolean isNexusUsesProxy() { +709 return nexusUsesProxy; +710 } +711 +712 /** +713 * Set the value of nexusUsesProxy. +714 * +715 * @param nexusUsesProxy new value of nexusUsesProxy +716 */ +717 public void setNexusUsesProxy(Boolean nexusUsesProxy) { +718 this.nexusUsesProxy = nexusUsesProxy; +719 } +720 +721 /** +722 * Additional ZIP File extensions to add analyze. This should be a comma-separated list of file extensions to treat like ZIP +723 * files. 724 */ -725 public String getZipExtensions() { -726 return zipExtensions; -727 } -728 -729 /** -730 * Set the value of zipExtensions. -731 * -732 * @param zipExtensions new value of zipExtensions -733 */ -734 public void setZipExtensions(String zipExtensions) { -735 this.zipExtensions = zipExtensions; -736 } -737 -738 /** -739 * The path to Mono for .NET assembly analysis on non-windows systems. +725 private String zipExtensions; +726 +727 /** +728 * Get the value of zipExtensions. +729 * +730 * @return the value of zipExtensions +731 */ +732 public String getZipExtensions() { +733 return zipExtensions; +734 } +735 +736 /** +737 * Set the value of zipExtensions. +738 * +739 * @param zipExtensions new value of zipExtensions 740 */ -741 private String pathToMono; -742 -743 /** -744 * Get the value of pathToMono. -745 * -746 * @return the value of pathToMono +741 public void setZipExtensions(String zipExtensions) { +742 this.zipExtensions = zipExtensions; +743 } +744 +745 /** +746 * The path to Mono for .NET assembly analysis on non-windows systems. 747 */ -748 public String getPathToMono() { -749 return pathToMono; -750 } -751 -752 /** -753 * Set the value of pathToMono. -754 * -755 * @param pathToMono new value of pathToMono -756 */ -757 public void setPathToMono(String pathToMono) { -758 this.pathToMono = pathToMono; -759 } -760 -761 @Override -762 public void execute() throws BuildException { -763 dealWithReferences(); -764 validateConfiguration(); -765 populateSettings(); -766 Engine engine = null; -767 try { -768 engine = new Engine(Check.class.getClassLoader()); -769 if (isUpdateOnly()) { -770 log("Deprecated 'UpdateOnly' property set; please use the UpdateTask instead", Project.MSG_WARN); -771 engine.doUpdates(); -772 } else { -773 try { -774 for (Resource resource : path) { -775 final FileProvider provider = resource.as(FileProvider.class); -776 if (provider != null) { -777 final File file = provider.getFile(); -778 if (file != null && file.exists()) { -779 engine.scan(file); -780 } -781 } -782 } -783 -784 engine.analyzeDependencies(); -785 DatabaseProperties prop = null; -786 CveDB cve = null; -787 try { -788 cve = new CveDB(); -789 cve.open(); -790 prop = cve.getDatabaseProperties(); -791 } catch (DatabaseException ex) { -792 log("Unable to retrieve DB Properties", ex, Project.MSG_DEBUG); -793 } finally { -794 if (cve != null) { -795 cve.close(); -796 } -797 } -798 final ReportGenerator reporter = new ReportGenerator(getProjectName(), engine.getDependencies(), engine.getAnalyzers(), prop); -799 reporter.generateReports(reportOutputDirectory, reportFormat); -800 -801 if (this.failBuildOnCVSS <= 10) { -802 checkForFailure(engine.getDependencies()); -803 } -804 if (this.showSummary) { -805 showSummary(engine.getDependencies()); -806 } -807 } catch (IOException ex) { -808 log("Unable to generate dependency-check report", ex, Project.MSG_DEBUG); -809 throw new BuildException("Unable to generate dependency-check report", ex); -810 } catch (Exception ex) { -811 log("An exception occurred; unable to continue task", ex, Project.MSG_DEBUG); -812 throw new BuildException("An exception occurred; unable to continue task", ex); -813 } -814 } -815 } catch (DatabaseException ex) { -816 log("Unable to connect to the dependency-check database; analysis has stopped", ex, Project.MSG_ERR); -817 } finally { -818 Settings.cleanup(true); -819 if (engine != null) { -820 engine.cleanup(); +748 private String pathToMono; +749 +750 /** +751 * Get the value of pathToMono. +752 * +753 * @return the value of pathToMono +754 */ +755 public String getPathToMono() { +756 return pathToMono; +757 } +758 +759 /** +760 * Set the value of pathToMono. +761 * +762 * @param pathToMono new value of pathToMono +763 */ +764 public void setPathToMono(String pathToMono) { +765 this.pathToMono = pathToMono; +766 } +767 +768 @Override +769 public void execute() throws BuildException { +770 dealWithReferences(); +771 validateConfiguration(); +772 populateSettings(); +773 Engine engine = null; +774 try { +775 engine = new Engine(Check.class.getClassLoader()); +776 if (isUpdateOnly()) { +777 log("Deprecated 'UpdateOnly' property set; please use the UpdateTask instead", Project.MSG_WARN); +778 engine.doUpdates(); +779 } else { +780 try { +781 for (Resource resource : path) { +782 final FileProvider provider = resource.as(FileProvider.class); +783 if (provider != null) { +784 final File file = provider.getFile(); +785 if (file != null && file.exists()) { +786 engine.scan(file); +787 } +788 } +789 } +790 +791 engine.analyzeDependencies(); +792 DatabaseProperties prop = null; +793 CveDB cve = null; +794 try { +795 cve = new CveDB(); +796 cve.open(); +797 prop = cve.getDatabaseProperties(); +798 } catch (DatabaseException ex) { +799 log("Unable to retrieve DB Properties", ex, Project.MSG_DEBUG); +800 } finally { +801 if (cve != null) { +802 cve.close(); +803 } +804 } +805 final ReportGenerator reporter = new ReportGenerator(getProjectName(), engine.getDependencies(), engine.getAnalyzers(), prop); +806 reporter.generateReports(reportOutputDirectory, reportFormat); +807 +808 if (this.failBuildOnCVSS <= 10) { +809 checkForFailure(engine.getDependencies()); +810 } +811 if (this.showSummary) { +812 showSummary(engine.getDependencies()); +813 } +814 } catch (IOException ex) { +815 log("Unable to generate dependency-check report", ex, Project.MSG_DEBUG); +816 throw new BuildException("Unable to generate dependency-check report", ex); +817 } catch (Exception ex) { +818 log("An exception occurred; unable to continue task", ex, Project.MSG_DEBUG); +819 throw new BuildException("An exception occurred; unable to continue task", ex); +820 } 821 } -822 } -823 } -824 -825 /** -826 * Validate the configuration to ensure the parameters have been properly configured/initialized. -827 * -828 * @throws BuildException if the task was not configured correctly. -829 */ -830 private void validateConfiguration() throws BuildException { -831 if (path == null) { -832 throw new BuildException("No project dependencies have been defined to analyze."); -833 } -834 if (failBuildOnCVSS < 0 || failBuildOnCVSS > 11) { -835 throw new BuildException("Invalid configuration, failBuildOnCVSS must be between 0 and 11."); -836 } -837 } -838 -839 /** -840 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties -841 * required to change the proxy server, port, and connection timeout. -842 */ -843 @Override -844 protected void populateSettings() { -845 super.populateSettings(); -846 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); -847 -848 if (suppressionFile != null && !suppressionFile.isEmpty()) { -849 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); -850 } -851 -852 Settings.setBoolean(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled); -853 -854 Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, pyDistributionAnalyzerEnabled); -855 Settings.setBoolean(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, pyPackageAnalyzerEnabled); -856 Settings.setBoolean(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, rubygemsAnalyzerEnabled); -857 Settings.setBoolean(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, opensslAnalyzerEnabled); -858 Settings.setBoolean(Settings.KEYS.ANALYZER_CMAKE_ENABLED, cmakeAnalyzerEnabled); -859 Settings.setBoolean(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, autoconfAnalyzerEnabled); -860 Settings.setBoolean(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, composerAnalyzerEnabled); -861 Settings.setBoolean(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, nodeAnalyzerEnabled); -862 -863 Settings.setBoolean(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled); -864 Settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); -865 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); -866 if (nexusUrl != null && !nexusUrl.isEmpty()) { -867 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); -868 } -869 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy); -870 Settings.setBoolean(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled); -871 if (zipExtensions != null && !zipExtensions.isEmpty()) { -872 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); -873 } -874 Settings.setBoolean(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled); -875 if (pathToMono != null && !pathToMono.isEmpty()) { -876 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); -877 } -878 } -879 -880 /** -881 * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the -882 * configuration. -883 * -884 * @param dependencies the list of dependency objects -885 * @throws BuildException thrown if a CVSS score is found that is higher then the threshold set -886 */ -887 private void checkForFailure(List<Dependency> dependencies) throws BuildException { -888 final StringBuilder ids = new StringBuilder(); -889 for (Dependency d : dependencies) { -890 for (Vulnerability v : d.getVulnerabilities()) { -891 if (v.getCvssScore() >= failBuildOnCVSS) { -892 if (ids.length() == 0) { -893 ids.append(v.getName()); -894 } else { -895 ids.append(", ").append(v.getName()); -896 } -897 } -898 } -899 } -900 if (ids.length() > 0) { -901 final String msg = String.format("%n%nDependency-Check Failure:%n" -902 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" -903 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); -904 throw new BuildException(msg); -905 } -906 } -907 -908 /** -909 * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. -910 * -911 * @param dependencies a list of dependency objects -912 */ -913 private void showSummary(List<Dependency> dependencies) { -914 final StringBuilder summary = new StringBuilder(); -915 for (Dependency d : dependencies) { -916 boolean firstEntry = true; -917 final StringBuilder ids = new StringBuilder(); -918 for (Vulnerability v : d.getVulnerabilities()) { -919 if (firstEntry) { -920 firstEntry = false; -921 } else { -922 ids.append(", "); -923 } -924 ids.append(v.getName()); -925 } -926 if (ids.length() > 0) { -927 summary.append(d.getFileName()).append(" ("); -928 firstEntry = true; -929 for (Identifier id : d.getIdentifiers()) { -930 if (firstEntry) { -931 firstEntry = false; -932 } else { -933 summary.append(", "); -934 } -935 summary.append(id.getValue()); -936 } -937 summary.append(") : ").append(ids).append(NEW_LINE); -938 } -939 } -940 if (summary.length() > 0) { -941 final String msg = String.format("%n%n" -942 + "One or more dependencies were identified with known vulnerabilities:%n%n%s" -943 + "%n%nSee the dependency-check report for more details.%n%n", summary.toString()); -944 log(msg, Project.MSG_WARN); -945 } -946 } -947 -948 /** -949 * An enumeration of supported report formats: "ALL", "HTML", "XML", "VULN", etc.. -950 */ -951 public static class ReportFormats extends EnumeratedAttribute { -952 -953 /** -954 * Returns the list of values for the report format. -955 * -956 * @return the list of values for the report format -957 */ -958 @Override -959 public String[] getValues() { -960 int i = 0; -961 final Format[] formats = Format.values(); -962 final String[] values = new String[formats.length]; -963 for (Format format : formats) { -964 values[i++] = format.name(); -965 } -966 return values; -967 } -968 } -969 } +822 } catch (DatabaseException ex) { +823 log("Unable to connect to the dependency-check database; analysis has stopped", ex, Project.MSG_ERR); +824 } finally { +825 Settings.cleanup(true); +826 if (engine != null) { +827 engine.cleanup(); +828 } +829 } +830 } +831 +832 /** +833 * Validate the configuration to ensure the parameters have been properly configured/initialized. +834 * +835 * @throws BuildException if the task was not configured correctly. +836 */ +837 private void validateConfiguration() throws BuildException { +838 if (path == null) { +839 throw new BuildException("No project dependencies have been defined to analyze."); +840 } +841 if (failBuildOnCVSS < 0 || failBuildOnCVSS > 11) { +842 throw new BuildException("Invalid configuration, failBuildOnCVSS must be between 0 and 11."); +843 } +844 } +845 +846 /** +847 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties +848 * required to change the proxy server, port, and connection timeout. +849 * +850 * @throws BuildException thrown when an invalid setting is configured. +851 */ +852 @Override +853 protected void populateSettings() throws BuildException { +854 super.populateSettings(); +855 Settings.setBooleanIfNotNull(Settings.KEYS.AUTO_UPDATE, autoUpdate); +856 Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); +857 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled); +858 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, pyDistributionAnalyzerEnabled); +859 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, pyPackageAnalyzerEnabled); +860 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED, rubygemsAnalyzerEnabled); +861 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_OPENSSL_ENABLED, opensslAnalyzerEnabled); +862 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CMAKE_ENABLED, cmakeAnalyzerEnabled); +863 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_AUTOCONF_ENABLED, autoconfAnalyzerEnabled); +864 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_COMPOSER_LOCK_ENABLED, composerAnalyzerEnabled); +865 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NODE_PACKAGE_ENABLED, nodeAnalyzerEnabled); +866 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NUSPEC_ENABLED, nuspecAnalyzerEnabled); +867 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); +868 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); +869 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ARCHIVE_ENABLED, archiveAnalyzerEnabled); +870 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED, assemblyAnalyzerEnabled); +871 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); +872 Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy); +873 Settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); +874 Settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono); +875 } +876 +877 /** +878 * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the +879 * configuration. +880 * +881 * @param dependencies the list of dependency objects +882 * @throws BuildException thrown if a CVSS score is found that is higher then the threshold set +883 */ +884 private void checkForFailure(List<Dependency> dependencies) throws BuildException { +885 final StringBuilder ids = new StringBuilder(); +886 for (Dependency d : dependencies) { +887 for (Vulnerability v : d.getVulnerabilities()) { +888 if (v.getCvssScore() >= failBuildOnCVSS) { +889 if (ids.length() == 0) { +890 ids.append(v.getName()); +891 } else { +892 ids.append(", ").append(v.getName()); +893 } +894 } +895 } +896 } +897 if (ids.length() > 0) { +898 final String msg = String.format("%n%nDependency-Check Failure:%n" +899 + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n" +900 + "See the dependency-check report for more details.%n%n", failBuildOnCVSS, ids.toString()); +901 throw new BuildException(msg); +902 } +903 } +904 +905 /** +906 * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries. +907 * +908 * @param dependencies a list of dependency objects +909 */ +910 private void showSummary(List<Dependency> dependencies) { +911 final StringBuilder summary = new StringBuilder(); +912 for (Dependency d : dependencies) { +913 boolean firstEntry = true; +914 final StringBuilder ids = new StringBuilder(); +915 for (Vulnerability v : d.getVulnerabilities()) { +916 if (firstEntry) { +917 firstEntry = false; +918 } else { +919 ids.append(", "); +920 } +921 ids.append(v.getName()); +922 } +923 if (ids.length() > 0) { +924 summary.append(d.getFileName()).append(" ("); +925 firstEntry = true; +926 for (Identifier id : d.getIdentifiers()) { +927 if (firstEntry) { +928 firstEntry = false; +929 } else { +930 summary.append(", "); +931 } +932 summary.append(id.getValue()); +933 } +934 summary.append(") : ").append(ids).append(NEW_LINE); +935 } +936 } +937 if (summary.length() > 0) { +938 final String msg = String.format("%n%n" +939 + "One or more dependencies were identified with known vulnerabilities:%n%n%s" +940 + "%n%nSee the dependency-check report for more details.%n%n", summary.toString()); +941 log(msg, Project.MSG_WARN); +942 } +943 } +944 +945 /** +946 * An enumeration of supported report formats: "ALL", "HTML", "XML", "VULN", etc.. +947 */ +948 public static class ReportFormats extends EnumeratedAttribute { +949 +950 /** +951 * Returns the list of values for the report format. +952 * +953 * @return the list of values for the report format +954 */ +955 @Override +956 public String[] getValues() { +957 int i = 0; +958 final Format[] formats = Format.values(); +959 final String[] values = new String[formats.length]; +960 for (Format format : formats) { +961 values[i++] = format.name(); +962 } +963 return values; +964 } +965 } +966 }
        diff --git a/xref/org/owasp/dependencycheck/taskdefs/Update.html b/xref/org/owasp/dependencycheck/taskdefs/Update.html index 826534bbe..fc33b42bb 100644 --- a/xref/org/owasp/dependencycheck/taskdefs/Update.html +++ b/xref/org/owasp/dependencycheck/taskdefs/Update.html @@ -366,79 +366,83 @@ 358 } 359 360 /** -361 * Executes the update by initializing the settings, downloads the NVD XML data, and then processes the data storing it in the -362 * local database. -363 * -364 * @throws BuildException thrown if a connection to the local database cannot be made. -365 */ -366 @Override -367 public void execute() throws BuildException { -368 populateSettings(); -369 Engine engine = null; -370 try { -371 engine = new Engine(Update.class.getClassLoader()); -372 engine.doUpdates(); -373 } catch (DatabaseException ex) { -374 throw new BuildException("Unable to connect to the dependency-check database; unable to update the NVD data", ex); -375 } finally { -376 Settings.cleanup(true); -377 if (engine != null) { -378 engine.cleanup(); -379 } -380 } +361 * The number of hours to wait before re-checking for updates. +362 */ +363 private Integer cveValidForHours; +364 +365 /** +366 * Get the value of cveValidForHours. +367 * +368 * @return the value of cveValidForHours +369 */ +370 public Integer getCveValidForHours() { +371 return cveValidForHours; +372 } +373 +374 /** +375 * Set the value of cveValidForHours. +376 * +377 * @param cveValidForHours new value of cveValidForHours +378 */ +379 public void setCveValidForHours(Integer cveValidForHours) { +380 this.cveValidForHours = cveValidForHours; 381 } 382 383 /** -384 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties -385 * required to change the proxy server, port, and connection timeout. -386 */ -387 @Override -388 protected void populateSettings() { -389 super.populateSettings(); -390 if (proxyServer != null && !proxyServer.isEmpty()) { -391 Settings.setString(Settings.KEYS.PROXY_SERVER, proxyServer); -392 } -393 if (proxyPort != null && !proxyPort.isEmpty()) { -394 Settings.setString(Settings.KEYS.PROXY_PORT, proxyPort); -395 } -396 if (proxyUsername != null && !proxyUsername.isEmpty()) { -397 Settings.setString(Settings.KEYS.PROXY_USERNAME, proxyUsername); -398 } -399 if (proxyPassword != null && !proxyPassword.isEmpty()) { -400 Settings.setString(Settings.KEYS.PROXY_PASSWORD, proxyPassword); -401 } -402 if (connectionTimeout != null && !connectionTimeout.isEmpty()) { -403 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); -404 } -405 if (databaseDriverName != null && !databaseDriverName.isEmpty()) { -406 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); -407 } -408 if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) { -409 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); -410 } -411 if (connectionString != null && !connectionString.isEmpty()) { -412 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString); -413 } -414 if (databaseUser != null && !databaseUser.isEmpty()) { -415 Settings.setString(Settings.KEYS.DB_USER, databaseUser); -416 } -417 if (databasePassword != null && !databasePassword.isEmpty()) { -418 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword); -419 } -420 if (cveUrl12Modified != null && !cveUrl12Modified.isEmpty()) { -421 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); -422 } -423 if (cveUrl20Modified != null && !cveUrl20Modified.isEmpty()) { -424 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); -425 } -426 if (cveUrl12Base != null && !cveUrl12Base.isEmpty()) { -427 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); -428 } -429 if (cveUrl20Base != null && !cveUrl20Base.isEmpty()) { -430 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); -431 } -432 } -433 } +384 * Executes the update by initializing the settings, downloads the NVD XML data, and then processes the data storing it in the +385 * local database. +386 * +387 * @throws BuildException thrown if a connection to the local database cannot be made. +388 */ +389 @Override +390 public void execute() throws BuildException { +391 populateSettings(); +392 Engine engine = null; +393 try { +394 engine = new Engine(Update.class.getClassLoader()); +395 engine.doUpdates(); +396 } catch (DatabaseException ex) { +397 throw new BuildException("Unable to connect to the dependency-check database; unable to update the NVD data", ex); +398 } finally { +399 Settings.cleanup(true); +400 if (engine != null) { +401 engine.cleanup(); +402 } +403 } +404 } +405 +406 /** +407 * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties +408 * required to change the proxy server, port, and connection timeout. +409 * +410 * @throws BuildException thrown when an invalid setting is configured. +411 */ +412 @Override +413 protected void populateSettings() throws BuildException { +414 super.populateSettings(); +415 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_SERVER, proxyServer); +416 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PORT, proxyPort); +417 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_USERNAME, proxyUsername); +418 Settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PASSWORD, proxyPassword); +419 Settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); +420 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); +421 Settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); +422 Settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString); +423 Settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser); +424 Settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword); +425 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified); +426 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified); +427 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base); +428 Settings.setStringIfNotEmpty(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base); +429 if (cveValidForHours != null) { +430 if (cveValidForHours >= 0) { +431 Settings.setInt(Settings.KEYS.CVE_CHECK_VALID_FOR_HOURS, cveValidForHours); +432 } else { +433 throw new BuildException("Invalid setting: `cpeValidForHours` must be 0 or greater"); +434 } +435 } +436 } +437 }
        diff --git a/xref/org/owasp/dependencycheck/taskdefs/package-frame.html b/xref/org/owasp/dependencycheck/taskdefs/package-frame.html index c3276b9ca..9ffa4bf3d 100644 --- a/xref/org/owasp/dependencycheck/taskdefs/package-frame.html +++ b/xref/org/owasp/dependencycheck/taskdefs/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.taskdefs + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.taskdefs diff --git a/xref/org/owasp/dependencycheck/taskdefs/package-summary.html b/xref/org/owasp/dependencycheck/taskdefs/package-summary.html index 5e7a1b14f..9fef198fd 100644 --- a/xref/org/owasp/dependencycheck/taskdefs/package-summary.html +++ b/xref/org/owasp/dependencycheck/taskdefs/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.taskdefs + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.taskdefs diff --git a/xref/org/owasp/dependencycheck/utils/Checksum.html b/xref/org/owasp/dependencycheck/utils/Checksum.html index a36e67a35..71f8cd52b 100644 --- a/xref/org/owasp/dependencycheck/utils/Checksum.html +++ b/xref/org/owasp/dependencycheck/utils/Checksum.html @@ -65,98 +65,91 @@ 57 * @throws IOException when the file does not exist 58 * @throws NoSuchAlgorithmException when an algorithm is specified that does not exist 59 */ -60 @SuppressWarnings("empty-statement") -61 public static byte[] getChecksum(String algorithm, File file) throws NoSuchAlgorithmException, IOException { -62 MessageDigest digest = MessageDigest.getInstance(algorithm); -63 FileInputStream fis = null; -64 try { -65 fis = new FileInputStream(file); -66 FileChannel ch = fis.getChannel(); -67 long remainingToRead = file.length(); -68 long start = 0; -69 while (remainingToRead > 0) { -70 long amountToRead; -71 if (remainingToRead > Integer.MAX_VALUE) { -72 remainingToRead -= Integer.MAX_VALUE; -73 amountToRead = Integer.MAX_VALUE; -74 } else { -75 amountToRead = remainingToRead; -76 remainingToRead = 0; -77 } -78 MappedByteBuffer byteBuffer = ch.map(FileChannel.MapMode.READ_ONLY, start, amountToRead); -79 digest.update(byteBuffer); -80 start += amountToRead; -81 } -82 -83 // BufferedInputStream bis = new BufferedInputStream(fis); -84 // DigestInputStream dis = new DigestInputStream(bis, digest); -85 // //yes, we are reading in a buffer for performance reasons - 1 byte at a time is SLOW -86 // byte[] buffer = new byte[8192]; -87 // while (dis.read(buffer) != -1); -88 } finally { -89 if (fis != null) { -90 try { -91 fis.close(); -92 } catch (IOException ex) { -93 LOGGER.trace("Error closing file '{}'.", file.getName(), ex); -94 } -95 } -96 } -97 return digest.digest(); -98 } -99 -100 /** -101 * Calculates the MD5 checksum of a specified file. -102 * -103 * @param file the file to generate the MD5 checksum -104 * @return the hex representation of the MD5 hash -105 * @throws IOException when the file passed in does not exist -106 * @throws NoSuchAlgorithmException when the MD5 algorithm is not available -107 */ -108 public static String getMD5Checksum(File file) throws IOException, NoSuchAlgorithmException { -109 byte[] b = getChecksum("MD5", file); -110 return getHex(b); -111 } -112 -113 /** -114 * Calculates the SHA1 checksum of a specified file. -115 * -116 * @param file the file to generate the MD5 checksum -117 * @return the hex representation of the SHA1 hash -118 * @throws IOException when the file passed in does not exist -119 * @throws NoSuchAlgorithmException when the SHA1 algorithm is not available +60 public static byte[] getChecksum(String algorithm, File file) throws NoSuchAlgorithmException, IOException { +61 MessageDigest digest = MessageDigest.getInstance(algorithm); +62 FileInputStream fis = null; +63 try { +64 fis = new FileInputStream(file); +65 FileChannel ch = fis.getChannel(); +66 long remainingToRead = file.length(); +67 long start = 0; +68 while (remainingToRead > 0) { +69 long amountToRead; +70 if (remainingToRead > Integer.MAX_VALUE) { +71 remainingToRead -= Integer.MAX_VALUE; +72 amountToRead = Integer.MAX_VALUE; +73 } else { +74 amountToRead = remainingToRead; +75 remainingToRead = 0; +76 } +77 MappedByteBuffer byteBuffer = ch.map(FileChannel.MapMode.READ_ONLY, start, amountToRead); +78 digest.update(byteBuffer); +79 start += amountToRead; +80 } +81 } finally { +82 if (fis != null) { +83 try { +84 fis.close(); +85 } catch (IOException ex) { +86 LOGGER.trace("Error closing file '{}'.", file.getName(), ex); +87 } +88 } +89 } +90 return digest.digest(); +91 } +92 +93 /** +94 * Calculates the MD5 checksum of a specified file. +95 * +96 * @param file the file to generate the MD5 checksum +97 * @return the hex representation of the MD5 hash +98 * @throws IOException when the file passed in does not exist +99 * @throws NoSuchAlgorithmException when the MD5 algorithm is not available +100 */ +101 public static String getMD5Checksum(File file) throws IOException, NoSuchAlgorithmException { +102 byte[] b = getChecksum("MD5", file); +103 return getHex(b); +104 } +105 +106 /** +107 * Calculates the SHA1 checksum of a specified file. +108 * +109 * @param file the file to generate the MD5 checksum +110 * @return the hex representation of the SHA1 hash +111 * @throws IOException when the file passed in does not exist +112 * @throws NoSuchAlgorithmException when the SHA1 algorithm is not available +113 */ +114 public static String getSHA1Checksum(File file) throws IOException, NoSuchAlgorithmException { +115 byte[] b = getChecksum("SHA1", file); +116 return getHex(b); +117 } +118 /** +119 * Hex code characters used in getHex. 120 */ -121 public static String getSHA1Checksum(File file) throws IOException, NoSuchAlgorithmException { -122 byte[] b = getChecksum("SHA1", file); -123 return getHex(b); -124 } -125 /** -126 * Hex code characters used in getHex. -127 */ -128 private static final String HEXES = "0123456789abcdef"; -129 -130 /** -131 * <p> -132 * Converts a byte array into a hex string.</p> -133 * -134 * <p> -135 * This method was copied from <a -136 * href="http://www.rgagnon.com/javadetails/java-0596.html">http://www.rgagnon.com/javadetails/java-0596.html</a></p> -137 * -138 * @param raw a byte array -139 * @return the hex representation of the byte array -140 */ -141 public static String getHex(byte[] raw) { -142 if (raw == null) { -143 return null; -144 } -145 final StringBuilder hex = new StringBuilder(2 * raw.length); -146 for (final byte b : raw) { -147 hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt(b & 0x0F)); -148 } -149 return hex.toString(); -150 } -151 } +121 private static final String HEXES = "0123456789abcdef"; +122 +123 /** +124 * <p> +125 * Converts a byte array into a hex string.</p> +126 * +127 * <p> +128 * This method was copied from <a +129 * href="http://www.rgagnon.com/javadetails/java-0596.html">http://www.rgagnon.com/javadetails/java-0596.html</a></p> +130 * +131 * @param raw a byte array +132 * @return the hex representation of the byte array +133 */ +134 public static String getHex(byte[] raw) { +135 if (raw == null) { +136 return null; +137 } +138 final StringBuilder hex = new StringBuilder(2 * raw.length); +139 for (final byte b : raw) { +140 hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt(b & 0x0F)); +141 } +142 return hex.toString(); +143 } +144 }
        diff --git a/xref/org/owasp/dependencycheck/utils/DateUtil.html b/xref/org/owasp/dependencycheck/utils/DateUtil.html index 2524e1549..342fdb391 100644 --- a/xref/org/owasp/dependencycheck/utils/DateUtil.html +++ b/xref/org/owasp/dependencycheck/utils/DateUtil.html @@ -44,14 +44,15 @@ 36 * 37 * @param date the date to be checked. 38 * @param compareTo the date to compare to. -39 * @param range the range in days to be considered valid. +39 * @param dayRange the range in days to be considered valid. 40 * @return whether or not the date is within the range. 41 */ -42 public static boolean withinDateRange(long date, long compareTo, int range) { -43 final double differenceInDays = (compareTo - date) / 1000.0 / 60.0 / 60.0 / 24.0; -44 return differenceInDays < range; -45 } -46 } +42 public static boolean withinDateRange(long date, long compareTo, int dayRange) { +43 // ms = dayRange x 24 hours/day x 60 min/hour x 60 sec/min x 1000 ms/sec +44 final long msRange = dayRange * 24L * 60L * 60L * 1000L; +45 return (compareTo - date) < msRange; +46 } +47 }
        diff --git a/xref/org/owasp/dependencycheck/utils/DependencyVersion.html b/xref/org/owasp/dependencycheck/utils/DependencyVersion.html index ecda6b9a0..9025edebd 100644 --- a/xref/org/owasp/dependencycheck/utils/DependencyVersion.html +++ b/xref/org/owasp/dependencycheck/utils/DependencyVersion.html @@ -123,7 +123,7 @@ 115 */ 116 @Override 117 public String toString() { -118 return StringUtils.join(versionParts.toArray(), "."); +118 return StringUtils.join(versionParts, '.'); 119 } 120 121 /** diff --git a/xref/org/owasp/dependencycheck/utils/ExtractionUtil.html b/xref/org/owasp/dependencycheck/utils/ExtractionUtil.html index 08a5dc248..d2d2db981 100644 --- a/xref/org/owasp/dependencycheck/utils/ExtractionUtil.html +++ b/xref/org/owasp/dependencycheck/utils/ExtractionUtil.html @@ -190,98 +190,94 @@ 182 while ((entry = input.getNextEntry()) != null) { 183 if (entry.isDirectory()) { 184 final File dir = new File(destination, entry.getName()); -185 if (!dir.exists()) { -186 if (!dir.mkdirs()) { -187 final String msg = String.format( -188 "Unable to create directory '%s'.", -189 dir.getAbsolutePath()); -190 throw new AnalysisException(msg); -191 } -192 } -193 } else { -194 extractFile(input, destination, filter, entry); -195 } -196 } -197 } catch (IOException ex) { +185 if (!dir.exists() && !dir.mkdirs()) { +186 final String msg = String.format( +187 "Unable to create directory '%s'.", +188 dir.getAbsolutePath()); +189 throw new AnalysisException(msg); +190 } +191 } else { +192 extractFile(input, destination, filter, entry); +193 } +194 } +195 } catch (IOException ex) { +196 throw new ArchiveExtractionException(ex); +197 } catch (Throwable ex) { 198 throw new ArchiveExtractionException(ex); -199 } catch (Throwable ex) { -200 throw new ArchiveExtractionException(ex); -201 } finally { -202 closeStream(input); -203 } -204 } -205 -206 /** -207 * Extracts a file from an archive (input stream) and correctly builds the directory structure. -208 * -209 * @param input the archive input stream -210 * @param destination where to write the file -211 * @param filter the file filter to apply to the files being extracted -212 * @param entry the entry from the archive to extract -213 * @throws ExtractionException thrown if there is an error reading from the archive stream -214 */ -215 private static void extractFile(ArchiveInputStream input, File destination, -216 FilenameFilter filter, ArchiveEntry entry) throws ExtractionException { -217 final File file = new File(destination, entry.getName()); -218 if (filter.accept(file.getParentFile(), file.getName())) { -219 LOGGER.debug("Extracting '{}'", -220 file.getPath()); -221 FileOutputStream fos = null; -222 try { -223 createParentFile(file); -224 fos = new FileOutputStream(file); -225 IOUtils.copy(input, fos); -226 } catch (FileNotFoundException ex) { -227 LOGGER.debug("", ex); -228 final String msg = String.format("Unable to find file '%s'.", -229 file.getName()); -230 throw new ExtractionException(msg, ex); -231 } catch (IOException ex) { -232 LOGGER.debug("", ex); -233 final String msg = String -234 .format("IO Exception while parsing file '%s'.", -235 file.getName()); -236 throw new ExtractionException(msg, ex); -237 } finally { -238 closeStream(fos); -239 } -240 } -241 } -242 -243 /** -244 * Closes the stream. -245 * -246 * @param stream the stream to close -247 */ -248 private static void closeStream(Closeable stream) { -249 if (stream != null) { -250 try { -251 stream.close(); -252 } catch (IOException ex) { -253 LOGGER.trace("", ex); -254 } -255 } -256 } -257 -258 /** -259 * Ensures the parent path is correctly created on disk so that the file can be extracted to the correct location. -260 * -261 * @param file the file path -262 * @throws ExtractionException thrown if the parent paths could not be created -263 */ -264 private static void createParentFile(final File file) -265 throws ExtractionException { -266 final File parent = file.getParentFile(); -267 if (!parent.isDirectory()) { -268 if (!parent.mkdirs()) { -269 final String msg = String.format( -270 "Unable to build directory '%s'.", -271 parent.getAbsolutePath()); -272 throw new ExtractionException(msg); -273 } -274 } -275 } -276 } +199 } finally { +200 closeStream(input); +201 } +202 } +203 +204 /** +205 * Extracts a file from an archive (input stream) and correctly builds the directory structure. +206 * +207 * @param input the archive input stream +208 * @param destination where to write the file +209 * @param filter the file filter to apply to the files being extracted +210 * @param entry the entry from the archive to extract +211 * @throws ExtractionException thrown if there is an error reading from the archive stream +212 */ +213 private static void extractFile(ArchiveInputStream input, File destination, +214 FilenameFilter filter, ArchiveEntry entry) throws ExtractionException { +215 final File file = new File(destination, entry.getName()); +216 if (filter.accept(file.getParentFile(), file.getName())) { +217 LOGGER.debug("Extracting '{}'", +218 file.getPath()); +219 FileOutputStream fos = null; +220 try { +221 createParentFile(file); +222 fos = new FileOutputStream(file); +223 IOUtils.copy(input, fos); +224 } catch (FileNotFoundException ex) { +225 LOGGER.debug("", ex); +226 final String msg = String.format("Unable to find file '%s'.", +227 file.getName()); +228 throw new ExtractionException(msg, ex); +229 } catch (IOException ex) { +230 LOGGER.debug("", ex); +231 final String msg = String +232 .format("IO Exception while parsing file '%s'.", +233 file.getName()); +234 throw new ExtractionException(msg, ex); +235 } finally { +236 closeStream(fos); +237 } +238 } +239 } +240 +241 /** +242 * Closes the stream. +243 * +244 * @param stream the stream to close +245 */ +246 private static void closeStream(Closeable stream) { +247 if (stream != null) { +248 try { +249 stream.close(); +250 } catch (IOException ex) { +251 LOGGER.trace("", ex); +252 } +253 } +254 } +255 +256 /** +257 * Ensures the parent path is correctly created on disk so that the file can be extracted to the correct location. +258 * +259 * @param file the file path +260 * @throws ExtractionException thrown if the parent paths could not be created +261 */ +262 private static void createParentFile(final File file) +263 throws ExtractionException { +264 final File parent = file.getParentFile(); +265 if (!parent.isDirectory() && !parent.mkdirs()) { +266 final String msg = String.format( +267 "Unable to build directory '%s'.", +268 parent.getAbsolutePath()); +269 throw new ExtractionException(msg); +270 } +271 } +272 }
        diff --git a/xref/org/owasp/dependencycheck/utils/FileUtils.html b/xref/org/owasp/dependencycheck/utils/FileUtils.html index 1af7b1149..db32f77a0 100644 --- a/xref/org/owasp/dependencycheck/utils/FileUtils.html +++ b/xref/org/owasp/dependencycheck/utils/FileUtils.html @@ -25,102 +25,98 @@ 17 */ 18 package org.owasp.dependencycheck.utils; 19 -20 import org.slf4j.Logger; -21 import org.slf4j.LoggerFactory; -22 -23 import java.io.File; -24 import java.io.IOException; -25 import java.util.UUID; -26 -27 /** -28 * A collection of utilities for processing information about files. -29 * -30 * @author Jeremy Long -31 */ -32 public final class FileUtils { -33 -34 /** -35 * The logger. -36 */ -37 private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class); -38 /** -39 * Bit bucket for non-Windows systems -40 */ -41 private static final String BIT_BUCKET_UNIX = "/dev/null"; -42 -43 /** -44 * Bit bucket for Windows systems (yes, only one 'L') -45 */ -46 private static final String BIT_BUCKET_WIN = "NUL"; -47 -48 /** -49 * Private constructor for a utility class. -50 */ -51 private FileUtils() { -52 } -53 -54 /** -55 * Returns the (lowercase) file extension for a specified file. -56 * -57 * @param fileName the file name to retrieve the file extension from. -58 * @return the file extension. -59 */ -60 public static String getFileExtension(String fileName) { -61 String ret = null; -62 final int pos = fileName.lastIndexOf("."); -63 if (pos >= 0) { -64 ret = fileName.substring(pos + 1, fileName.length()).toLowerCase(); -65 } -66 return ret; -67 } -68 -69 /** -70 * Deletes a file. If the File is a directory it will recursively delete the contents. -71 * -72 * @param file the File to delete -73 * @return true if the file was deleted successfully, otherwise false -74 */ -75 public static boolean delete(File file) { -76 boolean success = true; -77 if (!org.apache.commons.io.FileUtils.deleteQuietly(file)) { -78 success = false; -79 LOGGER.debug("Failed to delete file: {}; attempting to delete on exit.", file.getPath()); -80 file.deleteOnExit(); -81 } -82 return success; -83 } -84 -85 /** -86 * Generates a new temporary file name that is guaranteed to be unique. -87 * -88 * @param prefix the prefix for the file name to generate -89 * @param extension the extension of the generated file name -90 * @return a temporary File -91 * @throws java.io.IOException thrown if the temporary folder could not be created -92 */ -93 public static File getTempFile(String prefix, String extension) throws IOException { -94 final File dir = Settings.getTempDirectory(); -95 final String tempFileName = String.format("%s%s.%s", prefix, UUID.randomUUID().toString(), extension); -96 final File tempFile = new File(dir, tempFileName); -97 if (tempFile.exists()) { -98 return getTempFile(prefix, extension); -99 } -100 return tempFile; -101 } -102 -103 /** -104 * Return the bit bucket for the OS. '/dev/null' for Unix and 'NUL' for Windows -105 * -106 * @return a String containing the bit bucket -107 */ -108 public static String getBitBucket() { -109 if (System.getProperty("os.name").startsWith("Windows")) { -110 return BIT_BUCKET_WIN; -111 } else { -112 return BIT_BUCKET_UNIX; -113 } -114 } -115 } +20 import org.apache.commons.io.FilenameUtils; +21 import org.slf4j.Logger; +22 import org.slf4j.LoggerFactory; +23 +24 import java.io.File; +25 import java.io.IOException; +26 import java.util.UUID; +27 +28 /** +29 * A collection of utilities for processing information about files. +30 * +31 * @author Jeremy Long +32 */ +33 public final class FileUtils { +34 +35 /** +36 * The logger. +37 */ +38 private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class); +39 /** +40 * Bit bucket for non-Windows systems +41 */ +42 private static final String BIT_BUCKET_UNIX = "/dev/null"; +43 +44 /** +45 * Bit bucket for Windows systems (yes, only one 'L') +46 */ +47 private static final String BIT_BUCKET_WIN = "NUL"; +48 +49 /** +50 * Private constructor for a utility class. +51 */ +52 private FileUtils() { +53 } +54 +55 /** +56 * Returns the (lowercase) file extension for a specified file. +57 * +58 * @param fileName the file name to retrieve the file extension from. +59 * @return the file extension. +60 */ +61 public static String getFileExtension(String fileName) { +62 final String fileExt = FilenameUtils.getExtension(fileName); +63 return null == fileExt || fileExt.isEmpty() ? null : fileExt.toLowerCase(); +64 } +65 +66 /** +67 * Deletes a file. If the File is a directory it will recursively delete the contents. +68 * +69 * @param file the File to delete +70 * @return true if the file was deleted successfully, otherwise false +71 */ +72 public static boolean delete(File file) { +73 final boolean success = org.apache.commons.io.FileUtils.deleteQuietly(file); +74 if (!success) { +75 LOGGER.debug("Failed to delete file: {}; attempting to delete on exit.", file.getPath()); +76 file.deleteOnExit(); +77 } +78 return success; +79 } +80 +81 /** +82 * Generates a new temporary file name that is guaranteed to be unique. +83 * +84 * @param prefix the prefix for the file name to generate +85 * @param extension the extension of the generated file name +86 * @return a temporary File +87 * @throws java.io.IOException thrown if the temporary folder could not be created +88 */ +89 public static File getTempFile(String prefix, String extension) throws IOException { +90 final File dir = Settings.getTempDirectory(); +91 final String tempFileName = String.format("%s%s.%s", prefix, UUID.randomUUID().toString(), extension); +92 final File tempFile = new File(dir, tempFileName); +93 if (tempFile.exists()) { +94 return getTempFile(prefix, extension); +95 } +96 return tempFile; +97 } +98 +99 /** +100 * Return the bit bucket for the OS. '/dev/null' for Unix and 'NUL' for Windows +101 * +102 * @return a String containing the bit bucket +103 */ +104 public static String getBitBucket() { +105 if (System.getProperty("os.name").startsWith("Windows")) { +106 return BIT_BUCKET_WIN; +107 } else { +108 return BIT_BUCKET_UNIX; +109 } +110 } +111 }
        diff --git a/xref/org/owasp/dependencycheck/utils/Settings.html b/xref/org/owasp/dependencycheck/utils/Settings.html index 4d0fdc90e..740d2eaef 100644 --- a/xref/org/owasp/dependencycheck/utils/Settings.html +++ b/xref/org/owasp/dependencycheck/utils/Settings.html @@ -126,700 +126,733 @@ 118 */ 119 public static final String CVE_MODIFIED_VALID_FOR_DAYS = "cve.url.modified.validfordays"; 120 /** -121 * The properties key for the telling us how many cve.url.* URLs exists. This is used in combination with CVE_BASE_URL to -122 * be able to retrieve the URLs for all of the files that make up the NVD CVE listing. -123 */ -124 public static final String CVE_START_YEAR = "cve.startyear"; -125 /** -126 * The properties key for the CVE schema version 1.2. +121 * The properties key to control the skipping of the check for CVE updates. +122 */ +123 public static final String CVE_CHECK_VALID_FOR_HOURS = "cve.check.validforhours"; +124 /** +125 * The properties key for the telling us how many cve.url.* URLs exists. This is used in combination with CVE_BASE_URL to +126 * be able to retrieve the URLs for all of the files that make up the NVD CVE listing. 127 */ -128 public static final String CVE_SCHEMA_1_2 = "cve.url-1.2.base"; +128 public static final String CVE_START_YEAR = "cve.startyear"; 129 /** -130 * The properties key for the CVE schema version 2.0. +130 * The properties key for the CVE schema version 1.2. 131 */ -132 public static final String CVE_SCHEMA_2_0 = "cve.url-2.0.base"; +132 public static final String CVE_SCHEMA_1_2 = "cve.url-1.2.base"; 133 /** -134 * The properties key that indicates how often the CPE data needs to be updated. +134 * The properties key for the CVE schema version 2.0. 135 */ -136 public static final String CPE_MODIFIED_VALID_FOR_DAYS = "cpe.validfordays"; +136 public static final String CVE_SCHEMA_2_0 = "cve.url-2.0.base"; 137 /** -138 * The properties key for the URL to retrieve the CPE. +138 * The properties key that indicates how often the CPE data needs to be updated. 139 */ -140 public static final String CPE_URL = "cpe.url"; +140 public static final String CPE_MODIFIED_VALID_FOR_DAYS = "cpe.validfordays"; 141 /** -142 * The properties key for the proxy server. -143 * -144 * @deprecated use {@link org.owasp.dependencycheck.utils.Settings.KEYS#PROXY_SERVER} instead. -145 */ -146 @Deprecated -147 public static final String PROXY_URL = "proxy.server"; -148 /** -149 * The properties key for the proxy server. -150 */ -151 public static final String PROXY_SERVER = "proxy.server"; +142 * The properties key for the URL to retrieve the CPE. +143 */ +144 public static final String CPE_URL = "cpe.url"; +145 /** +146 * The properties key for the proxy server. +147 * +148 * @deprecated use {@link org.owasp.dependencycheck.utils.Settings.KEYS#PROXY_SERVER} instead. +149 */ +150 @Deprecated +151 public static final String PROXY_URL = "proxy.server"; 152 /** -153 * The properties key for the proxy port - this must be an integer value. +153 * The properties key for the proxy server. 154 */ -155 public static final String PROXY_PORT = "proxy.port"; +155 public static final String PROXY_SERVER = "proxy.server"; 156 /** -157 * The properties key for the proxy username. +157 * The properties key for the proxy port - this must be an integer value. 158 */ -159 public static final String PROXY_USERNAME = "proxy.username"; +159 public static final String PROXY_PORT = "proxy.port"; 160 /** -161 * The properties key for the proxy password. +161 * The properties key for the proxy username. 162 */ -163 public static final String PROXY_PASSWORD = "proxy.password"; +163 public static final String PROXY_USERNAME = "proxy.username"; 164 /** -165 * The properties key for the connection timeout. +165 * The properties key for the proxy password. 166 */ -167 public static final String CONNECTION_TIMEOUT = "connection.timeout"; +167 public static final String PROXY_PASSWORD = "proxy.password"; 168 /** -169 * The location of the temporary directory. +169 * The properties key for the connection timeout. 170 */ -171 public static final String TEMP_DIRECTORY = "temp.directory"; +171 public static final String CONNECTION_TIMEOUT = "connection.timeout"; 172 /** -173 * The maximum number of threads to allocate when downloading files. +173 * The location of the temporary directory. 174 */ -175 public static final String MAX_DOWNLOAD_THREAD_POOL_SIZE = "max.download.threads"; +175 public static final String TEMP_DIRECTORY = "temp.directory"; 176 /** -177 * The key for a list of suppression files. +177 * The maximum number of threads to allocate when downloading files. 178 */ -179 public static final String SUPPRESSION_FILE = "suppression.file"; +179 public static final String MAX_DOWNLOAD_THREAD_POOL_SIZE = "max.download.threads"; 180 /** -181 * The properties key for whether the Jar Analyzer is enabled. +181 * The key for a list of suppression files. 182 */ -183 public static final String ANALYZER_JAR_ENABLED = "analyzer.jar.enabled"; +183 public static final String SUPPRESSION_FILE = "suppression.file"; 184 /** -185 * The properties key for whether the Archive analyzer is enabled. +185 * The properties key for whether the Jar Analyzer is enabled. 186 */ -187 public static final String ANALYZER_ARCHIVE_ENABLED = "analyzer.archive.enabled"; +187 public static final String ANALYZER_JAR_ENABLED = "analyzer.jar.enabled"; 188 /** -189 * The properties key for whether the node.js package analyzer is enabled. +189 * The properties key for whether the Archive analyzer is enabled. 190 */ -191 public static final String ANALYZER_NODE_PACKAGE_ENABLED = "analyzer.node.package.enabled"; +191 public static final String ANALYZER_ARCHIVE_ENABLED = "analyzer.archive.enabled"; 192 /** -193 * The properties key for whether the composer lock file analyzer is enabled. +193 * The properties key for whether the node.js package analyzer is enabled. 194 */ -195 public static final String ANALYZER_COMPOSER_LOCK_ENABLED = "analyzer.composer.lock.enabled"; +195 public static final String ANALYZER_NODE_PACKAGE_ENABLED = "analyzer.node.package.enabled"; 196 /** -197 * The properties key for whether the Python Distribution analyzer is enabled. +197 * The properties key for whether the composer lock file analyzer is enabled. 198 */ -199 public static final String ANALYZER_PYTHON_DISTRIBUTION_ENABLED = "analyzer.python.distribution.enabled"; +199 public static final String ANALYZER_COMPOSER_LOCK_ENABLED = "analyzer.composer.lock.enabled"; 200 /** -201 * The properties key for whether the Python Package analyzer is enabled. +201 * The properties key for whether the Python Distribution analyzer is enabled. 202 */ -203 public static final String ANALYZER_PYTHON_PACKAGE_ENABLED = "analyzer.python.package.enabled"; +203 public static final String ANALYZER_PYTHON_DISTRIBUTION_ENABLED = "analyzer.python.distribution.enabled"; 204 /** -205 * The properties key for whether the Ruby Gemspec Analyzer is enabled. +205 * The properties key for whether the Python Package analyzer is enabled. 206 */ -207 public static final String ANALYZER_RUBY_GEMSPEC_ENABLED = "analyzer.ruby.gemspec.enabled"; +207 public static final String ANALYZER_PYTHON_PACKAGE_ENABLED = "analyzer.python.package.enabled"; 208 /** -209 * The properties key for whether the Autoconf analyzer is enabled. +209 * The properties key for whether the Ruby Gemspec Analyzer is enabled. 210 */ -211 public static final String ANALYZER_AUTOCONF_ENABLED = "analyzer.autoconf.enabled"; +211 public static final String ANALYZER_RUBY_GEMSPEC_ENABLED = "analyzer.ruby.gemspec.enabled"; 212 /** -213 * The properties key for whether the CMake analyzer is enabled. +213 * The properties key for whether the Autoconf analyzer is enabled. 214 */ -215 public static final String ANALYZER_CMAKE_ENABLED = "analyzer.cmake.enabled"; +215 public static final String ANALYZER_AUTOCONF_ENABLED = "analyzer.autoconf.enabled"; 216 /** -217 * The properties key for whether the .NET Assembly analyzer is enabled. +217 * The properties key for whether the CMake analyzer is enabled. 218 */ -219 public static final String ANALYZER_ASSEMBLY_ENABLED = "analyzer.assembly.enabled"; +219 public static final String ANALYZER_CMAKE_ENABLED = "analyzer.cmake.enabled"; 220 /** -221 * The properties key for whether the .NET Nuspec analyzer is enabled. +221 * The properties key for whether the Ruby Bundler Audit analyzer is enabled. 222 */ -223 public static final String ANALYZER_NUSPEC_ENABLED = "analyzer.nuspec.enabled"; +223 public static final String ANALYZER_BUNDLE_AUDIT_ENABLED = "analyzer.bundle.audit.enabled"; 224 /** -225 * The properties key for whether the Nexus analyzer is enabled. +225 * The properties key for whether the .NET Assembly analyzer is enabled. 226 */ -227 public static final String ANALYZER_NEXUS_ENABLED = "analyzer.nexus.enabled"; +227 public static final String ANALYZER_ASSEMBLY_ENABLED = "analyzer.assembly.enabled"; 228 /** -229 * The properties key for the Nexus search URL. +229 * The properties key for whether the .NET Nuspec analyzer is enabled. 230 */ -231 public static final String ANALYZER_NEXUS_URL = "analyzer.nexus.url"; +231 public static final String ANALYZER_NUSPEC_ENABLED = "analyzer.nuspec.enabled"; 232 /** -233 * The properties key for using the proxy to reach Nexus. +233 * The properties key for whether the Nexus analyzer is enabled. 234 */ -235 public static final String ANALYZER_NEXUS_PROXY = "analyzer.nexus.proxy"; +235 public static final String ANALYZER_NEXUS_ENABLED = "analyzer.nexus.enabled"; 236 /** -237 * The properties key for whether the Central analyzer is enabled. +237 * The properties key for the Nexus search URL. 238 */ -239 public static final String ANALYZER_CENTRAL_ENABLED = "analyzer.central.enabled"; +239 public static final String ANALYZER_NEXUS_URL = "analyzer.nexus.url"; 240 /** -241 * The properties key for whether the OpenSSL analyzer is enabled. +241 * The properties key for using the proxy to reach Nexus. 242 */ -243 public static final String ANALYZER_OPENSSL_ENABLED = "analyzer.openssl.enabled"; +243 public static final String ANALYZER_NEXUS_USES_PROXY = "analyzer.nexus.proxy"; 244 /** -245 * The properties key for the Central search URL. +245 * The properties key for whether the Central analyzer is enabled. 246 */ -247 public static final String ANALYZER_CENTRAL_URL = "analyzer.central.url"; +247 public static final String ANALYZER_CENTRAL_ENABLED = "analyzer.central.enabled"; 248 /** -249 * The path to mono, if available. +249 * The properties key for whether the OpenSSL analyzer is enabled. 250 */ -251 public static final String ANALYZER_ASSEMBLY_MONO_PATH = "analyzer.assembly.mono.path"; +251 public static final String ANALYZER_OPENSSL_ENABLED = "analyzer.openssl.enabled"; 252 /** -253 * The additional configured zip file extensions, if available. +253 * The properties key for the Central search URL. 254 */ -255 public static final String ADDITIONAL_ZIP_EXTENSIONS = "extensions.zip"; +255 public static final String ANALYZER_CENTRAL_URL = "analyzer.central.url"; 256 /** -257 * The properties key for whether Test Scope dependencies should be skipped. +257 * The path to mono, if available. 258 */ -259 public static final String SKIP_TEST_SCOPE = "skip.test.scope"; +259 public static final String ANALYZER_ASSEMBLY_MONO_PATH = "analyzer.assembly.mono.path"; 260 /** -261 * The properties key for whether Runtime Scope dependencies should be skipped. +261 * The path to bundle-audit, if available. 262 */ -263 public static final String SKIP_RUNTIME_SCOPE = "skip.runtime.scope"; +263 public static final String ANALYZER_BUNDLE_AUDIT_PATH = "analyzer.bundle.audit.path"; 264 /** -265 * The properties key for whether Provided Scope dependencies should be skipped. +265 * The additional configured zip file extensions, if available. 266 */ -267 public static final String SKIP_PROVIDED_SCOPE = "skip.provided.scope"; -268 -269 /** -270 * The key to obtain the path to the VFEED data file. -271 */ -272 public static final String VFEED_DATA_FILE = "vfeed.data_file"; -273 /** -274 * The key to obtain the VFEED connection string. -275 */ -276 public static final String VFEED_CONNECTION_STRING = "vfeed.connection_string"; -277 -278 /** -279 * The key to obtain the base download URL for the VFeed data file. -280 */ -281 public static final String VFEED_DOWNLOAD_URL = "vfeed.download_url"; -282 /** -283 * The key to obtain the download file name for the VFeed data. -284 */ -285 public static final String VFEED_DOWNLOAD_FILE = "vfeed.download_file"; -286 /** -287 * The key to obtain the VFeed update status. -288 */ -289 public static final String VFEED_UPDATE_STATUS = "vfeed.update_status"; -290 -291 /** -292 * The HTTP request method for query last modified date. -293 */ -294 public static final String DOWNLOADER_QUICK_QUERY_TIMESTAMP = "downloader.quick.query.timestamp"; -295 } -296 //</editor-fold> -297 -298 /** -299 * The logger. -300 */ -301 private static final Logger LOGGER = LoggerFactory.getLogger(Settings.class); -302 /** -303 * The properties file location. -304 */ -305 private static final String PROPERTIES_FILE = "dependencycheck.properties"; -306 /** -307 * Thread local settings. -308 */ -309 private static ThreadLocal<Settings> localSettings = new ThreadLocal<Settings>(); -310 /** -311 * The properties. -312 */ -313 private Properties props = null; -314 -315 /** -316 * Private constructor for the Settings class. This class loads the properties files. -317 * -318 * @param propertiesFilePath the path to the base properties file to load -319 */ -320 private Settings(String propertiesFilePath) { -321 InputStream in = null; -322 props = new Properties(); -323 try { -324 in = this.getClass().getClassLoader().getResourceAsStream(propertiesFilePath); -325 props.load(in); -326 } catch (IOException ex) { -327 LOGGER.error("Unable to load default settings."); -328 LOGGER.debug("", ex); -329 } finally { -330 if (in != null) { -331 try { -332 in.close(); -333 } catch (IOException ex) { -334 LOGGER.trace("", ex); -335 } -336 } -337 } -338 logProperties("Properties loaded", props); -339 } -340 -341 /** -342 * Initializes the thread local settings object. Note, to use the settings object you must call this method. However, you must -343 * also call Settings.cleanup() to properly release resources. -344 */ -345 public static void initialize() { -346 localSettings.set(new Settings(PROPERTIES_FILE)); -347 } -348 -349 /** -350 * Initializes the thread local settings object. Note, to use the settings object you must call this method. However, you must -351 * also call Settings.cleanup() to properly release resources. -352 * -353 * @param propertiesFilePath the path to the base properties file to load -354 */ -355 public static void initialize(String propertiesFilePath) { -356 localSettings.set(new Settings(propertiesFilePath)); -357 } -358 -359 /** -360 * Cleans up resources to prevent memory leaks. -361 * -362 */ -363 public static void cleanup() { -364 cleanup(true); -365 } -366 -367 /** -368 * Cleans up resources to prevent memory leaks. -369 * -370 * @param deleteTemporary flag indicating whether any temporary directories generated should be removed -371 */ -372 public static void cleanup(boolean deleteTemporary) { -373 if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) { -374 FileUtils.delete(tempDirectory); -375 if (tempDirectory.exists()) { -376 try { -377 Thread.sleep(2000); -378 } catch (InterruptedException ex) { -379 LOGGER.trace("ignore", ex); -380 } -381 FileUtils.delete(tempDirectory); -382 } -383 } -384 try { -385 localSettings.remove(); -386 } catch (Throwable ex) { -387 LOGGER.debug("Error cleaning up Settings", ex); -388 } -389 } -390 -391 /** -392 * Gets the underlying instance of the Settings object. -393 * -394 * @return the Settings object -395 */ -396 public static Settings getInstance() { -397 return localSettings.get(); -398 } -399 -400 /** -401 * Sets the instance of the Settings object to use in this thread. -402 * -403 * @param instance the instance of the settings object to use in this thread -404 */ -405 public static void setInstance(Settings instance) { -406 localSettings.set(instance); -407 } -408 -409 /** -410 * Logs the properties. This will not log any properties that contain 'password' in the key. -411 * -412 * @param header the header to print with the log message -413 * @param properties the properties to log -414 */ -415 private static void logProperties(String header, Properties properties) { -416 if (LOGGER.isDebugEnabled()) { -417 final StringWriter sw = new StringWriter(); -418 PrintWriter pw = null; -419 try { -420 pw = new PrintWriter(sw); -421 pw.format("%s:%n%n", header); -422 final Enumeration<?> e = properties.propertyNames(); -423 while (e.hasMoreElements()) { -424 final String key = (String) e.nextElement(); -425 if (key.contains("password")) { -426 pw.format("%s='*****'%n", key); -427 } else { -428 final String value = properties.getProperty(key); -429 if (value != null) { -430 pw.format("%s='%s'%n", key, value); -431 } -432 } -433 } -434 pw.flush(); -435 LOGGER.debug(sw.toString()); -436 } finally { -437 if (pw != null) { -438 pw.close(); -439 } -440 } -441 -442 } -443 } -444 -445 /** -446 * Sets a property value. -447 * -448 * @param key the key for the property -449 * @param value the value for the property -450 */ -451 public static void setString(String key, String value) { -452 localSettings.get().props.setProperty(key, value); -453 LOGGER.debug("Setting: {}='{}'", key, value); -454 } -455 -456 /** -457 * Sets a property value. -458 * -459 * @param key the key for the property -460 * @param value the value for the property -461 */ -462 public static void setBoolean(String key, boolean value) { -463 if (value) { -464 localSettings.get().props.setProperty(key, Boolean.TRUE.toString()); -465 } else { -466 localSettings.get().props.setProperty(key, Boolean.FALSE.toString()); -467 } -468 LOGGER.debug("Setting: {}='{}'", key, value); -469 } -470 -471 /** -472 * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties -473 * file.<br/><br/> -474 * Note: even if using this method - system properties will be loaded before properties loaded from files. -475 * -476 * @param filePath the path to the properties file to merge. -477 * @throws FileNotFoundException is thrown when the filePath points to a non-existent file -478 * @throws IOException is thrown when there is an exception loading/merging the properties -479 */ -480 public static void mergeProperties(File filePath) throws FileNotFoundException, IOException { -481 FileInputStream fis = null; -482 try { -483 fis = new FileInputStream(filePath); -484 mergeProperties(fis); -485 } finally { -486 if (fis != null) { -487 try { -488 fis.close(); -489 } catch (IOException ex) { -490 LOGGER.trace("close error", ex); -491 } -492 } -493 } -494 } -495 -496 /** -497 * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties -498 * file.<br/><br/> -499 * Note: even if using this method - system properties will be loaded before properties loaded from files. -500 * -501 * @param filePath the path to the properties file to merge. -502 * @throws FileNotFoundException is thrown when the filePath points to a non-existent file -503 * @throws IOException is thrown when there is an exception loading/merging the properties -504 */ -505 public static void mergeProperties(String filePath) throws FileNotFoundException, IOException { -506 FileInputStream fis = null; -507 try { -508 fis = new FileInputStream(filePath); -509 mergeProperties(fis); -510 } finally { -511 if (fis != null) { -512 try { -513 fis.close(); -514 } catch (IOException ex) { -515 LOGGER.trace("close error", ex); -516 } -517 } -518 } -519 } -520 -521 /** -522 * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties -523 * file.<br/><br/> -524 * Note: even if using this method - system properties will be loaded before properties loaded from files. -525 * -526 * @param stream an Input Stream pointing at a properties file to merge -527 * @throws IOException is thrown when there is an exception loading/merging the properties -528 */ -529 public static void mergeProperties(InputStream stream) throws IOException { -530 localSettings.get().props.load(stream); -531 logProperties("Properties updated via merge", localSettings.get().props); -532 } -533 -534 /** -535 * Returns a value from the properties file as a File object. If the value was specified as a system property or passed in via -536 * the -Dprop=value argument - this method will return the value from the system properties before the values in the contained -537 * configuration file. -538 * -539 * @param key the key to lookup within the properties file -540 * @return the property from the properties file converted to a File object -541 */ -542 public static File getFile(String key) { -543 final String file = getString(key); -544 if (file == null) { -545 return null; +267 public static final String ADDITIONAL_ZIP_EXTENSIONS = "extensions.zip"; +268 /** +269 * The key to obtain the path to the VFEED data file. +270 */ +271 public static final String VFEED_DATA_FILE = "vfeed.data_file"; +272 /** +273 * The key to obtain the VFEED connection string. +274 */ +275 public static final String VFEED_CONNECTION_STRING = "vfeed.connection_string"; +276 +277 /** +278 * The key to obtain the base download URL for the VFeed data file. +279 */ +280 public static final String VFEED_DOWNLOAD_URL = "vfeed.download_url"; +281 /** +282 * The key to obtain the download file name for the VFeed data. +283 */ +284 public static final String VFEED_DOWNLOAD_FILE = "vfeed.download_file"; +285 /** +286 * The key to obtain the VFeed update status. +287 */ +288 public static final String VFEED_UPDATE_STATUS = "vfeed.update_status"; +289 +290 /** +291 * The HTTP request method for query last modified date. +292 */ +293 public static final String DOWNLOADER_QUICK_QUERY_TIMESTAMP = "downloader.quick.query.timestamp"; +294 } +295 //</editor-fold> +296 +297 /** +298 * The logger. +299 */ +300 private static final Logger LOGGER = LoggerFactory.getLogger(Settings.class); +301 /** +302 * The properties file location. +303 */ +304 private static final String PROPERTIES_FILE = "dependencycheck.properties"; +305 /** +306 * Thread local settings. +307 */ +308 private static ThreadLocal<Settings> localSettings = new ThreadLocal<Settings>(); +309 /** +310 * The properties. +311 */ +312 private Properties props = null; +313 +314 /** +315 * Private constructor for the Settings class. This class loads the properties files. +316 * +317 * @param propertiesFilePath the path to the base properties file to load +318 */ +319 private Settings(String propertiesFilePath) { +320 InputStream in = null; +321 props = new Properties(); +322 try { +323 in = this.getClass().getClassLoader().getResourceAsStream(propertiesFilePath); +324 props.load(in); +325 } catch (IOException ex) { +326 LOGGER.error("Unable to load default settings."); +327 LOGGER.debug("", ex); +328 } finally { +329 if (in != null) { +330 try { +331 in.close(); +332 } catch (IOException ex) { +333 LOGGER.trace("", ex); +334 } +335 } +336 } +337 logProperties("Properties loaded", props); +338 } +339 +340 /** +341 * Initializes the thread local settings object. Note, to use the settings object you must call this method. However, you must +342 * also call Settings.cleanup() to properly release resources. +343 */ +344 public static void initialize() { +345 localSettings.set(new Settings(PROPERTIES_FILE)); +346 } +347 +348 /** +349 * Initializes the thread local settings object. Note, to use the settings object you must call this method. However, you must +350 * also call Settings.cleanup() to properly release resources. +351 * +352 * @param propertiesFilePath the path to the base properties file to load +353 */ +354 public static void initialize(String propertiesFilePath) { +355 localSettings.set(new Settings(propertiesFilePath)); +356 } +357 +358 /** +359 * Cleans up resources to prevent memory leaks. +360 * +361 */ +362 public static void cleanup() { +363 cleanup(true); +364 } +365 +366 /** +367 * Cleans up resources to prevent memory leaks. +368 * +369 * @param deleteTemporary flag indicating whether any temporary directories generated should be removed +370 */ +371 public static void cleanup(boolean deleteTemporary) { +372 if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) { +373 FileUtils.delete(tempDirectory); +374 if (tempDirectory.exists()) { +375 try { +376 Thread.sleep(2000); +377 } catch (InterruptedException ex) { +378 LOGGER.trace("ignore", ex); +379 } +380 FileUtils.delete(tempDirectory); +381 } +382 } +383 try { +384 localSettings.remove(); +385 } catch (Throwable ex) { +386 LOGGER.debug("Error cleaning up Settings", ex); +387 } +388 } +389 +390 /** +391 * Gets the underlying instance of the Settings object. +392 * +393 * @return the Settings object +394 */ +395 public static Settings getInstance() { +396 return localSettings.get(); +397 } +398 +399 /** +400 * Sets the instance of the Settings object to use in this thread. +401 * +402 * @param instance the instance of the settings object to use in this thread +403 */ +404 public static void setInstance(Settings instance) { +405 localSettings.set(instance); +406 } +407 +408 /** +409 * Logs the properties. This will not log any properties that contain 'password' in the key. +410 * +411 * @param header the header to print with the log message +412 * @param properties the properties to log +413 */ +414 private static void logProperties(String header, Properties properties) { +415 if (LOGGER.isDebugEnabled()) { +416 final StringWriter sw = new StringWriter(); +417 PrintWriter pw = null; +418 try { +419 pw = new PrintWriter(sw); +420 pw.format("%s:%n%n", header); +421 final Enumeration<?> e = properties.propertyNames(); +422 while (e.hasMoreElements()) { +423 final String key = (String) e.nextElement(); +424 if (key.contains("password")) { +425 pw.format("%s='*****'%n", key); +426 } else { +427 final String value = properties.getProperty(key); +428 if (value != null) { +429 pw.format("%s='%s'%n", key, value); +430 } +431 } +432 } +433 pw.flush(); +434 LOGGER.debug(sw.toString()); +435 } finally { +436 if (pw != null) { +437 pw.close(); +438 } +439 } +440 +441 } +442 } +443 +444 /** +445 * Sets a property value. +446 * +447 * @param key the key for the property +448 * @param value the value for the property +449 */ +450 public static void setString(String key, String value) { +451 localSettings.get().props.setProperty(key, value); +452 LOGGER.debug("Setting: {}='{}'", key, value); +453 } +454 +455 /** +456 * Sets a property value only if the value is not null. +457 * +458 * @param key the key for the property +459 * @param value the value for the property +460 */ +461 public static void setStringIfNotNull(String key, String value) { +462 if (null != value) { +463 setString(key, value); +464 } +465 } +466 +467 /** +468 * Sets a property value only if the value is not null and not empty. +469 * +470 * @param key the key for the property +471 * @param value the value for the property +472 */ +473 public static void setStringIfNotEmpty(String key, String value) { +474 if (null != value && !value.isEmpty()) { +475 setString(key, value); +476 } +477 } +478 +479 /** +480 * Sets a property value. +481 * +482 * @param key the key for the property +483 * @param value the value for the property +484 */ +485 public static void setBoolean(String key, boolean value) { +486 setString(key, Boolean.toString(value)); +487 } +488 +489 /** +490 * Sets a property value only if the value is not null. +491 * +492 * @param key the key for the property +493 * @param value the value for the property +494 */ +495 public static void setBooleanIfNotNull(String key, Boolean value) { +496 if (null != value) { +497 setBoolean(key, value); +498 } +499 } +500 +501 /** +502 * Sets a property value. +503 * +504 * @param key the key for the property +505 * @param value the value for the property +506 */ +507 public static void setInt(String key, int value) { +508 localSettings.get().props.setProperty(key, String.valueOf(value)); +509 LOGGER.debug("Setting: {}='{}'", key, value); +510 } +511 +512 /** +513 * Sets a property value only if the value is not null. +514 * +515 * @param key the key for the property +516 * @param value the value for the property +517 */ +518 public static void setIntIfNotNull(String key, Integer value) { +519 if (null != value) { +520 setInt(key, value); +521 } +522 } +523 +524 /** +525 * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties +526 * file.<br/><br/> +527 * Note: even if using this method - system properties will be loaded before properties loaded from files. +528 * +529 * @param filePath the path to the properties file to merge. +530 * @throws FileNotFoundException is thrown when the filePath points to a non-existent file +531 * @throws IOException is thrown when there is an exception loading/merging the properties +532 */ +533 public static void mergeProperties(File filePath) throws FileNotFoundException, IOException { +534 FileInputStream fis = null; +535 try { +536 fis = new FileInputStream(filePath); +537 mergeProperties(fis); +538 } finally { +539 if (fis != null) { +540 try { +541 fis.close(); +542 } catch (IOException ex) { +543 LOGGER.trace("close error", ex); +544 } +545 } 546 } -547 return new File(file); -548 } -549 -550 /** -551 * Returns a value from the properties file as a File object. If the value was specified as a system property or passed in via -552 * the -Dprop=value argument - this method will return the value from the system properties before the values in the contained -553 * configuration file. -554 * -555 * This method will check the configured base directory and will use this as the base of the file path. Additionally, if the -556 * base directory begins with a leading "[JAR]\" sequence with the path to the folder containing the JAR file containing this -557 * class. -558 * -559 * @param key the key to lookup within the properties file -560 * @return the property from the properties file converted to a File object -561 */ -562 protected static File getDataFile(String key) { -563 final String file = getString(key); -564 LOGGER.debug("Settings.getDataFile() - file: '{}'", file); -565 if (file == null) { -566 return null; -567 } -568 if (file.startsWith("[JAR]")) { -569 LOGGER.debug("Settings.getDataFile() - transforming filename"); -570 final File jarPath = getJarPath(); -571 LOGGER.debug("Settings.getDataFile() - jar file: '{}'", jarPath.toString()); -572 final File retVal = new File(jarPath, file.substring(6)); -573 LOGGER.debug("Settings.getDataFile() - returning: '{}'", retVal.toString()); -574 return retVal; -575 } -576 return new File(file); -577 } -578 -579 /** -580 * Attempts to retrieve the folder containing the Jar file containing the Settings class. -581 * -582 * @return a File object -583 */ -584 private static File getJarPath() { -585 final String jarPath = Settings.class.getProtectionDomain().getCodeSource().getLocation().getPath(); -586 String decodedPath = "."; -587 try { -588 decodedPath = URLDecoder.decode(jarPath, "UTF-8"); -589 } catch (UnsupportedEncodingException ex) { -590 LOGGER.trace("", ex); -591 } -592 -593 final File path = new File(decodedPath); -594 if (path.getName().toLowerCase().endsWith(".jar")) { -595 return path.getParentFile(); -596 } else { -597 return new File("."); -598 } -599 } -600 -601 /** -602 * Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value -603 * argument - this method will return the value from the system properties before the values in the contained configuration -604 * file. -605 * -606 * @param key the key to lookup within the properties file -607 * @param defaultValue the default value for the requested property -608 * @return the property from the properties file -609 */ -610 public static String getString(String key, String defaultValue) { -611 final String str = System.getProperty(key, localSettings.get().props.getProperty(key, defaultValue)); -612 return str; -613 } -614 -615 /** -616 * A reference to the temporary directory; used incase it needs to be deleted during cleanup. -617 */ -618 private static File tempDirectory = null; -619 -620 /** -621 * Returns the temporary directory. -622 * -623 * @return the temporary directory -624 * @throws java.io.IOException thrown if the temporary directory does not exist and cannot be created -625 */ -626 public static File getTempDirectory() throws IOException { -627 final File tmpDir = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")), "dctemp"); -628 if (!tmpDir.exists() && !tmpDir.mkdirs()) { -629 final String msg = String.format("Unable to make a temporary folder '%s'", tmpDir.getPath()); -630 throw new IOException(msg); -631 } -632 tempDirectory = tmpDir; -633 return tmpDir; -634 } -635 -636 /** -637 * Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value -638 * argument - this method will return the value from the system properties before the values in the contained configuration -639 * file. -640 * -641 * @param key the key to lookup within the properties file -642 * @return the property from the properties file -643 */ -644 public static String getString(String key) { -645 return System.getProperty(key, localSettings.get().props.getProperty(key)); -646 } -647 -648 /** -649 * Removes a property from the local properties collection. This is mainly used in test cases. -650 * -651 * @param key the property key to remove -652 */ -653 public static void removeProperty(String key) { -654 localSettings.get().props.remove(key); -655 } -656 -657 /** -658 * Returns an int value from the properties file. If the value was specified as a system property or passed in via the -659 * -Dprop=value argument - this method will return the value from the system properties before the values in the contained -660 * configuration file. -661 * -662 * @param key the key to lookup within the properties file -663 * @return the property from the properties file -664 * @throws InvalidSettingException is thrown if there is an error retrieving the setting -665 */ -666 public static int getInt(String key) throws InvalidSettingException { -667 int value; -668 try { -669 value = Integer.parseInt(Settings.getString(key)); -670 } catch (NumberFormatException ex) { -671 throw new InvalidSettingException("Could not convert property '" + key + "' to an int.", ex); -672 } -673 return value; -674 } -675 -676 /** -677 * Returns an int value from the properties file. If the value was specified as a system property or passed in via the -678 * -Dprop=value argument - this method will return the value from the system properties before the values in the contained -679 * configuration file. -680 * -681 * @param key the key to lookup within the properties file -682 * @param defaultValue the default value to return -683 * @return the property from the properties file or the defaultValue if the property does not exist or cannot be converted to -684 * an integer -685 */ -686 public static int getInt(String key, int defaultValue) { -687 int value; -688 try { -689 value = Integer.parseInt(Settings.getString(key)); -690 } catch (NumberFormatException ex) { -691 LOGGER.trace("Could not convert property '{}' to an int.", key, ex); -692 value = defaultValue; -693 } -694 return value; -695 } -696 -697 /** -698 * Returns a long value from the properties file. If the value was specified as a system property or passed in via the -699 * -Dprop=value argument - this method will return the value from the system properties before the values in the contained -700 * configuration file. -701 * -702 * @param key the key to lookup within the properties file -703 * @return the property from the properties file -704 * @throws InvalidSettingException is thrown if there is an error retrieving the setting +547 } +548 +549 /** +550 * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties +551 * file.<br/><br/> +552 * Note: even if using this method - system properties will be loaded before properties loaded from files. +553 * +554 * @param filePath the path to the properties file to merge. +555 * @throws FileNotFoundException is thrown when the filePath points to a non-existent file +556 * @throws IOException is thrown when there is an exception loading/merging the properties +557 */ +558 public static void mergeProperties(String filePath) throws FileNotFoundException, IOException { +559 FileInputStream fis = null; +560 try { +561 fis = new FileInputStream(filePath); +562 mergeProperties(fis); +563 } finally { +564 if (fis != null) { +565 try { +566 fis.close(); +567 } catch (IOException ex) { +568 LOGGER.trace("close error", ex); +569 } +570 } +571 } +572 } +573 +574 /** +575 * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties +576 * file.<br/><br/> +577 * Note: even if using this method - system properties will be loaded before properties loaded from files. +578 * +579 * @param stream an Input Stream pointing at a properties file to merge +580 * @throws IOException is thrown when there is an exception loading/merging the properties +581 */ +582 public static void mergeProperties(InputStream stream) throws IOException { +583 localSettings.get().props.load(stream); +584 logProperties("Properties updated via merge", localSettings.get().props); +585 } +586 +587 /** +588 * Returns a value from the properties file as a File object. If the value was specified as a system property or passed in via +589 * the -Dprop=value argument - this method will return the value from the system properties before the values in the contained +590 * configuration file. +591 * +592 * @param key the key to lookup within the properties file +593 * @return the property from the properties file converted to a File object +594 */ +595 public static File getFile(String key) { +596 final String file = getString(key); +597 if (file == null) { +598 return null; +599 } +600 return new File(file); +601 } +602 +603 /** +604 * Returns a value from the properties file as a File object. If the value was specified as a system property or passed in via +605 * the -Dprop=value argument - this method will return the value from the system properties before the values in the contained +606 * configuration file. +607 * +608 * This method will check the configured base directory and will use this as the base of the file path. Additionally, if the +609 * base directory begins with a leading "[JAR]\" sequence with the path to the folder containing the JAR file containing this +610 * class. +611 * +612 * @param key the key to lookup within the properties file +613 * @return the property from the properties file converted to a File object +614 */ +615 protected static File getDataFile(String key) { +616 final String file = getString(key); +617 LOGGER.debug("Settings.getDataFile() - file: '{}'", file); +618 if (file == null) { +619 return null; +620 } +621 if (file.startsWith("[JAR]")) { +622 LOGGER.debug("Settings.getDataFile() - transforming filename"); +623 final File jarPath = getJarPath(); +624 LOGGER.debug("Settings.getDataFile() - jar file: '{}'", jarPath.toString()); +625 final File retVal = new File(jarPath, file.substring(6)); +626 LOGGER.debug("Settings.getDataFile() - returning: '{}'", retVal.toString()); +627 return retVal; +628 } +629 return new File(file); +630 } +631 +632 /** +633 * Attempts to retrieve the folder containing the Jar file containing the Settings class. +634 * +635 * @return a File object +636 */ +637 private static File getJarPath() { +638 final String jarPath = Settings.class.getProtectionDomain().getCodeSource().getLocation().getPath(); +639 String decodedPath = "."; +640 try { +641 decodedPath = URLDecoder.decode(jarPath, "UTF-8"); +642 } catch (UnsupportedEncodingException ex) { +643 LOGGER.trace("", ex); +644 } +645 +646 final File path = new File(decodedPath); +647 if (path.getName().toLowerCase().endsWith(".jar")) { +648 return path.getParentFile(); +649 } else { +650 return new File("."); +651 } +652 } +653 +654 /** +655 * Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value +656 * argument - this method will return the value from the system properties before the values in the contained configuration +657 * file. +658 * +659 * @param key the key to lookup within the properties file +660 * @param defaultValue the default value for the requested property +661 * @return the property from the properties file +662 */ +663 public static String getString(String key, String defaultValue) { +664 final String str = System.getProperty(key, localSettings.get().props.getProperty(key, defaultValue)); +665 return str; +666 } +667 +668 /** +669 * A reference to the temporary directory; used incase it needs to be deleted during cleanup. +670 */ +671 private static File tempDirectory = null; +672 +673 /** +674 * Returns the temporary directory. +675 * +676 * @return the temporary directory +677 * @throws java.io.IOException thrown if the temporary directory does not exist and cannot be created +678 */ +679 public static File getTempDirectory() throws IOException { +680 final File tmpDir = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")), "dctemp"); +681 if (!tmpDir.exists() && !tmpDir.mkdirs()) { +682 final String msg = String.format("Unable to make a temporary folder '%s'", tmpDir.getPath()); +683 throw new IOException(msg); +684 } +685 tempDirectory = tmpDir; +686 return tmpDir; +687 } +688 +689 /** +690 * Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value +691 * argument - this method will return the value from the system properties before the values in the contained configuration +692 * file. +693 * +694 * @param key the key to lookup within the properties file +695 * @return the property from the properties file +696 */ +697 public static String getString(String key) { +698 return System.getProperty(key, localSettings.get().props.getProperty(key)); +699 } +700 +701 /** +702 * Removes a property from the local properties collection. This is mainly used in test cases. +703 * +704 * @param key the property key to remove 705 */ -706 public static long getLong(String key) throws InvalidSettingException { -707 long value; -708 try { -709 value = Long.parseLong(Settings.getString(key)); -710 } catch (NumberFormatException ex) { -711 throw new InvalidSettingException("Could not convert property '" + key + "' to an int.", ex); -712 } -713 return value; -714 } -715 -716 /** -717 * Returns a boolean value from the properties file. If the value was specified as a system property or passed in via the -718 * <code>-Dprop=value</code> argument this method will return the value from the system properties before the values in the -719 * contained configuration file. -720 * -721 * @param key the key to lookup within the properties file -722 * @return the property from the properties file -723 * @throws InvalidSettingException is thrown if there is an error retrieving the setting -724 */ -725 public static boolean getBoolean(String key) throws InvalidSettingException { -726 boolean value; -727 try { -728 value = Boolean.parseBoolean(Settings.getString(key)); -729 } catch (NumberFormatException ex) { -730 throw new InvalidSettingException("Could not convert property '" + key + "' to an int.", ex); -731 } -732 return value; -733 } -734 -735 /** -736 * Returns a boolean value from the properties file. If the value was specified as a system property or passed in via the -737 * <code>-Dprop=value</code> argument this method will return the value from the system properties before the values in the -738 * contained configuration file. -739 * -740 * @param key the key to lookup within the properties file -741 * @param defaultValue the default value to return if the setting does not exist -742 * @return the property from the properties file -743 * @throws InvalidSettingException is thrown if there is an error retrieving the setting -744 */ -745 public static boolean getBoolean(String key, boolean defaultValue) throws InvalidSettingException { -746 boolean value; -747 try { -748 final String strValue = Settings.getString(key); -749 if (strValue == null) { -750 return defaultValue; -751 } -752 value = Boolean.parseBoolean(strValue); -753 } catch (NumberFormatException ex) { -754 throw new InvalidSettingException("Could not convert property '" + key + "' to an int.", ex); -755 } -756 return value; -757 } -758 -759 /** -760 * Returns a connection string from the configured properties. If the connection string contains a %s, this method will -761 * determine the 'data' directory and replace the %s with the path to the data directory. If the data directory does not -762 * exists it will be created. -763 * -764 * @param connectionStringKey the property file key for the connection string -765 * @param dbFileNameKey the settings key for the db filename -766 * @return the connection string -767 * @throws IOException thrown the data directory cannot be created -768 * @throws InvalidSettingException thrown if there is an invalid setting -769 */ -770 public static String getConnectionString(String connectionStringKey, String dbFileNameKey) -771 throws IOException, InvalidSettingException { -772 final String connStr = Settings.getString(connectionStringKey); -773 if (connStr == null) { -774 final String msg = String.format("Invalid properties file; %s is missing.", connectionStringKey); -775 throw new InvalidSettingException(msg); -776 } -777 if (connStr.contains("%s")) { -778 final File directory = getDataDirectory(); -779 String fileName = null; -780 if (dbFileNameKey != null) { -781 fileName = Settings.getString(dbFileNameKey); -782 } -783 if (fileName == null) { -784 final String msg = String.format("Invalid properties file to get a file based connection string; '%s' must be defined.", -785 dbFileNameKey); -786 throw new InvalidSettingException(msg); -787 } -788 if (connStr.startsWith("jdbc:h2:file:") && fileName.endsWith(".h2.db")) { -789 fileName = fileName.substring(0, fileName.length() - 6); -790 } -791 // yes, for H2 this path won't actually exists - but this is sufficient to get the value needed -792 final File dbFile = new File(directory, fileName); -793 final String cString = String.format(connStr, dbFile.getCanonicalPath()); -794 LOGGER.debug("Connection String: '{}'", cString); -795 return cString; -796 } -797 return connStr; -798 } -799 -800 /** -801 * Retrieves the directory that the JAR file exists in so that we can ensure we always use a common data directory for the -802 * embedded H2 database. This is public solely for some unit tests; otherwise this should be private. -803 * -804 * @return the data directory to store data files -805 * @throws IOException is thrown if an IOException occurs of course... -806 */ -807 public static File getDataDirectory() throws IOException { -808 final File path = Settings.getDataFile(Settings.KEYS.DATA_DIRECTORY); -809 if (path.exists() || path.mkdirs()) { -810 return path; -811 } -812 throw new IOException(String.format("Unable to create the data directory '%s'", path.getAbsolutePath())); -813 } -814 } +706 public static void removeProperty(String key) { +707 localSettings.get().props.remove(key); +708 } +709 +710 /** +711 * Returns an int value from the properties file. If the value was specified as a system property or passed in via the +712 * -Dprop=value argument - this method will return the value from the system properties before the values in the contained +713 * configuration file. +714 * +715 * @param key the key to lookup within the properties file +716 * @return the property from the properties file +717 * @throws InvalidSettingException is thrown if there is an error retrieving the setting +718 */ +719 public static int getInt(String key) throws InvalidSettingException { +720 try { +721 return Integer.parseInt(Settings.getString(key)); +722 } catch (NumberFormatException ex) { +723 throw new InvalidSettingException("Could not convert property '" + key + "' to an int.", ex); +724 } +725 } +726 +727 /** +728 * Returns an int value from the properties file. If the value was specified as a system property or passed in via the +729 * -Dprop=value argument - this method will return the value from the system properties before the values in the contained +730 * configuration file. +731 * +732 * @param key the key to lookup within the properties file +733 * @param defaultValue the default value to return +734 * @return the property from the properties file or the defaultValue if the property does not exist or cannot be converted to +735 * an integer +736 */ +737 public static int getInt(String key, int defaultValue) { +738 int value; +739 try { +740 value = Integer.parseInt(Settings.getString(key)); +741 } catch (NumberFormatException ex) { +742 LOGGER.trace("Could not convert property '{}' to an int.", key, ex); +743 value = defaultValue; +744 } +745 return value; +746 } +747 +748 /** +749 * Returns a long value from the properties file. If the value was specified as a system property or passed in via the +750 * -Dprop=value argument - this method will return the value from the system properties before the values in the contained +751 * configuration file. +752 * +753 * @param key the key to lookup within the properties file +754 * @return the property from the properties file +755 * @throws InvalidSettingException is thrown if there is an error retrieving the setting +756 */ +757 public static long getLong(String key) throws InvalidSettingException { +758 try { +759 return Long.parseLong(Settings.getString(key)); +760 } catch (NumberFormatException ex) { +761 throw new InvalidSettingException("Could not convert property '" + key + "' to a long.", ex); +762 } +763 } +764 +765 /** +766 * Returns a boolean value from the properties file. If the value was specified as a system property or passed in via the +767 * <code>-Dprop=value</code> argument this method will return the value from the system properties before the values in the +768 * contained configuration file. +769 * +770 * @param key the key to lookup within the properties file +771 * @return the property from the properties file +772 * @throws InvalidSettingException is thrown if there is an error retrieving the setting +773 */ +774 public static boolean getBoolean(String key) throws InvalidSettingException { +775 return Boolean.parseBoolean(Settings.getString(key)); +776 } +777 +778 /** +779 * Returns a boolean value from the properties file. If the value was specified as a system property or passed in via the +780 * <code>-Dprop=value</code> argument this method will return the value from the system properties before the values in the +781 * contained configuration file. +782 * +783 * @param key the key to lookup within the properties file +784 * @param defaultValue the default value to return if the setting does not exist +785 * @return the property from the properties file +786 * @throws InvalidSettingException is thrown if there is an error retrieving the setting +787 */ +788 public static boolean getBoolean(String key, boolean defaultValue) throws InvalidSettingException { +789 return Boolean.parseBoolean(Settings.getString(key, Boolean.toString(defaultValue))); +790 } +791 +792 /** +793 * Returns a connection string from the configured properties. If the connection string contains a %s, this method will +794 * determine the 'data' directory and replace the %s with the path to the data directory. If the data directory does not +795 * exists it will be created. +796 * +797 * @param connectionStringKey the property file key for the connection string +798 * @param dbFileNameKey the settings key for the db filename +799 * @return the connection string +800 * @throws IOException thrown the data directory cannot be created +801 * @throws InvalidSettingException thrown if there is an invalid setting +802 */ +803 public static String getConnectionString(String connectionStringKey, String dbFileNameKey) +804 throws IOException, InvalidSettingException { +805 final String connStr = Settings.getString(connectionStringKey); +806 if (connStr == null) { +807 final String msg = String.format("Invalid properties file; %s is missing.", connectionStringKey); +808 throw new InvalidSettingException(msg); +809 } +810 if (connStr.contains("%s")) { +811 final File directory = getDataDirectory(); +812 String fileName = null; +813 if (dbFileNameKey != null) { +814 fileName = Settings.getString(dbFileNameKey); +815 } +816 if (fileName == null) { +817 final String msg = String.format("Invalid properties file to get a file based connection string; '%s' must be defined.", +818 dbFileNameKey); +819 throw new InvalidSettingException(msg); +820 } +821 if (connStr.startsWith("jdbc:h2:file:") && fileName.endsWith(".h2.db")) { +822 fileName = fileName.substring(0, fileName.length() - 6); +823 } +824 // yes, for H2 this path won't actually exists - but this is sufficient to get the value needed +825 final File dbFile = new File(directory, fileName); +826 final String cString = String.format(connStr, dbFile.getCanonicalPath()); +827 LOGGER.debug("Connection String: '{}'", cString); +828 return cString; +829 } +830 return connStr; +831 } +832 +833 /** +834 * Retrieves the directory that the JAR file exists in so that we can ensure we always use a common data directory for the +835 * embedded H2 database. This is public solely for some unit tests; otherwise this should be private. +836 * +837 * @return the data directory to store data files +838 * @throws IOException is thrown if an IOException occurs of course... +839 */ +840 public static File getDataDirectory() throws IOException { +841 final File path = Settings.getDataFile(Settings.KEYS.DATA_DIRECTORY); +842 if (path.exists() || path.mkdirs()) { +843 return path; +844 } +845 throw new IOException(String.format("Unable to create the data directory '%s'", path.getAbsolutePath())); +846 } +847 }
        diff --git a/xref/org/owasp/dependencycheck/utils/URLConnectionFactory.html b/xref/org/owasp/dependencycheck/utils/URLConnectionFactory.html index 78c98d3ea..32115a3ee 100644 --- a/xref/org/owasp/dependencycheck/utils/URLConnectionFactory.html +++ b/xref/org/owasp/dependencycheck/utils/URLConnectionFactory.html @@ -60,74 +60,73 @@ 52 @SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE", justification = "Just being extra safe") 53 public static HttpURLConnection createHttpURLConnection(URL url) throws URLConnectionFailureException { 54 HttpURLConnection conn = null; -55 Proxy proxy; -56 final String proxyUrl = Settings.getString(Settings.KEYS.PROXY_SERVER); -57 try { -58 if (proxyUrl != null) { -59 final int proxyPort = Settings.getInt(Settings.KEYS.PROXY_PORT); -60 final SocketAddress address = new InetSocketAddress(proxyUrl, proxyPort); -61 -62 final String username = Settings.getString(Settings.KEYS.PROXY_USERNAME); -63 final String password = Settings.getString(Settings.KEYS.PROXY_PASSWORD); -64 if (username != null && password != null) { -65 final Authenticator auth = new Authenticator() { -66 @Override -67 public PasswordAuthentication getPasswordAuthentication() { -68 if (getRequestorType().equals(Authenticator.RequestorType.PROXY)) { -69 return new PasswordAuthentication(username, password.toCharArray()); -70 } -71 return super.getPasswordAuthentication(); -72 } -73 }; -74 Authenticator.setDefault(auth); -75 } -76 -77 proxy = new Proxy(Proxy.Type.HTTP, address); -78 conn = (HttpURLConnection) url.openConnection(proxy); -79 } else { -80 conn = (HttpURLConnection) url.openConnection(); -81 } -82 final int timeout = Settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000); -83 conn.setConnectTimeout(timeout); -84 conn.setInstanceFollowRedirects(true); -85 } catch (IOException ex) { -86 if (conn != null) { -87 try { -88 conn.disconnect(); -89 } finally { -90 conn = null; -91 } -92 } -93 throw new URLConnectionFailureException("Error getting connection.", ex); -94 } -95 return conn; -96 } -97 -98 /** -99 * Utility method to create an HttpURLConnection. The use of a proxy here is optional as there may be cases where a proxy is -100 * configured but we don't want to use it (for example, if there's an internal repository configured) -101 * -102 * @param url the URL to connect to -103 * @param proxy whether to use the proxy (if configured) -104 * @return a newly constructed HttpURLConnection -105 * @throws URLConnectionFailureException thrown if there is an exception -106 */ -107 public static HttpURLConnection createHttpURLConnection(URL url, boolean proxy) throws URLConnectionFailureException { -108 if (proxy) { -109 return createHttpURLConnection(url); -110 } -111 HttpURLConnection conn = null; -112 try { -113 conn = (HttpURLConnection) url.openConnection(); -114 final int timeout = Settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000); -115 conn.setConnectTimeout(timeout); -116 conn.setInstanceFollowRedirects(true); -117 } catch (IOException ioe) { -118 throw new URLConnectionFailureException("Error getting connection.", ioe); -119 } -120 return conn; -121 } -122 } +55 final String proxyUrl = Settings.getString(Settings.KEYS.PROXY_SERVER); +56 try { +57 if (proxyUrl != null) { +58 final int proxyPort = Settings.getInt(Settings.KEYS.PROXY_PORT); +59 final SocketAddress address = new InetSocketAddress(proxyUrl, proxyPort); +60 +61 final String username = Settings.getString(Settings.KEYS.PROXY_USERNAME); +62 final String password = Settings.getString(Settings.KEYS.PROXY_PASSWORD); +63 if (username != null && password != null) { +64 final Authenticator auth = new Authenticator() { +65 @Override +66 public PasswordAuthentication getPasswordAuthentication() { +67 if (getRequestorType().equals(Authenticator.RequestorType.PROXY)) { +68 return new PasswordAuthentication(username, password.toCharArray()); +69 } +70 return super.getPasswordAuthentication(); +71 } +72 }; +73 Authenticator.setDefault(auth); +74 } +75 +76 final Proxy proxy = new Proxy(Proxy.Type.HTTP, address); +77 conn = (HttpURLConnection) url.openConnection(proxy); +78 } else { +79 conn = (HttpURLConnection) url.openConnection(); +80 } +81 final int timeout = Settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000); +82 conn.setConnectTimeout(timeout); +83 conn.setInstanceFollowRedirects(true); +84 } catch (IOException ex) { +85 if (conn != null) { +86 try { +87 conn.disconnect(); +88 } finally { +89 conn = null; +90 } +91 } +92 throw new URLConnectionFailureException("Error getting connection.", ex); +93 } +94 return conn; +95 } +96 +97 /** +98 * Utility method to create an HttpURLConnection. The use of a proxy here is optional as there may be cases where a proxy is +99 * configured but we don't want to use it (for example, if there's an internal repository configured) +100 * +101 * @param url the URL to connect to +102 * @param proxy whether to use the proxy (if configured) +103 * @return a newly constructed HttpURLConnection +104 * @throws URLConnectionFailureException thrown if there is an exception +105 */ +106 public static HttpURLConnection createHttpURLConnection(URL url, boolean proxy) throws URLConnectionFailureException { +107 if (proxy) { +108 return createHttpURLConnection(url); +109 } +110 HttpURLConnection conn = null; +111 try { +112 conn = (HttpURLConnection) url.openConnection(); +113 final int timeout = Settings.getInt(Settings.KEYS.CONNECTION_TIMEOUT, 10000); +114 conn.setConnectTimeout(timeout); +115 conn.setInstanceFollowRedirects(true); +116 } catch (IOException ioe) { +117 throw new URLConnectionFailureException("Error getting connection.", ioe); +118 } +119 return conn; +120 } +121 }
        diff --git a/xref/org/owasp/dependencycheck/utils/package-frame.html b/xref/org/owasp/dependencycheck/utils/package-frame.html index 593fdfd10..4bd9cbc04 100644 --- a/xref/org/owasp/dependencycheck/utils/package-frame.html +++ b/xref/org/owasp/dependencycheck/utils/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.utils + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.utils @@ -59,9 +59,6 @@
      • KEYS -
      • -
      • - NonClosingStream
      • Pair diff --git a/xref/org/owasp/dependencycheck/utils/package-summary.html b/xref/org/owasp/dependencycheck/utils/package-summary.html index bda13c0fd..91394e6e6 100644 --- a/xref/org/owasp/dependencycheck/utils/package-summary.html +++ b/xref/org/owasp/dependencycheck/utils/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.utils + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.utils @@ -109,11 +109,6 @@
      • KEYS
        - NonClosingStream -
        diff --git a/xref/org/owasp/dependencycheck/xml/pom/Model.html b/xref/org/owasp/dependencycheck/xml/pom/Model.html index 04728c400..0fcb6f461 100644 --- a/xref/org/owasp/dependencycheck/xml/pom/Model.html +++ b/xref/org/owasp/dependencycheck/xml/pom/Model.html @@ -29,322 +29,333 @@ 21 import java.util.List; 22 import java.util.Properties; 23 -24 /** -25 * A simple pojo to hold data related to a Maven POM file. -26 * -27 * @author jeremy -28 */ -29 public class Model { -30 -31 /** -32 * The name of the project. -33 */ -34 private String name; -35 -36 /** -37 * Get the value of name. -38 * -39 * @return the value of name -40 */ -41 public String getName() { -42 return name; -43 } -44 -45 /** -46 * Set the value of name. -47 * -48 * @param name new value of name -49 */ -50 public void setName(String name) { -51 this.name = name; -52 } -53 -54 /** -55 * The organization name. -56 */ -57 private String organization; -58 -59 /** -60 * Get the value of organization. -61 * -62 * @return the value of organization -63 */ -64 public String getOrganization() { -65 return organization; -66 } -67 -68 /** -69 * Set the value of organization. -70 * -71 * @param organization new value of organization -72 */ -73 public void setOrganization(String organization) { -74 this.organization = organization; -75 } -76 -77 /** -78 * The description. -79 */ -80 private String description; -81 -82 /** -83 * Get the value of description. -84 * -85 * @return the value of description -86 */ -87 public String getDescription() { -88 return description; -89 } -90 -91 /** -92 * Set the value of description. -93 * -94 * @param description new value of description -95 */ -96 public void setDescription(String description) { -97 this.description = description; -98 } -99 -100 /** -101 * The group id. -102 */ -103 private String groupId; -104 -105 /** -106 * Get the value of groupId. -107 * -108 * @return the value of groupId -109 */ -110 public String getGroupId() { -111 return groupId; -112 } -113 -114 /** -115 * Set the value of groupId. -116 * -117 * @param groupId new value of groupId -118 */ -119 public void setGroupId(String groupId) { -120 this.groupId = groupId; -121 } -122 -123 /** -124 * The artifact id. -125 */ -126 private String artifactId; -127 -128 /** -129 * Get the value of artifactId. -130 * -131 * @return the value of artifactId -132 */ -133 public String getArtifactId() { -134 return artifactId; -135 } -136 -137 /** -138 * Set the value of artifactId. -139 * -140 * @param artifactId new value of artifactId -141 */ -142 public void setArtifactId(String artifactId) { -143 this.artifactId = artifactId; -144 } -145 -146 /** -147 * The version number. -148 */ -149 private String version; -150 -151 /** -152 * Get the value of version. -153 * -154 * @return the value of version -155 */ -156 public String getVersion() { -157 return version; -158 } -159 -160 /** -161 * Set the value of version. -162 * -163 * @param version new value of version -164 */ -165 public void setVersion(String version) { -166 this.version = version; -167 } -168 -169 /** -170 * The parent group id. -171 */ -172 private String parentGroupId; -173 -174 /** -175 * Get the value of parentGroupId. -176 * -177 * @return the value of parentGroupId -178 */ -179 public String getParentGroupId() { -180 return parentGroupId; -181 } -182 -183 /** -184 * Set the value of parentGroupId. -185 * -186 * @param parentGroupId new value of parentGroupId -187 */ -188 public void setParentGroupId(String parentGroupId) { -189 this.parentGroupId = parentGroupId; -190 } -191 -192 /** -193 * The parent artifact id. -194 */ -195 private String parentArtifactId; -196 -197 /** -198 * Get the value of parentArtifactId. -199 * -200 * @return the value of parentArtifactId -201 */ -202 public String getParentArtifactId() { -203 return parentArtifactId; -204 } -205 -206 /** -207 * Set the value of parentArtifactId. -208 * -209 * @param parentArtifactId new value of parentArtifactId -210 */ -211 public void setParentArtifactId(String parentArtifactId) { -212 this.parentArtifactId = parentArtifactId; -213 } -214 -215 /** -216 * The parent version number. -217 */ -218 private String parentVersion; -219 -220 /** -221 * Get the value of parentVersion. -222 * -223 * @return the value of parentVersion -224 */ -225 public String getParentVersion() { -226 return parentVersion; -227 } -228 -229 /** -230 * Set the value of parentVersion. -231 * -232 * @param parentVersion new value of parentVersion -233 */ -234 public void setParentVersion(String parentVersion) { -235 this.parentVersion = parentVersion; -236 } -237 -238 /** -239 * The list of licenses. -240 */ -241 private List<License> licenses = new ArrayList<License>(); -242 -243 /** -244 * Returns the list of licenses. -245 * -246 * @return the list of licenses -247 */ -248 public List<License> getLicenses() { -249 return licenses; -250 } -251 -252 /** -253 * Adds a new license to the list of licenses. -254 * -255 * @param license the license to add -256 */ -257 public void addLicense(License license) { -258 licenses.add(license); -259 } -260 -261 /** -262 * Process the Maven properties file and interpolate all properties. -263 * -264 * @param properties new value of properties -265 */ -266 public void processProperties(Properties properties) { -267 this.groupId = interpolateString(this.groupId, properties); -268 this.artifactId = interpolateString(this.artifactId, properties); -269 this.version = interpolateString(this.version, properties); -270 this.description = interpolateString(this.description, properties); -271 for (License l : this.getLicenses()) { -272 l.setName(interpolateString(l.getName(), properties)); -273 l.setUrl(interpolateString(l.getUrl(), properties)); -274 } -275 this.name = interpolateString(this.name, properties); -276 this.organization = interpolateString(this.organization, properties); -277 this.parentGroupId = interpolateString(this.parentGroupId, properties); -278 this.parentArtifactId = interpolateString(this.parentArtifactId, properties); -279 this.parentVersion = interpolateString(this.parentVersion, properties); -280 -281 } -282 -283 /** -284 * <p> -285 * A utility function that will interpolate strings based on values given in the properties file. It will also interpolate the -286 * strings contained within the properties file so that properties can reference other properties.</p> +24 import org.apache.commons.lang3.text.StrLookup; +25 import org.apache.commons.lang3.text.StrSubstitutor; +26 +27 /** +28 * A simple pojo to hold data related to a Maven POM file. +29 * +30 * @author jeremy +31 */ +32 public class Model { +33 +34 /** +35 * The name of the project. +36 */ +37 private String name; +38 +39 /** +40 * Get the value of name. +41 * +42 * @return the value of name +43 */ +44 public String getName() { +45 return name; +46 } +47 +48 /** +49 * Set the value of name. +50 * +51 * @param name new value of name +52 */ +53 public void setName(String name) { +54 this.name = name; +55 } +56 +57 /** +58 * The organization name. +59 */ +60 private String organization; +61 +62 /** +63 * Get the value of organization. +64 * +65 * @return the value of organization +66 */ +67 public String getOrganization() { +68 return organization; +69 } +70 +71 /** +72 * Set the value of organization. +73 * +74 * @param organization new value of organization +75 */ +76 public void setOrganization(String organization) { +77 this.organization = organization; +78 } +79 +80 /** +81 * The description. +82 */ +83 private String description; +84 +85 /** +86 * Get the value of description. +87 * +88 * @return the value of description +89 */ +90 public String getDescription() { +91 return description; +92 } +93 +94 /** +95 * Set the value of description. +96 * +97 * @param description new value of description +98 */ +99 public void setDescription(String description) { +100 this.description = description; +101 } +102 +103 /** +104 * The group id. +105 */ +106 private String groupId; +107 +108 /** +109 * Get the value of groupId. +110 * +111 * @return the value of groupId +112 */ +113 public String getGroupId() { +114 return groupId; +115 } +116 +117 /** +118 * Set the value of groupId. +119 * +120 * @param groupId new value of groupId +121 */ +122 public void setGroupId(String groupId) { +123 this.groupId = groupId; +124 } +125 +126 /** +127 * The artifact id. +128 */ +129 private String artifactId; +130 +131 /** +132 * Get the value of artifactId. +133 * +134 * @return the value of artifactId +135 */ +136 public String getArtifactId() { +137 return artifactId; +138 } +139 +140 /** +141 * Set the value of artifactId. +142 * +143 * @param artifactId new value of artifactId +144 */ +145 public void setArtifactId(String artifactId) { +146 this.artifactId = artifactId; +147 } +148 +149 /** +150 * The version number. +151 */ +152 private String version; +153 +154 /** +155 * Get the value of version. +156 * +157 * @return the value of version +158 */ +159 public String getVersion() { +160 return version; +161 } +162 +163 /** +164 * Set the value of version. +165 * +166 * @param version new value of version +167 */ +168 public void setVersion(String version) { +169 this.version = version; +170 } +171 +172 /** +173 * The parent group id. +174 */ +175 private String parentGroupId; +176 +177 /** +178 * Get the value of parentGroupId. +179 * +180 * @return the value of parentGroupId +181 */ +182 public String getParentGroupId() { +183 return parentGroupId; +184 } +185 +186 /** +187 * Set the value of parentGroupId. +188 * +189 * @param parentGroupId new value of parentGroupId +190 */ +191 public void setParentGroupId(String parentGroupId) { +192 this.parentGroupId = parentGroupId; +193 } +194 +195 /** +196 * The parent artifact id. +197 */ +198 private String parentArtifactId; +199 +200 /** +201 * Get the value of parentArtifactId. +202 * +203 * @return the value of parentArtifactId +204 */ +205 public String getParentArtifactId() { +206 return parentArtifactId; +207 } +208 +209 /** +210 * Set the value of parentArtifactId. +211 * +212 * @param parentArtifactId new value of parentArtifactId +213 */ +214 public void setParentArtifactId(String parentArtifactId) { +215 this.parentArtifactId = parentArtifactId; +216 } +217 +218 /** +219 * The parent version number. +220 */ +221 private String parentVersion; +222 +223 /** +224 * Get the value of parentVersion. +225 * +226 * @return the value of parentVersion +227 */ +228 public String getParentVersion() { +229 return parentVersion; +230 } +231 +232 /** +233 * Set the value of parentVersion. +234 * +235 * @param parentVersion new value of parentVersion +236 */ +237 public void setParentVersion(String parentVersion) { +238 this.parentVersion = parentVersion; +239 } +240 +241 /** +242 * The list of licenses. +243 */ +244 private List<License> licenses = new ArrayList<License>(); +245 +246 /** +247 * Returns the list of licenses. +248 * +249 * @return the list of licenses +250 */ +251 public List<License> getLicenses() { +252 return licenses; +253 } +254 +255 /** +256 * Adds a new license to the list of licenses. +257 * +258 * @param license the license to add +259 */ +260 public void addLicense(License license) { +261 licenses.add(license); +262 } +263 +264 /** +265 * Process the Maven properties file and interpolate all properties. +266 * +267 * @param properties new value of properties +268 */ +269 public void processProperties(Properties properties) { +270 this.groupId = interpolateString(this.groupId, properties); +271 this.artifactId = interpolateString(this.artifactId, properties); +272 this.version = interpolateString(this.version, properties); +273 this.description = interpolateString(this.description, properties); +274 for (License l : this.getLicenses()) { +275 l.setName(interpolateString(l.getName(), properties)); +276 l.setUrl(interpolateString(l.getUrl(), properties)); +277 } +278 this.name = interpolateString(this.name, properties); +279 this.organization = interpolateString(this.organization, properties); +280 this.parentGroupId = interpolateString(this.parentGroupId, properties); +281 this.parentArtifactId = interpolateString(this.parentArtifactId, properties); +282 this.parentVersion = interpolateString(this.parentVersion, properties); +283 +284 } +285 +286 /** 287 * <p> -288 * <b>Note:</b> if there is no property found the reference will be removed. In other words, if the interpolated string will -289 * be replaced with an empty string. -290 * </p> -291 * <p> -292 * Example:</p> -293 * <code> -294 * Properties p = new Properties(); -295 * p.setProperty("key", "value"); -296 * String s = interpolateString("'${key}' and '${nothing}'", p); -297 * System.out.println(s); -298 * </code> -299 * <p> -300 * Will result in:</p> -301 * <code> -302 * 'value' and '' -303 * </code> -304 * -305 * @param text the string that contains references to properties. -306 * @param properties a collection of properties that may be referenced within the text. -307 * @return the interpolated text. -308 */ -309 public static String interpolateString(String text, Properties properties) { -310 final Properties props = properties; -311 if (text == null) { -312 return text; -313 } -314 if (props == null) { -315 return text; -316 } -317 -318 final int pos = text.indexOf("${"); -319 if (pos < 0) { -320 return text; -321 } -322 final int end = text.indexOf("}"); -323 if (end < pos) { -324 return text; -325 } -326 -327 final String propName = text.substring(pos + 2, end); -328 String propValue = interpolateString(props.getProperty(propName), props); -329 if (propValue == null) { -330 propValue = ""; -331 } -332 final StringBuilder sb = new StringBuilder(propValue.length() + text.length()); -333 sb.append(text.subSequence(0, pos)); -334 sb.append(propValue); -335 sb.append(text.substring(end + 1)); -336 return interpolateString(sb.toString(), props); //yes yes, this should be a loop... -337 } +288 * A utility function that will interpolate strings based on values given in the properties file. It will also interpolate the +289 * strings contained within the properties file so that properties can reference other properties.</p> +290 * <p> +291 * <b>Note:</b> if there is no property found the reference will be removed. In other words, if the interpolated string will +292 * be replaced with an empty string. +293 * </p> +294 * <p> +295 * Example:</p> +296 * <code> +297 * Properties p = new Properties(); +298 * p.setProperty("key", "value"); +299 * String s = interpolateString("'${key}' and '${nothing}'", p); +300 * System.out.println(s); +301 * </code> +302 * <p> +303 * Will result in:</p> +304 * <code> +305 * 'value' and '' +306 * </code> +307 * +308 * @param text the string that contains references to properties. +309 * @param properties a collection of properties that may be referenced within the text. +310 * @return the interpolated text. +311 */ +312 public static String interpolateString(String text, Properties properties) { +313 if (null == text || null == properties) { +314 return text; +315 } +316 final StrSubstitutor substitutor = new StrSubstitutor(new PropertyLookup(properties)); +317 return substitutor.replace(text); +318 } +319 +320 /** +321 * Utility class that can provide values from a Properties object to a StrSubstitutor. +322 */ +323 private static class PropertyLookup extends StrLookup { +324 +325 /** +326 * Reference to the properties to lookup. +327 */ +328 private final Properties props; +329 +330 /** +331 * Constructs a new property lookup. +332 * +333 * @param props the properties to wrap. +334 */ +335 PropertyLookup(Properties props) { +336 this.props = props; +337 } 338 -339 } +339 /** +340 * Looks up the given property. +341 * +342 * @param key the key to the property +343 * @return the value of the property specified by the key +344 */ +345 @Override +346 public String lookup(String key) { +347 return props.getProperty(key); +348 } +349 } +350 }
        diff --git a/xref/org/owasp/dependencycheck/xml/pom/package-frame.html b/xref/org/owasp/dependencycheck/xml/pom/package-frame.html index 9ca652387..02946bc25 100644 --- a/xref/org/owasp/dependencycheck/xml/pom/package-frame.html +++ b/xref/org/owasp/dependencycheck/xml/pom/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.xml.pom + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.xml.pom @@ -32,6 +32,9 @@
      • PomUtils +
      • +
      • + PropertyLookup
      • diff --git a/xref/org/owasp/dependencycheck/xml/pom/package-summary.html b/xref/org/owasp/dependencycheck/xml/pom/package-summary.html index fdacda16d..a90f5243a 100644 --- a/xref/org/owasp/dependencycheck/xml/pom/package-summary.html +++ b/xref/org/owasp/dependencycheck/xml/pom/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.owasp.dependencycheck.xml.pom + Dependency-Check 1.3.2 Reference Package org.owasp.dependencycheck.xml.pom @@ -64,6 +64,11 @@
        PomUtils
        + PropertyLookup +
        diff --git a/xref/org/slf4j/impl/package-frame.html b/xref/org/slf4j/impl/package-frame.html index d0a484432..2c1f97d48 100644 --- a/xref/org/slf4j/impl/package-frame.html +++ b/xref/org/slf4j/impl/package-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.slf4j.impl + Dependency-Check 1.3.2 Reference Package org.slf4j.impl diff --git a/xref/org/slf4j/impl/package-summary.html b/xref/org/slf4j/impl/package-summary.html index 0edaa14c4..c9c381c92 100644 --- a/xref/org/slf4j/impl/package-summary.html +++ b/xref/org/slf4j/impl/package-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference Package org.slf4j.impl + Dependency-Check 1.3.2 Reference Package org.slf4j.impl diff --git a/xref/overview-frame.html b/xref/overview-frame.html index 1dd2c6596..aeb4ec8fd 100644 --- a/xref/overview-frame.html +++ b/xref/overview-frame.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference + Dependency-Check 1.3.2 Reference diff --git a/xref/overview-summary.html b/xref/overview-summary.html index 94f543409..33e544e46 100644 --- a/xref/overview-summary.html +++ b/xref/overview-summary.html @@ -3,7 +3,7 @@ - Dependency-Check 1.3.1 Reference + Dependency-Check 1.3.2 Reference @@ -24,7 +24,7 @@
      -

      Dependency-Check 1.3.1 Reference

      +

      Dependency-Check 1.3.2 Reference