Fix: Prevent storing GitHub token in .git/config#73
Open
granolacowboy wants to merge 1 commit intoopactorai:mainfrom
Open
Fix: Prevent storing GitHub token in .git/config#73granolacowboy wants to merge 1 commit intoopactorai:mainfrom
granolacowboy wants to merge 1 commit intoopactorai:mainfrom
Conversation
A critical security vulnerability was identified where the GitHub access token was being stored in plaintext within the project's local `.git/config` file. This occurred because the token was embedded directly into the remote URL during repository connection and subsequent push operations. The code has been modified to no longer store the GitHub token in the remote URL. The `lib/services/github.ts` file was updated to set the remote URL without credentials. For push operations, the authenticated URL is now constructed just-in-time and passed directly to the `git push` command. The `lib/services/git.ts` file was also updated to support this by allowing the `pushToRemote` function to accept a dynamic, authenticated URL for the push, ensuring the token is used for authentication but never written to disk.
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.
A critical security vulnerability was identified where the GitHub access token was being stored in plaintext within the project's local
.git/configfile. This occurred because the token was embedded directly into the remote URL during repository connection and subsequent push operations.The code has been modified to no longer store the GitHub token in the remote URL. The
lib/services/github.tsfile was updated to set the remote URL without credentials. For push operations, the authenticated URL is now constructed just-in-time and passed directly to thegit pushcommand. Thelib/services/git.tsfile was also updated to support this by allowing thepushToRemotefunction to accept a dynamic, authenticated URL for the push, ensuring the token is used for authentication but never written to disk.