A forked pull request becomes a route to release credentials when a GitHub Actions pull_request_target job checks out and runs the contributor’s code. Socket’s new guide to outside threats follows that route through workflow permissions, shared build state and the publish job. Socket sells supply-chain security products; its guide assesses the controls from a vendor perspective. It gives maintainers concrete changes to make before the next outsider-controlled build runs.
GitHub says an action can reach GITHUB_TOKEN through github.token even when the workflow never passes the token as an input. A release key or an OIDC-capable job gives untrusted code another route to production. A workflow file that looks tidy from the outside can still put a publishing identity in the same job as a fork’s code.
A fork enters a privileged job
A normal pull_request run from a fork receives a read-only token and, by default, no repository secrets beyond GITHUB_TOKEN. The pull_request_target event instead runs in the base repository’s privileged context. Socket describes the dangerous combination: check out the fork head inside that job, then install dependencies, format files or run a test script. The contributor controls what that process executes while the job holds credentials belonging to the base repository.
In Socket’s account of the 2025 Nx compromise, an untrusted pull-request title leaked a publishing credential from a privileged workflow. Nx’s malicious packages were published using stolen credentials, according to the postmortem Socket cites; the CI pipeline itself did not publish those packages. Investigate the privileged workflow run and its publishing-token access separately from the malicious package release.
There is a second input route in an otherwise ordinary job. GitHub substitutes an expression such as a PR title into a run script before the shell parses it. Quotation marks around the expression do not turn that substituted text into harmless data. Put the expression in a step env value and read the quoted environment variable in the shell instead. Review actions/github-script too: inserting a PR title into its script source makes JavaScript parse contributor-controlled text. Read the title through the event context or an environment value.

Figure details
Two horizontal lanes begin with a fork pull request. In the upper lane, an arrow leads from the fork to a privileged job marked with secrets and a token. In the lower lane, an arrow leads from the fork to a read-only build marked without a publishing key. The two arrows identify the event context and the credentials available in each receiving job.
Build state crosses into release
A job can pass information to a later, more privileged run without a code change in the pull request. Socket describes older cache-poisoning incidents where a pull_request_target run wrote a cache entry that a release build restored. The platform now gives externally influenced default-branch events such as pull_request_target, issue_comment and workflow_run read-only access to that cache scope by default, according to Socket. A workflow that explicitly requests cache-mode: write or write-only on one of those triggers can reopen the write path. Inspect those overrides alongside the release job’s restore behavior, and set cache-mode: none on release jobs that do not need a cache.
Artifact handoffs have a different risk. A separate privileged workflow_run may consume a report from the fork build, but that report remains contributor-controlled data. Tie the download to the triggering run, check its originating workflow and event, and parse only the expected file shape. Extract with a tool that rejects traversal entries and unsafe links; the destination directory alone cannot make a crafted archive safe. Keep the privileged job away from project build scripts and from executing anything inside the artifact.
Action refs also carry code
Socket’s guide recalls the tj-actions/changed-files compromise: an attacker retargeted version tags, and builds that followed those tags ran the changed action code. Roughly 23,000 repositories referenced the action at the time, according to Socket. Its warning is concise: “A SHA proves immutability, not provenance.” A pinned action can still invoke another action by a floating reference, and a Docker action can fetch a mutable base image when built.
For GitHub-hosted repositories, Socket recommends reviewing and committing a workflow lockfile covering step-level actions and their transitive references, then enforcing its verification in CI. Reusable workflow calls, local path actions, container images and inputs require their own treatment; review the commits at first lockfile generation, because it also preserves a malicious commit when that commit is the current ref. On GitHub Enterprise Server, Socket advises full commit SHA pins because workflow lockfiles are not supported there. Check repository and organization action policies before enabling enforcement so shared workflows receive compatible coverage.
Separate the build from the publisher
Start with the workflow files under .github/workflows/. Find pull_request_target jobs that fetch a PR head or run code influenced by a fork, then move compilation and tests to an unprivileged pull_request job. Where a privileged follow-up is necessary, keep its inputs to validated data and restrict the job to the specific operation it performs. The publishing job should consume a reviewed output through a gated environment, with id-token: write or a publishing credential granted only there. A build job that holds id-token: write can request its own OIDC token if a dependency or action turns hostile.
Set an organization-wide read-only default for GITHUB_TOKEN; use workflow-level permissions: {} and grant each job only what it needs. Inspect the effective job permissions and the list of secrets or OIDC capabilities available at runtime, rather than relying on the absence of a token input in YAML. Also inspect actions/checkout uses that persist Git credentials and set persist-credentials: false where later steps need no authenticated Git operations.
Verify the change with a fork-originated test PR whose contents you control: its build should complete without access to release credentials or write-scoped token permissions, and the publishing workflow should run only through its gated, trusted path. Check the run’s event, job permissions, artifact origin and cache access in the resulting records. GitHub’s current checkout guard blocks common unsafe fork-head checkouts, but older pins and custom checkout steps still deserve inspection. Keep the release credential out of the build job; that is the point where an ordinary contribution stops becoming a publishing authority.