GitHub — Personal Access Token
GitHub PATs authenticate API requests and Git operations. Exposure grants access to repositories, organizations, and user data based on token scopes.
Immediate Action Required
Deleting a leaked credential from a repository does not invalidate it. Assume it has already been copied. Follow the revocation steps below immediately, then investigate for unauthorized access.
What Is This Credential?
GitHub PATs authenticate API requests and Git operations. Exposure grants access to repositories, organizations, and user data based on token scopes.
Permissions Granted
- Repository read/write (if repo scope granted)
- Organization access
- Workflow and Actions access
- Package registry access
Exposure & Blast Radius
- Unauthorized access to private repositories
- Code exfiltration or modification
- Secrets extraction from repository settings
- Triggering malicious CI/CD workflows
- Access to GitHub Actions secrets
Immediate Response Steps
Revoke the token immediately
Go to GitHub Settings → Developer settings → Personal access tokens → Delete the token.
Check token audit log
Review the token's recent activity in GitHub's audit log (Settings → Security log).
Review repository access logs
Check for unexpected pushes, forks, or clones of private repositories.
Generate a replacement token
Create a new fine-grained PAT with minimal required scopes.
Update all consumers
Update CI/CD systems, local git configs, and any services using the old token.
Revocation vs Rotation
Revocation
Delete the token at github.com/settings/tokens. Revocation is immediate — the token becomes invalid instantly.
Rotation
Create a new token at github.com/settings/tokens. Prefer fine-grained tokens with minimal scopes over classic tokens.
Grace Period & Session Persistence
Grace Period
None. Token deletion is immediate.
Session Persistence
OAuth app tokens and GitHub App installation tokens are separate and unaffected. Git credential caches on developer machines may retain the token — clear with `git credential reject`.
Investigation Checklist
- Review GitHub audit log for API calls using the token
- Check for unexpected repository forks or clones
- Look for new deploy keys or webhooks added to repositories
- Review Actions workflow runs for unexpected triggers
- Check organization audit log if the token had org access
- Look for new OAuth app authorizations
Recovery Steps
- Update git remote URLs if token was embedded in URLs
- Rotate any GitHub Actions secrets that may have been exposed
- Review and revoke any OAuth apps authorized during the exposure window
- Enable GitHub secret scanning on all repositories
Prevention
- Use fine-grained PATs with minimal scopes and expiration dates
- Use GitHub Actions GITHUB_TOKEN instead of PATs for CI/CD
- Enable GitHub secret scanning and push protection
- Store tokens in a secrets manager, never in code
- Set token expiration dates
Sources & Evidence
GitHub: Managing Personal Access Tokens
official docs
GitHub: Reviewing Your Security Log
official docs
Always verify critical instructions with official provider documentation before taking action. Provider behavior may change without notice.
Found an issue with this playbook?
If these instructions are incorrect, outdated, or missing important information, please report it so we can improve the playbook.
Report an Issue on GitHub