Skip to content

Commit 00c8e80

Browse files
authored
fix(server/auth/webhook): update GitHub webhook events list and library version (argoproj#14389)
Signed-off-by: Malthe Poulsen <[email protected]>
1 parent 6583424 commit 00c8e80

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ require (
2626
github.com/go-git/go-git/v5 v5.16.0
2727
github.com/go-jose/go-jose/v3 v3.0.4
2828
github.com/go-openapi/jsonreference v0.21.0
29+
github.com/go-playground/webhooks/v6 v6.4.0
2930
github.com/go-sql-driver/mysql v1.9.2
3031
github.com/gogo/protobuf v1.3.2
3132
github.com/golang/protobuf v1.5.4

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF
326326
github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4=
327327
github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZU=
328328
github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0=
329+
github.com/go-playground/webhooks/v6 v6.4.0 h1:KLa6y7bD19N48rxJDHM0DpE3T4grV7GxMy1b/aHMWPY=
330+
github.com/go-playground/webhooks/v6 v6.4.0/go.mod h1:5lBxopx+cAJiBI4+kyRbuHrEi+hYRDdRHuRR4Ya5Ums=
329331
github.com/go-sql-driver/mysql v1.9.2 h1:4cNKDYQ1I84SXslGddlsrMhc8k4LeDVj6Ad6WRjiHuU=
330332
github.com/go-sql-driver/mysql v1.9.2/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
331333
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=

server/auth/webhook/github.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package webhook
33
import (
44
"net/http"
55

6-
"gopkg.in/go-playground/webhooks.v5/github"
6+
"github.com/go-playground/webhooks/v6/github"
77
)
88

99
func githubMatch(secret string, r *http.Request) bool {
@@ -14,12 +14,16 @@ func githubMatch(secret string, r *http.Request) bool {
1414
_, err = hook.Parse(r,
1515
github.CheckRunEvent,
1616
github.CheckSuiteEvent,
17+
github.CodeScanningAlertEvent,
1718
github.CommitCommentEvent,
1819
github.CreateEvent,
1920
github.DeleteEvent,
21+
github.DependabotAlertEvent,
22+
github.DeployKeyEvent,
2023
github.DeploymentEvent,
2124
github.DeploymentStatusEvent,
2225
github.ForkEvent,
26+
github.GitHubAppAuthorizationEvent,
2327
github.GollumEvent,
2428
github.InstallationEvent,
2529
github.InstallationRepositoriesEvent,
@@ -52,6 +56,9 @@ func githubMatch(secret string, r *http.Request) bool {
5256
github.TeamEvent,
5357
github.TeamAddEvent,
5458
github.WatchEvent,
59+
github.WorkflowDispatchEvent,
60+
github.WorkflowJobEvent,
61+
github.WorkflowRunEvent,
5562
)
5663
return err == nil
5764
}

server/auth/webhook/interceptor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ func TestInterceptor(t *testing.T) {
5959
})
6060
t.Run("Github", func(t *testing.T) {
6161
r, _ := intercept("POST", "/api/v1/events/my-ns/my-d", map[string]string{
62-
"X-Github-Event": "push",
63-
"X-Hub-Signature": "00000ba880174336fbe22d4723a67ba5c4c356ec9c696",
62+
"X-Github-Event": "push",
63+
"X-Hub-Signature-256": "sha256=926ceeb8dcd67d5979fd7d726e3905af6d220f7fd6b2d8cce946906f7cf35963",
6464
})
6565
assert.Equal(t, []string{"Bearer my-github-token"}, r.Header["Authorization"])
6666
})

test/e2e/argo_server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ spec:
182182
s.e().
183183
POST("/api/v1/events/argo/").
184184
WithHeader("X-Github-Event", "push").
185-
WithHeader("X-Hub-Signature", "sha1=c09e61386e81c2669e015049350500448148205c").
185+
WithHeader("X-Hub-Signature-256", "sha256=dd6f6b41f6d0cb9523d6459032e164e220853b683a5e87892145b0eb0b84e0cd").
186186
WithBytes(data).
187187
Expect().
188188
Status(200)

0 commit comments

Comments
 (0)