Commit 156b034
committed
fix(settings): use CIDR-aware proxy detection in ForwardedForHeaders setup check
The setup check used in_array() with strict comparison to determine
if REMOTE_ADDR matched a trusted proxy entry. This cannot match CIDR
ranges (e.g., 172.16.0.0/12) because the raw IP and the CIDR string
are never equal.
Replace in_array() with a check that compares the raw REMOTE_ADDR
against the resolved address from getRemoteAddress(), which already
handles CIDR matching internally via IpUtils::checkIp().
Also add a test case for large CIDR (/12) matching to prevent
future regressions.
Fixes: #60287
Signed-off-by: Arya Rizky <arya@algojogacor.dev>1 parent 88b79c6 commit 156b034
2 files changed
Lines changed: 29 additions & 20 deletions
File tree
- apps/settings/lib/SetupChecks
- tests/lib/AppFramework/Http
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
639 | 639 | | |
640 | 640 | | |
641 | 641 | | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
652 | 661 | | |
653 | 662 | | |
654 | 663 | | |
| |||
0 commit comments