"Forwarded for headers" setup check trusts a client-sent Remote-Addr header and ignores CIDR proxies
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
調査の方向性
apps/settings/lib/SetupChecks/ForwardedForHeaders.php から始め、アドレスの取得方法と信頼するプロキシのチェックを、Request::getRemoteAddress() および IpUtils::checkIp() と比較してください。apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php を読み、クライアントが送信した Remote-Addr ヘッダーと CIDR 形式の信頼するプロキシを対象とするテストを追加してください。セットアップチェックがサーバーのアドレスを使用し、CIDR 範囲を処理し、テストが通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
Bug description
The ForwardedForHeaders setup check reads the connecting address with getHeader('REMOTE_ADDR'):
Request::getHeader() first looks at HTTP_REMOTE_ADDR, i.e. a Remote-Addr: request header sent by the client, and only falls back to the real REMOTE_ADDR server variable afterwards:
So the check result depends on a client-controlled header (or on a proxy forwarding such a header). Furthermore the trusted proxy comparison is an exact in_array():
so for proxies configured in CIDR notation (e.g. 172.16.0.0/12), which Request::getRemoteAddress() supports, the check never reports the resolved address nor the misconfiguration warning.
This only affects the setup check, not Request::getRemoteAddress() itself.
Steps to reproduce
Found by code reading.
- Configure
trusted_proxieswith a CIDR range, e.g.['172.16.0.0/12'], behind a reverse proxy in that range. - Open Administration settings → Overview: the "Your IP address was resolved as …" success / warning is never shown.
- Send the setup check request with an additional
Remote-Addr: 1.2.3.4header: the check evaluates1.2.3.4as the connecting address.
Expected behavior
The check uses the real REMOTE_ADDR server variable (not a client header with the same name) and matches it against trusted_proxies the same way Request::getRemoteAddress() does (CIDR aware, IpUtils::checkIp()), covered by tests in apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php.
Nextcloud version
master
- 主要言語
- PHP
- スター
- 37.6k
- フォーク
- 5.4k
- 平均マージ
- 1日 20時間
- マージ済み PR(30日)
- 605
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nextcloud/server のほかの issue
-
Document lexicon.default.userconfig and lexicon.default.userconfig.enforced in config.sample.phpオープンenhancement feature: settings good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
bug feature: previews and thumbnails performance 🚀
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug feature: TaskProcessing good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
files_external occ commands crash with InvalidArgumentException for SMB mounts without credentialsオープンbug feature: external storage feature: occ good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug feature: occ
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
nextcloud/server の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
nextcloud/integration_openai#480 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
a11y
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
omeka/plugin-Contribution#84 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
recca0120/vscode-phpunit#620 ·
メンテナーはふだん 1 日以内に返信
-
Validation rule generation for recursive Data objects is unbounded (O(payload depth))対応中かも @irfanm96 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
spatie/laravel-data#1226 ·