Skip to content

Access tokens get exposed through URL params in API requests

Moderate
unknwon published GHSA-x9p5-w45c-7ffc Mar 5, 2026

Package

gomod gogs.io/gogs (Go)

Affected versions

<= 0.14.1

Patched versions

None

Description

Summary

gogs api still accepts tokens in url params like token and access_token, which can leak through logs, browser history, and referrers

Details

static review shows the api still checks tokens in the url query before looking at headers

  • internal/context/auth.go reads c.Query("token")
  • internal/context/auth.go falls back to c.Query("access_token")
  • internal/context/auth.go only checks authorization header when query token is empty
  • internal/context/auth.go authenticates using that token and marks request as token-authenticated

token authenticated requests are accepted by API routes through c.IsTokenAuth checks

  • internal/route/api/v1/api.go

Impact

if users send tokens in urls like /api/v1/user?token=..., they can leak in logs, browser or shell history, and referrer headers, and can be reused until revoked

Recommended fix

  • use auth headers only for tokens
  • block token params at proxy or waf
  • scrub query strings from logs
  • set strict referrer policy

Severity

Moderate

CVE ID

CVE-2026-26196

Weaknesses

Use of HTTP Request With Sensitive Query String

The web application uses an HTTP method to process a request, but the request includes sensitive information in the query string. Learn more on MITRE.

Credits