What a GitHub Actions Cache Can Expose to Anyone Who Opens a Pull Request

GitHub Actions caches in public and private repositories can be exploited by untrusted pull requests from forks to inadvertently read sensitive credentials stored in broad paths. While GitHub prevents forks from writing or poisoning base caches and restricts direct secret passing, pull requests can still restore and extract cached tokens like Docker credentials, AWS configurations, and package manager tokens. The GhostAction campaign previously demonstrated how attackers leverage CI workflows to steal hardcoded secrets. Developers can mitigate this risk by avoiding broad cache paths like home directories, clearing local credentials before caching, adopting short-lived OpenID Connect tokens, and requiring manual approval for external contributor workflows.