Skip to content

Commit 510ae35

Browse files
committed
feat(integrations): bitbucket webhook auth
1 parent e6cd4e3 commit 510ae35

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

api/integration.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ func ReceiveIntegration(w http.ResponseWriter, r *http.Request) {
107107
payload,
108108
"sha256=")
109109

110+
if !ok {
111+
log.Error("Invalid HMAC signature")
112+
continue
113+
}
114+
case db.IntegrationAuthBitbucket:
115+
ok := isValidHmacPayload(
116+
integration.AuthSecret.LoginPassword.Password,
117+
r.Header.Get("x-hub-signature"),
118+
payload,
119+
"sha256=")
120+
110121
if !ok {
111122
log.Error("Invalid HMAC signature")
112123
continue

db/Integration.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import (
88
type IntegrationAuthMethod string
99

1010
const (
11-
IntegrationAuthNone = ""
12-
IntegrationAuthGitHub = "github"
13-
IntegrationAuthToken = "token"
14-
IntegrationAuthHmac = "hmac"
11+
IntegrationAuthNone = ""
12+
IntegrationAuthGitHub = "github"
13+
IntegrationAuthToken = "token"
14+
IntegrationAuthHmac = "hmac"
15+
IntegrationAuthBitbucket = "bitbucket"
1516
)
1617

1718
type IntegrationMatchType string

web/src/components/IntegrationForm.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ export default {
8383
}, {
8484
id: 'github',
8585
title: 'GitHub Webhooks',
86+
}, {
87+
id: 'bitbucket',
88+
title: 'Bitbucket Webhooks',
8689
}, {
8790
id: 'token',
8891
title: 'Token',

0 commit comments

Comments
 (0)