Skip to content

fix(sign): Fixed proxy routing with native fetch - #3898

Open
NUAAwqy wants to merge 1 commit into
mozilla:masterfrom
NUAAwqy:taiyi/fix-signing-api-proxy
Open

NUAAwqy wants to merge 1 commit into
mozilla:masterfrom
NUAAwqy:taiyi/fix-signing-api-proxy

Conversation

@NUAAwqy

@NUAAwqy NUAAwqy commented Oct 13, 2026

Copy link
Copy Markdown

Fixes #3413.

The signing client passes https-proxy-agent using the agent option, which native Node fetch ignores. As a result, web-ext sign --api-proxy ... sends requests directly instead of through the requested proxy. This affects uploads, validation/approval polling, source patches, and signed-file downloads.

Use Undici's ProxyAgent via the supported dispatcher option. Replace the unused https-proxy-agent dependency with Undici 6, which supports the existing Node >=20.0.0 engine range. The lockfile retains Cheerio's existing Undici 7 version under its own dependency tree.

Each request closes its dispatcher gracefully once the response body is consumed. Cleanup is initiated after fetch returns headers without awaiting it, so callers can consume multipart responses and streamed downloads; failed requests also initiate cleanup. No global dispatcher is changed.

Executed validation

The new tests use real loopback origin and HTTP CONNECT proxy servers, with no external service or real AMO credentials. They check GET polling, JSON PUT, multipart POST/PATCH, chunked binary downloads, URL-encoded proxy credentials, rejection without a direct fallback, and no-proxy requests.

  • Original source: 7 new tests failed, 1 passed; the origin received direct requests while the proxy received none.
  • Fixed source: all 8 new tests passed.
  • Original npm test: 589 passed.
  • Fixed npm test: 597 passed, including ESLint checks.
  • npm run test-functional: 20 passed, 4 existing pending.
  • npm run build and Prettier checks: passed.

Validated on Node 22.22.0. The transport regressions use HTTP origins and an HTTP CONNECT proxy; they do not exercise a real AMO submission or a live enterprise TLS proxy.

Implementation and test execution were assisted by Codex.

Replace the ignored agent option with an Undici proxy dispatcher. Close each dispatcher gracefully without blocking response body consumption. Add real CONNECT proxy regressions for uploads, polling, downloads, credentials and failure behavior.

Fixes mozilla#3413

Signed-off-by: NUAAwqy <146524024+NUAAwqy@users.noreply.github.com>
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.

--api-proxy is ignore when signing

1 participant