Validate the length of a job name
The database config for ci_builds.name
name is not exactly the same for development and production. For GitLab.com
we accept at most 255
characters and everything that exceeds is presented with an 500
error.
gitlabhq_development=# \d+ ci_builds
Table "public.ci_builds"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
-------------------------+-----------------------------+-----------+----------+---------------------------------------+----------+--------------+-------------
name | character varying | | | | extended | |
gitlabhq_production=> \d+ ci_builds
Table "public.ci_builds"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
-------------------------+-----------------------------+-----------+----------+---------------------------------------+----------+--------------+-------------
name | character varying(255) | | | | extended | |
json.exception.class ActiveRecord::ValueTooLong
json.exception.message PG::StringDataRightTruncation: ERROR: value too long for type character varying(255)
lib/gitlab/database/load_balancing/connection_proxy.rb:119:in `block in write_using_load_balancer',
lib/gitlab/database/load_balancing/load_balancer.rb:107:in `block in read_write',
lib/gitlab/database/load_balancing/load_balancer.rb:174:in `retry_with_backoff',
lib/gitlab/database/load_balancing/load_balancer.rb:105:in `read_write',
lib/gitlab/database/load_balancing/connection_proxy.rb:118:in `write_using_load_balancer',
lib/gitlab/database/load_balancing/connection_proxy.rb:60:in `block (2 levels) in <class:ConnectionProxy>',
lib/gitlab/database/load_balancing/connection_proxy.rb:119:in `block in write_using_load_balancer',
lib/gitlab/database/load_balancing/load_balancer.rb:107:in `block in read_write',
lib/gitlab/database/load_balancing/load_balancer.rb:174:in `retry_with_backoff',
lib/gitlab/database/load_balancing/load_balancer.rb:105:in `read_write',
lib/gitlab/database/load_balancing/connection_proxy.rb:118:in `write_using_load_balancer',
lib/gitlab/database/load_balancing/connection_proxy.rb:70:in `transaction',
lib/gitlab/database/load_balancing/connection_proxy.rb:119:in `block in write_using_load_balancer',
lib/gitlab/database/load_balancing/load_balancer.rb:107:in `block in read_write',
lib/gitlab/database/load_balancing/load_balancer.rb:174:in `retry_with_backoff',
lib/gitlab/database/load_balancing/load_balancer.rb:105:in `read_write',
lib/gitlab/database/load_balancing/connection_proxy.rb:118:in `write_using_load_balancer',
lib/gitlab/database/load_balancing/connection_proxy.rb:70:in `transaction',
lib/gitlab/database/load_balancing/connection_proxy.rb:119:in `block in write_using_load_balancer',
lib/gitlab/database/load_balancing/load_balancer.rb:107:in `block in read_write',
lib/gitlab/database/load_balancing/load_balancer.rb:174:in `retry_with_backoff',
lib/gitlab/database/load_balancing/load_balancer.rb:105:in `read_write',
lib/gitlab/database/load_balancing/connection_proxy.rb:118:in `write_using_load_balancer',
lib/gitlab/database/load_balancing/connection_proxy.rb:70:in `transaction',
lib/gitlab/ci/pipeline/chain/create.rb:12:in `block in perform!',
app/models/concerns/bulk_insertable_associations.rb:54:in `with_bulk_insert',
lib/gitlab/ci/pipeline/chain/create.rb:11:in `perform!',
lib/gitlab/ci/pipeline/chain/sequence.rb:20:in `block in build!',
lib/gitlab/ci/pipeline/chain/sequence.rb:16:in `each',
lib/gitlab/ci/pipeline/chain/sequence.rb:16:in `build!',
app/services/ci/create_pipeline_service.rb:85:in `execute',
app/controllers/projects/pipelines_controller.rb:69:in `create',
ee/lib/gitlab/ip_address_state.rb:10:in `with',
ee/app/controllers/ee/application_controller.rb:44:in `set_current_ip_address',
app/controllers/application_controller.rb:497:in `set_current_admin',
lib/gitlab/session.rb:11:in `with_session',
app/controllers/application_controller.rb:488:in `set_session_storage',
lib/gitlab/i18n.rb:105:in `with_locale',
lib/gitlab/i18n.rb:111:in `with_user_locale',
app/controllers/application_controller.rb:482:in `set_locale',
app/controllers/application_controller.rb:476:in `set_current_context',
ee/lib/omni_auth/strategies/group_saml.rb:41:in `other_phase',
lib/gitlab/metrics/elasticsearch_rack_middleware.rb:16:in `call',
lib/gitlab/middleware/rails_queue_duration.rb:33:in `call',
lib/gitlab/middleware/speedscope.rb:13:in `call',
lib/gitlab/request_profiler/middleware.rb:17:in `call',
lib/gitlab/database/load_balancing/rack_middleware.rb:38:in `call',
lib/gitlab/metrics/rack_middleware.rb:16:in `block in call',
lib/gitlab/metrics/web_transaction.rb:21:in `run',
lib/gitlab/metrics/rack_middleware.rb:16:in `call',
lib/gitlab/jira/middleware.rb:19:in `call',
lib/gitlab/middleware/go.rb:20:in `call',
lib/gitlab/etag_caching/middleware.rb:21:in `call',
lib/gitlab/middleware/multipart.rb:172:in `call',
lib/gitlab/middleware/read_only/controller.rb:50:in `call',
lib/gitlab/middleware/read_only.rb:18:in `call',
lib/gitlab/middleware/same_site_cookies.rb:27:in `call',
lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call',
lib/gitlab/middleware/basic_health_check.rb:25:in `call',
lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call',
lib/gitlab/middleware/request_context.rb:21:in `call',
config/initializers/fix_local_cache_middleware.rb:11:in `call',
lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call',
lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call',
lib/gitlab/metrics/requests_rack_middleware.rb:75:in `call',
lib/gitlab/middleware/release_env.rb:12:in `call'
Proposal
Add a length validation to https://gitlab.com/gitlab-org/gitlab/-/blob/197b1c3e8215fae5e5d2cbf0213922e726b2e569/lib/gitlab/ci/config/entry/processable.rb#L24-25