@@ -79,6 +79,24 @@ func TestBadRequests(t *testing.T) {
79
79
"X-Gitea-Event" : []string {"push" },
80
80
},
81
81
},
82
+ {
83
+ name : "BadSignatureLength" ,
84
+ event : PushEvent ,
85
+ payload : bytes .NewBuffer ([]byte ("{}" )),
86
+ headers : http.Header {
87
+ "X-Github-Event" : []string {"push" },
88
+ "X-Gitea-Signature" : []string {"" },
89
+ },
90
+ },
91
+ {
92
+ name : "BadSignatureMatch" ,
93
+ event : PushEvent ,
94
+ payload : bytes .NewBuffer ([]byte ("{}" )),
95
+ headers : http.Header {
96
+ "X-Github-Event" : []string {"push" },
97
+ "X-Gitea-Signature" : []string {"111" },
98
+ },
99
+ },
82
100
}
83
101
84
102
for _ , tt := range tests {
@@ -119,7 +137,8 @@ func TestWebhooks(t *testing.T) {
119
137
typ : CreatePayload {},
120
138
filename : "../testdata/gitea/create-event.json" ,
121
139
headers : http.Header {
122
- "X-Gitea-Event" : []string {"create" },
140
+ "X-Gitea-Event" : []string {"create" },
141
+ "X-Gitea-Signature" : []string {"6f250ac7a090096574758e31bd31770eab63dfd0459404f0c18431f1c6b9024a" },
123
142
},
124
143
},
125
144
{
@@ -128,7 +147,8 @@ func TestWebhooks(t *testing.T) {
128
147
typ : DeletePayload {},
129
148
filename : "../testdata/gitea/delete-event.json" ,
130
149
headers : http.Header {
131
- "X-Gitea-Event" : []string {"delete" },
150
+ "X-Gitea-Event" : []string {"delete" },
151
+ "X-Gitea-Signature" : []string {"84307b509e663cd897bc719b2a564e64fa4af8716fda389488f18369139e0fdd" },
132
152
},
133
153
},
134
154
{
@@ -137,7 +157,8 @@ func TestWebhooks(t *testing.T) {
137
157
typ : ForkPayload {},
138
158
filename : "../testdata/gitea/fork-event.json" ,
139
159
headers : http.Header {
140
- "X-Gitea-Event" : []string {"fork" },
160
+ "X-Gitea-Event" : []string {"fork" },
161
+ "X-Gitea-Signature" : []string {"b7750f34adeaf333ac83a1fadcda4cbac097c8587e8dda297c3e7f059012215f" },
141
162
},
142
163
},
143
164
{
@@ -146,7 +167,8 @@ func TestWebhooks(t *testing.T) {
146
167
typ : IssuePayload {},
147
168
filename : "../testdata/gitea/issues-event.json" ,
148
169
headers : http.Header {
149
- "X-Gitea-Event" : []string {"issues" },
170
+ "X-Gitea-Event" : []string {"issues" },
171
+ "X-Gitea-Signature" : []string {"98c44fd0ae42ca4208eac6f81e59b436837740abc8693bf828366b32d33b1cbc" },
150
172
},
151
173
},
152
174
{
@@ -155,7 +177,8 @@ func TestWebhooks(t *testing.T) {
155
177
typ : IssuePayload {},
156
178
filename : "../testdata/gitea/issue-assign-event.json" ,
157
179
headers : http.Header {
158
- "X-Gitea-Event" : []string {"issue_assign" },
180
+ "X-Gitea-Event" : []string {"issue_assign" },
181
+ "X-Gitea-Signature" : []string {"7d2adaf2fb3dc3769294c737ff48da003b7c3660b4f917b85c2c25dabd34a13c" },
159
182
},
160
183
},
161
184
{
@@ -164,7 +187,8 @@ func TestWebhooks(t *testing.T) {
164
187
typ : IssuePayload {},
165
188
filename : "../testdata/gitea/issue-label-event.json" ,
166
189
headers : http.Header {
167
- "X-Gitea-Event" : []string {"issue_label" },
190
+ "X-Gitea-Event" : []string {"issue_label" },
191
+ "X-Gitea-Signature" : []string {"3611415860ed5904c87dd589a7c5fa7e87d2a72b0b2a92ea149ba9691ba8c785" },
168
192
},
169
193
},
170
194
{
@@ -173,7 +197,8 @@ func TestWebhooks(t *testing.T) {
173
197
typ : IssuePayload {},
174
198
filename : "../testdata/gitea/issue-milestone-event.json" ,
175
199
headers : http.Header {
176
- "X-Gitea-Event" : []string {"issue_milestone" },
200
+ "X-Gitea-Event" : []string {"issue_milestone" },
201
+ "X-Gitea-Signature" : []string {"4b782b02035ca264c8e7782b8f2eb9d64e4a61344a1bc3a08fa85d7eed1e77b5" },
177
202
},
178
203
},
179
204
{
@@ -182,7 +207,8 @@ func TestWebhooks(t *testing.T) {
182
207
typ : IssueCommentPayload {},
183
208
filename : "../testdata/gitea/issue-comment-event.json" ,
184
209
headers : http.Header {
185
- "X-Gitea-Event" : []string {"issue_comment" },
210
+ "X-Gitea-Event" : []string {"issue_comment" },
211
+ "X-Gitea-Signature" : []string {"690180a8c853460cba88f9b09911a531d449e9f63ed6b1ff0a0def3b972ca744" },
186
212
},
187
213
},
188
214
{
@@ -191,7 +217,8 @@ func TestWebhooks(t *testing.T) {
191
217
typ : PushPayload {},
192
218
filename : "../testdata/gitea/push-event.json" ,
193
219
headers : http.Header {
194
- "X-Gitea-Event" : []string {"push" },
220
+ "X-Gitea-Event" : []string {"push" },
221
+ "X-Gitea-Signature" : []string {"60fe446c74fa0cb9474f98cc557db79e10c7aaf22cf324ad65239600b9e4d915" },
195
222
},
196
223
},
197
224
{
@@ -200,7 +227,8 @@ func TestWebhooks(t *testing.T) {
200
227
typ : PullRequestPayload {},
201
228
filename : "../testdata/gitea/pull-request-event.json" ,
202
229
headers : http.Header {
203
- "X-Gitea-Event" : []string {"pull_request" },
230
+ "X-Gitea-Event" : []string {"pull_request" },
231
+ "X-Gitea-Signature" : []string {"65c18a212efc7bde0f336acaec87f596fe20e80b2a0e7e51a790dd38393ff771" },
204
232
},
205
233
},
206
234
{
@@ -209,7 +237,8 @@ func TestWebhooks(t *testing.T) {
209
237
typ : PullRequestPayload {},
210
238
filename : "../testdata/gitea/pull-request-assign-event.json" ,
211
239
headers : http.Header {
212
- "X-Gitea-Event" : []string {"pull_request_assign" },
240
+ "X-Gitea-Event" : []string {"pull_request_assign" },
241
+ "X-Gitea-Signature" : []string {"6e96f0515898d427d87fc022cef60e4a02695739e8eae05f8cccd79b2ce4809a" },
213
242
},
214
243
},
215
244
{
@@ -218,7 +247,8 @@ func TestWebhooks(t *testing.T) {
218
247
typ : PullRequestPayload {},
219
248
filename : "../testdata/gitea/pull-request-label-event.json" ,
220
249
headers : http.Header {
221
- "X-Gitea-Event" : []string {"pull_request_label" },
250
+ "X-Gitea-Event" : []string {"pull_request_label" },
251
+ "X-Gitea-Signature" : []string {"c52fa035b8d9ac4d94449349b16bac5892bc59faa72be19ff39f33b6bc24315a" },
222
252
},
223
253
},
224
254
{
@@ -227,7 +257,8 @@ func TestWebhooks(t *testing.T) {
227
257
typ : PullRequestPayload {},
228
258
filename : "../testdata/gitea/pull-request-milestone-event.json" ,
229
259
headers : http.Header {
230
- "X-Gitea-Event" : []string {"pull_request_milestone" },
260
+ "X-Gitea-Event" : []string {"pull_request_milestone" },
261
+ "X-Gitea-Signature" : []string {"38b2cf88e15b15795371517cb4121a92c7db1116f83eba57c13c192a7e0730dc" },
231
262
},
232
263
},
233
264
{
@@ -236,7 +267,8 @@ func TestWebhooks(t *testing.T) {
236
267
typ : IssueCommentPayload {},
237
268
filename : "../testdata/gitea/pull-request-comment-event.json" ,
238
269
headers : http.Header {
239
- "X-Gitea-Event" : []string {"pull_request_comment" },
270
+ "X-Gitea-Event" : []string {"pull_request_comment" },
271
+ "X-Gitea-Signature" : []string {"8b38bf221adbaef2ce01cfa810c6d9cb977414fec306895973aea61e10e8d5a8" },
240
272
},
241
273
},
242
274
{
@@ -245,7 +277,8 @@ func TestWebhooks(t *testing.T) {
245
277
typ : PullRequestPayload {},
246
278
filename : "../testdata/gitea/pull-request-review-event.json" ,
247
279
headers : http.Header {
248
- "X-Gitea-Event" : []string {"pull_request_review" },
280
+ "X-Gitea-Event" : []string {"pull_request_review" },
281
+ "X-Gitea-Signature" : []string {"5d5c315cc199807a23da81b788dcf7874299a223ba81fc77d76ab248fdab4d1c" },
249
282
},
250
283
},
251
284
{
@@ -254,7 +287,8 @@ func TestWebhooks(t *testing.T) {
254
287
typ : RepositoryPayload {},
255
288
filename : "../testdata/gitea/repository-event.json" ,
256
289
headers : http.Header {
257
- "X-Gitea-Event" : []string {"repository" },
290
+ "X-Gitea-Event" : []string {"repository" },
291
+ "X-Gitea-Signature" : []string {"52ca39cfb873254a9cbbda10f8a878f9df16216da6ae92267fc81352ac685d97" },
258
292
},
259
293
},
260
294
{
@@ -263,7 +297,8 @@ func TestWebhooks(t *testing.T) {
263
297
typ : ReleasePayload {},
264
298
filename : "../testdata/gitea/release-event.json" ,
265
299
headers : http.Header {
266
- "X-Gitea-Event" : []string {"release" },
300
+ "X-Gitea-Event" : []string {"release" },
301
+ "X-Gitea-Signature" : []string {"847fcef001c2e59dadac3fa5fa01ca26c9985a5faa10e48a9868a8ad98e9dd18" },
267
302
},
268
303
},
269
304
}
0 commit comments