Skip to content

Gemfile.lock vulnerability scanner

Free, no sign-up

Scan a Gemfile.lock for Ruby gems with known vulnerabilities. See each advisory, CVE, severity and fixed version in your browser, without installing a gem.

The file is read in your browser. Only package names and versions are sent to OSV when you scan.

This tool asks the OSV.dev vulnerability database directly from your browser. It sends the name, version and ecosystem of each package in the file, and then the IDs of the advisories that matched. The file itself, its paths, URLs and hashes stay in your browser, and nothing is sent to HardenKit.

How to use the gemfile.lock vulnerability scanner

  1. Drop your Gemfile.lock on the page, or paste its contents.
  2. Press the scan button to send the gem names and versions to OSV.dev.
  3. Read the table, worst first.
  4. Upgrade with bundle update gem-name --conservative, which leaves unrelated gems alone, and scan again.

About this tool

Bundler writes Gemfile.lock after it resolves your Gemfile. Under GEM and specs: it lists every gem that will be installed with its exact version, and indented below each gem the ranges that gem asks of others. The Gemfile says what you want; the lockfile says what you got, including the gems Rails and your other dependencies brought with them.

This scanner reads the installed gems of every GEM section, skips the indented dependency lines and the DEPENDENCIES list, which hold ranges and not installed versions, and asks OSV.dev about each gem. OSV.dev carries GitHub’s advisories for RubyGems, many of which come from the community’s ruby-advisory-db. A gem that appears once per platform, such as nokogiri, is looked up once.

Gems from GIT and PATH sections are listed as not checked: their code is whatever the repository or folder holds, so no version number describes it. When a fix exists, the “Fixed in” column shows the first fixed version on your release line. For Rails applications that often means a patch release, which is a small and safe upgrade.

Sources

Questions

Is this the same as bundler-audit?

bundler-audit is a gem that checks Gemfile.lock against ruby-advisory-db on your machine. This page asks OSV.dev, which serves GitHub’s reviewed advisories for RubyGems, and needs neither Ruby nor the project. The two databases overlap heavily but are not identical, so results can differ by a few entries.

How do I update only the vulnerable gem?

Run bundle update gem-name --conservative. Without the flag Bundler may also update the dependencies of that gem to their newest allowed versions. If the fixed version is outside the range in your Gemfile, change the range first.

Does the scanner check my Ruby version?

No. The RUBY VERSION section is not looked up, and neither is Bundler itself. The scan covers the gems under GEM only. Check the Ruby release you run against the maintenance list on ruby-lang.org.

What does the platform suffix on a gem version mean?

A line such as nokogiri (1.15.4-x86_64-linux) is version 1.15.4 with code compiled in advance for that platform. Advisories are written for the version, so the scanner removes the suffix before the lookup.

Related tools