Skip to content

feat(git): an isolated clone can send an Authorization header - #432

Merged
aroff merged 1 commit into
mainfrom
feat/isolated-clone-auth-header
Oct 17, 2026
Merged

aroff merged 1 commit into
mainfrom
feat/isolated-clone-auth-header

Conversation

@aroff

@aroff aroff commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Summary

An isolated clone (storage::git_isolated::clone_isolated) can now send an Authorization header, so a caller can clone a private https repository with a short-lived token without putting it in the URL, argv or a file.

  • IsolatedCloneOptions gains authorization: Option<CloneAuthorization> (default None, so existing callers are unchanged).
  • CloneAuthorization::new takes the full header value (e.g. Basic … or Bearer …). It refuses an empty value and anything outside printable ASCII, so the value cannot inject another header line. Its Debug prints <redacted>.
  • The header reaches git through its environment only (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

  • Unit: the header reaches the command's environment scoped to the URL; invalid values are refused; Debug redacts.
  • Integration (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

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>
@aroff
aroff enabled auto-merge (squash) October 17, 2026 23:35
@aroff
aroff merged commit d77fb17 into main Oct 17, 2026
14 checks passed
@aroff
aroff deleted the feat/isolated-clone-auth-header branch October 17, 2026 23:45
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