<?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>Dependency Scanning | FirewallSync</title><link>https://firewallsync.com/tags/dependency-scanning/</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>Wed, 02 Dec 2026 04:30:00 +0000</lastBuildDate><atom:link href="https://firewallsync.com/tags/dependency-scanning/index.xml" rel="self" type="application/rss+xml"/><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>