`Database` passes unescaped `@path` to `Dir.glob`, reporting 0 advisories when the database path contains `[...]`
还没有人认领这个 Issue。
评估
调研方向
错误位于 lib/bundler/audit/database.rb 中的 each_advisory_path 和 each_advisory_path_for,其中 @path 未经转义就传入 Dir.glob。请与 exists?、download 和 git? 将 @path 视为字面目录的方式进行比较。使用包含 [...] 的数据库路径复现,目前会报告 0 个 advisory 并以退出码 0 退出。完成标准是:带方括号的路径能加载与重命名路径相同的 1411 个 advisory,并以退出码 1 退出。
由索引模型根据 Issue 内容生成。
描述
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/
- 主要语言
- Ruby
- 星标
- 2.8k
- 派生
- 243
- 平均合并
- 1 天 13 小时
- 30 天内合并 PR
- 9
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rubysec/bundler-audit 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
rubysec/bundler-audit#480 ·
-
Combine ignored CVEs from both `--config` with `--ignore` flag可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭feature
难度 2/5 1-3 小时 新手友好度 68/100
rubysec/bundler-audit#388 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 55/100
rubysec/bundler-audit#478 · 1 个 reaction ·
-
Create a new bundler-audit release then figure out how to get the gem published可能已有人在做 @flavorjones 于 4 天前认领。 未关闭chore
难度 5/5 一周以上 新手友好度 25/100
rubysec/bundler-audit#443 · 8 条评论 · 4 个 reaction · 已指派 1 人 ·
-
Duplicate vulnerabilities reported for gems that have multiple arch specs on the lockfile可能已有人在做 @jrodriigues 于 147 天前认领。 未关闭enhancement
难度 3/5 1-2 天 新手友好度 56/100
rubysec/bundler-audit#438 · 4 条评论 ·
查看 rubysec/bundler-audit 的全部 Issue
相似的 Issue
-
needs triage
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
dbohdan/structured-text-tools#148 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
Coolhand-Labs/coolhand-ruby#232 ·
维护者通常 1 天内回复
-
community
难度 1/5 1 小时以内 新手友好度 78/100
newrelic/newrelic-ruby-agent#3734 · 1 条评论 ·
维护者通常 2 天内回复
-
ETQ admin anglophone, le libellé de la date limite de dépôt reste en français可能已有人在做 @mmagn 于 1 天前认领。 未关闭autonome
难度 2/5 1-3 小时 新手友好度 76/100
demarche-numerique/demarche.numerique.gouv.fr#14711 ·
维护者通常 1 天内回复