fix: neutralize execution-capable config on an unauthenticated cache - #4
Merged
Conversation
Review on the downstream stub caught this: a poisoned policy cache can execute code through its OWN .git/config while it is being authenticated. core.fsmonitor runs a command during `git status`, so the cleanliness check itself was an execution vector; the *Proxy/*Command and credential hooks are the same class during fetch. Confirmed by planting core.fsmonitor in a cache and running the check — the attacker command executed twice before validation finished. policy_git now passes -c overrides that disable fsmonitor, hooksPath, sshCommand, askPass, credential.helper, protocol.ext and packObjectsHook for every command that touches a cache we have not yet authenticated. Assisted-by: AI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review on the downstream stub (vana-com/vana-sdk#194) caught this, and it applies here too.
The problem
A poisoned policy cache can execute code through its own
.git/configwhile it is being authenticated.core.fsmonitorruns a command duringgit status— so the cleanliness check was itself an execution vector, firing before validation completed. The*Proxy/*Command,credential.helperandprotocol.extsettings are the same class during fetch.Confirmed by planting
core.fsmonitorin a cache and running the checks: the attacker command executed before validation finished.The fix
policy_git(bootstrap),shared_git(installer) and the hook's copy now pass-coverrides disablingcore.fsmonitor,core.hooksPath,core.sshCommand,core.askPass,credential.helper,protocol.ext.allowanduploadpack.packObjectsHookfor every command that touches a checkout not yet authenticated.Environment scrubbing alone was insufficient because these settings live in the cache's own repo-local config, which
-coverrides butenv -ucannot reach.Tests
New regression test plants
core.fsmonitorin a policy cache and asserts it never fires during validation. Existing coverage unchanged and passing.Assisted-by: AI