Files
cal.diy/packages/lib
Pranjul Chaurasiya 038381aeca fix: trim whitespace in parseIpFromHeaders to prevent IP banlist bypass (#29857)
* fix: trim whitespace in parseIpFromHeaders to prevent IP banlist bypass

Fixes #29851

parseIpFromHeaders did not trim whitespace after splitting on comma
(or from array elements), so a padded x-forwarded-for header like
' 1.2.3.4 , 5.6.7.8' would fail an exact-match lookup against
IP_BANLIST, allowing a banned IP to bypass the check.

Added regression tests covering padded string, array, and an
end-to-end isIpInBanlist test reproducing the reported bypass.

* fix: address CodeRabbit review feedback

- Guard against undefined rawIp when parsing an empty header array
- Delete IP_BANLIST env var in test cleanup instead of assigning undefined
- Add regression test for empty array input to parseIpFromHeaders

* test: add regression test for tab/whitespace trimming in parseIpFromHeaders
2026-07-31 20:49:53 +00:00
..
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-01-02 12:47:00 +00:00
2024-04-27 18:14:37 +02:00
2026-04-15 09:52:36 -03:00
2025-03-20 21:30:51 -03:00
2024-03-08 15:13:29 +00:00
2022-03-23 15:00:30 -07:00
2025-11-28 09:14:48 +00:00
2022-03-23 15:00:30 -07:00
2025-11-26 17:02:42 +01:00
2026-01-02 12:47:00 +00:00
2024-10-04 13:44:50 -07:00
2024-05-10 08:47:57 +01:00
2025-12-16 14:01:54 +00:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2025-08-31 08:20:19 +00:00