@@ -240,52 +240,3 @@ def check_signature(self, obj):
240240 # analysis by attackers.
241241 if not hmac .compare_digest (force_bytes (obj .webhook_key ), self .get_signature ()):
242242 raise PermissionDenied
243-
244-
245- class BitbucketWebhookReceiver (WebhookReceiverBase ):
246- service = 'bitbucket'
247-
248- ref_keys = {
249- # Bitbucket Server
250- 'repo:refs_changed' : 'changes.0.toHash' ,
251- 'repo:comment:added' : 'commit' ,
252- 'repo:comment:edited' : 'commit' ,
253- 'repo:comment:deleted' : 'commit' ,
254- 'pr:opened' : 'pullRequest.fromRef.latestCommit' ,
255- 'pr:modified' : 'pullRequest.fromRef.latestCommit' ,
256- 'pr:reviewer:updated' : 'pullRequest.fromRef.latestCommit' ,
257- 'pr:reviewer:approved' : 'pullRequest.fromRef.latestCommit' ,
258- 'pr:reviewer:unapproved' : 'pullRequest.fromRef.latestCommit' ,
259- 'pr:reviewer:needs_work' : 'pullRequest.fromRef.latestCommit' ,
260- 'pr:merged' : 'pullRequest.fromRef.latestCommit' ,
261- 'pr:declined' : 'pullRequest.fromRef.latestCommit' ,
262- 'pr:deleted' : 'pullRequest.fromRef.latestCommit' ,
263- 'pr:comment:added' : 'pullRequest.fromRef.latestCommit' ,
264- 'pr:comment:edited' : 'pullRequest.fromRef.latestCommit' ,
265- 'pr:comment:deleted' : 'pullRequest.fromRef.latestCommit' ,
266-
267- # Bitbucket Cloud, aka bitbucket.org
268- 'repo:push' : 'push.changes.0.new.target.hash' ,
269- 'repo:commit_comment_created' : 'commit.hash' ,
270- 'pullrequest:created' : 'pullrequest.source.commit' ,
271- 'pullrequest:updated' : 'pullrequest.source.commit' ,
272- 'pullrequest:approved' : 'pullrequest.source.commit' ,
273- 'pullrequest:unapproved' : 'pullrequest.source.commit' ,
274- 'pullrequest:fulfilled' : 'pullrequest.source.commit' ,
275- 'pullrequest:rejected' : 'pullrequest.source.commit' ,
276- 'pullrequest:comment_created' : 'pullrequest.source.commit' ,
277- 'pullrequest:comment_updated' : 'pullrequest.source.commit' ,
278- 'pullrequest:comment_deleted' : 'pullrequest.source.commit' ,
279- }
280-
281- def get_event_type (self ):
282- return self .request .META .get ('HTTP_X_EVENT_KEY' )
283-
284- def get_event_guid (self ):
285- return self .request .META .get ('HTTP_X_REQUEST_UUID' )
286-
287- def get_signature (self ):
288- header_sig = self .request .META .get ('HTTP_X_HUB_SIGNATURE' )
289- if not header_sig :
290- raise PermissionDenied
291- return force_bytes (header_sig )
0 commit comments