Refactor Webhook + Add X-Hub-Signature (#16176)
This PR removes multiple unneeded fields from the `HookTask` struct and adds the two headers `X-Hub-Signature` and `X-Hub-Signature-256`. ## ⚠️ BREAKING ⚠️ * The `Secret` field is no longer passed as part of the payload. * "Breaking" change (or fix?): The webhook history shows the real called url and not the url registered in the webhook (`deliver.go`@129). Close #16115 Fixes #7788 Fixes #11755 Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
0b27b93728
commit
9b1b4b5433
18 changed files with 130 additions and 179 deletions
|
@ -133,7 +133,7 @@ func addHook(ctx *context.APIContext, form *api.CreateHookOption, orgID, repoID
|
|||
BranchFilter: form.BranchFilter,
|
||||
},
|
||||
IsActive: form.Active,
|
||||
Type: models.HookTaskType(form.Type),
|
||||
Type: models.HookType(form.Type),
|
||||
}
|
||||
if w.Type == models.SLACK {
|
||||
channel, ok := form.Config["channel"]
|
||||
|
|
|
@ -239,7 +239,7 @@ func GogsHooksNewPost(ctx *context.Context) {
|
|||
}
|
||||
|
||||
// newGogsWebhookPost response for creating gogs hook
|
||||
func newGogsWebhookPost(ctx *context.Context, form forms.NewGogshookForm, kind models.HookTaskType) {
|
||||
func newGogsWebhookPost(ctx *context.Context, form forms.NewGogshookForm, kind models.HookType) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue