# OSV GIT Ranges: Commit Hashes, fixed vs limit Events

> How OSV GIT ranges work: introduced and fixed are full commit hashes evaluated on the commit graph, cherry-picked fixes must each be listed, and limit trades false positives for false negatives. With counts from PyPA, OSS-Fuzz and GHSA data and a tested git-based evaluator.

- URL: https://firewallsync.com/posts/osv-git-ranges-commit-hashes-fixed-vs-limit-events/
- Site: FirewallSync (https://firewallsync.com/)
- Topic: AppSec & APIs
- Tags: osv, osv schema, git, vulnerability management, oss-fuzz, pypa, sbom, c/c++
- Published: 2026-12-03
- Author: Craig Leslie

## Key takeaways

- In an OSV GIT range, introduced and fixed are full-length commit hashes. The spec defines u < v as 'commit u is a (perhaps distant) parent of commit v', so evaluating a range means asking the repository's commit graph, not comparing strings.
- A fixed event only clears commits that descend from it. A fix cherry-picked onto a release branch has a different hash, so the spec requires every cherry-picked fix commit as its own fixed event; otherwise the release branch is a false positive.
- A limit event restricts the range to commits that are ancestors of the limit (git rev-list X..Y semantics). It removes other branches from scope, which can cause false negatives; the spec strongly recommends fixed over limit.
- We found zero limit events in the PyPA advisory database (1,558 GIT ranges), the OSS-Fuzz vulns repository (4,108 GIT ranges) and GitHub-reviewed advisories (no GIT ranges at all).
- Multiple fixed events are common: 174 PyPA ranges and 581 OSS-Fuzz ranges list more than one fix commit, and 265 OSS-Fuzz ranges have no fix yet.



**Short answer:** An OSV range of type `GIT` describes affected code by **commit hash**, not version number. `introduced` and `fixed` are full 40-character hashes in the repository named by `repo`, and "greater than" means "descends from" in the commit graph. A `fixed` commit clears only its own descendants, so a fix cherry-picked onto a release branch must be listed as a second `fixed` event or that branch stays flagged. A `limit` event does the opposite job: it shrinks the range to the ancestors of one commit, which drops other branches and can hide real exposure. In three large OSV datasets we checked, nobody uses `limit`.

This is the commit-graph companion to our [OSV schema ranges guide](/posts/osv-schema-ranges-introduced-fixed-last-affected-ghsa/), which covers `ECOSYSTEM` and `SEMVER` ranges and deliberately refuses `GIT`. If you work from CVE records rather than OSV, the equivalent is `versionType: git`, which we touched on in the [CVE affected versions guide](/posts/cve-affected-versions-lessthan-defaultstatus-versiontype/) and the [Linux kernel CVE ranges article](/posts/linux-kernel-cve-records-affected-versions-stable-branches/).

## When you meet a GIT range

You need GIT ranges when there is no package version to compare: vendored C/C++ libraries, git submodules, code built from a commit, or fuzzing findings that predate any release. OSV.dev's own blog puts the problem plainly: "C/C++ does not have a centralized package manager like npm or pyPI," and "Software projects typically pull in C/C++ by submodules or vendoring."

The spec (OSV schema **1.9.3**, dated 30 November 2026) defines the type like this:

> `GIT`: The versions `introduced` and `fixed` are full-length Git commit hashes. The repository's commit graph is needed to evaluate whether a given version is in the range. The relation `u < v` is true when commit `u` is a (perhaps distant) parent of commit `v`.

Two consequences follow:

- `repo` is **required** for GIT ranges, and it must be usable as an argument to `git clone`.
- You cannot evaluate a GIT range from the record alone. The spec says so directly: "`GIT` range inclusion queries cannot be answered without access to a copy of the underlying Git repository." That is why it still asks for an enumerated `versions` list (tags) alongside GIT ranges.

## The four events, read as graph questions

| Event | Value in a GIT range | Question you ask the graph |
|---|---|---|
| `introduced` | Commit hash, or `"0"` | Is this commit an ancestor of (or equal to) mine? `"0"` means "from the start of history". |
| `fixed` | Commit hash | Is this fix commit an ancestor of (or equal to) mine? If yes, I am fixed. |
| `last_affected` | Commit hash | Allowed by the spec, but cannot share an `events` array with `fixed`. Rare in GIT data. |
| `limit` | Commit hash, or `"*"` | Is my commit a strict ancestor of a limit commit? If no limit exists, an implicit `"*"` (infinity) applies. |

The spec allows only one key per event object, and requires at least one `introduced`.

## fixed versus limit: a tested example

The spec explains the trade-off in one paragraph:

> `events` arrays with `fixed` events must include all other cherrypicked fix commits in all branches as separate `fixed` events to avoid *false positive* matches in other branches. Conversely, `limit` events restrict the set of vulnerable commits to those reachable from the `limit`, which may result in *false negatives*. Where possible, it's strongly recommended to use `fixed` over `limit`.

To see it, we built a toy repository: `main` runs `X - A - B - FIX - M`, and `release/1.x` branches at `A` with `R1`, `R2`, then `R3`, a `git cherry-pick -x` of `FIX`.

```sh
#!/bin/sh
# Toy repo: main X-A-B-FIX-M; release/1.x branched at A with R1, R2, then cherry-picked fix R3.
set -e
rm -rf toy && git init -q -b main toy && cd toy
git config user.email t@example.com && git config user.name t
c(){ echo "$1" >> log && git add log && git commit -qm "$1" && git tag "$1"; }
c X; c A; git checkout -qb release/1.x; c R1; c R2; git checkout -q main; c B
echo fix > fix && git add fix && git commit -qm FIX && git tag FIX; c M
git checkout -q release/1.x && git cherry-pick -x FIX >/dev/null && git tag R3
```

The evaluator below uses `git merge-base --is-ancestor` for every comparison. It is **illustrative**: it treats a commit as affected when it descends from any `introduced` commit and from no `fixed` commit, which is correct for single-introduced ranges like these but not for ranges that re-introduce a bug after a fix. It is not OSV.dev's implementation. For readability the demo range files use tag names; real records use full hashes, and the script resolves both.

```python
#!/usr/bin/env python3
"""Evaluate an OSV GIT range against commits of a local clone. Illustrative."""
import subprocess, sys, json

def is_anc(repo, a, b):
    """True if commit a is an ancestor of (or equal to) commit b."""
    return subprocess.run(["git", "-C", repo, "merge-base", "--is-ancestor", a, b]).returncode == 0

def resolve(repo, ref):
    return subprocess.check_output(["git", "-C", repo, "rev-parse", ref], text=True).strip()

def affected(repo, rng, commit):
    # Resolve every event to a full hash ("0" and "*" are OSV special values).
    ev = [{k: (v if v in ("0", "*") else resolve(repo, v)) for k, v in e.items()} for e in rng["events"]]
    limits = [e["limit"] for e in ev if "limit" in e and e["limit"] != "*"]
    if limits and not any(is_anc(repo, commit, l) and commit != l for l in limits):
        return False
    intro = [e["introduced"] for e in ev if "introduced" in e]
    fixed = [e["fixed"] for e in ev if "fixed" in e]
    if not any(i == "0" or is_anc(repo, i, commit) for i in intro):
        return False
    return not any(is_anc(repo, f, commit) for f in fixed)

if __name__ == "__main__":
    repo, rng_file, *commits = sys.argv[1:]
    rng = json.load(open(rng_file))
    for c in commits:
        print(c, "AFFECTED" if affected(repo, rng, resolve(repo, c)) else "not affected")
```

We ran it with Python 3.13 and git 2.43 against three ranges (`python3 osv_git_eval.py toy r1.json X A B FIX M R1 R2 R3`):

| Commit | r1: `introduced X, fixed FIX` | r2: `+ fixed R3` | r3: `introduced X, limit FIX` |
|---|---|---|---|
| X, A, B | affected | affected | affected |
| FIX, M | not affected | not affected | not affected |
| R1, R2 | affected | affected | **not affected** |
| R3 (has the cherry-picked fix) | **affected** | not affected | not affected |

- **r1** flags R3 even though it contains the fix: a false positive, because the cherry-pick has its own hash.
- **r2** adds the cherry-pick as a second `fixed` event and gets every commit right.
- **r3** returns X, A and B, matching the spec's description of `limit` as "equivalent to `git rev-list X..Y` (but including `X` and excluding `Y`)". It also clears R1 and R2, which are still vulnerable: a false negative.

If you consume GIT ranges, prefer a false positive you can suppress with a [VEX not_affected statement](/posts/vex-explained-what-a-not-affected-statement-means-and-how-to-read-one/) over a false negative nobody sees.

## What real OSV data uses

We counted GIT ranges in three public OSV sources (Python 3.13, PyYAML 6.0.3):

| Source (commit) | Records | Records with GIT ranges | GIT ranges | Ranges with >1 `fixed` | Ranges with no `fixed` | `limit` events |
|---|---|---|---|---|---|---|
| [pypa/advisory-database](https://github.com/pypa/advisory-database) (`6c98d1c`, 2 Dec 2026) | 7,943 | 1,551 | 1,558 | 174 | 0 | 0 |
| [google/oss-fuzz-vulns](https://github.com/google/oss-fuzz-vulns) (`f120110`, 2 Dec 2026) | 4,128 | 4,108 | 4,108 | 581 | 265 | 0 |
| [github/advisory-database](https://github.com/github/advisory-database) reviewed (`85ddf6c`, 3 Dec 2026) | 38,222 | 0 | 0 | n/a | n/a | 0 |

What the counts show:

- **Nobody uses `limit`.** Zero events across all three. Support it in a consumer, but expect to see it rarely.
- **PyPA pairs GIT with ECOSYSTEM in the same entry.** All 1,551 PyPA records with a GIT range also carry an `ECOSYSTEM` range, inside the same `affected` object as the PyPI package. 1,555 of the 1,558 ranges start at `introduced: "0"`. Example: PYSEC-2017-3 (ansible, CVE-2015-6240) has a GIT range with two `fixed` commits plus an ECOSYSTEM range and 45 enumerated versions. Spec 1.9.3 recommends a different layout, a separate `affected` entry with no `package` for Git details, so expect both shapes.
- **OSS-Fuzz is GIT-first.** 4,108 of 4,128 records use GIT ranges, almost all (4,097) under the `OSS-Fuzz` ecosystem. The 265 ranges without a `fixed` event are open-ended: per the spec's implicit `limit: "*"`, everything descending from `introduced` is affected. Only 1,645 of the source files enumerate `versions`; the spec notes OSV.dev can populate that list from tags during ingestion.
- **GitHub-reviewed advisories never use GIT ranges**, so a Dependabot-style pipeline built on GHSA data never needs this code path.

## How to match vendored code

1. **Find the commit.** For a submodule, `git submodule status` gives it. For a vendored copy with no history, OSV.dev's experimental `determineversion` API, described in its July 2023 blog post, estimates the likely upstream version of a local C/C++ library.
2. **Ask OSV.dev, or evaluate locally.** `POST /v1/query` accepts `{"commit": "<hash>"}`; the docs say that if `commit` is specified, `version` should not be set, and the package is optional. To evaluate locally, clone the `repo` and use ancestry checks as above.
3. **Check every `fixed` event, not just the first.** One per branch is normal.
4. **Do not string-compare hashes.** Hashes have no order. Only the graph does.
5. **Feed the result into the same triage as everything else.** A GIT-matched record still needs a CVE alias before KEV or EPSS can help; see the [vulnerability prioritization workflow](/posts/vulnerability-prioritization-workflow-cve-record-to-patch-ticket/).

## Common mistakes

- **Treating `fixed` as "everything after this date".** It clears only descendants of that commit. A branch cut before the fix stays affected unless its own cherry-pick is listed.
- **Shallow clones.** `git clone --depth 1` lacks the history needed for ancestry checks; `merge-base --is-ancestor` will fail or mislead. Fetch enough history to contain the `introduced` commit.
- **Abbreviated hashes.** The spec says full-length hashes. Resolve short ones before comparing, as the script does.
- **Mixing tag versions with ecosystem versions.** The spec warns that `versions` under a GIT range "typically represent Git tags and cannot be relied upon to conform to any particular package manager's syntax".

## Limits of this article

- The evaluator is a simplified illustration and mishandles ranges that re-introduce a bug after a fix. Use OSV.dev or a maintained scanner in production.
- Data counts are from repository source files at the commits shown, not from OSV.dev's enriched exports, which may add `versions`. We could not download OSV.dev's bulk exports from our environment.
- We did not test OSV-Scanner's GIT handling or the `determineversion` API.

## Sources and verification

| Important claim | Source | Status |
|---|---|---|
| GIT type definition, `u < v` relation, `repo` required, `versions` still required, event rules, fixed vs limit trade-off, limit example semantics | [OSV schema 1.9.3, docs/schema.md](https://github.com/ossf/osv-schema/blob/main/docs/schema.md) | Verified (quoted) |
| Separate Git entries without `package` recommended | Same, "Separating Git and Strict Ecosystems" | Verified (quoted) |
| `commit` field in `POST /v1/query`; `version` must not be set; package optional | [OSV.dev API: POST /v1/query](https://google.github.io/osv.dev/post-v1-query/) | Verified (quoted) |
| C/C++ has no central package manager; `determineversion` is experimental | [OSV.dev blog, 20 July 2023](https://osv.dev/blog/posts/using-the-determineversion-api/) | Verified (quoted) |
| Toy repository results for r1, r2, r3 | Script run 3 December 2026, Python 3.13, git 2.43 | Verified (run) |
| All counts in the data table | Script run 3 December 2026 on the commits shown | Verified (computed) |

## Frequently asked questions

### What is a GIT range in the OSV schema?

It is an affected range whose type is GIT. Its introduced and fixed events are full-length commit hashes in the repository named by the required repo field. A commit is in range if it descends from an introduced commit and does not descend from a fixed commit.

### What is the difference between fixed and limit in an OSV GIT range?

fixed clears every commit that descends from the fix commit, on any branch. limit keeps only commits that are ancestors of the limit commit, which drops other branches entirely. Missing cherry-picks under fixed cause false positives; limit can cause false negatives, so the spec recommends fixed.

### Can I evaluate an OSV GIT range without cloning the repository?

Not reliably. The spec says GIT range inclusion queries cannot be answered without a copy of the Git repository, which is why it also asks for an enumerated versions list. OSV.dev can answer a commit query for you with the commit field of POST /v1/query.

### Why does a single OSV record list several fixed commits?

Because the fix landed on more than one branch. Each cherry-pick has its own commit hash, and the spec says events arrays with fixed events must include all cherry-picked fix commits in all branches to avoid false positives.


Image credit: Photo by [Yishen Ji](https://unsplash.com/photos/z501FGH2nF4) on Unsplash
