"Forwarded for headers" setup check trusts a client-sent Remote-Addr header and ignores CIDR proxies
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Bắt đầu với apps/settings/lib/SetupChecks/ForwardedForHeaders.php và so sánh cách tra cứu địa chỉ cùng bước kiểm tra proxy đáng tin cậy với Request::getRemoteAddress() và IpUtils::checkIp(). Đọc apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php, sau đó bổ sung kiểm thử cho tiêu đề Remote-Addr do client gửi và proxy đáng tin cậy dạng CIDR. Hoàn tất khi bước kiểm tra thiết lập sử dụng địa chỉ máy chủ, xử lý các dải CIDR và các kiểm thử đều chạy đạt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- PHP
- Star
- 37.6k
- Fork
- 5.4k
- Merge trung bình
- 1 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 605
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nextcloud/server
-
Document lexicon.default.userconfig and lexicon.default.userconfig.enforced in config.sample.phpĐang mởenhancement feature: settings good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug feature: previews and thumbnails performance 🚀
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug feature: TaskProcessing good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
files_external occ commands crash with InvalidArgumentException for SMB mounts without credentialsĐang mởbug feature: external storage feature: occ good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
occ config:app:set --value ignores --no-sensitive (and drops --sensitive for boolean values)Đang mởbug feature: occ
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của nextcloud/server
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
nextcloud/integration_openai#480 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
a11y
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
omeka/plugin-Contribution#84 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
recca0120/vscode-phpunit#620 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Validation rule generation for recursive Data objects is unbounded (O(payload depth))Có thể đã có người làm @irfanm96 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
spatie/laravel-data#1226 ·