What is the purpose of a fine-grained Personal Access Token (PAT) in GitHub?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Fine-grained PATs are the evolution of classic PATs. Instead of 'repo' permission that unlocks everything, you specify exactly which repos and exactly what operations. It's the principle of least privilege applied to personal tokens.
Full explanation below image
Full Explanation
Fine-grained Personal Access Tokens (introduced in 2022-2023) improve on classic PATs by offering: (1) Repository scope — tokens can be limited to specific repositories rather than all repos the user can access. (2) Granular permissions — instead of broad scopes like 'repo', you choose specific permissions (contents: read, issues: write, pull-requests: read, etc.). (3) Expiration — fine-grained PATs require an expiration date (max 1 year). (4) Organization approval — organization owners can require approval before fine-grained PATs with access to org resources can be used. Classic PATs have broad scopes and no mandatory expiration, making them riskier. Fine-grained PATs can also be reviewed and revoked at the organization level.