Skip to main content
Unmonitored developer tokens are one of the most common vectors for silent credential leaks and data exfiltration. Treat any token you see as sensitive.
Use this guide to understand the security differences between legacy classic personal access tokens (PATs) and the modern fine‑grained PATs. Follow the recommendations here to reduce blast radius, improve auditability, and meet organization security policies.
Never publish or share real personal access tokens. The examples shown below are illustrative.
Example (fake) classic token:
In this lesson we contrast the security posture of legacy classic personal access tokens with modern, admin‑approved, repository‑scoped fine‑grained personal access tokens. Consider these two token types as a progression from dangerous convenience to secure design.
A slide titled "A Progression, Not a Choice" showing a transition from a red/orange "Classic" key icon labeled "Dangerous convenience" to a green "Fine-grained" icon labeled "Secure design."

What is a Classic Personal Access Token?

A classic PAT is effectively a master key that grants whatever access the associated user account has. It is simple and powerful — but risky if compromised.
A slide titled "A Master Key" showing an orange key icon beside a rack of service rows (acme-payments, acme-web, acme-infra, acme-hr) populated with container-like boxes. Below are pill buttons labeled "Simple", "Powerful", and "Terrifying if lost."
Key characteristics and risks:
  • Classic PATs are user‑scoped — a token granted the repo scope has access to every repository the user can access.
  • You cannot limit a classic PAT to a single repository or resource.
  • Classic PATs can be configured with no expiration; if compromised, the blast radius can be indefinite.
  • Actions performed with a compromised classic PAT appear in audit logs as the user’s own actions, complicating attribution and forensics.
A screenshot of a "New personal access token (classic)" dialog with the Expiration set to "No expiration" and a recommendation to set an expiry. Below it is a timeline showing a "Compromised" point and an infinity symbol labeled "Blast radius, indefinite."
A screenshot titled "Recorded as the User" showing an Organization audit log. It lists two entries — "repo.access_granted" and "git.push" by user "maya-chen" from 2 minutes and 4 minutes ago.

What is a Fine‑Grained Personal Access Token?

A fine‑grained PAT acts like a programmed key card: it is scoped to specific repositories and actions. When creating a fine‑grained PAT, the user must explicitly select repositories and set precise permissions for each resource. Fine‑grained PATs require an expiration date and can be subject to admin approval for organization access.
A slide titled "Name the Repositories" showing a "Repository access" selection box. It lists three options—Public repositories, All repositories, and Only select repositories—with "Only select repositories" marked selected.
A slide titled "Expiration Is Mandatory." It shows a UI panel for creating a new fine-grained personal access token with the expiration set to 30 days (Expires Mar 14, 2026).
Example (fake) fine‑grained token representation:
Administration benefits:
  • Fine‑grained PATs limit tokens to explicit repositories and actions (for example: read issues, write pull requests).
  • Expiration is mandatory, which reduces indefinite exposure.
  • Owners can enforce admin approval before a token can access organization resources — preventing unseen tokens from gaining organization‑level access.

Example: Using a PAT to Call the GitHub API

A simple curl request shows how a token is used to authenticate API calls. Replace the example token with a real, securely stored token when testing; never embed tokens in source code or public repositories.

Comparison: Classic vs Fine‑Grained

Best Practices

  • Prefer fine‑grained PATs for scripts, CI jobs, and integrations where you can specify exact repositories and permissions.
  • Enforce short expirations and rotate tokens regularly.
  • Require admin approval for tokens that access organization resources.
  • Store tokens in secret managers or environment variables — never commit them to source control.
  • Monitor audit logs for unusual activity and revoke tokens immediately if compromise is suspected.

Summary (Exam & Practical)

  • Classic personal access tokens grant broad, user‑scoped access and may not expire. They are convenient but increase blast radius and complicate audits.
  • Fine‑grained personal access tokens are repository‑scoped, support precise permissions, mandate expirations, and can require admin approval — all of which reduce risk and improve governance.
  • When possible, adopt fine‑grained PATs and administrative controls to reduce blast radius and improve auditability.
Use fine‑grained PATs and administrative controls to strengthen your security posture and protect your organization’s resources.

Watch Video