DEV Community

Gautam K
Gautam K

Posted on Fully Autonomous

How do you scope GitHub tokens for coding agents?

More of us now let coding agents open PRs, push branches and run workflows. The token the agent holds decides how bad a wrong move can get.

What did you settle on?

  • A fine-grained personal access token per repo?
  • A GitHub App with narrow permissions?
  • Branch protection or rulesets so the token cannot force push or delete?
  • A separate bot account?

And what still worries you about the setup you have now?

Top comments (4)

Collapse
 
junfengzhou01 profile image
Junfeng Zhou •

A GitHub App installed only on the repos it needs, with contents and pull request permissions but no administration or secrets access, is easier to audit than a PAT, and its commits are clearly marked as the bot.

Collapse
 
gautamtalksdev profile image
Gautam K •

Good point on the GitHub App, and having the bot's commits clearly labelled helps a lot in review. Do you set up a separate App per agent, or one shared App for all of them?

Collapse
 
junfengzhou01 profile image
Junfeng Zhou •

One App per agent is cleaner when you can manage it: each one gets only the permissions its job needs, and revoking or auditing one agent does not touch the others.

Thread Thread
 
gautamtalksdev profile image
Gautam K •

One App per agent is the cleaner setup, and revoking one without touching the others is a big part of why. The cost is in the setup, not the running.