Safeguard
Security Guides•

Which CI credential should a small team use: token, PAT or app?

Prefer the built-in job token, then a GitHub App, then OIDC for cloud access. A personal access token is the last resort. A decision table with reasons.

Safeguard Security Team
4 min read

Use the built-in workflow token when it is enough, a GitHub App installation token when you need more, and OIDC for cloud access. Keep a personal access token as the last resort, because it is tied to one person and usually carries more access than a job needs.

The four options

A pipeline has to prove who it is to GitHub, to your cloud and to other services. There are four common ways.

CredentialLifetimeTied to a person?Best for
Built-in GITHUB_TOKENOne jobNoActions on the same repository
GitHub App installation tokenMinted in the workflowNoCross-repository access, bigger permission sets
OIDC token exchanged for cloud accessOne jobNoDeploying to a cloud provider
Personal access token stored as a secretUntil it expires or is revokedYesA last resort

When each one fits

Built-in token

It is the default. GitHub's docs say actions can use it through the token context, and recommend limiting its permissions to the minimum. If a job only needs to comment on a pull request or push a package, this is enough. See what permissions it should have.

GitHub App

GitHub's documentation says that if you need permissions the built-in token cannot have, you can create a GitHub App and generate an installation access token within the workflow. The App has its own permission list, is installed on chosen repositories, and does not disappear when a person leaves the team. It is the right answer for jobs that push to another repository or open pull requests across several.

OIDC for the cloud

For cloud deployments, GitHub's docs describe OIDC as a way to avoid duplicating cloud credentials as long-lived GitHub secrets. You create a trust relationship in the cloud provider and the workflow requests a short-lived access token directly. The token is valid for a single job and then expires. The provider checks claims such as the repository and environment, so you can limit a role to one workflow on one branch.

Personal access token

GitHub's own tutorial lists a personal access token as an alternative when the built-in token lacks permission, but it comes with downsides. It acts as the person who created it. It often has wide scope. When that person leaves, pipelines break, or worse, nobody revokes it. If you must use one, make it as narrow as the platform allows, give it a short expiry, put it in an environment secret and note an owner and a rotation date.

GitLab has an equivalent split: the job token for the project, ID tokens for third parties, and stored keys as the last resort. See restricting the job token.

A short decision flow

  1. Does the job only touch this repository? Use the built-in token with explicit permissions.
  2. Does it need other repositories or more scopes? Use an App.
  3. Does it need to reach your cloud? Use OIDC with a role limited by repository, branch and environment.
  4. Does it need a third party that offers none of these? Use a stored secret with a named owner, a short life, and a rotation plan.

Common mistakes

  • Using one broad token for every job. A leak then opens everything.
  • Storing a cloud key as a repository secret when OIDC was available.
  • Letting a departed employee's token keep running production deploys.
  • Keeping secrets in repository scope when only one environment needs them. GitHub notes that anyone with write access to a repository can read all secrets configured at repository level, so narrower scopes help.

Where Safeguard fits

Credential choices live in your platform settings. Safeguard focuses on what the pipeline builds: dependency scanning, SBOMs, and policy gates that can stop a risky change at the pull request. A free scan is at gold.safeguard.sh/scan.

Quick check

Is a GitHub App harder to set up than a personal token?

Slightly, since it takes a few steps to create and install. The result is not tied to a person and has narrower, clearer permissions.

Does OIDC mean I have no secrets left?

Not necessarily. It removes long-lived cloud credentials, but other services may still need stored secrets, and the trust rules need care.

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.