GitHub Actions cache permissions

GitHub Actions now lets workflows grant explicit read, write, write-only or no access to the dependency cache. The new control turns cache access into a deliberate trust decision instead of an implicit side effect of running a job.

Author
Intercube
Published
Reading time
8 min read

01

What GitHub changed

GitHub introduced cache-mode on 10 September 2026. The workflow key can now grant read, write, write-only or no cache access at workflow or job level. A job-level value overrides the workflow value, so one pipeline can give each stage only the access required for its role.

The cache service enforces the selected mode through scoped tokens. A reusable workflow cannot gain more access than its caller received. That inheritance matters for organisations that centralise build logic because the trust boundary now follows the call chain instead of depending only on conventions inside the reusable workflow.

Workflows that omit cache-mode keep GitHub's trigger-based defaults. Trusted events such as push receive read and write access, while low-trust events such as pull_request_target receive read access. Existing workflows therefore continue to run, but teams can now make the intended authority visible in the workflow definition.

02

Why cache access is a trust decision

A dependency cache improves build speed by reusing files across jobs and workflow runs. That same persistence can cross security boundaries. If a lower-trust job can save content under a key later restored by a trusted release, the cache becomes a route for unreviewed data to influence code that handles deployment credentials or production artefacts.

GitHub protects low-trust triggers with a read-only default, but an explicit write or write-only declaration can override that protection. GitHub adds a workflow warning when write access is granted to a low-trust event. The warning is useful, although the design review still belongs to the team because only the team knows which code runs, which cache keys overlap and what authority the later job holds.

Cache poisoning is not limited to the cache action itself. Package-manager integrations, setup actions and reusable workflows can use the Actions cache on behalf of the job. A sound review starts with the effective permission and every consumer of cached state, not only the most visible YAML step.

03

Assign the minimum useful permission

Start by classifying each job. A validation job for an external contribution may need a read-only dependency cache, or no shared cache when the restored data could affect sensitive analysis. A trusted main-branch build may need read and write access so it can publish a cache for later runs. A producer that should never consume earlier state can use write-only, although that design still needs unique and predictable cache keys.

Keep cache authority separate from repository and deployment authority. A job that can deploy production should not automatically receive cache write access merely because both activities happen after a merge. Splitting build, verification and release stages makes it easier to prove where untrusted content stops and which stage creates the artefact that reaches production.

Reusable workflows deserve explicit contracts. The caller should grant the maximum cache access that the shared workflow may use, while the called workflow documents which jobs restore or save. This prevents a future edit to the shared workflow from silently broadening cache behaviour across every repository that calls it.

  • Use read for jobs that may restore trusted cache entries but must not publish new ones.
  • Use write only where the event, branch and executed code are trusted to influence later runs.
  • Use write-only when producing a cache must remain separate from consuming earlier state.
  • Use none where cache reuse adds little value or crosses an unnecessary trust boundary.

04

Roll out the control without breaking releases

Inventory current cache users before adding policy. Record workflow triggers, reusable workflow calls, cache actions, package-manager caching and the keys shared between branches or events. Then map the effective default GitHub currently provides. This exposes workflows that already rely on write access without stating it and low-trust jobs that should remain restore-only.

Introduce cache-mode in stages. Start with jobs where the correct permission is unambiguous, then inspect workflow logs for skipped restores or saves. GitHub treats a blocked restore as a cache miss and a blocked save as an informational event, so a workflow can stay green while build time or cache freshness changes. Operational validation must therefore include timing and cache behaviour, not only the final status.

After the rollout, test the trust boundary with representative pull requests and main-branch releases. Confirm that untrusted runs cannot save to caches consumed by privileged jobs, that reusable workflows inherit the intended ceiling and that a cache miss still produces a complete build. Document the exception process for any job that needs broader access so later convenience changes do not quietly weaken the release path.

  • List every workflow, trigger and action that reads or writes cached data.
  • Separate low-trust validation from trusted build and deployment stages.
  • Check informational cache messages as well as workflow success or failure.
  • Test reusable workflows from both trusted and untrusted callers.
  • Keep a no-cache build path healthy so cache availability is never a release dependency.

GitHub Actions cache review

  • Treat cache restore and cache save as separate permissions.
  • Keep low-trust pull request workflows read-only or cache-free unless a reviewed exception exists.
  • Verify package-manager and setup-action caching, not only explicit actions/cache steps.
  • Set a cache ceiling at the caller when using reusable workflows.
  • Validate cache misses, workflow duration and artefact integrity during rollout.

Primary sources

Review the trust model behind your deployments.

We can map how code, caches, artefacts and credentials move through your release workflow, then define the controls that keep production authority explicit.

Review the deployment workflow