Repository navigation
Preserve HTTPS pagination links behind trusted proxies - #2495
Open
Prachi194agrawal wants to merge 1 commit into
Open
Prachi194agrawal wants to merge 1 commit into
Prachi194agrawal wants to merge 1 commit into
Conversation
Fixes aboutcode-org#2399 Signed-off-by: Prachi Agrawal <prachi194agrawal@gmail.com>
This branch has not been deployed
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.
Fixes #2399
When an outer proxy terminates HTTPS and forwards the request over HTTP, the bundled Nginx overwrites
X-Forwarded-Protowith its own connection scheme. Django then generateshttp://URLs in thenextandpreviousfields of the v3 packages and advisories responses.This change lets the bundled Nginx preserve
httporhttpsfrom an explicitly trusted immediate proxy. For untrusted peers or missing or invalid headers, it uses its own connection scheme.The installation guide explains how to add the immediate proxy’s IP address or CIDR to the trust list and configure that proxy to overwrite client-supplied headers. The trust list starts empty, so the public deployment needs to configure it for its proxy chain.
Testing
Added pagination unit tests and local Nginx integration tests covering HTTP and HTTPS on both v3 endpoints, including spoofed, missing, and invalid headers. CI installs Nginx and OpenSSL to run the integration tests.
NGINX_BINARY="$PWD/.cache/nginx-test/usr/sbin/nginx" \ venv/bin/python -m pytest \ vulnerabilities/tests/test_nginx_proxy.py --reuse-db -q16 passed, 7 warnings.
