Skip to content

Commit c271ec3

Browse files
author
Dean Karn
authored
Merge pull request #25 from lukepatrick/v3
Update bitbucket uuid check to allow a non-specified uuid, similar to…
2 parents 3667088 + 0c4911f commit c271ec3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

bitbucket/bitbucket.go

+8-4
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)