2.6 KiB
id, name, status, depends_on, scope, risk, impact, level, review_findings
| id | name | status | depends_on | scope | risk | impact | level | review_findings | ||
|---|---|---|---|---|---|---|---|---|---|---|
| fix/rate-limiter-connectinfo-tests | Update rate limiter tests to use ConnectInfo instead of X-Forwarded-For (S10) | completed |
|
narrow | medium | component | implementation |
|
Description
After fix/rate-limiter-ip-source removes X-Forwarded-For parsing from the rate
limiter, existing integration tests that pass client IPs via X-Forwarded-For
headers will no longer work correctly. The rate limiter now reads exclusively
from ConnectInfo<SocketAddr>, so tests must provide ConnectInfo in request
extensions.
This task also addresses review finding S10: "No test verifies the ConnectInfo extraction path, which is the primary path after C1 is fixed."
Changes Required
tests/integration_test.rs:
- Find all rate limit integration tests (lines 90-163 and any others) that set
X-Forwarded-Forheaders for rate limiting purposes - Update those tests to set
ConnectInfo<SocketAddr>in request extensions instead of (or in addition to)X-Forwarded-For - Verify that
X-Forwarded-Forheaders are now ignored by the rate limiter — add a test that sends requests with differentX-Forwarded-Forvalues from the sameConnectInfoIP and confirms they all count against the same bucket - Add a test that verifies requests without
ConnectInfoare rejected with 429 (per ADR-025)
src/rate_limit/mod.rs (test module):
- Update any unit tests that rely on
X-Forwarded-Forextraction - Add a test that verifies
ConnectInfo-based rate limiting works without anyX-Forwarded-Forheader
Acceptance Criteria
- All rate limit integration tests use
ConnectInfofor client IP - Tests verify
X-Forwarded-Forheaders are ignored by rate limiter - New test: requests without
ConnectInfoare rejected with 429 - New test: different
X-Forwarded-Forvalues from sameConnectInfoIP count against the same bucket (proving XFF is ignored) cargo testpassescargo clippypasses with no warnings
References
- docs/architecture/decisions/025-rate-limiter-ip-source.md — ADR-025
- docs/reviews/003-security-and-bug-review.md — S10 finding
- tests/integration_test.rs — rate limit tests
- src/rate_limit/mod.rs — rate limiter middleware and tests
Notes
This task depends on
fix/rate-limiter-ip-sourcebecause the code changes must be in place before the tests can be updated. Attempting this before the C1 fix would require writing tests for the old (broken) behavior.
Summary
To be filled on completion