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:
- Checks out
microsoft/vscode with checkout v7 and persisted credentials.
- Mints a separate App installation token for a fork.
- Calls v0.84.4's released
withGitHubHostToken(token, callback, checkoutCwd).
- 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.
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 separategit-credentials-<uuid>.configfile referenced by a repository-localincludeIf.gitdirentry. Clearing only--globaland--localvalues does not clear that included value.Versions
github/gh-aw-actions/setup: v0.84.4 (4f46189e0dfaf63988118c40003c30652d562906)actions/checkout: v7.0.1 (3d3c42e5aac5ba805825da76410c181273ba90b1)ubuntu-slimReproduction
A bounded shim:
microsoft/vscodewith checkout v7 and persisted credentials.withGitHubHostToken(token, callback, checkoutCwd).http.https://github.com/.extraheaderbefore, during, and after the callback without printing values.Run: https://github.com/microsoft/vscode-engineering/actions/runs/30939463258
Observed:
A preceding run allowed
ls-remoteto execute and it failed with exit code 128 at the same point: https://github.com/microsoft/vscode-engineering/actions/runs/30939247858Existing production driver runs show GitHub's exact response:
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@v7writes the token header to$RUNNER_TEMP/git-credentials-<uuid>.configand adds repository-localincludeIf.gitdir:<checkout>/.git.pathentries.unsetExtraheaderAllScopesremoves 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 andincludeIfentries.Expected
withGitHubHostTokenshould 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
includeIfcredential source (with strict path/pattern validation underRUNNER_TEMP) and restore it afterward, or use Git's emptyhttp.extraHeaderreset 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.