`Database` passes unescaped `@path` to `Dir.glob`, reporting 0 advisories when the database path contains `[...]`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
The bug is in lib/bundler/audit/database.rb, in each_advisory_path and each_advisory_path_for, where @path goes into Dir.glob unescaped. Compare that with how exists?, download and git? treat @path as a literal directory. Reproduce with a database path containing [...], which should currently report 0 advisories and exit 0. Done means the bracketed path loads the same 1411 advisories and exits 1, like the renamed path.
Written by the indexing model from the issue text.
Description
Description
Bundler::Audit::Database#each_advisory_path and #each_advisory_path_for in lib/bundler/audit/database.rb pass @path directly to Dir.glob(File.join(@path, ...)) without escaping glob metacharacters. Other Database methods (exists?, download, git?, update!) treat @path as a literal directory, so when the advisory database path (for example via --database, BUNDLER_AUDIT_DB="$PWD/..." in a matrix workspace like job[ruby-3.3], or HOME) contains [...], bundle-audit clones or opens the database cleanly while Dir.glob treats the bracketed segment as a character class, matches zero .yml files, and reports No vulnerabilities found with exit status 0.
Steps To Reproduce
Steps to reproduce the bug:
- Create a
Gemfile.locklockingrack2.2.0and downloadruby-advisory-dbinto a directory whose path contains brackets:
mkdir repro && cd repro
printf 'source "https://rubygems.org"\ngem "rack", "2.2.0"\n' > Gemfile
bundle lock
bundle-audit download "job[ruby-3.3]/ruby-advisory-db"
bundle-audit check --database "job[ruby-3.3]/ruby-advisory-db"
echo "exit=$?"
- Rename the directory to remove the brackets and run the same check:
mv "job[ruby-3.3]" job_ruby_3_3
bundle-audit stats "job_ruby_3_3/ruby-advisory-db"
bundle-audit check --database "job_ruby_3_3/ruby-advisory-db"
echo "exit=$?"
Expected Behavior
Both paths should load all advisories in ruby-advisory-db, report the known rack 2.2.0 advisories (such as CVE-2020-8184), print Vulnerabilities found!, and exit with status 1, matching the output for job_ruby_3_3/ruby-advisory-db:
ruby-advisory-db:
advisories: 1411 advisories
last updated: 2026-11-22 09:40:03 -0500
commit: c87703e7f2c64f8745ce032711308a17d10cda55
Name: rack
Version: 2.2.0
CVE: CVE-2020-8184
GHSA: GHSA-j6w9-fv6q-3q52
Criticality: High
URL: https://groups.google.com/g/rubyonrails-security/c/OWtmozPH9Ak
Title: Percent-encoded cookies can be used to overwrite existing prefixed cookie names
Solution: update to '~> 2.1.4', '>= 2.2.3'
...
Vulnerabilities found!
exit=1
Actual Behavior
Download ruby-advisory-db ...
Cloning into 'job[ruby-3.3]/ruby-advisory-db'...
ruby-advisory-db:
advisories: 0 advisories
last updated: 2026-11-22 09:40:03 -0500
commit: c87703e7f2c64f8745ce032711308a17d10cda55
No vulnerabilities found
exit=0
Environment
$ bundler-audit --version
bundler-audit 0.9.3
$ bundle --version
Bundler version 2.6.9
$ ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]
$ git --version
git version 2.39.5
Also reproduced against master (3cd866bedf609aa2c98a464909602f595265ae49).
We found this while fuzzing.
Credit: https://ucsbplse.github.io/
- Dominant language
- Ruby
- Stars
- 2.8k
- Forks
- 243
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 9
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rubysec/bundler-audit
-
Scanner#internal_host? treats unresolvable or offline hosts as internal because [].all? is trueOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rubysec/bundler-audit#480 ·
-
Combine ignored CVEs from both `--config` with `--ignore` flagPossibly taken A pull request linked to this issue is open or already merged. Openfeature
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
rubysec/bundler-audit#388 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
rubysec/bundler-audit#478 · 1 reaction ·
-
Create a new bundler-audit release then figure out how to get the gem publishedPossibly taken @flavorjones claimed this 4 days ago. Openchore
Difficulty 5/5 Over a week Newbie friendliness 25/100
rubysec/bundler-audit#443 · 8 comments · 4 reactions · 1 assignee ·
-
Duplicate vulnerabilities reported for gems that have multiple arch specs on the lockfilePossibly taken @jrodriigues claimed this 147 days ago. Openenhancement
Difficulty 3/5 1-2 days Newbie friendliness 56/100
rubysec/bundler-audit#438 · 4 comments ·
All issues in rubysec/bundler-audit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Coolhand-Labs/coolhand-ruby#232 ·
Maintainers usually reply within 1 day
-
community
Difficulty 1/5 Under an hour Newbie friendliness 78/100
newrelic/newrelic-ruby-agent#3734 · 1 comment ·
Maintainers usually reply within 2 days
-
ETQ admin anglophone, le libellé de la date limite de dépôt reste en françaisPossibly taken @mmagn claimed this today. Openautonome
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
demarche-numerique/demarche.numerique.gouv.fr#14711 ·
Maintainers usually reply within 1 day
-
Speed up the MIaaRD collection exportPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
xronos-ch/xronos.rails#573 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
rapid7/metasploit-framework#22183 ·
Maintainers usually reply within 2 days