← All insightsSecurity

Securing GitHub Actions: least privilege and safe defaults

CodeWizard Engineering · 12 July 2026 · 3 min read · Advanced

Security with GitHub Actions is mostly correct, boring defaults applied consistently. Here is the short list that removes most of the risk.

Safe defaults

  • Prefer OIDC over stored credentials; set least-privilege permissions
  • Use environments with required reviewers for production deploys

Wire it into the pipeline

Deploy to AWS using OIDC - no long-lived secrets.

yaml
permissions: { id-token: write, contents: read }
steps:
  - uses: aws-actions/configure-aws-credentials@v4
    with:
      role-to-assume: arn:aws:iam::1234:role/gha-deploy
      aws-region: eu-west-1
  - run: aws s3 sync ./dist s3://acme-site --delete

Reinforcing habits

  • Pin actions to a commit SHA and review third-party actions before use
  • Use OIDC for cloud auth and set minimal permissions blocks
  • Cache dependencies and split long jobs with a matrix

Want senior help putting GitHub Actions to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult