Skip to content

Fix: Prevent storing GitHub token in .git/config#73

Open
granolacowboy wants to merge 1 commit intoopactorai:mainfrom
granolacowboy:sentinel-secure-git-token-7884798895570688211
Open

Fix: Prevent storing GitHub token in .git/config#73
granolacowboy wants to merge 1 commit intoopactorai:mainfrom
granolacowboy:sentinel-secure-git-token-7884798895570688211

Conversation

@granolacowboy
Copy link

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant