git lfs env prints the password embedded in the remote URL
Describe the bug
git lfs env prints endpoint URLs verbatim. When a remote URL carries credentials (https://user:password@host/repo.git), the password appears in clear text in the Endpoint= lines. Since users are asked to paste git lfs env output into bug reports, embedded credentials can end up in public issues.
To Reproduce
git init t && cd tgit remote add origin https://user:[email protected]/r.gitgit lfs env | grep Endpoint- Output:
Endpoint=https://user:[email protected]/r.git/info/lfs (auth=none)
Expected behavior
The password is redacted in the printed URL, for example Endpoint=https://user:[email protected]/r.git/info/lfs (auth=none).
System environment git-lfs 3.7.1 (b84b338), git 2.45.2, Linux/arm64. No proxy, no TLS interception.
Output of git lfs env
git-lfs/3.7.1 (GitHub; linux arm64; go 1.24.5; git b84b338) git version 2.45.2
Endpoint=https://user:[email protected]/r.git/info/lfs (auth=none)
(remaining lines omitted; they do not contain the URL)
Additional context
Both Endpoint= lines in commands/command_env.go print endpoint.Url directly. A possible fix is to redact at the print site only, using (*url.URL).Redacted() from the standard library, so that the values used for access lookups and requests stay unchanged. I can open a pull request if this approach is acceptable.
Source: git-lfs/git-lfs