mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
fix(webhook): explain why webhook edit needs an authorization choice
Gitea 28 drops a webhook's stored authorization header on every edit that does not send it again, and never returns it, so tea cannot leave it unchanged. The error offered --clear-authorization as an equal alternative, which wiped credentials users still needed. It now says the header is lost unless sent again, asks for it first, and reserves --clear-authorization for hooks without one. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
3 files changed
+4
-4
No files matched your search
@@ -76,7 +76,7 @@ func (a *application) webhookCommand() *cobra.Command {
|
||||
command.Flags().StringVar(&filter, "branch-filter", "", "Branch glob for push events")
|
||||
command.Flags().StringVar(&authorization, "authorization-header", "", "Authorization value (prefer file input)")
|
||||
command.Flags().StringVar(&authorizationFile, "authorization-header-file", "", "Read authorization value from file or -")
|
||||
command.Flags().BoolVar(&clearAuthorization, "clear-authorization", false, "Explicitly clear delivery authorization")
|
||||
command.Flags().BoolVar(&clearAuthorization, "clear-authorization", false, "Send no authorization header; on edit, this removes the stored one")
|
||||
command.Flags().StringToStringVar(&config, "config", nil, "Adapter-specific configuration, for example channel=alerts")
|
||||
if verb == "create" {
|
||||
command.Flags().StringVar(&kind, "type", "gitea", "Webhook adapter type")
|
||||
@@ -116,7 +116,7 @@ func (a *application) webhookCommand() *cobra.Command {
|
||||
return clierr.Wrap(clierr.Usage, &services.CapabilityError{Feature: "webhook secret editing", Reason: "Gitea does not update signing secrets through its edit API; recreate the hook to rotate it"})
|
||||
}
|
||||
if verb == "edit" && authSources == 0 {
|
||||
return clierr.Wrap(clierr.Usage, errors.New("editing requires --authorization-header, --authorization-header-file, or --clear-authorization because Gitea replaces authorization"))
|
||||
return clierr.Wrap(clierr.Usage, errors.New("editing a webhook drops its stored authorization header unless it is sent again, and Gitea never returns it: pass --authorization-header-file or --authorization-header (use --clear-authorization only for a hook without one)"))
|
||||
}
|
||||
if len(args) > 0 && verb == "create" {
|
||||
if cmd.Flags().Changed("url") {
|
||||
|
||||
Reference in new issue
Block a user