Skip to content
GitLab
Next
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 54.9k
    • Issues 54.9k
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1.5k
    • Merge requests 1.5k
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #327641
Closed
Open
Issue created Apr 13, 2021 by Alin Ciciu@aciciuContributor

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.

Assignee
Assign to
Time tracking