Blogs / What a CI Cache Keeps and Who Can Read It

What a CI Cache Keeps and Who Can Read It

What a CI cache keeps between runs, who writes to it and who reads from it, as a Rust security advisory describes them.

  • Learning
  • 1 min read

For: Learners new to continuous integration.

What a cache keeps between runs

GitHub Actions makes it possible to cache directories between runs.[1]

Rust projects tend to speed up CI by caching binaries built by cargo install and sometimes the contents of target/.[1]

Who writes and who reads

Typical setups allow CI runs on main (and other branches) to write to cache, and PRs can only read from cache (preventing cache poisoning).[1]

PR CI can be triggered by anyone who can open PRs on your repository.[1]

Runs on main andother brancheswrite to the cacheCachedirectories kept betweenrunsPull request runsread onlywriteread
Which runs write to the cache and which runs read from it?

What the advisory says is not guaranteed

Cargo/Miri/Rust does not guarantee that environment variables will be safe from being copied into target/.[1]

While we are treating this as a security issue and patching it out of an abundance of caution, this is not something you should rely on in general.[1]

Sources

  1. GitHub Actions leaking secrets when Miri output is cached (blog.rust-lang.org · checked )

More articles