answered from live GitHub & Hugging Face data

What are the security implications of using fine-grained PATs vs GitHub App tokens for AI coding agents?

Verdict: For an AI coding agent, use a GitHub App installation token. A fine-grained PAT gives the agent the same reach as the person who created it, and it lasts much longer.

Comparison

Risk factor Fine-grained PAT GitHub App installation token
Lifetime Set by the user. Infinite lifetime is allowed unless an org policy blocks it. Expires after 1 hour.
Whose access it has The token owner's access, limited to one resource owner and the selected repositories. Only the repositories and permissions the installer granted to the app.
Scope control at issue time Choose repositories and permissions when you create the token. Request a subset of repositories and permissions for each token. The token cannot exceed what the app holds.
Who it is tied to A user. It stops working if that user loses access. The app installation. It is not tied to one person and remains if the installer leaves.
Attribution in logs Actions appear as the human user. Actions appear as a bot, such as @jenkins[bot].
Revocation The user or GitHub can revoke it. Removing repositories from the installation removes access. The installer can also uninstall the app.
Rate limits Tied to the user. Scale with the number of repositories and users.

Sources: token expiration and revocation, installation access tokens, personal access token management, and deciding when to build a GitHub App.

Security implications

1. Blast radius of a leaked credential

2. Automatic revocation

3. Human dependency

4. Attribution and audit

5. Where PATs still fit

6. Token user-to-server tokens

Recommendation

  1. Register a GitHub App for the agent.
  2. Install it on only the repositories the agent needs.
  3. Mint an installation token per task with the smallest permissions and repositories values.
  4. Use a fine-grained PAT only for a gap the app cannot cover, with a short expiry.
  5. Never use a classic PAT for an agent.

Choose a GitHub App if the agent runs repeatedly, works across repositories, or must not depend on one person. Choose a fine-grained PAT if you test a single task by hand and need one of the gaps listed above.

If you run more than one agent, give each agent its own GitHub App identity. A single shared app shows all agents as the same bot. githug does this today: each agent gets its own key, which mints one-hour tokens for one repository through a GitHub App. Its commits show the agent as author and name the accountable human in trailers. The hug CLI sets this up during the beta.

This is general guidance, not legal advice. Check your organization's token policies before you deploy.

docs.github.com/en/authentication/keeping-your-account-and-data-secure/token-expiration-and-revocationdocs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-an-installation-access-token-for-a-github-appdocs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokensdocs.github.com/en/apps/oauth-apps/building-oauth-apps/differences-between-github-apps-and-oauth-appsdocs.github.com/en/apps/creating-github-apps/about-creating-github-apps/deciding-when-to-build-a-github-app
Answered live from GitHub & Hugging Face · anthropic/claude-haiku-5.5 · 10/29/2026

Ask your own open-source question →