GitHub fine grained tokens can be scoped to chosen repositories and set to expire, and organizations can require approval and cap lifetimes. GitHub App installation tokens expire after an hour by design. Review expiration settings and revoke anything an agent session may have exposed.
Read in this order
- OfficialGitHub: Managing your personal access tokensStart here: scope a personal token to chosen repositories and give it an expiry.
- OfficialGitHub: Setting a personal access token policy for your organizationOrg controls to require approval and cap how long tokens live.
- OfficialGitHub: Token expiration and revocationWhen tokens expire or get revoked, and how to act on exposure.