OWASP Dependency-Check
owasp-dependency-check.yml runs OWASP Dependency-Check against
a Maven or Node.js project, fails the run when a vulnerability meets the CVSS threshold, and uploads the report as an
artifact. In the openmrs org it also syncs the JSON report to the
vulnerability dashboard .
Usage
on:
push:
branches: [main]
schedule:
- cron: '0 3 * * 1'
workflow_dispatch:
jobs:
dependency-check:
uses: openmrs/openmrs-contrib-gha-workflows/.github/workflows/owasp-dependency-check.yml@main
secrets:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
APP_ID: ${{ secrets.OMRS_SEC_DASHBOARD_APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.OMRS_SEC_DASHBOARD_APP_PRIVATE_KEY }}What it does
- Detects the project type:
pom.xmlat the repository root means Maven, otherwisepackage.jsonmeans Node.js. Anything else fails. - Sets up Java (version inferred from the Maven compiler settings, defaulting to 8) or Node.js (from
engines.node, defaulting to 22). For Maven, builds the project withmaven_args(clean install -DskipTestsby default). - Runs Dependency-Check with
--failOnCVSS <fail_on_cvss>(default6.2), the suppression file, andadditional_args(default--enableRetired). Node.js projects excludepackages/**. AnNVD_API_KEYspeeds up the vulnerability database download; it is not available to pull requests from forks. - Uploads the report as the
Dependency Check reportartifact, even when the scan fails. - On a push or manual run in the
openmrsorg, commits the JSON report to the dashboard repository.
Suppressions
If the repository has a file at suppression_file (default dependency-check-suppressions.xml at the root), the scan
uses it. Otherwise it uses the
shared suppressions file
from this repository. A repository’s own file replaces the shared one; the two are not merged.
The shared file applies to every repository that relies on it, so only add a suppression once it is confirmed to be a false positive.
- Every
<suppress>block needs a<notes>entry describing the CVE and why it is suppressed. - OpenMRS CVEs are suppressed by CVE ID, not by package. Many OpenMRS CVEs are matched against module JARs because
of the shared
openmrsnamespace, even though the vulnerable code is inopenmrs-core, the Reference Application or another module. Suppressing by CVE ID, after review, never silences a CVE that genuinely affects one of the project’s OpenMRS dependencies. - Non-OpenMRS packages can be suppressed more broadly (by package name, namespace and so on) where appropriate.
- When scanning an artifact that is the affected component (for example the
dataexchangeorreportingcompatibilitymodule), check that the version is patched before suppressing.
To handle a new OpenMRS CVE in a report:
- Read the CVE details: the affected component (e.g.
openmrs-core, a specific module, the standalone distribution) and the vulnerable version range. - Decide whether it is a false positive: it is if the vulnerable code does not ship with this project’s artifacts.
- If it is, add a suppression by CVE ID with a note explaining why it does not apply, following the existing format.
- If in doubt, treat it as real until proven otherwise.
See the Dependency-Check suppression documentation for the file format.
OpenMRS defaults
OpenMRS repositories use the shared suppressions file, pass the NVD_API_KEY org secret, and pass the
OMRS_SEC_DASHBOARD App credentials as APP_ID / APP_PRIVATE_KEY so reports reach the dashboard.
Outside OpenMRS
This workflow is for repositories in the OpenMRS organization: it feeds OpenMRS’s public vulnerability dashboard, and its shared suppressions are reviewed against OpenMRS’s own dependencies. It is not supported for use elsewhere; run OWASP Dependency-Check directly instead.
Permissions
The scan job requests contents: read. The dashboard sync uses the App token or BOT_GH_TOKEN to write to the
dashboard repository, not the calling repository’s token.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
java_version | string | Java version to use for the build. If omitted, inferred from Maven compiler settings in pom.xml. | |
node_version | string | Node.js version to use for the build. If omitted, inferred from engines.node in package.json. | |
java_distribution | string | temurin | Java distribution |
maven_args | string | clean install -DskipTests | Maven arguments for the build step |
fail_on_cvss | string | 6.2 | CVSS score threshold to fail the build (0-10) |
suppression_file | string | dependency-check-suppressions.xml | Path to the dependency-check suppressions XML file |
report_format | string | ALL | Output report format (e.g. ALL, HTML, JSON, XML) |
additional_args | string | --enableRetired | Additional arguments to pass to OWASP Dependency-Check |
Secrets
| Name | Description |
|---|---|
NVD_API_KEY | NVD API key for faster vulnerability database updates (Not available to workflows triggered by pull requests from forks) |
APP_ID | GitHub App ID for the security dashboard bot (contents:write on openmrs-contrib-dependency-vulnerability-dashboard). When set with APP_PRIVATE_KEY, a short-lived App token is preferred over BOT_GH_TOKEN. |
APP_PRIVATE_KEY | Private key for the security dashboard bot GitHub App. |
BOT_GH_TOKEN | Legacy bot PAT for pushing to the dashboard repo. Fallback when App credentials are not provided. |