Skip to content

Add ENTIRE_CHECKPOINT_TOKEN for checkpoint push/fetch auth#818

Merged
pjbgf merged 2 commits intomainfrom
pjbgf/push-token
Mar 31, 2026
Merged

Add ENTIRE_CHECKPOINT_TOKEN for checkpoint push/fetch auth#818
pjbgf merged 2 commits intomainfrom
pjbgf/push-token

Conversation

@pjbgf
Copy link
Copy Markdown
Member

@pjbgf pjbgf commented Mar 31, 2026

Inject a bearer token into git push/fetch operations for checkpoint branches when the ENTIRE_CHECKPOINT_TOKEN env var is set. The token is passed via GIT_CONFIG_COUNT env vars (not CLI args) to avoid exposing it in /proc/cmdline. Only HTTPS remotes are supported; SSH remotes trigger a warning that the token is ignored.


Note

Medium Risk
Moderate risk because it changes how git network commands are constructed and modifies authentication behavior via environment injection, which could affect checkpoint syncing and credential handling. Scope is limited to checkpoint/metadata git operations and is covered by new unit and integration-style tests.

Overview
Adds ENTIRE_CHECKPOINT_TOKEN support for checkpoint git operations by introducing strategy.CheckpointGitCommand, which injects a bearer token as http.extraHeader via GIT_CONFIG_* env vars for HTTPS remotes (and warns/ignores tokens for SSH or unknown targets).

Updates checkpoint-related git fetch/push call sites (including metadata fetches and checkpoint-remote bootstrap fetch) to use this wrapper, while preserving non-interactive behavior by explicitly appending GIT_TERMINAL_PROMPT=0 where needed.

Adds comprehensive tests validating protocol detection, env var filtering/injection, SSH warning behavior, and that real git requests to an HTTPS test server actually include the Authorization header.

Written by Cursor Bugbot for commit ea1a7da. Configure here.

@pjbgf pjbgf requested a review from a team as a code owner March 31, 2026 16:03
Copilot AI review requested due to automatic review settings March 31, 2026 16:03
Inject a bearer token into git push/fetch operations for checkpoint
branches when the ENTIRE_CHECKPOINT_TOKEN env var is set. The token
is passed via GIT_CONFIG_COUNT env vars (not CLI args) to avoid
exposing it in /proc/cmdline. Only HTTPS remotes are supported;
SSH remotes trigger a warning that the token is ignored.

Signed-off-by: Paulo Gomes <paulo@entire.io>
Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 0d5153892d18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds optional bearer-token authentication for checkpoint-related git push/git fetch operations when ENTIRE_CHECKPOINT_TOKEN is set, by injecting an http.extraHeader Authorization header via GIT_CONFIG_COUNT env vars (avoiding CLI args exposure).

Changes:

  • Introduces strategy.CheckpointGitCommand to build git CLI commands with conditional token injection for HTTPS remotes (and warn/ignore for SSH).
  • Switches checkpoint push/fetch call sites to use CheckpointGitCommand.
  • Adds unit/integration-style tests validating protocol resolution, env injection, and that git actually sends the Authorization header over HTTPS.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
cmd/entire/cli/strategy/push_common.go Uses CheckpointGitCommand for checkpoint branch push/fetch.
cmd/entire/cli/strategy/checkpoint_token.go New helper for protocol detection and token injection via GIT_CONFIG_* env vars.
cmd/entire/cli/strategy/checkpoint_token_test.go Tests for protocol resolution, env injection, stderr warning, and real HTTPS header behavior.
cmd/entire/cli/strategy/checkpoint_remote.go Uses CheckpointGitCommand for metadata-branch fetch-by-URL with GIT_TERMINAL_PROMPT=0.
cmd/entire/cli/git_operations.go Routes several origin fetch operations through strategy.CheckpointGitCommand.

Reject tokens containing control characters (CR, LF, null, etc.) to
prevent HTTP header injection when the value is concatenated into
http.extraHeader. Emit the SSH token warning only once per process
via sync.Once, and improve doc comments for CheckpointGitCommand.

Signed-off-by: Paulo Gomes <paulo@entire.io>
Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: ff9b5ede9efe
@pjbgf pjbgf force-pushed the pjbgf/push-token branch from ea1a7da to b6c7463 Compare March 31, 2026 16:23
Copy link
Copy Markdown
Contributor

@nodo nodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@pjbgf pjbgf merged commit 0b7288e into main Mar 31, 2026
3 checks passed
@pjbgf pjbgf deleted the pjbgf/push-token branch March 31, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants