code.gitea.io/gitea
Affected
- introduced
0, fixed1.27.0(semver)
Fixed versions
1.27.0
Fix
- Fixed version
1.27.0go get code.gitea.io/[email protected]
Advisory
Also known as: CVE-2026-58511, GO-2026-6040
Gitea: Webhook Authorization Header Returned in Plaintext via API
Summary
The ToHook() function in services/webhook/general.go decrypts the webhook's HeaderAuthorizationEncrypted field and returns the plaintext authorization header in the API response. Any repository admin can read the full plaintext value of webhook authorization headers (Bearer tokens, Basic auth credentials, API keys) set by other admins.
The authorization header is stored encrypted in the database using the server's SecretKey, but ToHook() decrypts it before serializing it into the API response — converting a write-only secret into a readable credential.
Vulnerable Code
File: services/webhook/general.go:407-420
func ToHook(repoLink string, w *webhook_model.Webhook) (*api.Hook, error) {
// ...
authorizationHeader, err := w.HeaderAuthorization() // DECRYPTS from DB
if err != nil {
return nil, err
}
return &api.Hook{
// ...
AuthorizationHeader: authorizationHeader, // PLAINTEXT in response
// ...
}, nil
}
Decryption function: models/webhook/webhook.go:209-216
func (w Webhook) HeaderAuthorization() (string, error) {
if w.HeaderAuthorizationEncrypted == "" {
return "", nil
}
return secret.DecryptSecret(setting.SecretKey, w.HeaderAuthorizationEncrypted)
}
Affected Endpoints
All call ToHook():
GET /api/v1/repos/{owner}/{repo}/hooks (requires repo admin)GET /api/v1/repos/{owner}/{repo}/hooks/{id} (requires repo admin)GET /api/v1/admin/hooks (requires site admin)GET /api/v1/orgs/{org}/hooks (requires org admin)GET /api/v1/user/hooks (requires authenticated user)Steps to Reproduce
GET /api/v1/repos/{owner}/{repo}/hooks.Impact
Suggested Fix
The authorization header should be write-only. Return a masked/redacted version or a boolean has_authorization_header flag instead.
References
services/webhook/general.go:392-425models/webhook/webhook.go:209-216Low Basis: The source's own band: LOW
0, fixed 1.27.0 (semver)1.27.0
1.27.0go get code.gitea.io/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0