fix: Keep GitHub token out of git source URLs - #608
Closed
alecthomas wants to merge 1 commit into
Closed
Conversation
The token was embedded in the source URL, so it reached every consumer that treats that URL as an identifier: command lines in logs and error messages, the UI task label, hermit status output, the source directory hash, and remote.origin.url in the cloned repository's .git/config, where it persisted indefinitely and was reused on every pull. Pass it to git as an http.extraheader via GIT_CONFIG_* environment variables instead. The environment keeps it out of argv as well as out of .git/config, so all of those sinks close at once. Redacting URL userinfo where commands and sources are displayed covers the remaining case of credentials a user hand-writes into sources. DX-26 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
A correct implementation of this is quite tricky, and the risk is relatively low. |
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.
The token was embedded in the source URL, so it reached every consumer
that treats that URL as an identifier: command lines in logs and error
messages, the UI task label, hermit status output, the source directory
hash, and remote.origin.url in the cloned repository's .git/config,
where it persisted indefinitely and was reused on every pull.
Pass it to git as an http.extraheader via GIT_CONFIG_* environment
variables instead. The environment keeps it out of argv as well as out
of .git/config, so all of those sinks close at once. Redacting URL
userinfo where commands and sources are displayed covers the remaining
case of credentials a user hand-writes into sources.
DX-26
Co-Authored-By: Claude Fable 5 noreply@anthropic.com