Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lando/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ def get(self, request: WSGIRequest, repo_name: str, number: int) -> JsonResponse
return JsonResponse(warnings_and_blockers)


@method_decorator(csrf_exempt, name="dispatch")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It may actually make sense to keep the CSRF here.

Unless we want others than the PR view page to be able to create a try job?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is added so that external services (e.g., code-review-bot) can use this endpoint. I think since we require an authenticated user for all requests to this endpoint, we should be OK.

class PullRequestTryPushAPIView(APIView):
@method_decorator(require_authenticated_user)
def post(
Expand Down Expand Up @@ -343,6 +344,7 @@ def post(
}
revision = Revision.objects.create(
pull_number=pull_request.number,
pull_head_sha=pull_request.head_sha,
patches=pull_request.patch,
patch_data=patch_data,
)
Expand Down