Skip to content

Rust Team Warns Miri Cached Environment Variables Can Leak CI Secrets Through GitHub Actions

Miri saved every environment variable under target/, so GitHub Actions caches of that folder could expose CI secrets to pull requests. Nightly 2026-09-22 fixes it.

Published
Reading time
2 min read
Author
VoltKit Editorial

Based on an official announcement · Source: Rust blog

What happened

On 21 September 2026 the Rust Security Response Team published a notice about Miri, the interpreter used to check Rust code for undefined behaviour. To keep build-relevant settings between runs, Miri stored all environment variables into the target/ directory. When a CI workflow caches target/ and exposes that cache to pull requests, secrets present in the environment can be read by anyone who can trigger a PR build.

What we know

  • The team says this is "not necessarily a vulnerability in and of itself", but combined with GitHub Actions caching it can expose secrets to PRs. A contributor whose first PR was approved can trigger later CI runs on every push and then hide the extraction commit by pushing over it.
  • The short-term fix makes Miri keep only CARGO_* variables (excluding CARGO_*_TOKEN) and OUT_DIR. The post says the fix lands in the nightly dated 2026-09-22 and may not be on nightly at the time of writing.
  • A scan of GitHub repositories found one repository with the issue and seven that did not appear vulnerable but should be cautious; maintainers were contacted. The team describes the scan as likely imperfect.
  • You are affected if you run cargo miri in CI, the step has secrets in its environment, the workflow caches the target directory (for example with actions/cache or swatinem/rust-cache), and PRs can read that cache.
  • Suggested quick fixes: disable the cache for that job, scope secrets to steps that do not call Miri, or temporarily disable Miri. Then clear the cache and consider rotating secrets that might have leaked.

What is not yet confirmed

The notice does not report any known exploitation. Whether the one affected repository found by the scan had secrets exposed is not stated.

Why it matters

The broader warning applies beyond Rust: many tools assume the whole environment can be written to disk, so any job that can write to a public cache should not have secrets in its environment. That is a CI hygiene rule worth checking in every repository that caches build output.

Sources

This summary was written from the documents below. Read the original before relying on any detail.

  1. GitHub Actions leaking secrets when Miri output is cached(opens in a new tab)

    Rust blog · Official announcement · blog.rust-lang.org

VoltKit summarises and organises information from public and official sources; it does not have reporters on the ground. How stories are sourced and corrected.

You might also like

Something useful from another corner of VoltKit.