Too high project limit results in error 500 upon user creation
If you as an admin are creating a new user from the admin interface, and give a too large number as a project limit (such as 100000000000000000000000), GitLab will give an error 500. This happens at least on 8.17.2.
Reproducing:
- Go to /admin/users/new to create a new user while logged in as an admin.
- Fill in the new user details (name, username, email)
- Set projects limit to an arbitrarily high number, such as 100000000000000000000000
- Leave other settings as defaults / empty and press "Create user"
Current bug behaviour:
At point 4., the page will reload and present an error 500 from GitLab. The new user is not created, and going back to the previous page will result in the form being blank.
How it should behave:
GitLab should warn that the number is too large, and should inform about the maximum project limit. If the value is above this, the create new user button should be disabled or the issue should be handled in some other way to not allow such high number to be set/submitted.
RangeError: 2477759393939929292 is out of range for ActiveRecord::ConnectionAdapters::PostgreSQL
https://sentry.gitlap.com/gitlab/gitlabcom/issues/15314/
RangeError: 2477759393939929292 is out of range for ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer with limit 4
app/controllers/projects/issues_controller.rb:171:in `issue'
@noteable = @issue ||= @project.issues.where(iid: params[:id]).reorder(nil).take || redirect_old
lib/gitlab/request_profiler/middleware.rb:15:in `call'
@app.call(env)
lib/gitlab/middleware/rails_queue_duration.rb:20:in `call'
@app.call(env)
lib/gitlab/metrics/rack_middleware.rb:29:in `block in call'
retval = trans.run { @app.call(env) }
lib/gitlab/metrics/transaction.rb:49:in `run'
yield
...
(111 additional frame(s) were not displayed)
How to reproduce
Navigate to a URL that contains a number and make the number big. Hit ENTER.