Hardening GitHub Actions: Lessons from Recent Attacks
This guide examines recent supply chain attacks exploiting GitHub Actions, such as the Ultralytics cryptominer incident and the tj-actions compromise, highlighting vulnerabilities like excessive permissions and unverified third-party actions. It recommends security measures including setting default workflow permissions to read-only, restricting actions to verified sources, enforcing branch protection rules, and managing secrets with least privilege. The guide emphasizes avoiding unsafe practices like using high-privilege triggers (pull_request_target
), exposing all secrets via toJson(secrets)
, and persisting credentials unnecessarily. It also advises against using self-hosted runners with public repositories due to security risks. Tools like zizmor, gato, and allstar are suggested for auditing and enforcing security policies.
Comments
Post a Comment