Scanner#internal_host? treats unresolvable or offline hosts as internal because [].all? is true
まだ誰も着手していません。
評価
調査の方向性
バグは lib/bundler/audit/scanner.rb の Scanner#internal_host? にあり、ここで Resolv.getaddresses(host).all? を呼び出しています。結果が空になると [].all? が true を返し、ソースが内部扱いされてしまいます。まずこのメソッドと internal_source? を読み、次に名前解決できないホスト(例:gems.example.invalid)で再現してください。名前解決できない http:// または git:// のソースが安全でないソースとして報告され、コマンドが終了ステータス 1 で終了すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
bundle-audit check skips InsecureSource warnings whenever Resolv.getaddresses(host) returns an empty array (for example when running offline without DNS access, despite the README noting that bundler-audit does not require a network connection, or when a source hostname in Gemfile.lock no longer resolves).
In lib/bundler/audit/scanner.rb, Scanner#internal_host? runs Resolv.getaddresses(host).all? { |ip| internal_ip?(ip) }. When Resolv.getaddresses(host) returns [], [].all? evaluates to true, so internal_source? treats the http:// or git:// source as a private internal IP.
Steps To Reproduce
Steps to reproduce the bug:
gem install rake -v 13.2.1
bundler-audit update
mkdir repro && cd repro
printf 'source "http://rubygems.org"\ngem "rake", "13.2.1"\n' > Gemfile
bundle lock --local
# Online: reports Insecure Source URI found: http://rubygems.org/ (exit 1)
bundle-audit check --no-update
# Offline (Linux network namespace with loopback up, like docker run --network none):
unshare -rn sh -c 'ip link set lo up && bundle-audit check --no-update'
The same happens while online on any OS if the http:// or git:// host does not resolve in DNS (source "http://gems.example.invalid").
Expected Behavior
bundle-audit check --no-update reports the http:// source and exits with status 1:
Insecure Source URI found: http://rubygems.org/
Vulnerabilities found!
Actual Behavior
No vulnerabilities found
Exit status is 0. Reproduces on bundler-audit 0.9.3 and current master (3cd866bedf).
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 tested against master at commit 3cd866bedf609aa2c98a464909602f595265ae49 on Debian x86_64.
Found with a differential-testing tool; the report was drafted with AI assistance and reviewed and edited by me.
Credit: https://ucsbplse.github.io/
- 主要言語
- Ruby
- スター
- 2.8k
- フォーク
- 243
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 9
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rubysec/bundler-audit のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
rubysec/bundler-audit#481 ·
-
Combine ignored CVEs from both `--config` with `--ignore` flag対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンfeature
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
rubysec/bundler-audit#388 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
rubysec/bundler-audit#478 · リアクション 1 件 ·
-
Create a new bundler-audit release then figure out how to get the gem published対応中かも @flavorjones が 4 日前に担当しました。 オープンchore
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
rubysec/bundler-audit#443 · コメント 8 件 · リアクション 4 件 · 担当者 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
-
難易度 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 日以内に返信
-
Speed up the MIaaRD collection export対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
xronos-ch/xronos.rails#573 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
rapid7/metasploit-framework#22183 ·
メンテナーはふだん 2 日以内に返信