Skip to content

v0.83.5: fork create_pull_request still sends duplicate Authorization headers #48952

Description

@bryanchen-d

Summary

The fix released in v0.83.5 for #48414 does not prevent duplicate Authorization headers in fork-backed create_pull_request.

The runtime contains withGitHubHostToken, but the first fork git ls-remote still fails with:

remote: Duplicate header: "Authorization"
fatal: unable to access 'https://github.com/bryanchen-d/vscode.git/': The requested URL returned error: 400

The restore loop then accumulates another visible value on every attempt (read 1, then 2, 3, 4).

Environment

Reproduction

Workflow run: https://github.com/microsoft/vscode-engineering/actions/runs/30472145297

Relevant sequence from the first attempt:

git_auth_helpers: read 1 existing extraheader value(s)
git_auth_helpers: overriding http.https://github.com/.extraheader with CI trigger token
git config --replace-all http.https://github.com/.extraheader Authorization: basic ***
git_auth_helpers: extraheader override applied
git ls-remote --heads https://github.com/bryanchen-d/vscode.git ...
remote: Duplicate header: "Authorization"
git_auth_helpers: restoring 1 previous extraheader value(s)

Subsequent operations report read 2, read 3, and read 4, and all fail with the same duplicate-header HTTP 400.

No fork branch or PR is created; fallback-as-issue produces an issue instead.

Expected

withGitHubHostToken should ensure exactly one effective Authorization source and restoration should return to the original cardinality.

Analysis

getExtraheaderValues reads effective values with unscoped git config --get-all, while overridePersistedExtraheader and restorePersistedExtraheader write through the repository-local default scope. If another scope or injected config contributes the second header, --replace-all in the local scope cannot remove it. The helper should either:

  • explicitly enumerate and neutralize all effective sources for the fork operation, or
  • invoke git with a one-shot config/environment that suppresses inherited auth and supplies exactly one header.

Also verify that the outer withGitHubHostToken wrapper is not combined with another auth mechanism inside pushSignedCommits.

Related

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions