Granite: Granular Runtime Enforcement for GitHub Actions Permissions

arXiv:2512.11602 · cs.CR · Submitted 2025-12-12 · Read on arXiv

Listen

Radio episode about this paper

Transcript

Introduction to the show: ident: Security Radio. Generated commentary on the latest security and cryptography papers.

Nadia: We're looking at the paper: "Granite: Granular Runtime Enforcement for GitHub Actions Permissions".

Title and authors: Nadia: So we're looking at this paper called Granite: Granular Runtime Enforcement for GitHub Actions Permissions, written by Mojtaba Moazen and Amir Ahmadian, and it tackles the idea that GitHub Actions currently gives every action in a job the same permissions, which isn't very safe.

Elias: Right, so they are looking at how to enforce permissions at the step level instead of just the whole job level. The implication here is that we can stop those actions from abusing their overly broad access to things like pull requests or other repository resources >

Priya: It sounds like they're trying to solve that problem where one slightly malicious action can compromise everything in a job, which means they need a way to check permissions while the workflow is actually running.

Nadia: Exactly. The authors are showing how this system works by building something that acts as a runtime proxy, monitoring what JavaScript and composite actions try to do as they execute their tasks during the workflow run >

Elias: I'm interested in how they manage that enforcement without slowing everything down too much, because if we add a lot of checks, the CI/CD pipeline becomes unusable for developers.

Priya: That's a big concern for me. If this system introduces significant delays or complexity into every single step, it defeats the purpose of streamlining development workflows in the first place.

The paper's summary: Nadia: They start by showing that GitHub’s current job-level permission model is too coarse-grained, and they use data from five hundred workflows and about thirteen thousand jobs to prove that overprivileged jobs are very common, at about forty six point six percent of the time <ref:2512.11602#pg2>

Elias: And they find that when they test this system against twenty popular repositories, Granite manages to identify about forty two overprivileged jobs, which is nearly sixty percent of them being high or critical severity >

Priya: So the summary points out that before you even have a solution like Granite, the problem is already widespread in GitHub's current setup. The data shows how prevalent this issue is in real-world usage >

Nadia: And then they use it to actually implement proof-of-concept exploits to show exactly how easy it is for an action with broad permissions to cause damage, like being able to write and confirm any pull request on a repository >

Elias: The core finding they're emphasizing is that by using Granite, which enforces step-level permissions dynamically, they can reduce the attacks surface by about eighty three point three percent per overprivileged job <ref:2512.11602#pg2>

Priya: That reduction in attack surface sounds important because it means less potential for supply chain attacks where one bad action can spread its damage across the entire project >

The paper's improvements: Nadia: The paper discusses a few key improvements they've built into Granite, focusing on how it handles different types of actions and context. They introduce a step dispatcher that figures out what kind of action it is—whether it’s a JavaScript action, a composite action, or just a simple command >

Elias: And for those JavaScript actions, they use a proxy-based shim layer to transparently intercept the communication that the action tries to make with its target repository during execution. That's how they get visibility into what the code is actually trying to do >

Priya: So if we think about it from a measurement side, this means they are capturing traffic on behalf of the action and checking those requests against predefined policies for that particular step. It sounds like they are creating a feedback loop between what the action wants to do and what it's actually allowed to do >

Nadia: And for composite actions, Granite relies on something called mitmproxy running inside an isolated Docker container to intercept all the network traffic within that bundled action. This lets them verify those complex bundles against policies, like checking if a composite action is allowed to write on pull requests >

Elias: They also introduce dynamic context awareness where the verifier checks the request against action policies based on runtime inputs and event types, like figuring out what the goal of an action is based on the event that triggered it >

Priya: That contextual awareness is interesting because it moves beyond just static rules. It means they can adjust permissions based on what's actually happening at that moment in the workflow execution, which should make the enforcement much smarter and more relevant to each step >

Conclusion: Nadia: So to wrap up, Granite is this runtime proxy system that enforces fine-grained permissions for GitHub Actions at the step level within a job. They've shown it can prevent permission misuse attacks by making sure an action only uses the permissions granted to that particular step >

Elias: The implications are big because they confirm that you can actually reduce the number of steps with write access by about eighty three point three percent per overprivileged job, which is a significant reduction in the attack surface >

Priya: From my view what this means for someone just running workflows is that we get a much tighter control over who or what can do what during execution, instead of relying on the broad permissions of the entire job >

Nadia: And they also showed that they can adapt their security posture by switching between enforcement and learning modes when a policy isn't available, which gives developers some transparency into what permissions are actually required for each step >

Elias: It’s a practical approach to addressing this, showing how to be both secure and still functional within the CI/CD environment >

Priya: I just want to say that while the ninety four percent overhead for composite actions sounds high, it's worth looking at how much of that is necessary for real-world security versus what might be overkill for some simpler workflows <ref:2512.11602#pg1>

Nadia: Exactly, it’s a tool designed to reduce risk in CI/CD pipelines by focusing on the actual execution context rather than just the job container. That's Granite for now.

KTH Royal Institute of Technology · Chalmers University of Technology

cs.CR

Submitted: 2025-12-12

Updated: 2026-11-24

Comments: 14 pages, abstract compacted

Code: https://github.com/advisories/GHSA-mrrh-fwg8-r2c3

License: http://creativecommons.org/licenses/by/4.0/

Importance score: 88/100

The gist: Granite is a runtime proxy-based system that enforces fine-grained permissions for GitHub Actions at the step-level granularity within a job.<ref:2512.11602#pg7>.

Key concepts

Coarse-Grained Permissions
GitHub currently grants all actions within a job the same set of permissions. Granite addresses this by enforcing permissions at the step level, meaning each individual action gets its own tailored access rights instead of sharing the entire job's broad privileges.
Step Dispatcher
This component analyzes each step in a workflow to determine if it is a composite, JavaScript, or Docker action. It evaluates templates and context to populate the necessary information for Granite to apply the correct enforcement mechanism for that specific step.
Proxy-Based Shim Layer
For JavaScript actions, Granite inserts a proxy layer that secretly intercepts all network communication between the action and external repositories. This allows Granite to inspect requests in real-time against defined security policies before they are executed.
MITM Proxy for Composite Actions
Composite actions are intercepted using mitmproxy within an isolated Docker container. This setup allows Granite to perform SSL-capable network traffic inspection, checking the action's requests against policies to prevent unauthorized operations like writing to pull requests.

Terminology

Summary

Granite is a runtime proxy-based system that enforces fine-grained permissions for GitHub Actions at the step-level granularity within a job. p. 0

Where the paper says it

This violates the principle of least privilege and can lead to broader software supply chain attacks, whenever a compromised action exploits the granted permissions to compromise the repository resources. In this paper, we present Granite, a runtime proxy-based system that enforces fine-grained permissions for GitHub Actions at the step-level granularity within a job.

<ref:2512.11602#pg7>.

Problem Setting and Motivation

The core issue addressed is that GitHub's current permission model is too coarse-grained, as all actions within a job share the same permissions granted to the job, which violates the principle of least privilege.<ref:2512.11602#pg3>. The motivating example illustrates this by showing how actions within a job can require different permissions based on the workflow context and inputs. p. 4

Where the paper says it

The design and implementation of a step-level permission enforcement mechanism for GitHub Actions requires addressing two key challenges: Challenge 1: GitHub Actions can behave differently based on the workflow context and the inputs passed to them. For example, consider the Listing 3 taken from the tj-actions/changed-files action.

<ref:2512.11602#pg4, An attacker can exploit the write permission on the pullrequest for tj-actions/changed-files to add malicious functionality to the action, for example to write and confirm any pull request on the repository >. p. 3
Where the paper says it

The permission is applied to all the steps in the job, including tj-actions/changed-files, even though it does not need the write permission on pull-requests. An attacker can exploit the write permission on the pullrequest for tj-actions/changed-files to add malicious functionality to the action, for example to write and confirm any pull request on the repository, as depicted in Listing 2.

Granite Architecture

Granite builds on GitHub’s selfhosted runner as the execution environment and monitors JavaScript and composite actions.<ref:2512.11602#pg4>.

The architecture involves several components:

  1. The Step Dispatcher determines the step’s type (composite, JavaScript, or Docker), evaluates expressions defined using templates and populates the step context. p. 5

    Where the paper says it

    Step Dispatcher determines the step’s type (composite, JavaScript, or Docker), evaluates expressions defined using templates ${{ . }}, and populates the step context with the relevant secrets and inputs.

    <ref:2512.11602#pg4>.

  2. For JavaScript actions, Granite introduces a proxy-based shim layer that transparently intercepts communication with the target repository. p. 0

    Where the paper says it

    Granite builds on the GitHub’s selfhosted runner as the execution environment and monitors the execution of actions at the level of single-steps, thus enforcing fine-grained access control. For JavaScript actions, we achieve this by introducing a proxy-based shim layer that transparently intercepts the communication with the target repository.

    <ref:2512.11602#pg5>.

  3. For composite actions, Granite relies on mitmproxy which is an SSLcapable proxy for intercepting network traffic within an isolated Docker container. p. 5

    Where the paper says it

    Instead of the shim layer, Granite relies on mitmproxy [25] which is an SSLcapable proxy for intercepting network traffic. The Granite monitor executes composite GitHub actions dispatched by the Step Dispatcher within an isolated Docker container.

    <ref:2512.11602#pg7, The verifier checks the request against the action policies and finds that the action is not allowed to write on pull requests >. p. 6
    Where the paper says it

    At this point, the proxied https module intercepts the request and forwards its information to the request verifier (line 27). The verifier checks the request against the policy and finds that the action is not allowed to write on pull requests.

Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.

Improvements for AI systems

  1. Fine-grained permission enforcement at step level allows systems to infer and enforce fine-grained permission for GitHub workflows by monitoring requests made by JavaScript and Composite actions during workflow execution. This enables systems to prevent permission misuse attacks by ensuring that an action only uses the permissions granted to that specific step, rather than the coarse-grained permissions of the entire job.

  2. Dynamic context awareness allows AI systems to determine if an action needs specific permissions based on runtime inputs and event types, such as in the example where the goal of this action is to determine the changed files in an event that triggered the workflow. This capability enables systems to move beyond static analysis, which suffer by the lack of contextual information, leading to more accurate permission requirements.

  3. The system can adapt its security posture dynamically by switching between enforcement and learning modes, allowing it to infer the permissions required by each executed step when a policy is unavailable. This provides developers with a tool to report permissions for further review, enhancing transparency in the security process.

  4. Attack surface reduction is achieved by minimizing the number of steps with write access on any scope, as Granite can reduce the number of steps with write access by approximately 83.3% per overprivileged job. This directly reduces the attack surface by ensuring that on average, Granite can reduce the number of steps with write access by approximately 83.3% per overprivileged job.

  5. Performance overhead is managed to keep security effective, as Granite introduces an average overhead of 55% (3.67 seconds) per job execution for JavaScript actions and 94% (4.92 seconds) for composite actions. This indicates that the system is a practical and effective tool to reduce the attack surface in CI/CD pipelines while remaining acceptable for most CI/CD pipelines.

Abstract

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.

Related papers