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.
More on OIDC & Security Hardening
How does GitHub OIDC work, end to end?IntermediateWhat are the `sub` claim formats, and which do you put in an AWS trust policy?AdvancedConfigure OIDC to AWS: provider, role and workflow.AdvancedConfigure OIDC to Azure.AdvancedConfigure OIDC to GCP.AdvancedWhy pin actions to a full commit SHA, and how do you keep pins updated?Intermediate