Skip to content

Public-only API token restriction is not enforced on team API routes

Moderate
bircni published GHSA-h56g-4qw7-2mxg Jul 13, 2026

Package

gomod gitea.dev (Go)

Affected versions

<= 1.26.4

Patched versions

1.27.0

Description

Summary

Gitea's /api/v1/teams/{id} API routes do not correctly enforce the public-only access token restriction.

A public-only token is intended to limit API access to public repositories and public organizations. However, several team API routes continue to return private team repository metadata and private team activity feed entries when called with a public-only token.

Details

The /api/v1/teams/{teamid} route group uses:

orgAssignment(false, true)

This loads ctx.Org.Team, but does not load ctx.Org.Organization.

The checkTokenPublicOnly middleware checks organization visibility through ctx.Org.Organization. When ctx.Org.Organization is nil, the organization visibility check silently passes.

In addition, the team repository handlers return repositories without applying repository-level public-only filtering:

repo_model.GetTeamRepositories(...)
convert.ToRepo(...)

They do not call:

ctx.TokenCanAccessRepo(repo)

The team activity feed handler also sets:

IncludePrivate: true

but does not apply:

opts.ApplyPublicOnly(ctx.PublicOnly)

PoC

Vulnerability is verified on latest gitea release (1.26.2) and nightly build.
Frist, create a public-only organization-scoped token for a user who is a member of a team in a private org with private repositories:

image image

Use the returned token to request team repositories:

image

Expected result: Private repositories should be hidden or rejected for a public-only token.
Actual result: Private team repository metadata is returned.

The team activity feed endpoint can be tested similarly:

image

Impact

A public-only token can access private team resources that should be hidden from that token.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N

CVE ID

CVE-2026-58431

Weaknesses

Incorrect Authorization

The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. Learn more on MITRE.

Credits