GitHub Actions is a popular CI/CD platform that lets maintainers build workflows from reusable third-party actions, organized into jobs of sequential steps. To control access to repository resources, GitHub enforces token permissions only at the job level. This violates the principle of least privilege: every step shares the job's full permissions, so a single compromised action can misuse all of them, as witnessed by the recent tj-actions compromise, enabling broader software supply chain attacks. We present Granite, the first system to enforce fine-grained, step-level permissions for GitHub Actions at runtime. Untrusted steps never hold the real token; a separate controller issues each step an identifier token and supplies the real token only to requests that meet the step's policy. Granite builds on GitHub's self-hosted runner, requires no workflow changes, and transparently handles JavaScript, composite, and Docker actions. Across 500 workflows (12,915 jobs) from the most-starred GitHub repositories, 46.3% of jobs are overprivileged and can be protected by Granite. On 46 repositories and 127 unique actions, Granite preserves the behavior of every job that runs on the unmodified runner, except one it blocks by design. Reproducing 10 permission-misuse attacks over 42 overprivileged jobs, including attempts to bypass its enforcement, Granite prevents all of them and removes write access from about 83.3% of the steps that hold it under GitHub's current model. Its average per-step overhead is 7.9%, making Granite a practical and effective tool to reduce the attack surface in CI/CD pipelines.
翻译:暂无翻译