Gitea: Webhook Authorization Header Returned in Plaintext via API
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.
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)
}
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)GET /api/v1/repos/{owner}/{repo}/hooks.The authorization header should be write-only. Return a masked/redacted version or a boolean has_authorization_header flag instead.
왜 이 VPI인가 (설명가능 · 실험적)
VPI 산정 기준
| 영향도 | 27.00 |
| 악용 신호(추가 악용신호 없음) | ×1.00 |
| VPI | 27.00 |
VPI 공식 vpi-v1 기준