Skip to content

Commit 716f005

Browse files
authored
Merge pull request readthedocs#5311 from rtfd/basic-auth-webhook-api
Add basic auth to the generic webhook API.
2 parents 6d960f1 + f888d83 commit 716f005

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

readthedocs/restapi/views/integrations.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ class IsAuthenticatedOrHasToken(permissions.IsAuthenticated):
349349
"""
350350

351351
def has_permission(self, request, view):
352-
has_perm = (super().has_permission(request, view))
352+
has_perm = super().has_permission(request, view)
353353
return has_perm or 'token' in request.data
354354

355355

@@ -420,8 +420,18 @@ class WebhookView(APIView):
420420
ever get webhook requests for established webhooks on our side. The other
421421
views can receive webhooks for unknown webhooks, as all legacy webhooks will
422422
be.
423+
424+
.. warning::
425+
We're turning off Authenication for this view.
426+
This fixes a bug where we were double-authenticating these views,
427+
because of the way we're passing the request along to the subviews.
428+
429+
If at any time we add real logic to this view,
430+
it will be completely unauthenticated.
423431
"""
424432

433+
authentication_classes = []
434+
425435
VIEW_MAP = {
426436
Integration.GITHUB_WEBHOOK: GitHubWebhookView,
427437
Integration.GITLAB_WEBHOOK: GitLabWebhookView,

0 commit comments

Comments
 (0)