Repository navigation
feat(proxy): enforce upstream failover timeout window and sanitize X-Request-ID against CRLF injection - #7
Merged
ATLURI0001 merged 1 commit intoNov 14, 2026
Conversation
…Request-ID against CRLF injection
ATLURI0001
deleted the
feat/proxy-failover-window-and-header-crlf-guard
branch
November 14, 2026 07:41
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.
Technical Deep-Dive & Defensive Hardening
Background & Failure Mode Analysis
proxy_next_upstream_tries 2;, the overall retry window lacked an explicit timeout bound (proxy_next_upstream_timeout). Under sustained cascading upstream failure or slow network partitions, requests could hang up to full connection/read timeout limits across retries.X-Request-IDheaders directly back into downstream JSON payloads and HTTP response headers without sanitization. If an untrusted upstream or client injected carriage returns (\r) or line feeds (\n), it could trigger header splitting or malformed response frames in legacy clients.Implementation Details
proxy_next_upstream_timeout 10s;tonginx/snippets/proxy.conf, ensuring that client requests fail over promptly rather than lingering across hanging upstreams.sanitize_header_valhelper inapps/demo/app.pystripping\rand\ncharacters fromX-Request-IDvalues before propagation into headers and responses.tests/test_project.pyto assert the bounded failover window and header sanitization invariants.Testing & Verification
python -m pytest tests/test_project.py