A GitHub Actions cache can carry files from one run into another. If a lower-trust job can save files that a privileged build later restores, those files can become part of a release. GitHub’s dependency caching reference explains that cached contents are unsigned and unverified. Treat a cache as a build input with its own trust requirements.
Give each job the smallest amount of cache access it needs. Set cache-mode: read for jobs that only need to restore dependencies, and dedicate cache writes to CI that runs on reviewed changes to the default branch. Check both workflow and job settings because the job setting takes precedence. If a job calls a reusable workflow, set its mode explicitly to cap the access delegated to that workflow.
Keep signing and publishing separate from routine CI. Use cache-mode: none for release jobs and build from a reviewed commit on a clean runner with pinned, verified dependencies. Review cached paths for credentials, package-manager settings and other sensitive files that could be picked up alongside dependencies.
If you suspect contamination, stop using the affected cache and delete the affected entries before rebuilding from verified inputs. Clear relevant local caches separately on persistent self-hosted runners, and review any release artifacts built during the exposure window. SC Media’s coverage also recommends reviewing cache access after changes to branch protections or contributor permissions.