## 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`
```go
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`
```go
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
1. Admin A creates a webhook with a sensitive authorization header.
2. Admin B (different repo admin) lists webhooks via `GET /api/v1/repos/{owner}/{repo}/hooks`.
3. The API response includes the full plaintext authorization header set by Admin A.
## Impact
- Cross-admin secret exposure on shared repositories
- Credential harvesting if a repo admin's Gitea token is stolen
- External service compromise via leaked Bearer tokens and API keys
- Undermines the intentional encryption-at-rest protection
## Suggested Fix
The authorization header should be write-only. Return a masked/redacted version or a boolean `has_authorization_header` flag instead.
## References
- Vulnerable function: `services/webhook/general.go:392-425`
- Decryption function: `models/webhook/webhook.go:209-216`
- Verified against commit 19f0169
EUVD source date text has no stated timezone and is retained without inventing a UTC instant. Related bulletin membership is not an alias, common cause or applicability claim. A missing vector with a zero score is treated as unrated. Complete vendor/product and underlying source evidence remains in the original JSON.
Original publisher date fields
datePublished: Aug 13, 2026, 4:44:58 PM
dateUpdated: Aug 13, 2026, 6:50:39 PM
1 related source bulletins · separate from aliases
WID-SEC-W-2026-2304: Gitea: Mehrere Schwachstellen
No normalized affected-package data is projected for this source revision. The original publisher record may contain additional product and version evidence; this does not establish that a package is unaffected.
NVD analysis and CPE criteria are source context, not proof that a package or your environment is affected. Complete affected data, logical configurations and SSVC are retained in the original JSON.
Source analysis status: Deferred
Weakness classifications: CWE-200
Original publisher date fields
published: 2026-08-13T17:17:28.973
lastModified: 2026-08-26T16:53:48.300
No normalized affected-package data is projected for this source revision. The original publisher record may contain additional product and version evidence; this does not establish that a package is unaffected.