Adding OSV-Scanner to GitHub Actions
Scan your lockfiles against the open OSV database with Google OSV-Scanner.
OSV-Scanner checks your lockfiles against OSV.dev, the open vulnerability database aggregating advisories across ecosystems. Google publishes a reusable workflow that handles SARIF upload, so wiring it up is mostly a one-liner referencing that workflow.
What you need
- Supported lockfiles (package-lock.json, poetry.lock, go.mod, Cargo.lock, etc.).
- The google/osv-scanner-action reusable workflow.
- security-events: write to upload SARIF.
The workflow
Call the reusable PR-scan workflow.
.github/workflows/osv.yml
jobs:
scan:
uses: google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@v2
with:
scan-args: |-
--recursive
./
permissions:
security-events: write
contents: readCommon gotchas
- It scans lockfiles, so a manifest without a committed lockfile yields nothing.
- --recursive is needed for monorepos with nested lockfiles.
- Findings can include transitive-only CVEs you cannot fix directly - triage before failing builds.
Key takeaways
- OSV-Scanner checks lockfiles against the open OSV.dev database.
- Use the google/osv-scanner-action reusable workflow for SARIF.
- Commit lockfiles and use --recursive for monorepos.
Frequently asked questions
Adding OSV-Scanner to GitHub Actions?
OSV-Scanner checks your lockfiles against OSV.dev, the open vulnerability database aggregating advisories across ecosystems. Google publishes a reusable workflow that handles SARIF upload, so wiring it up is mostly a one-liner referencing that workflow.
The workflow?
Call the reusable PR-scan workflow.
Related guides
"Temporary failure in name resolution" in CIFix "Temporary failure in name resolution" in CI - the glibc resolver could not reach a DNS server, usually f…
Attestation "predicate invalid" for an in-toto statement in CIFix attestation "predicate invalid" in CI - the predicate JSON attached to an in-toto attestation does not ma…
Auth0 "access_denied" from the token endpoint in CIFix Auth0 "error":"access_denied" in CI - the client authenticated but was not authorized for the requested A…