chain-rdeveloper portal
build

Dependency Vulnerability Scanning

Overview

The platform scans its dependencies for known vulnerabilities (SCA) on every commit, PR and push — the counterpart to the bandit static analysis (SAST) that scans first-party code.

Two tools, split by what they can do rather than by ecosystem:

ToolScopeCan auto-fix
osv-scannerEvery lockfile — Python and NodeNo

osv-scanner queries the OSV database, which aggregates GHSA, PYSEC and CVE advisories. It reads uv.lock natively, so there is no export step and no second source of truth — the lockfile that gets installed is the lockfile that gets scanned.

What is covered

modules/svc-ai/uv.lock          modules/fe/package-lock.json
modules/svc-auth/uv.lock        tools/requirements.txt
modules/svc-bff/uv.lock         tools/collectors/requirements.txt
modules/svc-core/uv.lock        modules/svc-core/requirements.txt
modules/test/uv.lock

Discovery is by glob, not by a hardcoded list — a new service with a uv.lock is picked up with no change to the tooling.

Running it

make audit            # npm audit fix + Python scan (the everyday command)
make audit-fe         # npm audit fix only
make audit-be         # Python lockfiles only
make audit-deps       # every lockfile, Python and Node, in one pass

The binary is installed automatically on first use (and by the devcontainer's post-create step) via tools/security/install-osv-scanner.sh, which pins a release version and is idempotent.

The severity gate

OSV_FAIL_ON is the single policy knob, honoured identically by the Makefile, the pre-commit hook and CI:

ValueBehaviour
anyFail on any finding at all
lowFail at CVSS ≥ 0.1
mediumFail at CVSS ≥ 4.0
highFail at CVSS ≥ 7.0
criticalFail at CVSS ≥ 9.0
OSV_FAIL_ON=high make audit-be    # try a stricter policy locally

Flipping CI to blocking

The repo is report-only today because the existing lockfiles carry a backlog of findings. Making the gate blocking is two edits:

  1. Set OSV_FAIL_ON in the dependency-scan job in .github/workflows/ci.yml to critical, high or any.

  2. Add dependency-scan to the needs: list of the jobs that should wait on it (the job is deliberately independent of the pipeline while report-only).

Change OSV_FAIL_ON ?= in the Makefile to move the local default in step.

Where it runs

SurfaceScopeBlocking
CIWhole repo, every ecosystemNo (OSV_FAIL_ON)
make auditWhole repoNo (OSV_FAIL_ON)

The pre-commit hook runs with OSV_ON_ERROR=warn, so a machine with no network still commits — the scan is skipped with a warning rather than blocking. CI uses the default fail, so a broken scan there is a real failure, not a silent pass.

The CI job writes the findings table to the GitHub step summary and uploads the raw JSON as an osv-results artifact (30-day retention).

Fixing a finding

Upgrade in the lockfile first: uv lock --upgrade-package <pkg> in the service, npm update <pkg> in modules/fe. Take the earliest fixed release that has been out for at least a week; a release days old is a supply-chain risk of its own. Then re-run make audit-deps and the service's tests.

When no upstream release fixes it — the package that pulls it in pins the vulnerable version — force the fixed one with npm overrides in modules/fe/package.json, and record it here, since package.json takes no comments:

OverrideWhyRemove when
postcss-selector-parser 7.1.6 under @tailwindcss/typographyGHSA-rj75-hqrm-r3gf is fixed only in 7.1.6; @tailwindcss/typography 0.5.20 (latest) pins 6.0.10 exactly. 7.0's only breaking change is safe insertion during iteration; the plugin runs at build time on our own CSSthe plugin depends on 7.1.6 or later

Suppressing a finding

Never widen the severity gate to silence one advisory. Add an entry to .osv-scanner.toml instead:

[[IgnoredVulns]]
id = "GHSA-xxxx-xxxx-xxxx"
ignoreUntil = 2026-12-31
reason = "Only reachable via the CLI entrypoint, which we do not ship."

ignoreUntil is required by convention so suppressions expire and come back for review rather than accumulating silently.

Implementation

FileRole
tools/security/osv-scan.shScan wrapper — resolves targets, applies OSV_FAIL_ON
tools/security/osv_report.pyRenders the JSON result (text/markdown) and decides exit
.osv-scanner.tomlSuppressions and package overrides

osv-scanner emits one format per run, so the wrapper always requests JSON — the canonical form — and osv_report.py renders it for logs or for a GitHub step summary and applies the severity policy. One scan, one network round-trip, one policy shared by every surface.