Skip to content

test: verify TRUST_PROXY + rate limit independence (issue #280) - #365

Merged
David-patrick-chuks-02 merged 2 commits into
Lilly-Protocol:mainfrom
armorbreak001:fix/trust-proxy-rate-limit
Sep 6, 2026
Merged

test: verify TRUST_PROXY + rate limit independence (issue #280)#365
David-patrick-chuks-02 merged 2 commits into
Lilly-Protocol:mainfrom
armorbreak001:fix/trust-proxy-rate-limit

Conversation

@armorbreak001

Copy link
Copy Markdown
Contributor

Summary

Closes #280

Context

app.set("trust proxy", securityConfig.trustProxy) is already present in src/app.ts:51. This PR adds the missing test coverage that proves:

  1. The trust proxy value from securityConfig is correctly applied to Express
  2. When TRUST_PROXY=1, requests with different X-Forwarded-For headers are rate-limited independently (not sharing one bucket)
  3. When TRUST_PROXY=false (default), all requests share a single bucket

Changes

  • New test file: tests/trust-proxy-rate-limit.test.ts (5 tests)
  • No production code changes — the fix was already in place

Acceptance Checklist

  • createApp applies the trust proxy value from securityConfig (verified via app.get("trust proxy"))
  • With TRUST_PROXY=1, distinct X-Forwarded-For values are rate-limited independently
  • trust-proxy-validation.test.ts still passes unchanged (6/6 tests ✅)
  • Full suite: 265/265 tests pass

Test Output

 ✓ tests/trust-proxy-rate-limit.test.ts (5 tests)
 ✓ tests/trust-proxy-validation.test.ts (6 tests)
 Test Files  57 passed (57)
      Tests  265 passed (265)

armorbreak001 and others added 2 commits September 4, 2026 11:12
…tocol#280)

- Verify createApp applies TRUST_PROXY from securityConfig (false/integer/loopback)
- Prove that with trust proxy enabled, different X-Forwarded-For values
  get independent rate-limit buckets
- Contrast test: without trust proxy, all requests share one bucket
- All 265 tests pass (including existing trust-proxy-validation tests)
@David-patrick-chuks-02
David-patrick-chuks-02 merged commit 064d9e9 into Lilly-Protocol:main Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty: $100] Apply the configured TRUST_PROXY value to Express trust proxy

3 participants