<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>Osv Schema | FirewallSync</title><link>https://firewallsync.com/tags/osv-schema/</link><description>Practical cybersecurity writing for engineering teams that ship fast.</description><language>en-us</language><image><url>https://firewallsync.com/icon-512.png</url><title>FirewallSync</title><link>https://firewallsync.com/</link></image><lastBuildDate>Thu, 03 Dec 2026 04:40:00 +0000</lastBuildDate><atom:link href="https://firewallsync.com/tags/osv-schema/index.xml" rel="self" type="application/rss+xml"/><item><title>OSV GIT Ranges: Commit Hashes, fixed vs limit Events</title><link>https://firewallsync.com/posts/osv-git-ranges-commit-hashes-fixed-vs-limit-events/</link><guid>https://firewallsync.com/posts/osv-git-ranges-commit-hashes-fixed-vs-limit-events/</guid><pubDate>Thu, 03 Dec 2026 04:40:00 +0000</pubDate><dc:creator>Craig Leslie</dc:creator><category>AppSec &amp; APIs</category><description>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.</description><enclosure url="https://firewallsync.com/posts/osv-git-ranges-commit-hashes-fixed-vs-limit-events/cover_hu10549478243202500838.jpg" type="image/jpeg" length="0"/><media:content url="https://firewallsync.com/posts/osv-git-ranges-commit-hashes-fixed-vs-limit-events/cover_hu10549478243202500838.jpg" medium="image" type="image/jpeg" width="1200" height="630"/><content:encoded><![CDATA[<p><img src="https://firewallsync.com/posts/osv-git-ranges-commit-hashes-fixed-vs-limit-events/cover_hu10549478243202500838.jpg" alt="Bare, dark tree branches forking in every direction against a pale grey sky" width="1200" height="630"></p><p><strong>Short answer:</strong> An OSV range of type <code>GIT</code> describes affected code by <strong>commit hash</strong>, not version number. <code>introduced</code> and <code>fixed</code> are full 40-character hashes in the repository named by <code>repo</code>, and &ldquo;greater than&rdquo; means &ldquo;descends from&rdquo; in the commit graph. A <code>fixed</code> commit clears only its own descendants, so a fix cherry-picked onto a release branch must be listed as a second <code>fixed</code> event or that branch stays flagged. A <code>limit</code> 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 <code>limit</code>.</p>
<p>This is the commit-graph companion to our <a href="/posts/osv-schema-ranges-introduced-fixed-last-affected-ghsa/">OSV schema ranges guide</a>, which covers <code>ECOSYSTEM</code> and <code>SEMVER</code> ranges and deliberately refuses <code>GIT</code>. If you work from CVE records rather than OSV, the equivalent is <code>versionType: git</code>, which we touched on in the <a href="/posts/cve-affected-versions-lessthan-defaultstatus-versiontype/">CVE affected versions guide</a> and the <a href="/posts/linux-kernel-cve-records-affected-versions-stable-branches/">Linux kernel CVE ranges article</a>.</p>
<h2 id="when-you-meet-a-git-range">When you meet a GIT range</h2>
<p>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&rsquo;s own blog puts the problem plainly: &ldquo;C/C++ does not have a centralized package manager like npm or pyPI,&rdquo; and &ldquo;Software projects typically pull in C/C++ by submodules or vendoring.&rdquo;</p>
<p>The spec (OSV schema <strong>1.9.3</strong>, dated 30 November 2026) defines the type like this:</p>
<blockquote>
<p><code>GIT</code>: The versions <code>introduced</code> and <code>fixed</code> are full-length Git commit hashes. The repository&rsquo;s commit graph is needed to evaluate whether a given version is in the range. The relation <code>u &lt; v</code> is true when commit <code>u</code> is a (perhaps distant) parent of commit <code>v</code>.</p>
</blockquote>
<p>Two consequences follow:</p>
<ul>
<li><code>repo</code> is <strong>required</strong> for GIT ranges, and it must be usable as an argument to <code>git clone</code>.</li>
<li>You cannot evaluate a GIT range from the record alone. The spec says so directly: &ldquo;<code>GIT</code> range inclusion queries cannot be answered without access to a copy of the underlying Git repository.&rdquo; That is why it still asks for an enumerated <code>versions</code> list (tags) alongside GIT ranges.</li>
</ul>
<h2 id="the-four-events-read-as-graph-questions">The four events, read as graph questions</h2>
<table>
  <thead>
      <tr>
          <th>Event</th>
          <th>Value in a GIT range</th>
          <th>Question you ask the graph</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>introduced</code></td>
          <td>Commit hash, or <code>&quot;0&quot;</code></td>
          <td>Is this commit an ancestor of (or equal to) mine? <code>&quot;0&quot;</code> means &ldquo;from the start of history&rdquo;.</td>
      </tr>
      <tr>
          <td><code>fixed</code></td>
          <td>Commit hash</td>
          <td>Is this fix commit an ancestor of (or equal to) mine? If yes, I am fixed.</td>
      </tr>
      <tr>
          <td><code>last_affected</code></td>
          <td>Commit hash</td>
          <td>Allowed by the spec, but cannot share an <code>events</code> array with <code>fixed</code>. Rare in GIT data.</td>
      </tr>
      <tr>
          <td><code>limit</code></td>
          <td>Commit hash, or <code>&quot;*&quot;</code></td>
          <td>Is my commit a strict ancestor of a limit commit? If no limit exists, an implicit <code>&quot;*&quot;</code> (infinity) applies.</td>
      </tr>
  </tbody>
</table>
<p>The spec allows only one key per event object, and requires at least one <code>introduced</code>.</p>
<h2 id="fixed-versus-limit-a-tested-example">fixed versus limit: a tested example</h2>
<p>The spec explains the trade-off in one paragraph:</p>
<blockquote>
<p><code>events</code> arrays with <code>fixed</code> events must include all other cherrypicked fix commits in all branches as separate <code>fixed</code> events to avoid <em>false positive</em> matches in other branches. Conversely, <code>limit</code> events restrict the set of vulnerable commits to those reachable from the <code>limit</code>, which may result in <em>false negatives</em>. Where possible, it&rsquo;s strongly recommended to use <code>fixed</code> over <code>limit</code>.</p>
</blockquote>
<p>To see it, we built a toy repository: <code>main</code> runs <code>X - A - B - FIX - M</code>, and <code>release/1.x</code> branches at <code>A</code> with <code>R1</code>, <code>R2</code>, then <code>R3</code>, a <code>git cherry-pick -x</code> of <code>FIX</code>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span><span style="color:#75715e">#!/bin/sh
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#75715e"># Toy repo: main X-A-B-FIX-M; release/1.x branched at A with R1, R2, then cherry-picked fix R3.</span>
</span></span><span style="display:flex;"><span>set -e
</span></span><span style="display:flex;"><span>rm -rf toy <span style="color:#f92672">&amp;&amp;</span> git init -q -b main toy <span style="color:#f92672">&amp;&amp;</span> cd toy
</span></span><span style="display:flex;"><span>git config user.email t@example.com <span style="color:#f92672">&amp;&amp;</span> git config user.name t
</span></span><span style="display:flex;"><span>c<span style="color:#f92672">(){</span> echo <span style="color:#e6db74">&#34;</span>$1<span style="color:#e6db74">&#34;</span> &gt;&gt; log <span style="color:#f92672">&amp;&amp;</span> git add log <span style="color:#f92672">&amp;&amp;</span> git commit -qm <span style="color:#e6db74">&#34;</span>$1<span style="color:#e6db74">&#34;</span> <span style="color:#f92672">&amp;&amp;</span> git tag <span style="color:#e6db74">&#34;</span>$1<span style="color:#e6db74">&#34;</span>; <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>c X; c A; git checkout -qb release/1.x; c R1; c R2; git checkout -q main; c B
</span></span><span style="display:flex;"><span>echo fix &gt; fix <span style="color:#f92672">&amp;&amp;</span> git add fix <span style="color:#f92672">&amp;&amp;</span> git commit -qm FIX <span style="color:#f92672">&amp;&amp;</span> git tag FIX; c M
</span></span><span style="display:flex;"><span>git checkout -q release/1.x <span style="color:#f92672">&amp;&amp;</span> git cherry-pick -x FIX &gt;/dev/null <span style="color:#f92672">&amp;&amp;</span> git tag R3
</span></span></code></pre></div><p>The evaluator below uses <code>git merge-base --is-ancestor</code> for every comparison. It is <strong>illustrative</strong>: it treats a commit as affected when it descends from any <code>introduced</code> commit and from no <code>fixed</code> 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&rsquo;s implementation. For readability the demo range files use tag names; real records use full hashes, and the script resolves both.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#75715e">#!/usr/bin/env python3</span>
</span></span><span style="display:flex;"><span><span style="color:#e6db74">&#34;&#34;&#34;Evaluate an OSV GIT range against commits of a local clone. Illustrative.&#34;&#34;&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">import</span> subprocess<span style="color:#f92672">,</span> sys<span style="color:#f92672">,</span> json
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">def</span> <span style="color:#a6e22e">is_anc</span>(repo, a, b):
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;&#34;&#34;True if commit a is an ancestor of (or equal to) commit b.&#34;&#34;&#34;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> subprocess<span style="color:#f92672">.</span>run([<span style="color:#e6db74">&#34;git&#34;</span>, <span style="color:#e6db74">&#34;-C&#34;</span>, repo, <span style="color:#e6db74">&#34;merge-base&#34;</span>, <span style="color:#e6db74">&#34;--is-ancestor&#34;</span>, a, b])<span style="color:#f92672">.</span>returncode <span style="color:#f92672">==</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">def</span> <span style="color:#a6e22e">resolve</span>(repo, ref):
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> subprocess<span style="color:#f92672">.</span>check_output([<span style="color:#e6db74">&#34;git&#34;</span>, <span style="color:#e6db74">&#34;-C&#34;</span>, repo, <span style="color:#e6db74">&#34;rev-parse&#34;</span>, ref], text<span style="color:#f92672">=</span><span style="color:#66d9ef">True</span>)<span style="color:#f92672">.</span>strip()
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">def</span> <span style="color:#a6e22e">affected</span>(repo, rng, commit):
</span></span><span style="display:flex;"><span>    <span style="color:#75715e"># Resolve every event to a full hash (&#34;0&#34; and &#34;*&#34; are OSV special values).</span>
</span></span><span style="display:flex;"><span>    ev <span style="color:#f92672">=</span> [{k: (v <span style="color:#66d9ef">if</span> v <span style="color:#f92672">in</span> (<span style="color:#e6db74">&#34;0&#34;</span>, <span style="color:#e6db74">&#34;*&#34;</span>) <span style="color:#66d9ef">else</span> resolve(repo, v)) <span style="color:#66d9ef">for</span> k, v <span style="color:#f92672">in</span> e<span style="color:#f92672">.</span>items()} <span style="color:#66d9ef">for</span> e <span style="color:#f92672">in</span> rng[<span style="color:#e6db74">&#34;events&#34;</span>]]
</span></span><span style="display:flex;"><span>    limits <span style="color:#f92672">=</span> [e[<span style="color:#e6db74">&#34;limit&#34;</span>] <span style="color:#66d9ef">for</span> e <span style="color:#f92672">in</span> ev <span style="color:#66d9ef">if</span> <span style="color:#e6db74">&#34;limit&#34;</span> <span style="color:#f92672">in</span> e <span style="color:#f92672">and</span> e[<span style="color:#e6db74">&#34;limit&#34;</span>] <span style="color:#f92672">!=</span> <span style="color:#e6db74">&#34;*&#34;</span>]
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> limits <span style="color:#f92672">and</span> <span style="color:#f92672">not</span> any(is_anc(repo, commit, l) <span style="color:#f92672">and</span> commit <span style="color:#f92672">!=</span> l <span style="color:#66d9ef">for</span> l <span style="color:#f92672">in</span> limits):
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">False</span>
</span></span><span style="display:flex;"><span>    intro <span style="color:#f92672">=</span> [e[<span style="color:#e6db74">&#34;introduced&#34;</span>] <span style="color:#66d9ef">for</span> e <span style="color:#f92672">in</span> ev <span style="color:#66d9ef">if</span> <span style="color:#e6db74">&#34;introduced&#34;</span> <span style="color:#f92672">in</span> e]
</span></span><span style="display:flex;"><span>    fixed <span style="color:#f92672">=</span> [e[<span style="color:#e6db74">&#34;fixed&#34;</span>] <span style="color:#66d9ef">for</span> e <span style="color:#f92672">in</span> ev <span style="color:#66d9ef">if</span> <span style="color:#e6db74">&#34;fixed&#34;</span> <span style="color:#f92672">in</span> e]
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> <span style="color:#f92672">not</span> any(i <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;0&#34;</span> <span style="color:#f92672">or</span> is_anc(repo, i, commit) <span style="color:#66d9ef">for</span> i <span style="color:#f92672">in</span> intro):
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">False</span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> <span style="color:#f92672">not</span> any(is_anc(repo, f, commit) <span style="color:#66d9ef">for</span> f <span style="color:#f92672">in</span> fixed)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span> __name__ <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;__main__&#34;</span>:
</span></span><span style="display:flex;"><span>    repo, rng_file, <span style="color:#f92672">*</span>commits <span style="color:#f92672">=</span> sys<span style="color:#f92672">.</span>argv[<span style="color:#ae81ff">1</span>:]
</span></span><span style="display:flex;"><span>    rng <span style="color:#f92672">=</span> json<span style="color:#f92672">.</span>load(open(rng_file))
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">for</span> c <span style="color:#f92672">in</span> commits:
</span></span><span style="display:flex;"><span>        print(c, <span style="color:#e6db74">&#34;AFFECTED&#34;</span> <span style="color:#66d9ef">if</span> affected(repo, rng, resolve(repo, c)) <span style="color:#66d9ef">else</span> <span style="color:#e6db74">&#34;not affected&#34;</span>)
</span></span></code></pre></div><p>We ran it with Python 3.13 and git 2.43 against three ranges (<code>python3 osv_git_eval.py toy r1.json X A B FIX M R1 R2 R3</code>):</p>
<table>
  <thead>
      <tr>
          <th>Commit</th>
          <th>r1: <code>introduced X, fixed FIX</code></th>
          <th>r2: <code>+ fixed R3</code></th>
          <th>r3: <code>introduced X, limit FIX</code></th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>X, A, B</td>
          <td>affected</td>
          <td>affected</td>
          <td>affected</td>
      </tr>
      <tr>
          <td>FIX, M</td>
          <td>not affected</td>
          <td>not affected</td>
          <td>not affected</td>
      </tr>
      <tr>
          <td>R1, R2</td>
          <td>affected</td>
          <td>affected</td>
          <td><strong>not affected</strong></td>
      </tr>
      <tr>
          <td>R3 (has the cherry-picked fix)</td>
          <td><strong>affected</strong></td>
          <td>not affected</td>
          <td>not affected</td>
      </tr>
  </tbody>
</table>
<ul>
<li><strong>r1</strong> flags R3 even though it contains the fix: a false positive, because the cherry-pick has its own hash.</li>
<li><strong>r2</strong> adds the cherry-pick as a second <code>fixed</code> event and gets every commit right.</li>
<li><strong>r3</strong> returns X, A and B, matching the spec&rsquo;s description of <code>limit</code> as &ldquo;equivalent to <code>git rev-list X..Y</code> (but including <code>X</code> and excluding <code>Y</code>)&rdquo;. It also clears R1 and R2, which are still vulnerable: a false negative.</li>
</ul>
<p>If you consume GIT ranges, prefer a false positive you can suppress with a <a href="/posts/vex-explained-what-a-not-affected-statement-means-and-how-to-read-one/">VEX not_affected statement</a> over a false negative nobody sees.</p>
<h2 id="what-real-osv-data-uses">What real OSV data uses</h2>
<p>We counted GIT ranges in three public OSV sources (Python 3.13, PyYAML 6.0.3):</p>
<table>
  <thead>
      <tr>
          <th>Source (commit)</th>
          <th>Records</th>
          <th>Records with GIT ranges</th>
          <th>GIT ranges</th>
          <th>Ranges with &gt;1 <code>fixed</code></th>
          <th>Ranges with no <code>fixed</code></th>
          <th><code>limit</code> events</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><a href="https://github.com/pypa/advisory-database">pypa/advisory-database</a> (<code>6c98d1c</code>, 2 Dec 2026)</td>
          <td>7,943</td>
          <td>1,551</td>
          <td>1,558</td>
          <td>174</td>
          <td>0</td>
          <td>0</td>
      </tr>
      <tr>
          <td><a href="https://github.com/google/oss-fuzz-vulns">google/oss-fuzz-vulns</a> (<code>f120110</code>, 2 Dec 2026)</td>
          <td>4,128</td>
          <td>4,108</td>
          <td>4,108</td>
          <td>581</td>
          <td>265</td>
          <td>0</td>
      </tr>
      <tr>
          <td><a href="https://github.com/github/advisory-database">github/advisory-database</a> reviewed (<code>85ddf6c</code>, 3 Dec 2026)</td>
          <td>38,222</td>
          <td>0</td>
          <td>0</td>
          <td>n/a</td>
          <td>n/a</td>
          <td>0</td>
      </tr>
  </tbody>
</table>
<p>What the counts show:</p>
<ul>
<li><strong>Nobody uses <code>limit</code>.</strong> Zero events across all three. Support it in a consumer, but expect to see it rarely.</li>
<li><strong>PyPA pairs GIT with ECOSYSTEM in the same entry.</strong> All 1,551 PyPA records with a GIT range also carry an <code>ECOSYSTEM</code> range, inside the same <code>affected</code> object as the PyPI package. 1,555 of the 1,558 ranges start at <code>introduced: &quot;0&quot;</code>. Example: PYSEC-2017-3 (ansible, CVE-2015-6240) has a GIT range with two <code>fixed</code> commits plus an ECOSYSTEM range and 45 enumerated versions. Spec 1.9.3 recommends a different layout, a separate <code>affected</code> entry with no <code>package</code> for Git details, so expect both shapes.</li>
<li><strong>OSS-Fuzz is GIT-first.</strong> 4,108 of 4,128 records use GIT ranges, almost all (4,097) under the <code>OSS-Fuzz</code> ecosystem. The 265 ranges without a <code>fixed</code> event are open-ended: per the spec&rsquo;s implicit <code>limit: &quot;*&quot;</code>, everything descending from <code>introduced</code> is affected. Only 1,645 of the source files enumerate <code>versions</code>; the spec notes OSV.dev can populate that list from tags during ingestion.</li>
<li><strong>GitHub-reviewed advisories never use GIT ranges</strong>, so a Dependabot-style pipeline built on GHSA data never needs this code path.</li>
</ul>
<h2 id="how-to-match-vendored-code">How to match vendored code</h2>
<ol>
<li><strong>Find the commit.</strong> For a submodule, <code>git submodule status</code> gives it. For a vendored copy with no history, OSV.dev&rsquo;s experimental <code>determineversion</code> API, described in its July 2023 blog post, estimates the likely upstream version of a local C/C++ library.</li>
<li><strong>Ask OSV.dev, or evaluate locally.</strong> <code>POST /v1/query</code> accepts <code>{&quot;commit&quot;: &quot;&lt;hash&gt;&quot;}</code>; the docs say that if <code>commit</code> is specified, <code>version</code> should not be set, and the package is optional. To evaluate locally, clone the <code>repo</code> and use ancestry checks as above.</li>
<li><strong>Check every <code>fixed</code> event, not just the first.</strong> One per branch is normal.</li>
<li><strong>Do not string-compare hashes.</strong> Hashes have no order. Only the graph does.</li>
<li><strong>Feed the result into the same triage as everything else.</strong> A GIT-matched record still needs a CVE alias before KEV or EPSS can help; see the <a href="/posts/vulnerability-prioritization-workflow-cve-record-to-patch-ticket/">vulnerability prioritization workflow</a>.</li>
</ol>
<h2 id="common-mistakes">Common mistakes</h2>
<ul>
<li><strong>Treating <code>fixed</code> as &ldquo;everything after this date&rdquo;.</strong> It clears only descendants of that commit. A branch cut before the fix stays affected unless its own cherry-pick is listed.</li>
<li><strong>Shallow clones.</strong> <code>git clone --depth 1</code> lacks the history needed for ancestry checks; <code>merge-base --is-ancestor</code> will fail or mislead. Fetch enough history to contain the <code>introduced</code> commit.</li>
<li><strong>Abbreviated hashes.</strong> The spec says full-length hashes. Resolve short ones before comparing, as the script does.</li>
<li><strong>Mixing tag versions with ecosystem versions.</strong> The spec warns that <code>versions</code> under a GIT range &ldquo;typically represent Git tags and cannot be relied upon to conform to any particular package manager&rsquo;s syntax&rdquo;.</li>
</ul>
<h2 id="limits-of-this-article">Limits of this article</h2>
<ul>
<li>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.</li>
<li>Data counts are from repository source files at the commits shown, not from OSV.dev&rsquo;s enriched exports, which may add <code>versions</code>. We could not download OSV.dev&rsquo;s bulk exports from our environment.</li>
<li>We did not test OSV-Scanner&rsquo;s GIT handling or the <code>determineversion</code> API.</li>
</ul>
<h2 id="sources-and-verification">Sources and verification</h2>
<table>
  <thead>
      <tr>
          <th>Important claim</th>
          <th>Source</th>
          <th>Status</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>GIT type definition, <code>u &lt; v</code> relation, <code>repo</code> required, <code>versions</code> still required, event rules, fixed vs limit trade-off, limit example semantics</td>
          <td><a href="https://github.com/ossf/osv-schema/blob/main/docs/schema.md">OSV schema 1.9.3, docs/schema.md</a></td>
          <td>Verified (quoted)</td>
      </tr>
      <tr>
          <td>Separate Git entries without <code>package</code> recommended</td>
          <td>Same, &ldquo;Separating Git and Strict Ecosystems&rdquo;</td>
          <td>Verified (quoted)</td>
      </tr>
      <tr>
          <td><code>commit</code> field in <code>POST /v1/query</code>; <code>version</code> must not be set; package optional</td>
          <td><a href="https://google.github.io/osv.dev/post-v1-query/">OSV.dev API: POST /v1/query</a></td>
          <td>Verified (quoted)</td>
      </tr>
      <tr>
          <td>C/C++ has no central package manager; <code>determineversion</code> is experimental</td>
          <td><a href="https://osv.dev/blog/posts/using-the-determineversion-api/">OSV.dev blog, 20 July 2023</a></td>
          <td>Verified (quoted)</td>
      </tr>
      <tr>
          <td>Toy repository results for r1, r2, r3</td>
          <td>Script run 3 December 2026, Python 3.13, git 2.43</td>
          <td>Verified (run)</td>
      </tr>
      <tr>
          <td>All counts in the data table</td>
          <td>Script run 3 December 2026 on the commits shown</td>
          <td>Verified (computed)</td>
      </tr>
  </tbody>
</table>
]]></content:encoded></item><item><title>OSV Schema Ranges: introduced, fixed and last_affected</title><link>https://firewallsync.com/posts/osv-schema-ranges-introduced-fixed-last-affected-ghsa/</link><guid>https://firewallsync.com/posts/osv-schema-ranges-introduced-fixed-last-affected-ghsa/</guid><pubDate>Wed, 02 Dec 2026 04:30:00 +0000</pubDate><dc:creator>Craig Leslie</dc:creator><category>AppSec &amp; APIs</category><description>How OSV affected ranges work: introduced, fixed, last_affected and limit events, the IsVulnerable algorithm, and what 12,240 live 2026 GitHub-reviewed advisories actually use. Includes a tested Python evaluator for PyPI and npm.</description><enclosure url="https://firewallsync.com/posts/osv-schema-ranges-introduced-fixed-last-affected-ghsa/cover_hu13982152058533144389.jpg" type="image/jpeg" length="0"/><media:content url="https://firewallsync.com/posts/osv-schema-ranges-introduced-fixed-last-affected-ghsa/cover_hu13982152058533144389.jpg" medium="image" type="image/jpeg" width="1200" height="630"/><content:encoded><![CDATA[<p><img src="https://firewallsync.com/posts/osv-schema-ranges-introduced-fixed-last-affected-ghsa/cover_hu13982152058533144389.jpg" alt="A yellow tape measure, a translucent meter tape and a steel ruler laid side by side on a white surface, each with different markings" width="1200" height="630"></p><p><strong>Short answer:</strong> In an <a href="https://ossf.github.io/osv-schema/">OSV</a> record, each <code>affected[].ranges[]</code> entry is a timeline of events. A version is affected from an <code>introduced</code> event until a <code>fixed</code> event, where the fixed version is <strong>not</strong> affected. If the range uses <code>last_affected</code> instead, that version <strong>is</strong> affected and anything above it is assumed safe. <code>&quot;introduced&quot;: &quot;0&quot;</code> means &ldquo;from the first version&rdquo;. In the GitHub Advisory Database, every range is type <code>ECOSYSTEM</code> and has exactly one <code>introduced</code> event. That means your matcher needs a real per-ecosystem version comparator, not string comparison.</p>
<p>OSV is the format behind osv.dev, the GitHub Advisory Database (GHSA), the Go vulnerability database, PyPA&rsquo;s advisories and many Linux distributions. If you build or maintain anything that answers &ldquo;is <code>jupyterlab 4.6.3</code> affected?&rdquo;, these few fields decide whether your answer is right. That includes a dependency scanner, an SBOM matcher or a script that turns Dependabot data into tickets. This guide covers the spec rules, what real GitHub records look like, and a tested evaluator. It complements the <a href="/posts/cve-affected-versions-lessthan-defaultstatus-versiontype/">CVE JSON 5 affected-versions guide</a>, which covers the equivalent fields in CVE records.</p>
<h2 id="method">Method</h2>
<ul>
<li><strong>Spec:</strong> <code>docs/schema.md</code> from <a href="https://github.com/ossf/osv-schema/blob/main/docs/schema.md">ossf/osv-schema</a>, fetched 2 December 2026. Its header reads &ldquo;Version 1.9.3 (November 30, 2026)&rdquo;.</li>
<li><strong>Data:</strong> <a href="https://github.com/github/advisory-database">github/advisory-database</a>, <code>advisories/github-reviewed/2026/</code> at commit <code>11d8f435</code> (2 December 2026, 03:39 UTC). These are the GitHub-reviewed advisories filed under 2026: 12,918 JSON files, of which 678 carry <code>withdrawn</code>, leaving <strong>12,240 live</strong> records.</li>
<li><strong>Counts</strong> come from a Python script that reads every file. Counts of &ldquo;ranges&rdquo; and &ldquo;affected entries&rdquo; are the same here, because every GitHub <code>affected</code> entry in this set has at most one range.</li>
</ul>
<h2 id="the-fields">The fields</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span><span style="color:#e6db74">&#34;affected&#34;</span><span style="color:#960050;background-color:#1e0010">:</span> [ {
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;package&#34;</span>:  { <span style="color:#f92672">&#34;ecosystem&#34;</span>: <span style="color:#e6db74">&#34;PyPI&#34;</span>, <span style="color:#f92672">&#34;name&#34;</span>: <span style="color:#e6db74">&#34;jupyterlab&#34;</span>, <span style="color:#f92672">&#34;purl&#34;</span>: <span style="color:#e6db74">&#34;...&#34;</span> },
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;ranges&#34;</span>:   [ { <span style="color:#f92672">&#34;type&#34;</span>: <span style="color:#e6db74">&#34;ECOSYSTEM&#34;</span>, <span style="color:#f92672">&#34;events&#34;</span>: [ {<span style="color:#f92672">&#34;introduced&#34;</span>: <span style="color:#e6db74">&#34;4.0.0&#34;</span>}, {<span style="color:#f92672">&#34;fixed&#34;</span>: <span style="color:#e6db74">&#34;4.5.11&#34;</span>} ] } ],
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;versions&#34;</span>: [ <span style="color:#e6db74">&#34;...&#34;</span> ],
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;database_specific&#34;</span>: { }
</span></span><span style="display:flex;"><span>} ]
</span></span></code></pre></div><table>
  <thead>
      <tr>
          <th>Field</th>
          <th>What the spec says</th>
          <th>What it means for a matcher</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>package.ecosystem</code> + <code>name</code></td>
          <td>Identifies the package</td>
          <td>Match on both. Never match on name alone.</td>
      </tr>
      <tr>
          <td><code>ranges[].type</code></td>
          <td><code>SEMVER</code>, <code>ECOSYSTEM</code> or <code>GIT</code></td>
          <td>Picks the comparator. <code>GIT</code> needs the commit graph.</td>
      </tr>
      <tr>
          <td><code>introduced</code></td>
          <td>Start of a vulnerable stretch; <code>&quot;0&quot;</code> sorts before every version</td>
          <td>At least one is required per range</td>
      </tr>
      <tr>
          <td><code>fixed</code></td>
          <td>First version that contains the fix</td>
          <td>The fixed version is <strong>not</strong> affected</td>
      </tr>
      <tr>
          <td><code>last_affected</code></td>
          <td>&ldquo;the hard ceiling of the vulnerability <em>at the time of publication</em>&rdquo;</td>
          <td>That version <strong>is</strong> affected; versions above are assumed unaffected</td>
      </tr>
      <tr>
          <td><code>limit</code></td>
          <td>Upper limit; <code>&quot;*&quot;</code> means infinity, and an implicit <code>&quot;*&quot;</code> applies if absent</td>
          <td>Mostly relevant to <code>GIT</code> ranges</td>
      </tr>
      <tr>
          <td><code>versions[]</code></td>
          <td>Explicit list of affected versions</td>
          <td>A version is affected if it is in this list <strong>or</strong> inside any range</td>
      </tr>
  </tbody>
</table>
<p>Three rules from the spec trip up hand-written parsers:</p>
<ol>
<li><strong>One key per event.</strong> &ldquo;Only <strong>a single type</strong> (either <code>introduced</code>, <code>fixed</code>, <code>last_affected</code>, <code>limit</code>) is allowed in each event object.&rdquo; So <code>{&quot;introduced&quot;: &quot;1.0.0&quot;, &quot;fixed&quot;: &quot;1.0.2&quot;}</code> is invalid; it must be two objects.</li>
<li><strong><code>fixed</code> or <code>last_affected</code>, not both.</strong> &ldquo;Entries in the <code>events</code> array may be &ldquo;last_affected&rdquo; or &ldquo;fixed&rdquo; events, but not both.&rdquo; The spec adds that it is &ldquo;<strong>strongly recommended</strong> to use <code>fixed</code> instead of <code>last_affected</code> where possible.&rdquo;</li>
<li><strong>ECOSYSTEM strings are not SemVer.</strong> They are &ldquo;arbitrary, uninterpreted strings specific to the package ecosystem&rdquo;. For these ranges the spec recommends also supplying an explicit <code>versions</code> list, &ldquo;because <code>ECOSYSTEM</code> range inclusion queries may not be able to be answered without reference to the package ecosystem&rsquo;s own logic&rdquo;.</li>
</ol>
<h2 id="how-evaluation-works">How evaluation works</h2>
<p>The spec gives <code>IsVulnerable</code> as pseudocode. Per range, it sorts the events by version and walks them: <code>introduced</code> at or below <code>v</code> sets vulnerable, <code>fixed</code> at or below <code>v</code> clears it, and a <code>last_affected</code> strictly below <code>v</code> clears it. A version is affected if any range says so or if it is listed in <code>versions</code>.</p>
<table>
  <thead>
      <tr>
          <th>Range</th>
          <th><code>1.0.1</code></th>
          <th><code>1.0.2</code></th>
          <th><code>2.1.214</code></th>
          <th><code>2.1.215</code></th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>introduced 0</code>, <code>fixed 1.0.2</code></td>
          <td>affected</td>
          <td>not affected</td>
          <td>not affected</td>
          <td>not affected</td>
      </tr>
      <tr>
          <td><code>introduced 0</code>, <code>last_affected 2.1.214</code></td>
          <td>affected</td>
          <td>affected</td>
          <td><strong>affected</strong></td>
          <td>not affected</td>
      </tr>
      <tr>
          <td><code>introduced 0</code> (no closing event)</td>
          <td>affected</td>
          <td>affected</td>
          <td>affected</td>
          <td>affected</td>
      </tr>
  </tbody>
</table>
<p>The middle row is the false-negative risk the spec warns about. <code>last_affected</code> records what was known at publication. If the maintainers never ship a fix, every later version still matches as &ldquo;not affected&rdquo;.</p>
<h2 id="what-githubs-2026-records-actually-use">What GitHub&rsquo;s 2026 records actually use</h2>
<table>
  <thead>
      <tr>
          <th>Measure (live 2026 GitHub-reviewed records)</th>
          <th>Count</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Records</td>
          <td>12,240</td>
      </tr>
      <tr>
          <td><code>affected</code> entries</td>
          <td>23,877</td>
      </tr>
      <tr>
          <td>Entries with a range</td>
          <td>23,747</td>
      </tr>
      <tr>
          <td>Entries with only a <code>versions</code> list</td>
          <td>130</td>
      </tr>
      <tr>
          <td>Ranges ending in <code>fixed</code></td>
          <td>22,028</td>
      </tr>
      <tr>
          <td>Ranges ending in <code>last_affected</code></td>
          <td>1,603</td>
      </tr>
      <tr>
          <td>Ranges with only <code>introduced</code></td>
          <td>116</td>
      </tr>
      <tr>
          <td>Ranges with more than one <code>introduced</code></td>
          <td>0</td>
      </tr>
      <tr>
          <td>Ranges with a <code>limit</code> event</td>
          <td>0</td>
      </tr>
  </tbody>
</table>
<p>Across all 12,918 files, including withdrawn ones, every one of the 24,464 ranges is <code>&quot;type&quot;: &quot;ECOSYSTEM&quot;</code>. That holds even for npm and Go, which use SemVer-style versions. Every file declares <code>&quot;schema_version&quot;: &quot;1.4.0&quot;</code>, while the spec text is now at 1.9.3.</p>
<p>Ecosystems by <code>affected</code> entries (all 12,918 files): npm 5,721, NuGet 5,143, Go 3,415, PyPI 3,142, Maven 2,832, Packagist 2,643, crates.io 1,131, RubyGems 421, Hex 103, GitHub Actions 28, SwiftURL 25, Pub 2.</p>
<p>Practical consequences:</p>
<ul>
<li><strong>Multiple vulnerable branches show up as separate <code>affected</code> entries for the same package,</strong> each with its own range. They are not one range with several <code>introduced</code> events. <a href="https://github.com/advisories/GHSA-3325-v43h-43rv">GHSA-3325-v43h-43rv</a> (JupyterLab, CVE-2026-102904) has two <code>jupyterlab</code> entries: <code>introduced 4.0.0 → fixed 4.5.11</code> and <code>introduced 4.6.0 → fixed 4.6.4</code>. A matcher that stops at the first entry for a package misses the second branch.</li>
<li><strong>Mixed <code>fixed</code> and <code>last_affected</code> in one advisory is normal.</strong> <a href="https://github.com/advisories/GHSA-62vg-58rm-qff7">GHSA-62vg-58rm-qff7</a> (<code>@angular/router</code>, CVE-2026-111752) has four entries. Three branches have fixed versions (22.2.1, 21.2.25, 20.3.33). The oldest is <code>introduced 0 → last_affected 19.2.25</code>, so any 19.x above 19.2.25 evaluates as not affected, whether or not it contains a fix.</li>
</ul>
<h2 id="the-database_specific-trap">The database_specific trap</h2>
<p>GitHub adds a range-level <code>database_specific.last_known_affected_version_range</code> string, such as <code>&quot;&lt;= 16.3.0&quot;</code>. The advisory-database README describes it as range information &ldquo;that is not representable in OSV format&rdquo;, and says that GitHub&rsquo;s <code>database_specific</code> values &ldquo;are subject to change without notice. Consuming systems should not rely on them for processing vulnerability information.&rdquo;</p>
<p>The string is not always redundant with the OSV range:</p>
<table>
  <thead>
      <tr>
          <th>Live 2026 ranges</th>
          <th>Count</th>
          <th>Example</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>fixed</code> event + <code>&quot;&lt;= X&quot;</code> string</td>
          <td>6,526</td>
          <td>mercurius: <code>fixed 16.4.0</code>, string <code>&lt;= 16.3.0</code></td>
      </tr>
      <tr>
          <td><code>fixed</code> event + <code>&quot;&lt; X&quot;</code> string</td>
          <td>101</td>
          <td>netty-codec-http2 (CVE-2026-33871): <code>fixed 4.2.11.Final</code>, string <code>&lt; 4.2.10.Final</code></td>
      </tr>
      <tr>
          <td>only <code>introduced</code> + <code>&quot;&lt; X&quot;</code> string</td>
          <td>79</td>
          <td>frigate (CVE-2026-33125): range <code>introduced 0</code>, string <code>&lt; 0.16.3</code></td>
      </tr>
  </tbody>
</table>
<p>In the last row, the OSV range has no closing event, so any OSV-native evaluator treats every version as affected, including the one the string implies is safe. Of the 79, 49 are Go modules, 10 Maven, 9 npm, 7 Packagist, 3 PyPI and 1 crates.io. Our evaluator below reports <code>frigate 0.16.3</code> as affected, which is what the OSV data says. Following GitHub&rsquo;s guidance, the safe reading is to trust the range and treat the string only as a hint for manual review. Resolving the disagreement means checking the vendor advisory.</p>
<p>Withdrawn records are the other trap. Of the 678 withdrawn 2026 files, 659 have summaries beginning &ldquo;Duplicate Advisory&rdquo;. In 210 of their ranges, there is only an <code>introduced</code> event. A matcher that ignores <code>withdrawn</code> will raise &ldquo;all versions affected&rdquo; alerts for advisories GitHub has retracted.</p>
<h2 id="a-tested-evaluator">A tested evaluator</h2>
<p>This is a port of the spec&rsquo;s <code>IsVulnerable</code> pseudocode to Python 3. It supports PyPI (PEP 440, via <code>packaging</code> 26.3) and npm (SemVer 2.0 precedence). It refuses other ecosystems and <code>GIT</code> ranges rather than guessing. Treat it as a reference implementation for tests, not a production scanner: Maven, NuGet, Go pseudo-versions and Debian need their own comparators.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#e6db74">&#34;&#34;&#34;Evaluate whether a package version is affected by an OSV record.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Port of the IsVulnerable pseudocode in the OSV schema (ossf/osv-schema docs/schema.md).
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Usage: python3 osv_affected.py &lt;osv.json&gt; &lt;ecosystem&gt; &lt;package&gt; &lt;version&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&#34;&#34;&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">import</span> json<span style="color:#f92672">,</span> re<span style="color:#f92672">,</span> sys
</span></span><span style="display:flex;"><span><span style="color:#f92672">from</span> functools <span style="color:#f92672">import</span> cmp_to_key
</span></span><span style="display:flex;"><span><span style="color:#f92672">from</span> packaging.version <span style="color:#f92672">import</span> Version
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>SEMVER <span style="color:#f92672">=</span> re<span style="color:#f92672">.</span>compile(<span style="color:#e6db74">r</span><span style="color:#e6db74">&#34;^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">def</span> <span style="color:#a6e22e">semver_key</span>(v):
</span></span><span style="display:flex;"><span>    m <span style="color:#f92672">=</span> SEMVER<span style="color:#f92672">.</span><span style="color:#66d9ef">match</span>(v)
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> <span style="color:#f92672">not</span> m:
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">raise</span> <span style="color:#a6e22e">ValueError</span>(<span style="color:#e6db74">f</span><span style="color:#e6db74">&#34;not SemVer: </span><span style="color:#e6db74">{</span>v<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span>)
</span></span><span style="display:flex;"><span>    core <span style="color:#f92672">=</span> tuple(int(x) <span style="color:#66d9ef">for</span> x <span style="color:#f92672">in</span> m<span style="color:#f92672">.</span>group(<span style="color:#ae81ff">1</span>, <span style="color:#ae81ff">2</span>, <span style="color:#ae81ff">3</span>))
</span></span><span style="display:flex;"><span>    pre <span style="color:#f92672">=</span> m<span style="color:#f92672">.</span>group(<span style="color:#ae81ff">4</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> pre <span style="color:#f92672">is</span> <span style="color:#66d9ef">None</span>:
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">return</span> core, (<span style="color:#ae81ff">1</span>,)            <span style="color:#75715e"># a release sorts after its prereleases</span>
</span></span><span style="display:flex;"><span>    ids <span style="color:#f92672">=</span> tuple((<span style="color:#ae81ff">0</span>, int(p), <span style="color:#e6db74">&#34;&#34;</span>) <span style="color:#66d9ef">if</span> p<span style="color:#f92672">.</span>isdigit() <span style="color:#66d9ef">else</span> (<span style="color:#ae81ff">1</span>, <span style="color:#ae81ff">0</span>, p) <span style="color:#66d9ef">for</span> p <span style="color:#f92672">in</span> pre<span style="color:#f92672">.</span>split(<span style="color:#e6db74">&#34;.&#34;</span>))
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> core, (<span style="color:#ae81ff">0</span>,) <span style="color:#f92672">+</span> ids
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">def</span> <span style="color:#a6e22e">compare</span>(eco, a, b):
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> a <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;0&#34;</span>:                      <span style="color:#75715e"># OSV special value: sorts before everything</span>
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">return</span> <span style="color:#ae81ff">0</span> <span style="color:#66d9ef">if</span> b <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;0&#34;</span> <span style="color:#66d9ef">else</span> <span style="color:#f92672">-</span><span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> b <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;0&#34;</span>:
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">return</span> <span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> eco <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;PyPI&#34;</span>:
</span></span><span style="display:flex;"><span>        ka, kb <span style="color:#f92672">=</span> Version(a), Version(b)
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">elif</span> eco <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;npm&#34;</span>:
</span></span><span style="display:flex;"><span>        ka, kb <span style="color:#f92672">=</span> semver_key(a), semver_key(b)
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">else</span>:
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">raise</span> <span style="color:#a6e22e">NotImplementedError</span>(<span style="color:#e6db74">f</span><span style="color:#e6db74">&#34;no comparator for </span><span style="color:#e6db74">{</span>eco<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> (ka <span style="color:#f92672">&gt;</span> kb) <span style="color:#f92672">-</span> (ka <span style="color:#f92672">&lt;</span> kb)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">def</span> <span style="color:#a6e22e">event_value</span>(evt):
</span></span><span style="display:flex;"><span>    (k, v), <span style="color:#f92672">=</span> evt<span style="color:#f92672">.</span>items()            <span style="color:#75715e"># the spec allows exactly one key per event</span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> k, v
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">def</span> <span style="color:#a6e22e">included_in_range</span>(eco, v, rng):
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> rng[<span style="color:#e6db74">&#34;type&#34;</span>] <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;GIT&#34;</span>:
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">raise</span> <span style="color:#a6e22e">NotImplementedError</span>(<span style="color:#e6db74">&#34;GIT ranges need the commit graph&#34;</span>)
</span></span><span style="display:flex;"><span>    events <span style="color:#f92672">=</span> [event_value(e) <span style="color:#66d9ef">for</span> e <span style="color:#f92672">in</span> rng[<span style="color:#e6db74">&#34;events&#34;</span>]]
</span></span><span style="display:flex;"><span>    limits <span style="color:#f92672">=</span> [val <span style="color:#66d9ef">for</span> k, val <span style="color:#f92672">in</span> events <span style="color:#66d9ef">if</span> k <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;limit&#34;</span>]
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> limits <span style="color:#f92672">and</span> <span style="color:#f92672">not</span> any(<span style="color:#e6db74">&#34;*&#34;</span> <span style="color:#f92672">in</span> l <span style="color:#f92672">or</span> compare(eco, v, l) <span style="color:#f92672">&lt;</span> <span style="color:#ae81ff">0</span> <span style="color:#66d9ef">for</span> l <span style="color:#f92672">in</span> limits):
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">False</span>                 <span style="color:#75715e"># BeforeLimits(): no limit means an implicit &#34;*&#34;</span>
</span></span><span style="display:flex;"><span>    ordered <span style="color:#f92672">=</span> sorted((e <span style="color:#66d9ef">for</span> e <span style="color:#f92672">in</span> events <span style="color:#66d9ef">if</span> e[<span style="color:#ae81ff">0</span>] <span style="color:#f92672">!=</span> <span style="color:#e6db74">&#34;limit&#34;</span>),
</span></span><span style="display:flex;"><span>                     key<span style="color:#f92672">=</span>cmp_to_key(<span style="color:#66d9ef">lambda</span> x, y: compare(eco, x[<span style="color:#ae81ff">1</span>], y[<span style="color:#ae81ff">1</span>])))
</span></span><span style="display:flex;"><span>    vulnerable <span style="color:#f92672">=</span> <span style="color:#66d9ef">False</span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">for</span> k, val <span style="color:#f92672">in</span> ordered:
</span></span><span style="display:flex;"><span>        c <span style="color:#f92672">=</span> compare(eco, v, val)
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">if</span> k <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;introduced&#34;</span> <span style="color:#f92672">and</span> c <span style="color:#f92672">&gt;=</span> <span style="color:#ae81ff">0</span>:
</span></span><span style="display:flex;"><span>            vulnerable <span style="color:#f92672">=</span> <span style="color:#66d9ef">True</span>
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">elif</span> k <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;fixed&#34;</span> <span style="color:#f92672">and</span> c <span style="color:#f92672">&gt;=</span> <span style="color:#ae81ff">0</span>:
</span></span><span style="display:flex;"><span>            vulnerable <span style="color:#f92672">=</span> <span style="color:#66d9ef">False</span>
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">elif</span> k <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;last_affected&#34;</span> <span style="color:#f92672">and</span> c <span style="color:#f92672">&gt;</span> <span style="color:#ae81ff">0</span>:
</span></span><span style="display:flex;"><span>            vulnerable <span style="color:#f92672">=</span> <span style="color:#66d9ef">False</span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> vulnerable
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">def</span> <span style="color:#a6e22e">is_affected</span>(osv, eco, name, v):
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> osv<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#34;withdrawn&#34;</span>):
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">False</span>, <span style="color:#e6db74">&#34;record withdrawn &#34;</span> <span style="color:#f92672">+</span> osv[<span style="color:#e6db74">&#34;withdrawn&#34;</span>]
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">for</span> a <span style="color:#f92672">in</span> osv<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#34;affected&#34;</span>, []):
</span></span><span style="display:flex;"><span>        p <span style="color:#f92672">=</span> a[<span style="color:#e6db74">&#34;package&#34;</span>]
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">if</span> p[<span style="color:#e6db74">&#34;ecosystem&#34;</span>] <span style="color:#f92672">!=</span> eco <span style="color:#f92672">or</span> p[<span style="color:#e6db74">&#34;name&#34;</span>] <span style="color:#f92672">!=</span> name:
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">continue</span>
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">if</span> v <span style="color:#f92672">in</span> a<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#34;versions&#34;</span>, []):
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">True</span>, <span style="color:#e6db74">&#34;listed in versions[]&#34;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">for</span> r <span style="color:#f92672">in</span> a<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#34;ranges&#34;</span>, []):
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">if</span> included_in_range(eco, v, r):
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">True</span>, <span style="color:#e6db74">&#34;inside range &#34;</span> <span style="color:#f92672">+</span> json<span style="color:#f92672">.</span>dumps(r[<span style="color:#e6db74">&#34;events&#34;</span>])
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">False</span>, <span style="color:#e6db74">&#34;not inside any range or versions[]&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span> __name__ <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;__main__&#34;</span>:
</span></span><span style="display:flex;"><span>    path, eco, name, ver <span style="color:#f92672">=</span> sys<span style="color:#f92672">.</span>argv[<span style="color:#ae81ff">1</span>:<span style="color:#ae81ff">5</span>]
</span></span><span style="display:flex;"><span>    osv <span style="color:#f92672">=</span> json<span style="color:#f92672">.</span>load(open(path))
</span></span><span style="display:flex;"><span>    hit, why <span style="color:#f92672">=</span> is_affected(osv, eco, name, ver)
</span></span><span style="display:flex;"><span>    print(<span style="color:#e6db74">f</span><span style="color:#e6db74">&#34;</span><span style="color:#e6db74">{</span>osv[<span style="color:#e6db74">&#39;id&#39;</span>]<span style="color:#e6db74">}</span><span style="color:#e6db74"> </span><span style="color:#e6db74">{</span>name<span style="color:#e6db74">}</span><span style="color:#e6db74">@</span><span style="color:#e6db74">{</span>ver<span style="color:#e6db74">}</span><span style="color:#e6db74">: </span><span style="color:#e6db74">{</span><span style="color:#e6db74">&#39;AFFECTED&#39;</span> <span style="color:#66d9ef">if</span> hit <span style="color:#66d9ef">else</span> <span style="color:#e6db74">&#39;not affected&#39;</span><span style="color:#e6db74">}</span><span style="color:#e6db74"> (</span><span style="color:#e6db74">{</span>why<span style="color:#e6db74">}</span><span style="color:#e6db74">)&#34;</span>)
</span></span></code></pre></div><p>We ran it on 2 December 2026 against the advisory-database files named above:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>GHSA-3325-v43h-43rv jupyterlab@4.5.10: AFFECTED (inside range [{&#34;introduced&#34;: &#34;4.0.0&#34;}, {&#34;fixed&#34;: &#34;4.5.11&#34;}])
</span></span><span style="display:flex;"><span>GHSA-3325-v43h-43rv jupyterlab@4.5.11: not affected (not inside any range or versions[])
</span></span><span style="display:flex;"><span>GHSA-3325-v43h-43rv jupyterlab@4.6.0: AFFECTED (inside range [{&#34;introduced&#34;: &#34;4.6.0&#34;}, {&#34;fixed&#34;: &#34;4.6.4&#34;}])
</span></span><span style="display:flex;"><span>GHSA-3325-v43h-43rv jupyterlab@4.6.4: not affected (not inside any range or versions[])
</span></span><span style="display:flex;"><span>GHSA-3325-v43h-43rv jupyterlab@4.6.0rc1: not affected (not inside any range or versions[])
</span></span><span style="display:flex;"><span>GHSA-62vg-58rm-qff7 @angular/router@19.2.25: AFFECTED (inside range [{&#34;introduced&#34;: &#34;0&#34;}, {&#34;last_affected&#34;: &#34;19.2.25&#34;}])
</span></span><span style="display:flex;"><span>GHSA-62vg-58rm-qff7 @angular/router@19.2.26: not affected (not inside any range or versions[])
</span></span><span style="display:flex;"><span>GHSA-62vg-58rm-qff7 @angular/router@20.0.0: AFFECTED (inside range [{&#34;introduced&#34;: &#34;20.0.0&#34;}, {&#34;fixed&#34;: &#34;20.3.33&#34;}])
</span></span><span style="display:flex;"><span>GHSA-vg28-83rp-8xx4 frigate@0.16.3: AFFECTED (inside range [{&#34;introduced&#34;: &#34;0&#34;}])
</span></span><span style="display:flex;"><span>GHSA-3r78-rqg8-95gg openclaw@2026.3.1: not affected (record withdrawn 2026-03-24T19:05:32Z)
</span></span></code></pre></div><p>Note the <code>4.6.0rc1</code> line. Under PEP 440 a release candidate sorts before <code>4.6.0</code>, so it falls outside <code>introduced 4.6.0</code>. Whether a prerelease really carries the bug is a question for the maintainers; the data only covers the versions it names.</p>
<h2 id="common-mistakes">Common mistakes</h2>
<ul>
<li><strong>Comparing version strings lexically.</strong> <code>&quot;4.10.0&quot; &lt; &quot;4.9.0&quot;</code> as strings. Use the ecosystem&rsquo;s comparator.</li>
<li><strong>Treating <code>last_affected</code> like <code>fixed</code>.</strong> It shifts the boundary by one version in the wrong direction, so the last vulnerable version gets marked safe.</li>
<li><strong>Reading only the first <code>affected</code> entry for a package.</strong> GitHub splits branches into separate entries.</li>
<li><strong>Ignoring <code>withdrawn</code>.</strong> Withdrawn duplicates often carry &ldquo;all versions&rdquo; ranges.</li>
<li><strong>Using <code>database_specific</code> as the source of truth.</strong> GitHub explicitly says not to.</li>
<li><strong>Matching by name across ecosystems.</strong> <code>jquery</code> on npm and <code>jquery-rails</code> on RubyGems are different packages with different version lines.</li>
</ul>
<h2 id="where-this-fits">Where this fits</h2>
<p>Version matching answers &ldquo;does this advisory apply to us?&rdquo;. It comes before the prioritization questions in the <a href="/posts/vulnerability-prioritization-workflow-cve-record-to-patch-ticket/">vulnerability prioritization workflow from CVE record to patch ticket</a>. If you consume CVE records as well as OSV, the <a href="/posts/cve-packageurl-purl-cve-json-5-2-affected-sbom-matching/">CVE packageURL guide</a> covers joining CVE JSON 5.2 records to SBOM purls. If a supplier says a matched version is not exploitable in their product, that statement belongs in VEX, covered in <a href="/posts/vex-explained-what-a-not-affected-statement-means-and-how-to-read-one/">VEX explained</a>. To join GHSA IDs to KEV and EPSS, see our <a href="/posts/ghsa-vs-cve-join-github-advisories-to-kev-and-epss/">GHSA vs CVE join guide</a>.</p>
<h2 id="limits-of-this-article">Limits of this article</h2>
<ul>
<li>The counts cover GitHub-reviewed advisories filed under 2026 at one commit. Other OSV sources, such as Go&rsquo;s vulndb, PyPA, distributions and osv.dev&rsquo;s own enrichment, may use <code>SEMVER</code>, <code>GIT</code>, <code>versions</code> and <code>limit</code> differently; we did not measure them.</li>
<li>osv.dev says it expands ranges into <code>versions</code> lists for supported ecosystems; we did not test osv.dev&rsquo;s API output.</li>
<li>The evaluator handles PyPI and npm only and was tested on the four records shown, not fuzzed against each ecosystem&rsquo;s reference implementation.</li>
<li>We did not check which <code>@angular/router</code> or <code>frigate</code> releases actually exist or contain fixes; the examples show how the records evaluate, not the state of those projects.</li>
</ul>
<h2 id="sources-and-verification">Sources and verification</h2>
<table>
  <thead>
      <tr>
          <th>Important claim</th>
          <th>Source</th>
          <th>Status</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Event semantics, one key per event, fixed vs last_affected, ECOSYSTEM/SEMVER/GIT definitions, <code>IsVulnerable</code> pseudocode, spec version 1.9.3</td>
          <td><a href="https://github.com/ossf/osv-schema/blob/main/docs/schema.md">OSV schema docs/schema.md</a></td>
          <td>Verified (verbatim)</td>
      </tr>
      <tr>
          <td><code>database_specific</code> values &ldquo;subject to change without notice&rdquo; and &ldquo;should not rely on them&rdquo;; <code>last_known_affected_version_range</code> purpose</td>
          <td><a href="https://github.com/github/advisory-database#database_specific-values">github/advisory-database README</a></td>
          <td>Verified (verbatim)</td>
      </tr>
      <tr>
          <td>Advisories published in OSV format</td>
          <td><a href="https://docs.github.com/en/enterprise-cloud@latest/code-security/concepts/vulnerability-reporting-and-management/github-advisory-database">GitHub Docs: GitHub Advisory Database</a></td>
          <td>Verified</td>
      </tr>
      <tr>
          <td>All counts (12,918 / 678 / 12,240 records; range types; events; database_specific disagreements; ecosystem split)</td>
          <td>advisory-database commit 11d8f435, computed by script</td>
          <td>Verified (computed)</td>
      </tr>
      <tr>
          <td>Evaluator output for GHSA-3325-v43h-43rv, GHSA-62vg-58rm-qff7, GHSA-vg28-83rp-8xx4, GHSA-3r78-rqg8-95gg</td>
          <td>Script run 2 December 2026</td>
          <td>Verified (run)</td>
      </tr>
  </tbody>
</table>
]]></content:encoded></item></channel></rss>