Safeguard
Security Guides•

What permissions should a remediation bot have on your repositories?

A remediation bot needs to read code and open pull requests, not merge or administer. A least privilege checklist for the bot account or app you create.

Safeguard Security Team
3 min read

A remediation bot needs to read your code, push a branch and open a pull request. It should not be able to merge to protected branches, change settings, read secrets or administer the repository. Grant the minimum, scope it to chosen repositories, and review the grant on a schedule.

Start from what the job needs

A fix pull request involves four actions: read the repository, create a branch with the change, open the pull request, and read check results. Everything else is optional. GitHub's guidance for apps says to select the minimum permissions required, that apps start with none, and that Contents access covers HTTP Git operations. It also says Workflows access is needed only if the app edits files under the workflows folder.

That last point is worth noticing. Upgrading an action version means editing a workflow file, and a token that can edit workflows can change what your CI runs. Grant that only on repositories where you have decided you want it.

A least privilege checklist

CapabilityGive it?Reason
Read repository contentsYesNeeded to analyse and patch
Write a branchYesThe fix lives there
Open pull requestsYesThe review vehicle
Merge into protected branchesNo, until you choose itKeeps a human in the loop
Edit workflow filesPer repositoryCan change CI behaviour
Repository admin or settingsNoNot part of the job
Organisation secretsNoA fix does not need them

Scope and lifetime

  • Install on selected repositories, not the whole organisation, during the pilot.
  • Prefer a dedicated app or machine identity over a person's personal token, so the audit log shows the bot, and so a departing employee does not break it.
  • Use short lived credentials where the platform supports them.
  • Review the installed permissions quarterly. Account owners must approve new permissions, so a quiet expansion is harder, but check anyway.

Protect the branch, not just the bot

Branch protection is your second layer. Required reviews, required status checks and code owner approval apply to the bot like anyone else. GitHub's protected branch documentation describes each of these. If the bot cannot merge and the branch needs an approval, the worst case is a bad pull request that a reviewer rejects. See required status checks for automated fix PRs.

Where Safeguard fits

Safeguard's agent identity capability gives agents their own identities and audit trails, and autonomous remediation is off by default with every category on Manual. Start with a free scan before connecting anything.

Quick check

Can the bot use my personal access token?

It can, but a dedicated identity is better: actions are attributable, and the grant does not depend on one person.

Does the bot need access to secrets?

Normally no. A fix pull request does not need production credentials.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.