test: verify TRUST_PROXY + rate limit independence (issue #280) - #365
Merged
David-patrick-chuks-02 merged 2 commits intoSep 6, 2026
Merged
Conversation
…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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #280
Context
app.set("trust proxy", securityConfig.trustProxy)is already present insrc/app.ts:51. This PR adds the missing test coverage that proves:securityConfigis correctly applied to ExpressTRUST_PROXY=1, requests with differentX-Forwarded-Forheaders are rate-limited independently (not sharing one bucket)TRUST_PROXY=false(default), all requests share a single bucketChanges
tests/trust-proxy-rate-limit.test.ts(5 tests)Acceptance Checklist
createAppapplies the trust proxy value fromsecurityConfig(verified viaapp.get("trust proxy"))TRUST_PROXY=1, distinctX-Forwarded-Forvalues are rate-limited independentlytrust-proxy-validation.test.tsstill passes unchanged (6/6 tests ✅)Test Output