Skip to content

offline scan for C++ dependencies from Github project version #2291

@cybops35

Description

@cybops35

Hello osv team,

First, i want to thank you to have merged in the release 2.2.3 the Feature #2209: Add support for resolving git packages that have a version specified.
which was linked to my previous issue #2014: Offline scan for custom lockfile (C/C++ project from git project) skipped.

But I still don't manage to have results in offline mode for C++ dependencies from Github projects.

I use this script mirror.sh to create my osv-scanner local database:

#!/bin/sh

set -x

#Checking if the variable is set
if [ -n "$OSV_SCANNER_LOCAL_DB_CACHE_DIRECTORY" ];then
    echo "Downloading vulnerabilities databases in: $OSV_SCANNER_LOCAL_DB_CACHE_DIRECTORY"
else
    echo "Variable OSV_SCANNER_LOCAL_DB_CACHE_DIRECTORY is not set"
    exit 1
fi

# Download all-ecosystems recent changes
gsutil cp gs://osv-vulnerabilities/modified_id.csv "$OSV_SCANNER_LOCAL_DB_CACHE_DIRECTORY/osv-scanner/"

# Per-ecosystem downloads database + recent changes
for eco in $(gsutil cat gs://osv-vulnerabilities/ecosystems.txt); do
    mkdir -p "$OSV_SCANNER_LOCAL_DB_CACHE_DIRECTORY/osv-scanner/$eco"
    gsutil cp gs://osv-vulnerabilities/$eco/all.zip "$OSV_SCANNER_LOCAL_DB_CACHE_DIRECTORY/osv-scanner/$eco/"
    gsutil cp gs://osv-vulnerabilities/$eco/modified_id.csv "$OSV_SCANNER_LOCAL_DB_CACHE_DIRECTORY/osv-scanner/$eco/"
done

I test with this file osv-scanner-custom.json:

{
  "results": [
    {
      "packages": [
        {
          "package": {
            "name": "github.com/openssl/openssl",
            "commit": "45fda76bc1b9fd74d10e85e0ce9b65a12dcc58b0",
            "version": "openssl-3.2.3"
          }
        }
      ]
    }
  ]
}
  • I get results when I run the scan with internet connection:
docker run --rm -ti \
    --network=host \
    --volume /home/user/osv-scanner-custom.json:/osv/inputs/osv-scanner-custom.json \
    custom/osv-scanner:2.2.3 \
        osv-scanner scan source \
            --call-analysis=all \
            --recursive "/osv/inputs"

Scanning dir /osv/inputs
Starting filesystem walk for root: /
Scanned /osv/inputs/osv-scanner-custom.json file and found 2 packages
End status: 1 dirs visited, 2 inodes visited, 1 Extract calls, 857.6µs elapsed, 857.7µs wall time
Total 2 packages affected by 11 known vulnerabilities (0 Critical, 2 High, 7 Medium, 0 Low, 2 Unknown) from 1 ecosystem.
0 vulnerabilities can be fixed.


╭────────────────────────────────┬──────┬───────────┬───────────────────┬───────────────────┬───────────────┬──────────── ≈
│ OSV URL                        │ CVSS │ ECOSYSTEM │ PACKAGE           │ VERSION           │ FIXED VERSION │ SOURCE      ≈
├────────────────────────────────┼──────┼───────────┼───────────────────┴───────────────────┼───────────────┼──────────── ≈
│ https://osv.dev/CVE-2024-12797 │ 6.3  │ GIT       │  github.com/openssl/openssl@45fda76b  │ --            │ osv/inputs/ ≈
│ https://osv.dev/CVE-2024-13176 │ 4.1  │ GIT       │  github.com/openssl/openssl@45fda76b  │ --            │ osv/inputs/ ≈
│ https://osv.dev/CVE-2024-9143  │ 4.3  │ GIT       │  github.com/openssl/openssl@45fda76b  │ --            │ osv/inputs/ ≈
│ https://osv.dev/CVE-2025-9230  │ 7.5  │ GIT       │  github.com/openssl/openssl@45fda76b  │ --            │ osv/inputs/ ≈
│ https://osv.dev/CVE-2025-9231  │ 6.5  │ GIT       │  github.com/openssl/openssl@45fda76b  │ --            │ osv/inputs/ ≈
│ https://osv.dev/CVE-2025-9232  │ 5.9  │ GIT       │  github.com/openssl/openssl@45fda76b  │ --            │ osv/inputs/ ≈
╰────────────────────────────────┴──────┴───────────┴───────────────────────────────────────┴───────────────┴──────────── ≈
  • But not when I run the same scan but using only the mirrored database without internet connection
docker run --rm -ti \
    --network=none \
    --volume $OSV_SCANNER_LOCAL_DB_CACHE_DIRECTORY/osv-scanner:/osv/databases/osv-scanner \
    --env OSV_SCANNER_LOCAL_DB_CACHE_DIRECTORY="/osv/databases" \
    --volume /home/user/osv-scanner-custom.json:/osv/inputs/osv-scanner-custom.json \
    custom/osv-scanner:2.2.3 \
        osv-scanner scan source \
            --offline \
            --call-analysis=all \
            --recursive "/osv/inputs"

Scanning dir /osv/inputs
Starting filesystem walk for root: /
Scanned /osv/inputs/osv-scanner-custom.json file and found 2 packages
End status: 1 dirs visited, 2 inodes visited, 1 Extract calls, 704µs elapsed, 704µs wall time
Loaded GIT local db from /osv/databases/osv-scanner/GIT/all.zip
No issues found
  • Even with up-to-date GIT osv-scanner local database
docker run --rm -ti \
    --network=none \
    --volume $OSV_SCANNER_LOCAL_DB_CACHE_DIRECTORY/osv-scanner:/osv/databases/osv-scanner \
    custom/osv-scanner:2.2.3 \
       ls -la /osv/databases/osv-scanner/GIT

drwxr-xr-x 1 www-data 1000         4 Oct 20 08:42 .
drwxr-xr-x 1 www-data 1000        47 Oct 20 08:41 ..
-rw-r--r-- 1 www-data 1000 141149989 Oct 20 08:42 all.zip
-rw-r--r-- 1 www-data 1000   3259592 Oct 20 08:42 modified_id.csv

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions