Repository navigation
feat(git): an isolated clone can send an Authorization header - #432
Merged
Merged
Conversation
A caller that holds a short-lived credential for a repository it clones in isolation passes it as IsolatedCloneOptions::authorization. It reaches git as an http.<url>.extraHeader through the clone's environment (GIT_CONFIG_COUNT), scoped to the cloned URL, never on the command line, in the URL or in a file, and its Debug output is redacted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
An isolated clone (
storage::git_isolated::clone_isolated) can now send anAuthorizationheader, so a caller can clone a private https repository with a short-lived token without putting it in the URL, argv or a file.IsolatedCloneOptionsgainsauthorization: Option<CloneAuthorization>(defaultNone, so existing callers are unchanged).CloneAuthorization::newtakes the full header value (e.g.Basic …orBearer …). It refuses an empty value and anything outside printable ASCII, so the value cannot inject another header line. ItsDebugprints<redacted>.GIT_CONFIG_COUNT/GIT_CONFIG_KEY_0=http.<url>.extraHeader/GIT_CONFIG_VALUE_0), scoped to the clone URL, and only on the clone command. The isolation rules stay as they were: cleared environment, empty HOME, no credential helper, no redirects. Needs git 2.31+.Tests
Debugredacts.tests/git_isolated_auth_test.rs): a loopback HTTP server records request heads. With the option, every request carries the header; without it, none does; the error text never holds the secret.🤖 Generated with Claude Code