mirror of
https://github.com/storytold/artcraft-services.git
synced 2026-11-20 09:23:31 +01:00
What was wrong: (1) the Forwarded fallback returned the whole first list element (e.g. `for=1.2.3.4;proto=http`), so exact IP bans never matched. (2) The disabled-endpoint filter compared the raw URI path while actix routes on the percent-decoded path, so an equivalent encoded spelling bypassed it. Change: Forwarded values are parsed per RFC 7239 (first for= node, quotes/brackets/port stripped); X-Forwarded-For is unchanged. The filter now checks request.match_info().as_str(), the path actix routes with. Blast radius: crates/lib/actix_helpers (ban filter and disabled-endpoint middleware). Behavior changes: requests using a Forwarded header now yield a bare IP; encoded spellings of a disabled path are now blocked. Checks run: cargo test -p actix_helpers (new Forwarded test). Checks not run: clippy -D warnings (91 pre-existing errors in this crate on main); no integration test of the middleware against an encoded URI. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Forwarded IP addresses are now read from the first `for` parameter, including quoted values and IPv6 addresses. Other supported IP headers retain their existing parsing behavior. * Disabled-endpoint checks now use the matched route rather than the raw request path, improving checks for requests handled through routed endpoints. <!-- end of auto-generated comment: release notes by coderabbit.ai -->