Users not getting blocked despite block_auto_created_users when user cap is enabled
Summary
When user cap is set, omniauth_block_auto_created_users
is not blocking the new accounts if set to true.
Steps to reproduce
Set user cap and gitlab_rails['omniauth_block_auto_created_users']=true and try to sign up using any SSO.
gitlab_rails['omniauth_providers'] = [
{
"name" => "gitlab",
"app_id" => "[FILTERED]",
"app_secret" => "[FILTERED]",
"args" => { "scope" => "api" }
}
]
gitlab_rails['omniauth_allow_single_sign_on'] = ['gitlab']
gitlab_rails['omniauth_block_auto_created_users'] = true
What is the current bug behavior?
New users are auto approved even though block_auto_created_users
is enabled.
What is the expected correct behavior?
To block the users.
Relevant logs and/or screenshots
Started GET "/users/auth/gitlab/callback?code=[FILTERED]&state=[FILTERED]" for * at 2021-04-13 18:10:09 +0000
Processing by OmniauthCallbacksController#gitlab as HTML
Parameters: {"code"=>"[FILTERED]", "state"=>"[FILTERED]"}
Completed 401 Unauthorized in 257ms (ActiveRecord: 75.8ms | Elasticsearch: 0.0ms | Allocations: 38333)
[..]
{
"time": "2021-04-13T18:10:10.433Z",
"class": "SetUserStatusBasedOnUserCapSettingWorker",
"args": ["4"],
"queue": "set_user_status_based_on_user_cap_setting",
"meta.caller_id": "OmniauthCallbacksController#gitlab",
"message": "SetUserStatusBasedOnUserCapSettingWorker JID-03af25805be162bd15ab0293: start",
[..]
}
{
"time": "2021-04-13T18:10:10.547Z",
"class": "SetUserStatusBasedOnUserCapSettingWorker",
"args": ["4"],
"queue": "set_user_status_based_on_user_cap_setting",
"meta.caller_id": "OmniauthCallbacksController#gitlab",
"message": "SetUserStatusBasedOnUserCapSettingWorker JID-03af25805be162bd15ab0293: done: 0.114904 sec",
[..]
}
# second sign-in
Started GET "/users/auth/gitlab/callback?code=[FILTERED]&state=[FILTERED]" for * at 2021-04-13 18:10:14 +0000
Processing by OmniauthCallbacksController#failure as HTML
Parameters: {"code"=>"[FILTERED]", "state"=>"[FILTERED]"}
Redirected to https://domain/users/sign_in
Completed 302 Found in 61ms (ActiveRecord: 15.9ms | Elasticsearch: 0.0ms | Allocations: 21075)
Processing by SessionsController#new as HTML
Redirected to https://domain/
cc @amandarueda
cc @gitlab-com/gl-security/appsec since this might have security implications - if users are not getting blocked on sign-up as expected. I've made this issue confidential until you all have a chance to look at it.