Skip to content

Security: Git token persisted in local config via URL rewrite may leak credentials#2018

Open
tuanaiseo wants to merge 1 commit into
speakeasy-api:mainfrom
tuanaiseo:contribai/fix/security/git-token-persisted-in-local-config-via-
Open

Security: Git token persisted in local config via URL rewrite may leak credentials#2018
tuanaiseo wants to merge 1 commit into
speakeasy-api:mainfrom
tuanaiseo:contribai/fix/security/git-token-persisted-in-local-config-via-

Conversation

@tuanaiseo
Copy link
Copy Markdown

Problem

The GitHub access token is embedded directly into a rewritten URL and stored in repository-local git config (url.<auth>.insteadOf). This persists secrets in plaintext on disk and increases exposure via accidental config dumps, debugging output, backups, or compromised workspace reads.

Severity: high
File: internal/git/auth.go

Solution

Avoid writing tokens to git config. Prefer ephemeral auth mechanisms (GIT_ASKPASS, credential helpers with scoped lifetime, or in-memory command env). If persistence is unavoidable, scrub config after use and mask secrets in all logs.

Changes

  • internal/git/auth.go (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

The GitHub access token is embedded directly into a rewritten URL and stored in repository-local git config (`url.<auth>.insteadOf`). This persists secrets in plaintext on disk and increases exposure via accidental config dumps, debugging output, backups, or compromised workspace reads.

Affected files: auth.go

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
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