Giter Site home page Giter Site logo

clj-watson's Introduction

clj-watson

A Clojure tool for vulnerability checking.

clj-watson is a software composition analysis (SCA) tool, that scans dependencies in a Clojure deps.edn file looking for vulnerable direct and transitive dependencies, and builds a report with all the information needed to help you understand how the vulnerabilities manifest in your software.

clj-watson can suggest a remediation for the vulnerabilities found, and can check against both the NIST National Vulnerability Database (NVD) (by default) and the GitHub Advisory Database (experimental).

Quick Start

clj-watson can be added as an alias either on a per-project basis in the project's deps.edn file or in your user deps.edn file (either ~/.clojure/deps.edn or ~/.config/clojure/deps.edn):

  ;; in :aliases
  :clj-watson {:replace-deps
               {io.github.clj-holmes/clj-watson
                {:git/tag "v5.1.1" :git/sha "ad5fe07"}}
               :main-opts ["-m" "clj-watson.cli" "scan"]}

Then you can run it with:

clojure -M:clj-watson -p deps.edn

The first time it runs, it will download the vulnerability database, which can take a few minutes. Subsequent runs will be much faster.

Note: the database is stored in the /tmp/db/ folder (on macOS/Linux) - in case you ever need to delete that folder, if it looks like the database is corrupted.

It can also be installed as a Clojure CLI tool:

clojure -Ttools install-latest :lib io.github.clj-holmes/clj-watson :as clj-watson

Then run it with:

clojure -Tclj-watson scan :deps-edn-path '"deps.edn"' :output '"stdout"'
# or:
clojure -Tclj-watson scan '{:deps-edn-path "deps.edn" :output "stdout"}'

The tool option keywords match the long-form CLI option names (see below) but the abbreviations are also supported. In addition, any string option may be specified as a bare Clojure symbol (if it is legally representable as such), which means the above command-line can be simplified to just:

clojure -Tclj-watson scan :p deps.edn

:output can be omitted because it defaults to stdout, and :deps-edn-path can be shortened to :p (matching the -p short form of --deps-edn-path).

Note: :aliases (or :a) should be specified as a vector of keywords (or symbols), e.g., :a '[:foo :bar], whereas it would be specified multiple times (as strings) in the regular CLI, -a foo -a bar.

How it works

Vulnerability database strategies

clj-watson supports two methods for vulnerabilities scan.

DependencyCheck

DependencyCheck is the most widely used method among the Clojure/Java SCA tools. It downloads all vulnerabilities from NVD and stores it in a database (located in the /tmp/db/ folder), composes a Common Platform Enumeration (CPE) based on the dependencies, scans all JARs in the classpath and matches vulnerabilities using it.

  • clj-watson v5.x.x uses DependencyCheck 9.0.x and the new NIST NVD API.
  • clj-watson v4.x.x uses an earlier version of DependencyCheck and the old NVD data feeds, which have been deprecated.

NIST NVD API

As of version v5.0.0, clj-watson uses DependencyCheck 9.0.x which switches from the earlier NVD data feeds to the new NIST NVD API.

This new API heavily throttles anonymous requests, so it is highly recommended to get an API key in order to use the API efficiently.

Read the NIST NVD announcement for more information.

Once you have an API key, you can provide it to clj-watson via the nvd.api.key property in the optional clj-watson.properties file, either on the classpath you use to run clj-watson or via the -w / --clj-watson-properties command-line option:

# clj-watson.properties file
nvd.api.key=...your key here...

GitHub Advisory Database [experimental]

This approach doesn't need to download a database since it uses the GitHub Advisory Database via its GraphQL API, and matches are made via package names.

In order to use this approach, it is necessary to generate a GitHub Personal Access Token (PAT) to access the GraphQL API, or if you use GitHub Actions it is possible to use their GitHub token.

Another important thing to be aware of is that the API has a limit of 5,000 requests per hour/per PAT.

If you create a PAT or use the GitHub Action token, you can set it as an environment variable named GITHUB_TOKEN and clj-watson will be able to use it.

Allow Listing Known CVE's

Sometimes the transitive dependency tree is not under your control and it is not always possible to override versions of dependencies that are vulnerable. You can allow a CVE for a limited period by adding a clj-watson-config.edn configuration file to your classpath with the following structure:

{:allow-list {:cves [{:cve-label "CVE-0000"
                      :expires "2000-01-01"}
                     {:cve-label "CVE-00000"
                      :expires "2000-01-01"}]}}

Note: this is for the GitHub Advisory Database strategy only.

Remediation suggestion

The big difference between clj-watson and other tools!

Since fixing the vulnerabilities found manually can be a truly frustrating process clj-watson provides a way to suggest a remediation.

It performs lookups for the whole dependency tree, checking if the latest version of a parent dependency uses the secure version of the child dependency until it reaches the direct dependency.

Given the following dependency tree,

[dependency-a "v1"]
  [dependency-b "v1"]
    [dependency-c "v1"]

where dependency-c is vulnerable and fixing it would require a bump from v1 to v2, clj-watson will try to find a version of dependency-a that uses a version of dependency-b that uses dependency-c at version v2, and then clj-watson will propose updating dependency-a.

{dependency-a {:mvn/version "v4"}}

If clj-watson does not find a version of dependency-b or dependency-a that satisfies this condition, it will propose an exclusion instead:

{dependency-a {:exclusions [dependency-b]}
 dependency-b {:mvn/version "v3"}}

In order to get the automated remediation suggestions, provide the --suggest-fix or -s option when running clj-watson.

Installation

clj-watson can be installed as a Clojure CLI tool, as shown above. While this is the easiest way to install the latest version and keep it up-to-date (using clojure -Ttools install-latest), it also means using the key/value EDN-style options for the CLI tool which can be a bit unwieldy as present:

clojure -Tclj-watson scan '{:output "stdout" :fail-on-result true :deps-edn-path "deps.edn" :suggest-fix true :aliases ["*"] :database-strategy "dependency-check"}'
# or:
clojure -Tclj-watson scan :f true :p deps.edn :s true :a '[*]'

Both :output (:o) and :database-strategy (:t) can be omitted because they default to "stdout" and "dependency-check" respectively.

In addition to the CLI tool install, shown above, it can also be invoked directly via the Clojure CLI, by specifying clj-watson as a dependency via -Sdeps:

clojure -Sdeps '{:deps {io.github.clj-holmes/clj-watson {:git/tag "v5.1.1" :git/sha "ad5fe07"}}}' -M -m clj-watson.cli scan -p deps.edn

Or you can just add it to your deps.edn file as an alias:

{:deps {}
 :aliases
 {:clj-watson {:extra-deps {io.github.clj-holmes/clj-watson {:git/tag "v5.1.1" :git/sha "ad5fe07"}}
               :main-opts ["-m" "clj-watson.cli" "scan"]}}}

and invoke it with:

clojure -M:clj-watson -p deps.edn

CLI Options

You can get a full list of the available options by running:

clojure -M:clj-watson scan -\?

This produces:

NAME:
 clj-watson scan - Performs a scan on a deps.edn file

USAGE:
 clj-watson scan [command options] [arguments...]

OPTIONS:
   -p, --deps-edn-path S*                                                      path of deps.edn to scan.
   -o, --output edn|json|sarif|stdout|stdout-simple          stdout            Output type.
   -a, --aliases S                                                             Specify a alias that will have the dependencies analysed alongside with the project deps.It's possible to provide multiple aliases. If a * is provided all the aliases are going to be analysed.
   -d, --dependency-check-properties S                                         [ONLY APPLIED IF USING DEPENDENCY-CHECK STRATEGY] Path of a dependency-check properties file. If not provided uses resources/dependency-check.properties.
   -w, --clj-watson-properties S                                               [ONLY APPLIED IF USING DEPENDENCY-CHECK STRATEGY] Path of an additional, optional properties file.
   -t, --database-strategy dependency-check|github-advisory  dependency-check  Vulnerability database strategy.
   -s, --[no-]suggest-fix                                    false             Suggest a new deps.edn file fixing all vulnerabilities found.
   -f, --[no-]fail-on-result                                 false             Enable or disable fail if results were found (useful for CI/CD).
   -?, --help

By default, when using the DEPENDENCY-CHECK strategy, clj-watson will load its own dependency-check.properties file, and then look for a clj-watson.properties file on the classpath and load that if found, for additional properties to apply to the DependencyCheck scan.

If you provide -d (or --dependency-check-properties) then clj-watson will load that file instead of its own dependency-check.properties file so it needs to be a complete properties file, not just the properties you want to override.

If you provide -w (or --clj-watson-properties) then clj-watson will load that file and apply those properties to the dependency-check scan. This is in addition to the properties loaded from the dependency-check.properties or the -d file. This can be useful to override just a few properties.

Execution

The minimum needed to run clj-watson is to provide the path to a deps.edn file, but it is recommended that you also provide the -s option so clj-watson will try to suggest a remediation for any vulnerabilities found.

clojure -M:clj-watson -p deps.edn
...
Downloading/Updating database.
Download/Update completed.
...

Dependency Information
-----------------------------------------------------
NAME: dependency-e
VERSION: 1

DEPENDENCY FOUND IN:

[dependency-a]
        [dependency-b]

[dependency-a]
        [dependency-c]
                [dependency-d]

FIX SUGGESTION: {dependency-a {:mvn/version "3"}}

Vulnerabilities
-----------------------------------------------------

SEVERITY: Information not available.
IDENTIFIERS: CVE-2022-1000000
CVSS: 7.5
PATCHED VERSION: 1.55

SEVERITY: Information not available.
IDENTIFIERS: CVE-2022-2000000
CVSS: 5.3
PATCHED VERSION: 1.55
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Who uses it

Development

nREPL

clojure -M:nREPL -m nrepl.cmdline

Lint

clojure -M:clojure-lsp format
clojure -M:clojure-lsp clean-ns

License and Copyright

Copyright © 2021-2024 Matheus Bernardes

Distributed under the Eclipse Public License version 2.0.

clj-watson's People

Contributors

markomafs avatar mthbernardes avatar seancorfield avatar wtfleming avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

clj-watson's Issues

Native SARIF output support

Hi,

We are working with the Github team on the SARIF ecosystem, looking for adding native SARIF output functionality of the clj-watson tool, so that customers can easily create a workflow to scan vulnerabilities in their repo using clj-watson, generate code scanning alerts in Github security tab for each vulnerability found.

To achieve this goal below 3 steps needed:

  1. Native SARIF output support in clj-watson tool.
  2. Add steps in clj-watson-action to upload the SARIF file to Github.
  3. Create clj-watson Github starter workflow.

We are glad to help/contribute to these tasks. I see the SARIF report functionality in clj-holmes, according to the rule's definition and sample output I can find the fields map to SARIF report. But I don't find a document about clj-watson's output and from the sample output I don't figure out which properties should be used for SARIF report. Can you please provide the information about the tool's output?

Below are the required properties of a SARIF report according to a Github article at https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning. Can you please take a look and let me know what properties/values in clj-watson report can map to them?

SARIF properties clj-watson properties description
rule.Id An unique identifier for the rule. The id is referenced from other parts of the SARIF file and may be used by code scanning to display URLs on GitHub.
rule.shortDescription.text A concise description of the rule. Code scanning displays the short description on GitHub next to the associated results.
rule.fullDescription.text A description of the rule. Code scanning displays the full description on GitHub next to the associated results.
rule.help.text Documentation for the rule using text format. Code scanning displays this help documentation next to the associated results.
result.ruleId The unique identifier of the rule (rule.Id)
result.level The severity of the result. This level overrides the default severity defined by the rule. Code scanning uses the level to filter results by severity on GitHub.
result.message.text A message that describes the result. Code scanning displays the message text as the title of the result.
result.location.physicalLocation.artifactLocation.uri A URI indicating the location of an artifact, usually a file either in the repository or generated during a build.
result.location.physicalLocation.region.startLine The line number of the first character in the region.
result.location.physicalLocation.region.startColumn The column number of the first character in the region.
result.location.physicalLocation.region.endLine The line number of the last character in the region.
result.location.physicalLocation.region.endColumn The column number of the character following the end of the region.

Thanks!

cc @eddynaka @michaelcfanning

Document how to suppress false positives

Property:

suppression.file=false-positives.xml

and then that file on the classpath:

<?xml version="1.0" encoding="UTF-8"?>
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
</suppressions>

and link to the relevant parts of the DC docs.

Clean up command-line tool invocation

Per the README:

clojure -Tclj-watson scan :deps-edn-path '"deps.edn"' :output '"stdout"'
#or:
clojure -Tclj-watson scan '{:deps-edn-path "deps.edn" :output "stdout"}'

(this is somewhat verbose now but it will be improved over the next few releases)

Update DependencyCheck to latest version

clojure -M:outdated =>

Checking for old versions in: deps.edn
  org.clojure/tools.deps {:mvn/version "0.18.1374"} -> {:mvn/version "0.18.1398"}
  org.owasp/dependency-check-core {:mvn/version "9.0.6"} -> {:mvn/version "9.0.8"}
  org.slf4j/slf4j-nop {:mvn/version "2.0.9"} -> {:mvn/version "2.0.11"}

Error scanning after latest update

After updating to the latest version, I'm getting an error running a clj-watson scan. This is in the context of https://github.com/clojure/tools.deps:

$ clj -M:cve
...usual stuff...
INFO: Finished configuration in 52 ms.
Downloading/Updating database.
** ERROR: **
Exception: #error {
 :cause Function "MERGE_KNOWNEXPLOITED" not found; SQL statement:
CALL merge_knownexploited(?,?,?,?,?,?,?,?,?) [90022-214]
 :via
 [{:type org.owasp.dependencycheck.data.update.exception.UpdateException
   :message org.owasp.dependencycheck.data.nvdcve.DatabaseException: org.h2.jdbc.JdbcSQLSyntaxErrorException: Function "MERGE_KNOWNEXPLOITED" not found; SQL statement:
CALL merge_knownexploited(?,?,?,?,?,?,?,?,?) [90022-214]
   :at [org.owasp.dependencycheck.data.update.KnownExploitedDataSource update KnownExploitedDataSource.java 93]}
  {:type org.owasp.dependencycheck.data.nvdcve.DatabaseException
   :message org.h2.jdbc.JdbcSQLSyntaxErrorException: Function "MERGE_KNOWNEXPLOITED" not found; SQL statement:
CALL merge_knownexploited(?,?,?,?,?,?,?,?,?) [90022-214]
   :at [org.owasp.dependencycheck.data.nvdcve.CveDB getPreparedStatement CveDB.java 410]}
  {:type org.h2.jdbc.JdbcSQLSyntaxErrorException
   :message Function "MERGE_KNOWNEXPLOITED" not found; SQL statement:
CALL merge_knownexploited(?,?,?,?,?,?,?,?,?) [90022-214]
   :at [org.h2.message.DbException getJdbcSQLException DbException.java 632]}]
 :trace
 [[org.h2.message.DbException getJdbcSQLException DbException.java 632]
  [org.h2.message.DbException getJdbcSQLException DbException.java 477]
  [org.h2.message.DbException get DbException.java 223]
  [org.h2.message.DbException get DbException.java 199]
  [org.h2.command.Parser getFunctionAliasWithinPath Parser.java 2519]
  [org.h2.command.Parser readTableFunction Parser.java 2012]
  [org.h2.command.Parser parseCall Parser.java 6996]
  [org.h2.command.Parser parsePrepared Parser.java 765]
  [org.h2.command.Parser parse Parser.java 689]
  [org.h2.command.Parser parse Parser.java 661]
  [org.h2.command.Parser prepareCommand Parser.java 569]
  [org.h2.engine.SessionLocal prepareLocal SessionLocal.java 631]
  [org.h2.engine.SessionLocal prepareCommand SessionLocal.java 554]
  [org.h2.jdbc.JdbcConnection prepareCommand JdbcConnection.java 1116]
  [org.h2.jdbc.JdbcPreparedStatement <init> JdbcPreparedStatement.java 92]
  [org.h2.jdbc.JdbcConnection prepareStatement JdbcConnection.java 288]
  [org.apache.commons.dbcp2.DelegatingConnection prepareStatement DelegatingConnection.java 713]
  [org.apache.commons.dbcp2.DelegatingConnection prepareStatement DelegatingConnection.java 713]
  [org.owasp.dependencycheck.data.nvdcve.CveDB getPreparedStatement CveDB.java 402]
  [org.owasp.dependencycheck.data.nvdcve.CveDB updateKnownExploitedVulnerabilities CveDB.java 1128]
  [org.owasp.dependencycheck.data.update.KnownExploitedDataSource update KnownExploitedDataSource.java 85]
  [org.owasp.dependencycheck.Engine doUpdates Engine.java 906]
  [org.owasp.dependencycheck.Engine doUpdates Engine.java 878]
  [jdk.internal.reflect.NativeMethodAccessorImpl invoke0 NativeMethodAccessorImpl.java -2]
  [jdk.internal.reflect.NativeMethodAccessorImpl invoke NativeMethodAccessorImpl.java 62]
  [jdk.internal.reflect.DelegatingMethodAccessorImpl invoke DelegatingMethodAccessorImpl.java 43]
  [java.lang.reflect.Method invoke Method.java 566]
  [clojure.lang.Reflector invokeMatchingMethod Reflector.java 167]
  [clojure.lang.Reflector invokeNoArgInstanceMember Reflector.java 438]
  [clj_watson.controller.dependency_check.scanner$update_download_database invokeStatic scanner.clj 14]
  [clj_watson.controller.dependency_check.scanner$update_download_database invoke scanner.clj 11]
  [clj_watson.controller.dependency_check.scanner$build_engine invokeStatic scanner.clj 30]
  [clj_watson.controller.dependency_check.scanner$build_engine invoke scanner.clj 27]
  [clj_watson.controller.dependency_check.scanner$scan_jars invokeStatic scanner.clj 37]
  [clj_watson.controller.dependency_check.scanner$scan_jars invoke scanner.clj 36]
  [clj_watson.controller.dependency_check.scanner$start_BANG_ invokeStatic scanner.clj 48]
  [clj_watson.controller.dependency_check.scanner$start_BANG_ invoke scanner.clj 47]
  [clj_watson.entrypoint$eval11227$fn__11229 invoke entrypoint.clj 29]
  [clojure.lang.MultiFn invoke MultiFn.java 229]
  [clj_watson.entrypoint$scan invokeStatic entrypoint.clj 41]
  [clj_watson.entrypoint$scan invoke entrypoint.clj 40]
  [cli_matic.core$invoke_subcmd invokeStatic core.cljc 546]
  [cli_matic.core$invoke_subcmd invoke core.cljc 525]
  [cli_matic.core$run_cmd_STAR_ invokeStatic core.cljc 589]
  [cli_matic.core$run_cmd_STAR_ invoke core.cljc 560]
  [cli_matic.core$run_cmd invokeStatic core.cljc 601]
  [cli_matic.core$run_cmd invoke core.cljc 591]
  [clj_watson.cli$_main invokeStatic cli.clj 47]
  [clj_watson.cli$_main doInvoke cli.clj 46]
  [clojure.lang.RestFn applyTo RestFn.java 137]
  [clojure.lang.Var applyTo Var.java 705]
  [clojure.core$apply invokeStatic core.clj 667]
  [clojure.main$main_opt invokeStatic main.clj 514]
  [clojure.main$main_opt invoke main.clj 510]
  [clojure.main$main invokeStatic main.clj 664]
  [clojure.main$main doInvoke main.clj 616]
  [clojure.lang.RestFn applyTo RestFn.java 137]
  [clojure.lang.Var applyTo Var.java 705]
  [clojure.main main main.java 40]]}



Dec 28, 2023 1:41:53 PM org.apache.commons.jcs3.engine.control.CompositeCacheManager
INFO: Shutdown hook activated. Shutdown was not called. Shutting down JCS.

Sorted report

Sort dependencies by name and vulnerabilities by cve year and identification.

CVE identifiers are missing in 3.0.2 output

Since you released a new version, I just tried to updated from 3.0.1-ALPHA to 3.0.2 and all the CVE identifiers disappeared in the output:

SEVERITY: MEDIUM
IDENTIFIERS:  
CVSS: 5.5
PATCHED VERSION: 66.1

This feels like a bug we've talked about on Slack some time back, that I thought had gotten fixed?

Also, a request: to make it easier to diff the output, can you sort by CVE identifier without each artifact so the output order is repeatable? I can create a separate issue for that if you'd like?

Provide an additive properties file

Currently, Watson looks for dependency-check.properties on the classpath unless a different properties file is provided. So it's all or nothing -- you can't provide your own properties file that overrides just one or two properties. Given that the default properties file isn't easily "guessable" (you have to download it from GitHub -- and that makes it hard to keep in sync as changes are made), it would make sense for Watson to support an optional clj-watson.properties file on the classpath (or perhaps via a command-line option?) that could be read in and add to / override what is found in the default properties file.

Add logging/printing to show additional properties

It's hard to know for sure whether additional properties have been picked up when running the tool.

Add some sort of logging or printing to list any additional properties loaded (obscuring the API key!).

Breaks on datahike dep

When I run it on an empty project with the following deps.edn it breaks.

{
 :deps {io.replikativ/datahike                  {:mvn/version "0.4.1480"}}
 :aliases {:clj-watson {:extra-deps {io.github.clj-holmes/clj-watson {:git/tag "v2.1.0" :git/sha "468f6fe"}}
                        :main-opts ["-m" "clj-watson.cli" "scan"]}}
}
clojure -M:clj-watson scan scan -p deps.edn -s                                                                                                           ok  13:10:56 
Downloading/Updating database.
Download/Update completed.
** ERROR: **
Exception: #error {
 :cause Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null
 :via
 [{:type java.lang.NullPointerException
   :message Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null
   :at [java.util.regex.Matcher getTextLength Matcher.java 1769]}]
 :trace
 [[java.util.regex.Matcher getTextLength Matcher.java 1769]
  [java.util.regex.Matcher reset Matcher.java 415]
  [java.util.regex.Matcher <init> Matcher.java 252]
  [java.util.regex.Pattern matcher Pattern.java 1134]
  [clojure.core$re_matcher invokeStatic core.clj 4845]
  [clojure.core$re_matcher invoke core.clj 4838]
  [version_clj.split$split_once invokeStatic split.cljc 32]
  [version_clj.split$split_once invoke split.cljc 21]
  [version_clj.split$split_known_qualifier invokeStatic split.cljc 128]
  [version_clj.split$split_known_qualifier invoke split.cljc 125]
  [version_clj.split$split_version_and_qualifier invokeStatic split.cljc 139]
  [version_clj.split$split_version_and_qualifier invoke split.cljc 135]
  [version_clj.split$version__GT_seq invokeStatic split.cljc 154]
  [version_clj.split$version__GT_seq doInvoke split.cljc 151]
  [clojure.lang.RestFn invoke RestFn.java 410]
  [version_clj.compare$version_compare invokeStatic compare.cljc 95]
  [version_clj.compare$version_compare doInvoke compare.cljc 90]
  [clojure.lang.RestFn invoke RestFn.java 442]
  [version_clj.core$version_compare invokeStatic core.cljc 31]
  [version_clj.core$version_compare doInvoke core.cljc 25]
  [clojure.lang.RestFn invoke RestFn.java 442]
  [version_clj.core$older_QMARK_ invokeStatic core.cljc 38]
  [version_clj.core$older_QMARK_ doInvoke core.cljc 35]
  [clojure.lang.RestFn invoke RestFn.java 442]
  [version_clj.core$newer_or_equal_QMARK_ invokeStatic core.cljc 55]
  [version_clj.core$newer_or_equal_QMARK_ doInvoke core.cljc 51]
  [clojure.lang.RestFn invoke RestFn.java 425]
  [clj_watson.diplomat.remediate$parent_dependency_contains_child_version_QMARK_ invokeStatic remediate.clj 26]
  [clj_watson.diplomat.remediate$parent_dependency_contains_child_version_QMARK_ invoke remediate.clj 17]
  [clj_watson.diplomat.remediate$find_bump_version_using_latest invokeStatic remediate.clj 40]
  [clj_watson.diplomat.remediate$find_bump_version_using_latest invoke remediate.clj 28]
  [clj_watson.diplomat.remediate$vulnerabilities_fix_suggestions$fn__12531 invoke remediate.clj 50]
  [clojure.core$map$fn__5884 invoke core.clj 2757]
  [clojure.lang.LazySeq sval LazySeq.java 42]
  [clojure.lang.LazySeq seq LazySeq.java 51]
  [clojure.lang.LazySeq first LazySeq.java 73]
  [clojure.lang.RT first RT.java 692]
  [clojure.core$first__5401 invokeStatic core.clj 55]
  [clojure.core$first__5401 invoke core.clj 55]
  [cljstache.core$render_section invokeStatic core.cljc 459]
  [cljstache.core$render_section invoke core.cljc 441]
  [cljstache.core$render_template invokeStatic core.cljc 479]
  [cljstache.core$render_template invoke core.cljc 468]
  [cljstache.core$render invokeStatic core.cljc 499]
  [cljstache.core$render invoke core.cljc 491]
  [cljstache.core$render invokeStatic core.cljc 496]
  [cljstache.core$render invoke core.cljc 491]
  [clj_watson.logic.stdout$generate invokeStatic stdout.clj 28]
  [clj_watson.logic.stdout$generate invoke stdout.clj 27]
  [clj_watson.controller.output$eval12163$fn__12164 invoke output.clj 12]
  [clojure.lang.MultiFn invoke MultiFn.java 234]
  [clj_watson.controller.output$generate invokeStatic output.clj 21]
  [clj_watson.controller.output$generate invoke output.clj 20]
  [clj_watson.entrypoint$_main invokeStatic entrypoint.clj 17]
  [clj_watson.entrypoint$_main invoke entrypoint.clj 15]
  [cli_matic.core$invoke_subcmd invokeStatic core.cljc 546]
  [cli_matic.core$invoke_subcmd invoke core.cljc 525]
  [cli_matic.core$run_cmd_STAR_ invokeStatic core.cljc 589]
  [cli_matic.core$run_cmd_STAR_ invoke core.cljc 560]
  [cli_matic.core$run_cmd invokeStatic core.cljc 601]
  [cli_matic.core$run_cmd invoke core.cljc 591]
  [clj_watson.cli$_main invokeStatic cli.clj 40]
  [clj_watson.cli$_main doInvoke cli.clj 39]
  [clojure.lang.RestFn applyTo RestFn.java 137]
  [clojure.lang.Var applyTo Var.java 705]
  [clojure.core$apply invokeStatic core.clj 667]
  [clojure.main$main_opt invokeStatic main.clj 514]
  [clojure.main$main_opt invoke main.clj 510]
  [clojure.main$main invokeStatic main.clj 664]
  [clojure.main$main doInvoke main.clj 616]
  [clojure.lang.RestFn applyTo RestFn.java 137]
  [clojure.lang.Var applyTo Var.java 705]
  [clojure.main main main.java 40]]}

Persistent 503 errors?

For the last two or three days, I've been unable to run Watson:

Downloading/Updating database.
** ERROR: **
Exception: #error {
 :cause NVD Returned Status Code: 503
 :via
 [{:type org.owasp.dependencycheck.data.update.exception.UpdateException
   :message Error updating the NVD Data
   :at [org.owasp.dependencycheck.data.update.NvdApiDataSource processApi NvdApiDataSource.java 336]}
  {:type io.github.jeremylong.openvulnerability.client.nvd.NvdApiException
   :message NVD Returned Status Code: 503
   :at [io.github.jeremylong.openvulnerability.client.nvd.NvdCveClient next NvdCveClient.java 327]}]
 :trace
 [[io.github.jeremylong.openvulnerability.client.nvd.NvdCveClient next NvdCveClient.java 327]

I don't know whether this is genuinely due to some underlying service being down or whether it's a configuration issue (using a deprecated endpoint that has now been removed).

core.async false positive

See jeremylong/DependencyCheck#4384 (comment) for background.

I thought clj-watson wrapped that library and therefore false positive fixes there would automatically apply to clj-watson, but I see core.async flagged as a FP with the latest clj-watson so I'm wondering what the actual wrapping is and why FP fixes wouldn't apply?

I can (and have) easily applied a suppression locally for my clj-watson config but feel like I shouldn't need to?

Can't run clj-watson as a -M alias

Hello,
First of all, thank you for the work you are doing with clj-watson! :)

I am receiving the following error when I run clj-watson as a -M alias:

Execution error - invalid arguments to cli-matic.utils-v2/cfg-v2 at (test.cljc:30). nil - failed: some? at: [:cfg :v1 :commands :opts :default] spec: :cli-matic.specs/default nil - failed: string? at: [:cfg :v1 :app :version] spec: :cli-matic.specs/existing-string

Running the command below fires the same error:
clojure -M:clj-watson scan -\?

There seems to be an issue with parsing of command line arguments and I wanted to ask if you are able to reproduce it?

Thank you!

Score and severity missing from output

I recently upgraded Watson from v4.1.2 to v5.1.1. After upgrading, I no longer see scores or severities for the vulnerabilities in the output.

Output as of 5.1.1, using clojure -M:clj-watson -p deps.edn:

Dependency Information
-----------------------------------------------------
NAME: org.bouncycastle/bcprov-jdk15on
VERSION: 1.70

DEPENDENCY FOUND IN:

[buddy/buddy-sign]
	[buddy/buddy-core]
		[org.bouncycastle/bcpkix-jdk15on]

[buddy/buddy-sign]
	[buddy/buddy-core]
		[org.bouncycastle/bcpkix-jdk15on]
			[org.bouncycastle/bcutil-jdk15on]

[buddy/buddy-sign]
	[buddy/buddy-core]


FIX SUGGESTION:
Vulnerabilities
-----------------------------------------------------

SEVERITY: Information not available.
IDENTIFIERS: CVE-2023-33202
CVSS: Information not available.
PATCHED VERSION: Information not available.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

It looks like since DependencyCheck moved to the NVD API, getBaseSore and getBaseSeverity have changed. You can see that in this PR.

I've created a fork that fixes this, which I can propose as a PR: chrisetheridge@af84533

Output with my fix in place:

Dependency Information
-----------------------------------------------------
NAME: org.bouncycastle/bcprov-jdk15on
VERSION: 1.70

DEPENDENCY FOUND IN:

[buddy/buddy-sign]
	[buddy/buddy-core]
		[org.bouncycastle/bcpkix-jdk15on]

[buddy/buddy-sign]
	[buddy/buddy-core]
		[org.bouncycastle/bcpkix-jdk15on]
			[org.bouncycastle/bcutil-jdk15on]

[buddy/buddy-sign]
	[buddy/buddy-core]


FIX SUGGESTION:
Vulnerabilities
-----------------------------------------------------

SEVERITY: MEDIUM
IDENTIFIERS: CVE-2023-33202
CVSS: 5.5
PATCHED VERSION: Information not available.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Please let me know if I can add anything else :)

Bug in 5.0.0: clj-watson.properties file not found on classpath

Line 22 of clj-watson.controller.dependency-check.scanner should be if, not when.

Without -w option, the optional clj-watson.properties file is not found on the classpath.

With -w option, the file is read but ignored and then looked for on the classpath.

Unable to update watson database, version exceeds column limit

Downloading/Updating database.
2023-01-09 12:23:13,935 ERROR [o.o.d.Engine] - org.owasp.dependencycheck.data.nvdcve.DatabaseException: Error updating 'CVE-2020-36569'
org.owasp.dependencycheck.data.update.exception.UpdateException: org.owasp.dependencycheck.data.nvdcve.DatabaseException: Error updating 'CVE-2020-36569'
	at org.owasp.dependencycheck.data.update.nvd.ProcessTask.processFiles(ProcessTask.java:157)
	at org.owasp.dependencycheck.data.update.nvd.ProcessTask.call(ProcessTask.java:114)
	at org.owasp.dependencycheck.data.update.nvd.ProcessTask.call(ProcessTask.java:41)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.owasp.dependencycheck.data.nvdcve.DatabaseException: Error updating 'CVE-2020-36569'
	at org.owasp.dependencycheck.data.nvdcve.CveDB.updateVulnerability(CveDB.java:823)
	at org.owasp.dependencycheck.data.update.nvd.NvdCveParser.parse(NvdCveParser.java:114)
	at org.owasp.dependencycheck.data.update.nvd.ProcessTask.importJSON(ProcessTask.java:141)
	at org.owasp.dependencycheck.data.update.nvd.ProcessTask.processFiles(ProcessTask.java:154)
	... 6 common frames omitted
Caused by: org.h2.jdbc.JdbcBatchUpdateException: Value too long for column "VERSIONENDEXCLUDING CHARACTER VARYING(60)": "'0.0.0-20160722212129-ac0cc4484ad4_before_v0.0.0-20200131131040-063a3fb69896' (75)"; SQL statement:
INSERT INTO software (cveid, cpeEntryId, versionEndExcluding, versionEndIncluding, versionStartExcluding, versionStartIncluding, vulnerable) VALUES (?, ?, ?, ?, ?, ?, ?) [22001-214]
	at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1269)
	at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:241)
	at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:241)
	at org.owasp.dependencycheck.data.nvdcve.CveDB.executeBatch(CveDB.java:1248)
	at org.owasp.dependencycheck.data.nvdcve.CveDB.updateVulnerabilityInsertSoftware(CveDB.java:1098)
	at org.owasp.dependencycheck.data.nvdcve.CveDB.updateVulnerability(CveDB.java:816)
	... 9 common frames omitted
** ERROR: **
Exception: #error {
 :cause Value too long for column "VERSIONENDEXCLUDING CHARACTER VARYING(60)": "'0.0.0-20160722212129-ac0cc4484ad4_before_v0.0.0-20200131131040-063a3fb69896' (75)"; SQL statement:
INSERT INTO software (cveid, cpeEntryId, versionEndExcluding, versionEndIncluding, versionStartExcluding, versionStartIncluding, vulnerable) VALUES (?, ?, ?, ?, ?, ?, ?) [22001-214]
 :via
 [{:type org.owasp.dependencycheck.data.update.exception.UpdateException
   :message org.owasp.dependencycheck.data.nvdcve.DatabaseException: Error updating 'CVE-2020-36569'
   :at [org.owasp.dependencycheck.data.update.nvd.ProcessTask processFiles ProcessTask.java 157]}
  {:type org.owasp.dependencycheck.data.nvdcve.DatabaseException
   :message Error updating 'CVE-2020-36569'
   :at [org.owasp.dependencycheck.data.nvdcve.CveDB updateVulnerability CveDB.java 823]}
  {:type org.h2.jdbc.JdbcBatchUpdateException
   :message Value too long for column "VERSIONENDEXCLUDING CHARACTER VARYING(60)": "'0.0.0-20160722212129-ac0cc4484ad4_before_v0.0.0-20200131131040-063a3fb69896' (75)"; SQL statement:
INSERT INTO software (cveid, cpeEntryId, versionEndExcluding, versionEndIncluding, versionStartExcluding, versionStartIncluding, vulnerable) VALUES (?, ?, ?, ?, ?, ?, ?) [22001-214]
   :at [org.h2.jdbc.JdbcPreparedStatement executeBatch JdbcPreparedStatement.java 1269]}]
 :trace
 [[org.h2.jdbc.JdbcPreparedStatement executeBatch JdbcPreparedStatement.java 1269]
  [org.apache.commons.dbcp2.DelegatingStatement executeBatch DelegatingStatement.java 241]
  [org.apache.commons.dbcp2.DelegatingStatement executeBatch DelegatingStatement.java 241]
  [org.owasp.dependencycheck.data.nvdcve.CveDB executeBatch CveDB.java 1248]
  [org.owasp.dependencycheck.data.nvdcve.CveDB updateVulnerabilityInsertSoftware CveDB.java 1098]
  [org.owasp.dependencycheck.data.nvdcve.CveDB updateVulnerability CveDB.java 816]
  [org.owasp.dependencycheck.data.update.nvd.NvdCveParser parse NvdCveParser.java 114]
  [org.owasp.dependencycheck.data.update.nvd.ProcessTask importJSON ProcessTask.java 141]
  [org.owasp.dependencycheck.data.update.nvd.ProcessTask processFiles ProcessTask.java 154]
  [org.owasp.dependencycheck.data.update.nvd.ProcessTask call ProcessTask.java 114]
  [org.owasp.dependencycheck.data.update.nvd.ProcessTask call ProcessTask.java 41]
  [java.util.concurrent.FutureTask run FutureTask.java 264]
  [java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1136]
  [java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 635]
  [java.lang.Thread run Thread.java 833]]}

Project- and version-based false positives when shadow-cljs is a dependency

At the bottom, a trimmed output generated by using the -Tclj-watson command from the README is attached.

By CVE ID:

  • CVE-2017-12424 - a completely unrelated product
  • CVE-2020-8910 - only relevant for version v20200224 and below, but the used version is 0.0-20211011-0726fdeb which is newer
Dependency Information
-----------------------------------------------------
NAME: thheller/shadow-cljsjs
VERSION: 0.0.22

DEPENDENCY FOUND IN:

[thheller/shadow-cljs]


FIX SUGGESTION: No secure version available
Vulnerabilities
-----------------------------------------------------

SEVERITY: CRITICAL
IDENTIFIERS: CVE-2017-12424 
CVSS: 9.8
PATCHED VERSION: Information not available.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Dependency Information
-----------------------------------------------------
NAME: org.clojure/google-closure-library
VERSION: 0.0-20211011-0726fdeb

DEPENDENCY FOUND IN:

[thheller/shadow-cljs]


FIX SUGGESTION: No secure version available
Vulnerabilities
-----------------------------------------------------

SEVERITY: MEDIUM
IDENTIFIERS: CVE-2020-8910 
CVSS: 6.5
PATCHED VERSION: Information not available.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Dependency Information
-----------------------------------------------------
NAME: thheller/shadow-cljs
VERSION: 2.17.5

DEPENDENCY FOUND IN:

Direct dependency.

FIX SUGGESTION: No secure version available
Vulnerabilities
-----------------------------------------------------

SEVERITY: CRITICAL
IDENTIFIERS: CVE-2017-12424 
CVSS: 9.8
PATCHED VERSION: Information not available.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Dependency Information
-----------------------------------------------------
NAME: thheller/shadow-util
VERSION: 0.7.0

DEPENDENCY FOUND IN:

[thheller/shadow-cljs]


FIX SUGGESTION: No secure version available
Vulnerabilities
-----------------------------------------------------

SEVERITY: CRITICAL
IDENTIFIERS: CVE-2017-12424 
CVSS: 9.8
PATCHED VERSION: Information not available.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Dependency Information
-----------------------------------------------------
NAME: thheller/shadow-client
VERSION: 1.3.3

DEPENDENCY FOUND IN:

[thheller/shadow-cljs]


FIX SUGGESTION: No secure version available
Vulnerabilities
-----------------------------------------------------

SEVERITY: CRITICAL
IDENTIFIERS: CVE-2017-12424 
CVSS: 9.8
PATCHED VERSION: Information not available.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Dependency Information
-----------------------------------------------------
NAME: thheller/shadow-undertow
VERSION: 0.2.0

DEPENDENCY FOUND IN:

[thheller/shadow-cljs]


FIX SUGGESTION: No secure version available
Vulnerabilities
-----------------------------------------------------

SEVERITY: CRITICAL
IDENTIFIERS: CVE-2017-12424 
CVSS: 9.8
PATCHED VERSION: Information not available.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Bug in 4.1.1?

I updated to 4.1.1 and tried to scan our repo and got this error:

...
Downloading: cli-matic/cli-matic/0.5.4/cli-matic-0.5.4.jar from clojars
Execution error (FileNotFoundException) at clj-watson.adapter.config/eval220$loading (config.clj:1).
Could not locate clj_time/format__init.class, clj_time/format.clj or clj_time/format.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.

I reverted to 4.1.0 and the scan works fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.