1-minute read of a 5 min report

GitHub Actions Privileged PR Builds Put Release Secrets Within Reach

By

1-minute read

What a defender needs to know

A fork PR can expose release credentials if a GitHub Actions pull_request_target job checks out and executes the contributor’s code. Supply-chain security vendor Socket’s November 3 guide ties this route to overbroad GITHUB_TOKEN permissions, shared caches and compromised actions. GitHub documents that an action can access GITHUB_TOKEN through github.token without receiving it as an explicit input.

Start in .github/workflows/: look for pull_request_target plus checkout of a fork head, contributor text inserted directly into run or script, and build jobs holding publishing credentials or id-token: write. Move untrusted build work to a read-only pull_request job. Keep publishing in a separate gated job; treat its artifacts as untrusted data, bind each download to the originating run, validate content and avoid executing artifact contents. Review cache-mode: write overrides on externally influenced triggers and use cache-mode: none for release jobs that do not need caching.

Set the organization token default to read-only, use workflow-level permissions: {}, and grant only the required per-job scope. For third-party actions, review pinned commits and transitive dependencies or adopt and verify a workflow lockfile where GitHub supports it. Test with a controlled fork PR and check the run event, effective token permissions, cache access and artifact origin. The fork build should finish without a release credential or a write-scoped token.

Primary sources