Summary
Gitea did not enforce a personal access token's public-only restriction when registering an organization-level Actions runner, and the resulting runner was not restricted to public repositories. An attacker holding a qualifying token could receive jobs from the organization's private repositories, exposing workflow contents, Actions secrets and variables, and a task token; this expands the token's reach but does not grant capabilities beyond those of the account owner.
Affected context
The issue occurs at Gitea's organization Actions runner registration-token endpoint. It applies when a public-only personal access token with write:organization belongs to an owner of a public organization, and the organization has private repositories with Actions enabled. The registered organization-level runner is not constrained to public repositories, despite the token restriction.
Exploit preconditions
- Attack surface: Organization Actions runner registration-token endpoint
- Required access: Possession of a
public-onlypersonal access token withwrite:organizationbelonging to an owner of a public organization - Trigger point: Registering an organization-level runner with the resulting registration token; the runner must then receive eligible jobs
- Why exploitation is possible: The endpoint does not reject the restricted token, and the registered runner is not limited to public repositories
Why this happens
Authorization checks do not consistently preserve the token's resource restriction across runner registration and subsequent job assignment. The endpoint accepts a public-only token for organization-level runner registration, while the runner can receive jobs from private repositories. This is an authorization enforcement failure, mapping to CWE-863: Incorrect Authorization.
Potential impact
- A registered runner could receive jobs from the organization's private repositories
- Workflow content, Actions secrets, and variables could be exposed to the runner
- A task token with access to a private repository could be obtained through a job
- The token's effective reach could exceed its intended public-resource restriction
- The issue does not provide capabilities beyond what the token owner's full account can already do
General mitigation guidance
Mitigation patterns focus on enforcing authorization constraints consistently across token validation, runner registration, and job assignment.
- Reject tokens whose resource restrictions do not permit the requested organization-level operation
- Carry token scope and resource limitations through to runner registration and job scheduling
- Apply repository-level authorization checks whenever a runner is assigned a job
- Use narrowly scoped credentials and limit which identities can register organization-level runners
- Keep runner permissions and access to secrets limited to the repositories and tasks that require them
How teams detect issues like this
- Review authorization checks for consistency between token scope, runner registration, and repository job assignment
- Use static analysis or code review rules to flag endpoints that accept restricted credentials without checking resource boundaries
- Audit organization runner registrations and compare runner job histories with the repositories each runner is intended to serve
- Monitor policy enforcement for attempts to use public-only credentials for operations involving private resources

