Allow CI to clone public projects when HTTP protocol is disabled
What does this MR do?
The problem is that Git always sends an unauthenticated request before sending a request with auth. For a public project, the last conditional case at https://gitlab.com/gitlab-org/gitlab-ce/blob/fe214a217ca95c2c4a53c501f372367fecaf7f99/app/controllers/projects/git_http_client_controller.rb#L52 was passing with the first unauthenticated request, since it is public and guest/unauthenticated users can clone public projects. But then as the request passes further down eventually we check if HTTP is allowed and see that it isn't. Since it's not authenticated as a CI request specifically, we say it's not allowed and it fails.
This fix works because it says even if the project is public, if HTTP is not allowed, let that first unauthenticated request fail through. Then git actually sends the CI token and the next request is authenticated correctly as CI and it's allowed to clone via HTTP.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry for user-facing changes, or community contribution. Check the link for other scenarios. -
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Performance and testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Closes #65805 (closed)