Skip to content

Get notified

Get an email when a new major security incident drops. No spam, unsubscribe any time.

Only used for pwn.watch incident emails. Protected by Cloudflare Turnstile.

Supply Chain & SBOM10 min read

GitHub Actions & CI/CD Secrets Hardening Playbook (2026)

How to keep CI/CD secrets out of attackers' hands in GitHub Actions: pin actions to commit SHAs, replace stored cloud keys with OIDC short-lived credentials, guard pull_request_target and issue-triggered workflows, and revoke tokens fast when a workflow leaks.

// key takeaways

  • In 2026 attackers stopped needing a malicious action. GhostAction and Gheist used hijacked accounts and stolen tokens to commit their own workflows that read every secret the repository could reach.
  • Anything a workflow can read, a workflow someone else commits can read too. Scope secrets to protected environments and branches, and replace long-lived cloud keys with OIDC roles whose trust policy checks the branch or environment.
  • Issue titles, PR bodies and comments are attacker input. Pass them through env variables, never interpolate them into run steps, and give issue-triggered jobs read-only tokens with no secrets.
  • Pin third-party actions to full commit SHAs. Tags can be repointed, as the tj-actions/changed-files compromise showed.
  • Have a revocation runbook ready. When CircleCI was breached in 2023 it told every customer to rotate every stored secret, and that only works if you know where each secret lives.

What CI/CD secret theft looked like in 2026

GhostAction, a campaign GitGuardian first documented in September 2025, came back in force. During an October 8-12, 2026 wave, about 1,900 compromised GitHub accounts pushed fake 'security audit' workflows (security-audit.yml or github_actions_security.yml) to more than 30,000 repositories, according to GitGuardian. The new payload sent the repository's Actions secrets, plus every credential found in its full git history, to 193.32.204.199 over plain HTTP. GitHub began preventing the workflow from running around October 9, but secrets that had already left stay valid until someone rotates them.

Gheist, tracked by Wiz Research since September 15, 2026, took a quieter route. Stolen GitHub tokens committed a 'sync-check' workflow on ci-sync-* branches in every repository each token could reach. The workflow printed secrets base32-encoded, so GitHub's log masking missed them, then the tool downloaded the log and deleted the run. Wiz recovered more than 13,500 planted branches from over 850 accounts. A later variant added a deployment-environment matrix so environment-scoped secrets, often production ones, were dumped too. GitHub's approval hold stopped it in public repositories, but runs completed in private repositories and on GitHub Enterprise Server, followed by AWS Secrets Manager enumeration.

The third pattern needed no stolen credentials at all. On September 1, 2026, Radware found 83 issues, pull requests and comments aimed at 61 public repositories, 77 of them posted within 43 minutes. Each carried a $() shell command that runs if a workflow pastes the issue or PR text into a shell step. Run logs show the command executed in two cases. Google's Gemini CLI and run-gemini-cli issue-triage workflows had the same class of flaw: an unauthenticated attacker who opened a crafted issue could run commands on the runner or read tokens. Google fixed those workflows on May 12, 2026, but repositories that copied the example workflows earlier keep the vulnerable version until they update it.

Pin every action to a full commit SHA

A tag like v4 or v45 is a movable pointer. In March 2025 attackers repointed the version tags of tj-actions/changed-files to a commit that dumped runner memory and printed CI/CD secrets into workflow logs. More than 23,000 repositories used the action, and the attack started with an earlier compromise of reviewdog/action-setup. Workflows that referenced a full commit SHA kept running the code they had reviewed.

Pinning only works if updates are reviewed. Let Dependabot or Renovate propose SHA bumps with the version in a trailing comment, and read the diff of third-party actions before merging. Treat a sudden tag move on an action you depend on as an incident signal.

  • Reference third-party actions by 40-character commit SHA with the version as a comment, for example actions/checkout@<sha> # v4.
  • Enable the organization policy that requires actions to be pinned to a full-length commit SHA where your plan supports it, or enforce it with a CI lint.
  • Restrict allowed actions to GitHub-authored, verified creators and an explicit allowlist.
  • Vendor or fork rarely updated actions that touch secrets, so a maintainer compromise cannot change them under you.
  • Copying an example workflow (such as an AI triage workflow) makes it your code. Track its upstream and re-sync when the upstream fixes a security issue.
Find unpinned action references in your workflows
# List uses: lines that are not pinned to a 40-char SHA (local ./ actions excluded)
grep -RhoE 'uses:\s*[^ #]+' .github/workflows \
  | sed -E 's/uses:\s*//' \
  | grep -v '^\./' \
  | grep -vE '@[0-9a-f]{40}$' \
  | sort -u

Replace stored cloud keys with OIDC short-lived credentials

GhostAction and Gheist both harvested whatever secrets were stored in the repository, organization and environments. A long-lived AWS access key stored as an Actions secret is worth the same to an attacker whether it leaves through a log or over HTTP. With OpenID Connect, the workflow requests a signed token from GitHub at run time and exchanges it for cloud credentials that expire in minutes, so there is no static key to steal.

OIDC is only as strong as the cloud-side trust policy. Wiz's guidance for Gheist includes hunting for cloud OIDC role assumptions whose subject contains ci-sync-, which means a trust policy that accepted any branch in the repository would have handed the planted workflow a cloud role. Bind each role to a specific repository plus a protected branch or a deployment environment that requires review, never to repo:org/* or a wildcard ref.

  • Grant id-token: write only to the job that assumes the cloud role, not the whole workflow.
  • Match the token subject exactly: repo:org/repo:ref:refs/heads/main or repo:org/repo:environment:production.
  • Protect deployment environments with required reviewers and restrict which branches may deploy to them.
  • Keep remaining static secrets in environments, not at the repository or organization level, so a workflow on an unreviewed branch cannot read them.
  • Log every role assumption in CloudTrail or the equivalent, and alert on subjects that do not match your protected branches.
Least-privilege deploy job using OIDC instead of stored keys
permissions:
  contents: read
jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: production   # required reviewers + branch rules
    permissions:
      contents: read
      id-token: write         # only this job can mint an OIDC token
    steps:
      - uses: actions/checkout@<pinned-sha>
        with:
          persist-credentials: false
      - uses: aws-actions/configure-aws-credentials@<pinned-sha>
        with:
          role-to-assume: arn:aws:iam::123456789012:role/deploy-production
          aws-region: us-east-1
# AWS trust policy condition:
#   token.actions.githubusercontent.com:sub = repo:acme/app:environment:production

Guardrails for pull_request_target and issue-triggered workflows

pull_request_target, issues, issue_comment and workflow_run run in the context of the base repository, with access to its secrets and a write-capable GITHUB_TOKEN, even when the event comes from a stranger. That is why the Radware campaign and the Gemini CLI triage flaw worked: attacker-written text reached a shell step in a job that held tokens. The text did not need to be merged, or even stay open.

The fix is structural. Never check out and run the pull request's head code in a pull_request_target job. Never place ${{ github.event.issue.title }}, ${{ github.event.comment.body }} or similar expressions inside run: scripts; pass them through env: and quote them. Split untrusted analysis (label, comment, run tests on fork code without secrets) from privileged steps (push, publish, deploy) into separate jobs or workflows.

  • Set a top-level permissions: block that defaults to contents: read and add write scopes per job.
  • Use pull_request, not pull_request_target, for building and testing fork code; it runs without secrets.
  • If pull_request_target is required, never check out github.event.pull_request.head.sha in that job.
  • Set persist-credentials: false on actions/checkout so the token is not left in .git/config for later steps.
  • Require approval for workflow runs from first-time and outside contributors.
  • Run a workflow linter such as zizmor or actionlint in CI to flag template injection and dangerous triggers.
Untrusted text goes through env, never into the script
on:
  issues:
    types: [opened]
permissions:
  contents: read
  issues: write
jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
      # BAD:  run: echo "${{ github.event.issue.title }}" | ./label.sh
      - name: Label issue
        env:
          ISSUE_TITLE: ${{ github.event.issue.title }}
        run: printf '%s\n' "$ISSUE_TITLE" | ./label.sh

Rapid token revocation when a workflow leaks

The CircleCI breach is the reference case for CI secret exposure. Malware on an engineer's laptop stole a 2FA-backed SSO session, and the attacker exfiltrated customer environment variables, tokens and keys along with the encryption keys. On January 4, 2023, CircleCI told every customer to rotate every secret stored in the platform. Teams that had an inventory rotated in hours; teams that did not spent days finding where each key was used.

GhostAction raised the bar further: its payload collected credentials from the repository's entire git history, so the scope of rotation is every secret ever committed, not just the ones in Actions settings. Gheist's notes add a second rule: treat any self-hosted runner that ran the planted workflow as compromised, because its sync-host job swept the host for tokens, process environments and cloud metadata.

  • Keep an inventory mapping each CI secret to its owner, the systems it unlocks, and how to rotate it.
  • Revoke first, investigate second: disable the leaking PAT, OAuth app or GitHub App installation before reading logs.
  • Rotate every repository, organization and environment secret the affected workflow could read, and any credential present in git history.
  • Hunt for indicators: branches matching ci-sync-*, workflow files named sync-check.yml, security-audit.yml or github_actions_security.yml, runs deleted right after finishing, and traffic to 193.32.204.199.
  • Rebuild self-hosted runners from a clean image after an incident instead of cleaning them in place.
  • Check the owners of stolen tokens for infostealers; Wiz traced Gheist's tokens mainly to infostealer logs and earlier supply-chain leaks.
Hunt for planted workflows and branches across an org
# Requires gh CLI with read access to the org
ORG=acme
for repo in $(gh repo list "$ORG" --limit 1000 --json name -q '.[].name'); do
  gh api "repos/$ORG/$repo/branches" --paginate -q '.[].name' \
    | grep -E '^ci-sync-[0-9a-z]{6}$' && echo "suspicious branch in $repo"
  for f in sync-check.yml security-audit.yml github_actions_security.yml; do
    gh api "repos/$ORG/$repo/contents/.github/workflows/$f" >/dev/null 2>&1 \
      && echo "$repo has $f on default branch"
  done
done

// actionable engineering checklist

  • Pin actions to commit SHAs

    Every third-party uses: line references a full 40-character SHA, updated through reviewed Dependabot or Renovate PRs.

  • Default to read-only tokens

    Top-level permissions: contents: read in every workflow, with write scopes added per job only where needed.

  • Move cloud access to OIDC

    No long-lived cloud keys in Actions secrets; roles trust only a specific repository plus a protected branch or environment.

  • Scope remaining secrets to environments

    Production secrets live in protected environments with required reviewers and branch restrictions, not at repo or org level.

  • Lock down untrusted triggers

    No head checkout under pull_request_target, no event text in run: steps, persist-credentials: false, and approval for outside contributors.

  • Lint workflows in CI

    Run a workflow security linter on every change to .github/workflows and require CODEOWNERS review for that directory.

  • Maintain a secret inventory and revocation runbook

    Know where every secret is used, who owns it and how to rotate it, so a CircleCI-style 'rotate everything' notice takes hours, not days.

  • Monitor for planted workflows

    Alert on new workflow files from unusual accounts, deleted runs, ci-sync-* branches and OIDC subjects outside protected refs.

// connected pwn.watch tools & live trackers

Frequently Asked Questions

Is pinning a GitHub Action to a version tag enough?
No. Tags can be moved to a different commit by anyone with write access to the action's repository, which is how the tj-actions/changed-files compromise reached more than 23,000 repositories. Pin to the full commit SHA and review updates.
Does OIDC stop attacks like Gheist?
It removes static cloud keys from the secrets a planted workflow can dump. It only helps if the cloud trust policy checks the token subject: bind roles to a protected branch or a deployment environment with required reviewers, so a workflow on an attacker branch cannot assume them.
When is pull_request_target safe to use?
When the job never checks out or executes the pull request's code and never interpolates PR or issue text into shell steps. Use it for labeling or commenting with minimal permissions; build and test fork code under pull_request, which runs without secrets.
What should I rotate after a workflow leaked secrets?
Every repository, organization and environment secret the workflow could read, any credential that was ever committed to the repository's git history, and the token or account that pushed the workflow. Treat self-hosted runners that ran it as compromised and rebuild them.

Get an email when a new major security incident drops. No spam, unsubscribe any time.