Skip to content

fix/batches: discard extracted Git metadata before Git initialization - #1370

Merged
cbrnrd merged 1 commit into
mainfrom
carterbrainerd-vuln-146-i-can-turn-committed-backslash-filenames-into-host-git-hooks
Sep 4, 2026
Merged

fix/batches: discard extracted Git metadata before Git initialization#1370
cbrnrd merged 1 commit into
mainfrom
carterbrainerd-vuln-146-i-can-turn-committed-backslash-filenames-into-host-git-hooks

Conversation

@cbrnrd

@cbrnrd cbrnrd commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Problem

The checks added in #1366 and #1367 do not cover every Windows filename alias. Names such as .git./config and .git::$INDEX_ALLOCATION/config can pass the archive check but still resolve to .git/config on disk.

The first host-side git add reads this repository-local configuration before the trusted Git metadata snapshot is created and before the container step starts. Configuration such as core.fsmonitor can therefore run a command on the host.

Solution

Remove any .git metadata created during archive extraction before running git init. Git then creates a fresh repository with trusted configuration. This avoids relying on a complete list of Windows filename aliases.

Verification Evidence

  • Added a regression test with an untrusted core.fsmonitor configuration and verified that it does not run.
  • Verified that untrusted Git metadata is removed and replaced with a fresh configuration.
  • go test ./internal/batches/...
  • Windows test binary cross-compiled with GOOS=windows GOARCH=amd64 go test -c ./internal/batches/workspace

@cbrnrd
cbrnrd marked this pull request as ready for review September 4, 2026 14:08
@cbrnrd
cbrnrd requested a review from a team September 4, 2026 14:09
@cbrnrd
cbrnrd merged commit 2b1394e into main Sep 4, 2026
8 checks passed
@cbrnrd
cbrnrd deleted the carterbrainerd-vuln-146-i-can-turn-committed-backslash-filenames-into-host-git-hooks branch September 4, 2026 14:43
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.

2 participants