Skip to content

Fix proxy headers leak errconnect on strict proxies#792

Open
joelwizard wants to merge 6 commits intoactions:mainfrom
joelwizard:joelwizard/fix-proxy-headers-errconnect
Open

Fix proxy headers leak errconnect on strict proxies#792
joelwizard wants to merge 6 commits intoactions:mainfrom
joelwizard:joelwizard/fix-proxy-headers-errconnect

Conversation

@joelwizard
Copy link
Copy Markdown

This pull request adds a comprehensive test suite for the proxyPolicy to ensure it does not leak application-level headers into proxy connections and correctly handles proxy and no-proxy scenarios. The tests cover both HTTP and HTTPS requests, custom agents, and proxy bypass logic.

Tests for header leakage and proxy behavior:

  • Adds tests to verify that proxyPolicy does not leak application headers (such as Content-Type, x-ms-version, etc.) into the CONNECT request when using HttpsProxyAgent, addressing issues with strict corporate proxies.
  • Verifies that both HttpsProxyAgent and HttpProxyAgent are used appropriately for HTTPS and HTTP requests, respectively, and that the correct proxy URL is set.
  • Ensures that hosts specified in the no_proxy list are correctly bypassed and do not use a proxy agent.
  • Confirms that a custom agent already set on the request is not overwritten by the policy.

Fixes #747

@joelwizard joelwizard requested a review from a team as a code owner April 3, 2026 22:28
Copilot AI review requested due to automatic review settings April 3, 2026 22:28
@joelwizard joelwizard changed the title Joelwizard/fix proxy headers errconnect on strict proxies fix proxy headers errconnect on strict proxies Apr 3, 2026
@joelwizard joelwizard changed the title fix proxy headers errconnect on strict proxies Fix proxy headers leak errconnect on strict proxies Apr 3, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses failures with strict corporate proxies by ensuring application-level request headers are not forwarded into proxy agent CONNECT headers, and adds a Jest test suite validating proxy behavior and no-proxy/custom-agent scenarios (Fixes #747).

Changes:

  • Stop passing request.headers into HttpProxyAgent/HttpsProxyAgent constructor options in the bundled proxyPolicy implementation to prevent header leakage into CONNECT.
  • Add __tests__/proxy-policy.test.ts covering header leakage prevention, proxy routing, no-proxy bypass, and preserving pre-set custom agents.

Reviewed changes

Copilot reviewed 1 out of 3 changed files in this pull request and generated 3 comments.

File Description
dist/upload/index.js Removes forwarding of application headers into proxy agent options within the bundled proxy policy.
dist/merge/index.js Same proxy header leakage fix applied to the merge bundle.
tests/proxy-policy.test.ts Adds regression tests for proxy policy behavior (header leakage, proxy/no-proxy, agent selection, custom agent preservation).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

[bug] V6 Upload progress stalled behind proxy while V5 works

2 participants