Add authentication check to GitHub Import Public API endpoints
The following discussion from !98931 (merged) should be addressed:
-
@stanhu started a discussion: Does this API require a user to be authenticated?
Authentication check is missing from /api/v4/import/github/cancel and /api/v4/import/github
When PAT is not provided in headers on POST /api/v4/import/github the 500 error is returned
Screen_Recording_2022-10-12_at_18.59.27
When PAT is not provided in headers on POST /api/v4/import/github/cancel the 404 or 403 error is returned, depending on user access rights (covered by authorization)
Proposal solution:
Use https://gitlab.com/gitlab-org/gitlab/-/blob/17cdb7ad3eef7e82fea99e71c133db0106593356/lib/api/helpers.rb#L280 for user authentication.
Edited by Kristina Doskich