Skip to content

Guides

How to manage secrets in GitHub Actions

Secrets are sprawled across repository settings and nobody knows what is still used.

7 min read

Secrets are sprawled across repository settings and nobody knows what is still used.

Why it happens

Repository secrets are visible to every workflow, including ones triggered by pull requests, and they never expire.

How to fix it

  1. Use OIDC instead of stored secrets wherever the provider supports it
  2. Scope secrets to deployment environments with required reviewers
  3. Set explicit permissions on GITHUB_TOKEN — default the repository to read-only
  4. Audit which secrets have been read in the last 90 days and delete the rest
  5. Never use pull_request_target with a checkout of the PR head

Your next build could be twice as fast, at half the price

Start free. Migrating away is the same one line, and we publish that diff too.