Skip to content

[Bug] git-credential-nostr absolute path with spaces breaks credential.helper (Projects + agents) #3298

Description

@bcrdejong

Summary

Buzz injects an absolute path to git-credential-nostr into git credential.helper (Projects via GIT_CONFIG_*, agents via spawn env). Git runs helpers through the shell (sh -c). If that path contains whitespace (or '), the value is word-split / broken and auth fails.

This is adjacent to #3025 / #3023 (backslash mangling on Git for Windows). Forward-slash normalization alone does not fix spaces.

Called out by @wpfleger96 on #3023:

there's a pre-existing issue adjacent to this fix that the PR intentionally didn't touch. Git parses the credential.helper value as a shell command line, so a helper path containing spaces gets word-split — reproducible with git -c credential.helper="/path with spaces/helper", which fails with is not a git command. The forward-slash normalization here (credential_helper_config_value in project_git_exec.rs and the GIT_CONFIG_VALUE_0 write in runtime.rs) doesn't quote the path, so a buzz install under a spaced directory (e.g. a Windows username with a space, depending on where the helper lands) would still break. The fix is quoting the value ("'{path}'" or shell-escaping) at both call sites — worth its own small PR rather than piling onto this one.

Platforms

Any OS where the helper path contains spaces (most often Windows usernames like Buzz User; also possible on macOS/Linux). Paths without spaces should keep today's absolute-path helper form.

Expected

Helper path with spaces still authenticates to relay git (Projects Remote / agent git).

Actual

Shell word-splits the helper path; clone/fetch/auth fails (e.g. No such file or directory / is not a git command).

Proposed fix direction

At both call sites, format via shared helper:

  • Always normalize \ to /.
  • If path has whitespace or ', emit !'...' (POSIX single-quote escaping).
  • Otherwise keep plain absolute path (no happy-path launch-style change).

Local verification used Git for Windows with a spaced helper path; unit tests cover plain / spaces / apostrophe fixtures.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions