Sentinel · security scanner
sbom-diff-sentinel
See exactly what a pull request changes in your software bill of materials, and block the risky changes.
npm i -D @mrlouiswright/sbom-diff-sentinelPublished to GitHub Packages: add @mrlouiswright:registry=https://npm.pkg.github.com to .npmrc first (installing needs a token with read:packages).
What it checks
new-vulnerabilityAn added or changed component has an OSV advisory that the base didn't have (matched by ID and aliases)hash-changedSame name and version, different hash: a republished or tampered package, or a different mirrortoo-many-changesMore component changes than--max-changesosv-errorThe OSV lookup failed, so the check can't silently pass. Use--offlineto skip it on purposedowngradeA component moved to a lower versionsupplier-changedThe supplier or publisher changedlicense-changedAny license changeallowlist-expiredAn allowlist entry is past itsexpiresdate
Quick usage
CLI
npx sbom-diff-sentinel --base origin/main # project at origin/main vs working tree
npx sbom-diff-sentinel base.cdx.json head.spdx.json # two SBOM files (formats can be mixed)
npx sbom-diff-sentinel base.cdx.json # SBOM file vs the current project
npx sbom-diff-sentinel --generate bom.cdx.json # write a CycloneDX 1.5 SBOM for the project
API
import { readSbom, generateSbomAtRef, generateSbom, analyze, formatMarkdown, exitCode } from 'sbom-diff-sentinel';
const report = await analyze(generateSbomAtRef('.', 'origin/main'), generateSbom('.'), { maxChanges: 50 });
console.log(report.diff.upgraded, report.vulnerabilities.new);
process.exitCode = exitCode(report);
Every option is documented in the sbom-diff-sentinel docs.
CI / GitHub Action
on: pull_request
permissions:
contents: read
jobs:
sbom-diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0, persist-credentials: false }
- uses: MrLouisWright/sbom-diff-sentinel@v1
id: sbom
with:
fail-on: high # base defaults to origin/<PR base branch>
max-changes: '50'