Skip to content

v0.84.4: checkout@v7 includeIf credential still causes duplicate Authorization headers #50362

Description

@bryanchen-d

Summary

Fork-backed Git operations still cannot override credentials persisted by actions/checkout@v7. gh-aw v0.84.4 includes the all-scope cleanup from #49059, but checkout v7 stores its header in a separate git-credentials-<uuid>.config file referenced by a repository-local includeIf.gitdir entry. Clearing only --global and --local values does not clear that included value.

Versions

  • gh-aw / github/gh-aw-actions/setup: v0.84.4 (4f46189e0dfaf63988118c40003c30652d562906)
  • actions/checkout: v7.0.1 (3d3c42e5aac5ba805825da76410c181273ba90b1)
  • GitHub-hosted ubuntu-slim

Reproduction

A bounded shim:

  1. Checks out microsoft/vscode with checkout v7 and persisted credentials.
  2. Mints a separate App installation token for a fork.
  3. Calls v0.84.4's released withGitHubHostToken(token, callback, checkoutCwd).
  4. Counts effective values for http.https://github.com/.extraheader before, during, and after the callback without printing values.

Run: https://github.com/microsoft/vscode-engineering/actions/runs/30939463258

Observed:

Extraheader count before override: 1
git_auth_helpers: read 1 existing extraheader value(s) for https://github.com
git_auth_helpers: overriding http.https://github.com/.extraheader with CI trigger token
Extraheader count during override: 2
git_auth_helpers: restoring 1 previous extraheader value(s)
Extraheader count after restore: 2
Error: Extraheader count changed from 1 to 2

A preceding run allowed ls-remote to execute and it failed with exit code 128 at the same point: https://github.com/microsoft/vscode-engineering/actions/runs/30939247858

Existing production driver runs show GitHub's exact response:

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

Example: https://github.com/microsoft/vscode-engineering/actions/runs/30931907652

No disposable branch was created; both test refs were independently verified absent after the runs.

Root cause

actions/checkout@v7 writes the token header to $RUNNER_TEMP/git-credentials-<uuid>.config and adds repository-local includeIf.gitdir:<checkout>/.git.path entries. unsetExtraheaderAllScopes removes direct global/local values, but the included credential remains effective. The helper then writes the fork header locally, yielding two active values. Restore removes the fork header but writes the previously read included value locally, leaving two copies.

Relevant checkout v7 behavior is in src/git-auth-helper.ts::configureToken; it deliberately creates the credentials file and includeIf entries.

Expected

withGitHubHostToken should expose exactly one effective Authorization header during the callback and restore the checkout credential source without increasing cardinality afterward.

Possible direction

Track config origins, not only values. Temporarily suppress or detach checkout's matching includeIf credential source (with strict path/pattern validation under RUNNER_TEMP) and restore it afterward, or use Git's empty http.extraHeader reset semantics before the temporary Authorization value. Restore must preserve the original origin rather than copying an included value into local config.

Related: #48952, fixed by #49059 for direct global/local values.

Activity

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions