Skip to content

Commit 0c4911f

Browse files
committed
Update bitbucket uuid check to allow a non-specified uuid, similar to gitlab empty secret.
1 parent 3667088 commit 0c4911f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

bitbucket/bitbucket.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,14 @@ func (hook Webhook) ParsePayload(w http.ResponseWriter, r *http.Request) {
8080
}
8181
webhooks.DefaultLog.Debug(fmt.Sprintf("X-Hook-UUID:%s", uuid))
8282

83-
if uuid != hook.uuid {
84-
webhooks.DefaultLog.Error(fmt.Sprintf("X-Hook-UUID does not match configured uuid of %s", hook.uuid))
85-
http.Error(w, "403 Forbidden - X-Hook-UUID does not match", http.StatusForbidden)
86-
return
83+
if len(hook.uuid) > 0 {
84+
if uuid != hook.uuid {
85+
webhooks.DefaultLog.Error(fmt.Sprintf("X-Hook-UUID %s does not match configured uuid of %s", uuid, hook.uuid))
86+
http.Error(w, "403 Forbidden - X-Hook-UUID does not match", http.StatusForbidden)
87+
return
88+
}
89+
} else {
90+
webhooks.DefaultLog.Debug("hook uuid not defined - recommend setting for improved security")
8791
}
8892

8993
event := r.Header.Get("X-Event-Key")

0 commit comments

Comments
 (0)