GitHub Actions cache can leak secrets to any fork

Anyone who can open a pull request on a public GitHub repository may be able to read credentials cached by the project's own builds, according to a new report by HackRead, summarised by SC Media on 20 November 2026. The problem is not a bug in GitHub Actions. It is the way the build cache is shared: a pull request run can restore caches saved on the repository's main branch, and that includes pull requests opened from forks by people outside the team.
GitHub does not hand secrets to untrusted workflows. A workflow triggered by a fork pull request gets no access to repository secrets, and the token it receives is read-only, so it cannot make changes. But a cache is different. If credentials were written into a cached path on the main branch, a fork's workflow can restore that cache and read them without ever having access to the secrets themselves.
How secrets end up in the cache
GitHub itself warns against storing sensitive data in cached paths, because pull request workflows can reach them. The trouble is that secrets slip into caches by accident, usually because the cached paths are too broad. Caching a whole home directory or an entire workspace to improve the cache hit rate is the most common mistake.
Ordinary developer tools store credentials in exactly the places that get cached. Running docker login saves registry credentials to ~/.docker/config.json. The AWS command-line tool keeps credentials in ~/.aws and the Azure CLI in ~/.azure. Package manager configuration files can hold tokens for private registries, and API keys or passwords can sit in .env files or be baked into build outputs that are cached by mistake.
Why a leaked cache stays dangerous
GitHub does have safeguards, but none of them limits reading. A cache created by a pull request can only be restored by reruns of that same request, which stops a malicious cache from poisoning the main branch, and a cache cannot be edited once it is created. Neither rule stops a fork workflow from restoring a cache that the main branch saved and reading what is inside it.
GitHub deletes cache entries that have not been accessed for seven days, but that is not the same as removing the credentials. Once a pull request restores a cache, the credentials inside it can be copied anywhere. HackRead cites a recent report finding that 64 percent of valid secrets from 2022 were still not revoked in 2026, so a token copied out of a cache could stay usable for years after the cache itself is gone.
The danger is not theoretical. The GhostAction campaign showed how valuable build credentials are: attackers read projects' workflow files to learn which secrets they used, then committed malicious workflows with those secret names hardcoded to steal them.
What to change
The strongest protection is to stop credentials from being cached at all. Cache only the folders that hold dependencies and build outputs, never whole home directories or workspaces. Log out and clear credentials before anything is cached, and use OpenID Connect for temporary cloud credentials instead of long-lived access keys.
Teams should also require manual approval for workflows started by external contributors. GitHub only requires approval for first-time contributors by default, so that step reduces the risk without removing it. Existing caches should be reviewed for secrets, and any credentials found in them should be rotated before the unsafe cache is deleted. The safe working assumption, HackRead says, is that every cached path is readable by anyone who can open a pull request.