Skip to content

feat(determineversion): identify official SQLite amalgamations #6321

Open

Description

@coygeek

Summary

Please add identification coverage for the official SQLite amalgamation distributed as sqlite3.c and sqlite3.h. A directory containing those two files currently produces no candidate from the determineversion API, so OSV-Scanner cannot identify that vendored dependency through filesystem/vendored.

This is a feature request for generated release artifacts. The experimental API attempts to find the closest indexed source, and I found no existing guarantee that generated amalgamations are covered.

Problem to solve

SQLite is present in the published indexer configuration, which points to its Git mirror. However, SQLite's download documentation explains that the amalgamation files are build products absent from the raw source tree. Applications that vendor the official amalgamation therefore present a different artifact from the repository files currently indexed.

The determineversion documentation invites coverage feedback and points users to the indexer configuration to check available projects. It describes project coverage but does not explain this generated-artifact distinction.

Proposed behavior

Recognize an unmodified official SQLite amalgamation from its file hashes and return a supported SQLite release or corresponding upstream commit candidate through the existing API. Preserve uncertainty when the input cannot distinguish candidates. The package name alone should not establish a match. The indexing or matching approach is left to maintainers.

Acceptance criteria

  • A request containing the hashes of the two official amalgamation files in the reproduction below returns a SQLite candidate corresponding to that release, or clearly identifies equivalent candidates when exact attribution is ambiguous.
  • The same result is available to clients without access to a SQLite checkout or build environment.
  • Unrelated file contents do not become SQLite matches merely because the request name is sqlite.
  • Coverage documentation explains whether official generated release artifacts are supported and any remaining limits.

Affected area

The determineversion index and API, and downstream consumers such as OSV-Scanner. The scanner's extractor reaches the API and returns no inventory for the tested directory; the direct request below reproduces the absence of candidates independently of the scanner.

Non-goals

This request does not claim a vulnerability in either tool, establish any advisory's applicability, request support for arbitrary modified amalgamations, or require a particular index implementation.

Alternatives considered

  • Use a full canonical SQLite source tree: this changes the input from what the application actually vendors.
  • Supply independently maintained package metadata to a scanner: this requires an additional inventory source and does not improve identification of the existing two-file directory.
  • Document the limit alone: this would explain the current result, but would leave this common distribution form unidentified.

Supporting context

Tested baseline

OSV-Scanner v2.7.1, official Darwin arm64 binary, and scanner default branch 02f96a40691c2d155fdda799af436e111231e365 (the same commit reported by the release binary). The binary reports OSV-SCALIBR 0.5.3. The live public determineversion endpoint was queried directly; it does not expose a deployment revision in this response. OSV.dev default branch 59ebdcf7cf1d1855b72528dcf84cec3ef43ccef0 and latest published tag v0.1.3 were inspected, not built or deployed locally. Both indexer sources hash files from a Git worktree. The reproduction ran on macOS arm64 with disposable HOME and cache directories.

Reproduction

Download the official SQLite amalgamation archive and copy only sqlite3.c and sqlite3.h from its sqlite-amalgamation-3500400/ directory into fixture/third_party/sqlite/. This is SQLite 3.50.4. The downloaded ZIP's SHA-256 was 1d3049dd0f830a025a53105fc79fd2ab9431aea99e137809d064d8ee8356b032.

Run:

osv-scanner scan source -r --x-plugins filesystem/vendored \
  --format json --all-packages fixture

The scanner made one extraction call for third_party/sqlite, reported zero packages, printed No package sources found, --help for usage information., and exited 128.

The following direct request uses the base64-encoded MD5 hashes calculated from the two downloaded files:

curl -sS -X POST https://api.osv.dev/v1experimental/determineversion \
  -H 'Content-Type: application/json' \
  --data '{"name":"sqlite","file_hashes":[{"file_path":"sqlite3.c","hash":"cHgT/Ege3+DluVeLX3ll+w=="},{"file_path":"sqlite3.h","hash":"xEEcbsXFAMxqMIS5DldtfA=="}]}'

Observed response: HTTP 200 with {}. This establishes the current no-candidate result for this release artifact, not a general claim about every SQLite version or distribution.

Control

A request built from all 390 C/C++ files in the official canonical source archive, using the same MD5 encoding and endpoint, returned the matching release tag as its highest-scoring candidate: score 0.99489795918367352, minimum_file_matches: "389", and estimated_diff_files: "2". This confirms that the service can identify the canonical source for the tested release while returning no candidate for its amalgamation. A preliminary request containing only ten selected canonical files also returned {}; partial repository coverage is not an independently verified workaround.

Source inspection

The scanner's vendored extractor hashes C/C++ files and calls the experimental API. The OSV.dev indexer's processGit checks out the configured revision and hashes matching files in that worktree. Inspection of the SQLite release tag's complete Git tree confirmed that neither amalgamation file is present. These source observations explain why repository-file indexing does not itself provide amalgamation coverage; they do not prove the exact deployed service revision or exclude other reasons for an empty match.

Triage assessment

  • Impact level: not-applicable
  • Assessment status: not-applicable
  • Impact basis: This requests identification of generated release artifacts without an established contract requiring that coverage; no behavioral defect or security vulnerability is asserted.
  • Workaround status: not-applicable
  • Workaround basis: The alternatives above require another representation or additional metadata and are product tradeoffs for the requested capability, not verified repairs of an existing contract.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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