Skip to content

fix: clear stale header on redirect when target is no-proxy#10794

Merged
jasonsaayman merged 7 commits intov1.xfrom
fix/axi-197
Apr 22, 2026
Merged

fix: clear stale header on redirect when target is no-proxy#10794
jasonsaayman merged 7 commits intov1.xfrom
fix/axi-197

Conversation

@jasonsaayman
Copy link
Copy Markdown
Member

@jasonsaayman jasonsaayman commented Apr 22, 2026

Summary by cubic

Stops leaking Proxy-Authorization across redirects by stripping it on redirected requests, then re-adding it only if the final proxy needs credentials. Covers no-proxy targets, different proxies, env-derived proxies, NO_PROXY bypasses, and case-insensitive header keys. Addresses AXI-197 and GHSA-j5f8-grm9-p9fc.

  • Description

    • Strip stale Proxy-Authorization in setProxy only on redirect; preserve user-supplied header on the initial request.
    • Recalculate proxy per redirect from config/env; handles no-proxy, different proxy, and NO_PROXY bypass.
    • Docs: update /docs/ proxy section to note the header is not carried across redirects; add a short security note.
    • Semantic version impact: Patch (bug fix, no API changes).
  • Testing

    • Added unit tests for: redirect to no proxy, NO_PROXY bypass, redirect to a different proxy without credentials, hook with configProxy=false, preserving user-supplied header on the initial request, and case-insensitive stripping.
    • Switched the prototype‑pollution test to a stub transport and asserted final outgoing headers; verifies neither Authorization nor authorization leak attacker values.

Written for commit d78e4ca. Summary will update on new commits.

@jasonsaayman jasonsaayman self-assigned this Apr 22, 2026
@jasonsaayman jasonsaayman added priority::medium A medium priority commit::fix The PR is related to a bugfix labels Apr 22, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@jasonsaayman
Copy link
Copy Markdown
Member Author

@cubic-dev-ai review again on the latest PR

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Apr 22, 2026

@cubic-dev-ai review again on the latest PR

@jasonsaayman I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Confidence score: 2/5

  • There is a high-confidence, high-severity risk in lib/adapters/http.js: case-sensitive header stripping can leave proxy-authorization variants in place across redirects.
  • This can cause credential leakage behavior in redirect flows, so the current change is not yet low-risk to merge despite the small file scope.
  • Pay close attention to lib/adapters/http.js - make header removal case-insensitive so proxy auth headers are reliably cleared on redirects.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="lib/adapters/http.js">

<violation number="1" location="lib/adapters/http.js:211">
P1: Header removal is case-sensitive, so stale `proxy-authorization` variants can survive redirects.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread lib/adapters/http.js Outdated
@jasonsaayman
Copy link
Copy Markdown
Member Author

@cubic-dev-ai review this again, check that we have no regressions or potential blind spots here

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Apr 22, 2026

@cubic-dev-ai review this again, check that we have no regressions or potential blind spots here

@jasonsaayman I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Confidence score: 4/5

  • This PR is likely safe to merge, with minimal risk: the only issue is a test gap in tests/unit/adapters/http.test.js, not a confirmed runtime defect in production code.
  • The NO_PROXY redirect test currently doesn’t validate the HTTPS bypass path as intended because https_proxy is not kept set; this could let a proxy-bypass regression slip through undetected.
  • Given the moderate-low severity (4/10) and high confidence, this is a quality/coverage concern rather than a merge-blocking behavior break.
  • Pay close attention to tests/unit/adapters/http.test.js - ensure the NO_PROXY case keeps https_proxy configured so the test truly proves bypass behavior.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tests/unit/adapters/http.test.js">

<violation number="1" location="tests/unit/adapters/http.test.js:2351">
P2: The NO_PROXY redirect test doesn't actually exercise the bypass path for HTTPS targets. Keep `https_proxy` set so the redirect uses a proxy URL and NO_PROXY is what clears it.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread tests/unit/adapters/http.test.js Outdated
@jasonsaayman
Copy link
Copy Markdown
Member Author

jasonsaayman commented Apr 22, 2026

@cubic-dev-ai review this one last time

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Apr 22, 2026

@cubic-dev-ai review this one last time. be thought

@jasonsaayman I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Confidence score: 3/5

  • There is a concrete regression risk in lib/adapters/http.js: Proxy-Authorization is being stripped on initial requests, not just during redirects, which can break proxy-authenticated requests.
  • Given the issue is medium severity (6/10) with fairly strong confidence (7/10), this introduces some user-facing risk and makes the merge less predictable without a fix.
  • Pay close attention to lib/adapters/http.js - header-stripping behavior should be limited to redirect handling so initial request credentials are preserved.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="lib/adapters/http.js">

<violation number="1" location="lib/adapters/http.js:211">
P2: The new header-stripping logic runs on initial requests, so it removes user-supplied `Proxy-Authorization` even when not handling a redirect.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread lib/adapters/http.js Outdated
@jasonsaayman
Copy link
Copy Markdown
Member Author

@cubic-dev-ai please check one last time

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Apr 22, 2026

@cubic-dev-ai please check one last time

@jasonsaayman I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::fix The PR is related to a bugfix priority::medium A medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant