Osv scanner

From seaworld008/Commonly-used-high-value-skills · View interactive version

Osv scanner is an AI agent skill from the GitHub repository seaworld008/Commonly-used-high-value-skills. Use when checking open-source dependencies for known vulnerabilities with OSV-Scanner across lockfiles, manifests, SBOMs, git history, or source trees.

How to use this skill

Skill file

OSV-Scanner

Trigger / When to Use

Use this skill when the user wants a fast open-source dependency vulnerability scan based on the OSV database, especially for projects with lockfiles, package manifests, SBOMs, or git repositories.

Good trigger phrases:

Core Capabilities

Workflow

1. Confirm Scope

Determine whether the user wants to scan:

Prefer scanning lockfiles when present because they represent resolved dependency versions.

2. Verify Installation

osv-scanner --version

If it is missing, recommend the official OSV-Scanner installation method for the user's platform.

3. Run Source Scan

Use source scanning for normal repositories:

osv-scanner scan source .

For a single input, inspect the installed version's flags:

osv-scanner scan source --help
# When --lockfile is supported for this input:
osv-scanner scan source --lockfile package-lock.json

For an SPDX SBOM, use the SBOM option documented by that version and pass only sbom.spdx.json. Keep the positional directory target for repository scans.

4. Capture JSON Output

Use JSON when the result needs to feed automation:

osv-scanner scan source --format json --output osv-results.json .

If the installed version does not support a flag exactly as written, run osv-scanner --help and adapt to the installed CLI syntax.

5. Triage Results

For each finding, record:

Prioritize:

  1. Direct dependencies with fixed versions.
  2. Transitive vulnerabilities reachable through active runtime paths.
  3. Vulnerabilities with public exploit references.
  4. Dependencies used in production builds over dev-only packages.

6. Remediation Strategy

Use the package manager native workflow first:

npm audit fix
go get module@example.com@patched-version
pip-compile --upgrade-package package-name
cargo update -p package-name
bundle update package-name

When no fixed version exists:

Common Patterns

GitHub Actions Gate

Set OSV_SCANNER_VERSION to a reviewed exact v2 release tag in the repository's CI configuration. Record the scanner version and database snapshot time when available; otherwise record scan time and note the unknown database timestamp.

name: osv-scanner
on: [pull_request]
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install OSV-Scanner
        env:
          OSV_SCANNER_VERSION: ${{ vars.OSV_SCANNER_VERSION }}
        run: |
          go install "github.com/google/osv-scanner/v2/cmd/osv-scanner@${OSV_SCANNER_VERSION:?set a reviewed release tag}"
          osv-scanner --version
      - name: Scan dependencies
        run: osv-scanner scan source .

Monorepo Scan Checklist

1. List package roots and lockfiles.
2. Scan from repository root.
3. Re-run targeted scans for high-risk services.
4. Deduplicate repeated findings by package/version/vulnerability ID.
5. Assign owners based on package root.

Finding Template

## OSV Finding

- Package:
- Ecosystem:
- Current version:
- Fixed version:
- Vulnerability:
- Direct/transitive:
- Lockfile:
- Recommended action:
- Risk owner:

Interpretation Rules

Boundaries

Reference Sources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.