Skip to content
代码片段 群组 项目
提交 6c0de46a 编辑于 作者: Vasilii Iakliushin's avatar Vasilii Iakliushin
浏览文件

Remove `go_get_handle_401_error` feature flag

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/496539

**Original problem**

Self-managed instances that restricted password authentication for Git
over HTTP(S) started to receive 401 error code for `go-get=1` requests
from go toolchain.

The reason is a missing return for the case when request doesn't have
basic credentials.

It was introduced in
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/161162.

**Solution**

Restore check for missing basic credentials and add a test case.

Changelog: fixed
上级 d71703aa
No related branches found
No related tags found
无相关合并请求
---
name: go_get_handle_401_error
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/493732
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/167640
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/496539
milestone: '17.5'
group: group::source code
type: gitlab_com_derisk
default_enabled: false
......@@ -130,10 +130,7 @@ def project_for_path(path_info)
# can_read_project? checks if the request's credentials have read access to the project
def can_read_project?(request, project)
return true if project.public?
if Feature.enabled?(:go_get_handle_401_error, Feature.current_request) && !has_basic_credentials?(request)
return false
end
return false unless has_basic_credentials?(request)
login, password = user_name_and_password(request)
auth_result = Gitlab::Auth.find_for_git_client(login, password, project: project, request: request)
......
......@@ -69,17 +69,6 @@
it 'returns the 2-segment path' do
expect_response_with_path(go, enabled_protocol, project.full_path)
end
context 'when "go_get_handle_401_error" feature flag disabled' do
before do
stub_feature_flags(go_get_handle_401_error: false)
end
it 'returns 401 error response' do
response = go
expect(response[0]).to eq(401)
end
end
end
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册