Skip to main content

GitLab CI/CD

Add this include to your project's .gitlab-ci.yml to scan its lockfile. The URL references the v1.42.0 release tag of the template. GitLab fetches the YAML from GitHub when it creates the pipeline.

include:
- remote: 'https://raw.githubusercontent.com/OWASP/cve-lite-cli/v1.42.0/templates/cve-lite.yml'
inputs:
fail-on: high

The cve-lite-scan job runs in the test stage using the Node 24 Debian image. It can start immediately and runs independently of earlier stages and their artifacts. If your pipeline defines custom stages, set stage to one of them. The runner needs access to the npm registry to install the pinned CLI. Online scans also need access to OSV.

With the example above, high and critical findings fail the job. By default the log shows the findings and any available fix commands. Omit inputs to run an informational scan. An installation failure or scan error fails the job even if the CLI already wrote a report. In informational mode the job accepts exit code 1 only when the CLI records a completed scan with that code. Open cve-lite-scan → Job artifacts → Browse to read the JSON report and the SBOM, including when findings fail the job.

This version scans one project. In a repository with several independent lockfiles, set path to the directory containing the lockfile you want to scan, for example apps/web. Multi-project SBOM support is planned for a future CLI release.

Inputs​

InputDefaultBehavior
stagetestPipeline stage for the job.
version1.42.0Exact published CLI version, in major.minor.patch form.
path.Project directory to scan, relative to the checkout or absolute.
fail-onemptyFail on findings at or above low, medium, high, or critical.
prod-onlyfalseExclude development dependencies where supported.
allfalsePrint the findings table in the job log, including severities below the CLI’s default min-severity of medium. This enables verbose output and leaves the fail-on gate unchanged.
verbosetruePrint findings and available fix commands in the job log. Set to false for quieter output.
cdxtrueGenerate a CycloneDX SBOM alongside the JSON scan report. Set to false for JSON only.
sbomemptyChoose cyclonedx, spdx, or spdx2.3. An explicit format takes precedence over cdx.
offlinefalseScan using an existing advisory database.
offline-dbemptyDatabase path relative to the checkout or absolute. Supplying it enables offline scanning. The default offline path is .cache/cve-lite/advisories.db.
sync-advisoriesfalseDownload or refresh the database before scanning offline.
ca-certemptyPath to a PEM CA certificate trusted during npm installation, advisory sync, and scanning.

Offline scans and corporate runners​

To refresh the advisory database in the job, use these inputs on the same include. The sync step needs network access.

inputs:
path: apps/web
sync-advisories: true
offline-db: .cache/cve-lite/advisories.db
ca-cert: certs/corporate-root.pem

For a runner with a pre-synced database, supply its mounted path with offline-db and omit sync-advisories. The job still installs the CLI, so make the package available through your runner's npm registry or mirror.