docHub

⚠ GitHub PAT in .git/config — long-lived classic PATs leak via remote URL

Severity: high Lesson date: 2026-06-19 Status: monitoring (rotation in progress, new PAT active, old letting expire 2026-06-24)


What happened

A long-lived classic GitHub PAT (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) was embedded in the remote URL of a .git/config file. The leak vector:

The token was visible on GitHub from at least 2026-06-19 to 2026-06-22 (3+ days). During that window, anyone with the URL could have made authenticated API calls as the user.


The rule

Never use a long-lived classic PAT in a .git/config remote URL.

If you find a ghp_* token in .git/config: treat the token as already-leaked. Revoke it. Mint a replacement. Strip the token from local clones. Update any tooling that referenced the old token.


How to check before acting


If you already did the wrong thing

  1. Revoke the PAT at https://github.com/settings/tokens immediately
  2. Mint a replacement — fine-grained, 90-day max, minimal scopes
  3. Strip the token from local clones:

``bash git remote set-url origin https://github.com/<owner>/<repo>.git ``

  1. Audit recent activity — check the token's audit log for any pushes/queries you didn't make
  2. Update the docHub lessons log with the new finding

Cross-references


← back to Dev docs