Conversation
Use GIT_ASKPASS with a temporary helper script to pass credentials instead of embedding the token directly in the clone URL. The token is passed via the GIT_TOKEN environment variable, keeping it out of process listings, shell history, and logs. Closes #10 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Closes #10
Issue
Sanitize GitHub token from git clone command lines
In github.py, clone_repo() embeds the GitHub token directly in the git clone URL:
https://x-access-token:{_token}@github.com/.... This exposes the token in process listings (ps aux), shell history, and any logs that capture subprocess arguments.Suggested fix: Use git credential helpers or pass credentials via GIT_ASKPASS environment variable instead of embedding them in the URL. For example, set the token via the subprocess
envparameter using GIT_ASKPASS pointing to a helper script, or usChanges
Done. Here's what was changed:
minbot/github.py: Replaced the inline token in thegit cloneURL with aGIT_ASKPASS-based approach:_git_clone_with_token()helper creates a temporary shell script that returnsx-access-tokenfor username prompts and reads the token from theGIT_TOKENenv var for password promptsenvparameter (not visible inps auxor logs)https://github.com/{repo}.gitwith no embedded credentialsfinallyblocktests/test_github.py: Updatedtest_clone_repo_clones_if_newto mock the new tempfile/chmod/unlink calls and assert the token doesn't appear in command-line arguments.Automated by minbot using Claude Code.