Skip to content

Change back internal API return code

What does this MR do?

In !25936 (merged) we realized that the error code returned was different between git HTTP requests (403) and SSH requests (401), and we tried to fix that by returning also 403 in SSH requests.

But, it seems, according to #208253 (closed), when the error sent from the internal API is 403, instead of returning the generated custom error, the errors displayed is always the same, GitLab: API is not accessible.

There were different options to fix this:

  1. To revert !25936 (merged) and still use the old error name (and we would need a new error class to return real 401 in HTTP requests).
  2. Return again 401 in the internal API instead of 403
  3. Fix GitLab shell to return the custom error instead of the fixed one.

Option 3, according to #208253 (comment 295186776) is quite complex to do.

In option 1, it doesn't feel right to raise UnauthorizedErrors when the error is, in fact, ForbiddenError.

So we're going with option 2, return 401 again.

We need to ensure that the qa jobs passes.

Closes #208253 (closed)

Does this MR meet the acceptance criteria?

Conformity

Merge request reports