Interview Prep/GitHub Actions/OIDC & Security Hardening

What is cache poisoning in GitHub Actions?

AdvancedConceptOIDC & Security Hardening
Answer

An attacker who can run code in a workflow that saves caches (for example, through a pwn request on pull_request_target, which runs in the default branch scope) writes a malicious cache under a key that later privileged workflows on main restore, such as a tampered node_modules or build tool. Mitigations: never run untrusted code in default-branch-scoped workflows; do not restore caches in release workflows (build clean); use actions/cache/restore without save in sensitive jobs; and keep cache keys tied to lockfile hashes so unexpected keys are not hit.

All GitHub Actions questions Roadmap: GitHub Actions

More on OIDC & Security Hardening