diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index e2c959e1e2296bbd58fe5a192c4e1499517b2e3a..59de8badaaff0858d11340db26b50b122d546b42 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -7,6 +7,7 @@ class ApplicationSetting < MainClusterwide::ApplicationRecord include ChronicDurationAttribute include IgnorableColumns include Sanitizable + include SafelyChangeColumnDefault ignore_columns %i[elasticsearch_shards elasticsearch_replicas], remove_with: '14.4', remove_after: '2021-09-22' ignore_columns %i[static_objects_external_storage_auth_token], remove_with: '14.9', remove_after: '2022-03-22' @@ -17,6 +18,8 @@ class ApplicationSetting < MainClusterwide::ApplicationRecord ignore_column %i[sign_in_text help_text], remove_with: '17.3', remove_after: '2024-08-15' ignore_columns %i[arkose_labs_verify_api_url], remove_with: '17.4', remove_after: '2024-08-09' + columns_changing_default %i[ci_max_total_yaml_size_bytes max_yaml_size_bytes] + INSTANCE_REVIEW_MIN_USERS = 50 GRAFANA_URL_ERROR_MESSAGE = 'Please check your Grafana URL setting in ' \ 'Admin area > Settings > Metrics and profiling > Metrics - Grafana' diff --git a/app/models/application_setting_implementation.rb b/app/models/application_setting_implementation.rb index 2d14747edff4e10823b23561929cd33b511afaa9..4fc890f8476706bc27db032a13ca75b41fc2d4cf 100644 --- a/app/models/application_setting_implementation.rb +++ b/app/models/application_setting_implementation.rb @@ -44,7 +44,7 @@ def defaults # rubocop:disable Metrics/AbcSize allow_possible_spam: false, asset_proxy_enabled: false, authorized_keys_enabled: true, # TODO default to false if the instance is configured to use AuthorizedKeysCommand - ci_max_total_yaml_size_bytes: 157286400, # max_yaml_size_bytes * ci_max_includes = 1.megabyte * 150 + ci_max_total_yaml_size_bytes: 314572800, # max_yaml_size_bytes * ci_max_includes = 2.megabyte * 150 commit_email_hostname: default_commit_email_hostname, container_expiration_policies_enable_historic_entries: false, container_registry_features: [], @@ -132,7 +132,7 @@ def defaults # rubocop:disable Metrics/AbcSize max_import_remote_file_size: 10240, max_login_attempts: nil, max_terraform_state_size_bytes: 0, - max_yaml_size_bytes: 1.megabyte, + max_yaml_size_bytes: 2.megabyte, max_yaml_depth: 100, minimum_password_length: DEFAULT_MINIMUM_PASSWORD_LENGTH, mirror_available: true, diff --git a/db/post_migrate/20240726054350_update_ci_max_total_yaml_size_bytes_default.rb b/db/post_migrate/20240726054350_update_ci_max_total_yaml_size_bytes_default.rb new file mode 100644 index 0000000000000000000000000000000000000000..7ab85ddb185d19e1c4e742f9274713631ce2dd1c --- /dev/null +++ b/db/post_migrate/20240726054350_update_ci_max_total_yaml_size_bytes_default.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class UpdateCiMaxTotalYamlSizeBytesDefault < Gitlab::Database::Migration[2.2] + milestone '17.3' + + OLD_DEFAULT_MAX_YAML_SIZE_BYTES = 1.megabytes + NEW_DEFAULT_MAX_YAML_SIZE_BYTES = 2.megabytes + DEFAULT_CI_MAX_INCLUDES = 150 + + OLD_DEFAULT = OLD_DEFAULT_MAX_YAML_SIZE_BYTES * DEFAULT_CI_MAX_INCLUDES + NEW_DEFAULT = NEW_DEFAULT_MAX_YAML_SIZE_BYTES * DEFAULT_CI_MAX_INCLUDES + + def change + change_column_default('application_settings', 'ci_max_total_yaml_size_bytes', from: OLD_DEFAULT, to: NEW_DEFAULT) + end +end diff --git a/db/post_migrate/20240729093332_update_max_yaml_size_bytes_default.rb b/db/post_migrate/20240729093332_update_max_yaml_size_bytes_default.rb new file mode 100644 index 0000000000000000000000000000000000000000..26e1a8a16be2c0e6ac4e971a97641fc30bf0ba7c --- /dev/null +++ b/db/post_migrate/20240729093332_update_max_yaml_size_bytes_default.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class UpdateMaxYamlSizeBytesDefault < Gitlab::Database::Migration[2.2] + milestone '17.3' + + NEW_DEFAULT = 2.megabytes + OLD_DEFAULT = 1.megabyte + + def change + change_column_default('application_settings', 'max_yaml_size_bytes', from: OLD_DEFAULT, to: NEW_DEFAULT) + end +end diff --git a/db/schema_migrations/20240726054350 b/db/schema_migrations/20240726054350 new file mode 100644 index 0000000000000000000000000000000000000000..1b177effb802d572a85083f4d2d18ec22c3dec17 --- /dev/null +++ b/db/schema_migrations/20240726054350 @@ -0,0 +1 @@ +c7a975427a987536f0185d277149758ada7e24ba44927e3808509f5e4f8fa546 \ No newline at end of file diff --git a/db/schema_migrations/20240729093332 b/db/schema_migrations/20240729093332 new file mode 100644 index 0000000000000000000000000000000000000000..ca67ea7ef6a1b83d91f8c3f7c93a1fbe9bb2bff1 --- /dev/null +++ b/db/schema_migrations/20240729093332 @@ -0,0 +1 @@ +0403c855dc4310ee7e9462c154c4e2d85c9e80c56fccd9b923c8805b8512d828 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 691fa0f01189265368595f6389d4449c246d3cf8..6233bc343349ab252426e9bbb6b07a41c3fa0796 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -5597,7 +5597,7 @@ CREATE TABLE application_settings ( throttle_authenticated_files_api_period_in_seconds integer DEFAULT 15 NOT NULL, throttle_unauthenticated_files_api_enabled boolean DEFAULT false NOT NULL, throttle_authenticated_files_api_enabled boolean DEFAULT false NOT NULL, - max_yaml_size_bytes bigint DEFAULT 1048576 NOT NULL, + max_yaml_size_bytes bigint DEFAULT 2097152 NOT NULL, max_yaml_depth integer DEFAULT 100 NOT NULL, throttle_authenticated_git_lfs_requests_per_period integer DEFAULT 1000 NOT NULL, throttle_authenticated_git_lfs_period_in_seconds integer DEFAULT 60 NOT NULL, @@ -5768,7 +5768,7 @@ CREATE TABLE application_settings ( max_decompressed_archive_size integer DEFAULT 25600 NOT NULL, sentry_clientside_traces_sample_rate double precision DEFAULT 0.0 NOT NULL, prometheus_alert_db_indicators_settings jsonb, - ci_max_total_yaml_size_bytes integer DEFAULT 157286400 NOT NULL, + ci_max_total_yaml_size_bytes integer DEFAULT 314572800 NOT NULL, decompress_archive_file_timeout integer DEFAULT 210 NOT NULL, search_rate_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL, snowplow_database_collector_hostname text, diff --git a/doc/api/settings.md b/doc/api/settings.md index 65b001bbe2dd2084ad2a47aa9fb422da077bcf34..6820f10ac57e4f9e4ea044059f24b8fcfba771de 100644 --- a/doc/api/settings.md +++ b/doc/api/settings.md @@ -549,7 +549,7 @@ listed in the descriptions of the relevant settings. | `max_number_of_repository_downloads` | integer | no | Maximum number of unique repositories a user can download in the specified time period before they are banned. Default: 0, Maximum: 10,000 repositories. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87980) in GitLab 15.1. Self-managed, Ultimate only. | | `max_number_of_repository_downloads_within_time_period` | integer | no | Reporting time period (in seconds). Default: 0, Maximum: 864000 seconds (10 days). [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87980) in GitLab 15.1. Self-managed, Ultimate only. | | `max_yaml_depth` | integer | no | The maximum depth of nested CI/CD configuration added with the [`include` keyword](../ci/yaml/index.md#include). Default: `100`. | -| `max_yaml_size_bytes` | integer | no | The maximum size in bytes of a single CI/CD configuration file. Default: `1048576`. | +| `max_yaml_size_bytes` | integer | no | The maximum size in bytes of a single CI/CD configuration file. Default: `2097152`. | | `git_rate_limit_users_allowlist` | array of strings | no | List of usernames excluded from Git anti-abuse rate limits. Default: `[]`, Maximum: 100 usernames. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90815) in GitLab 15.2. Self-managed, Ultimate only. | | `git_rate_limit_users_alertlist` | array of integers | no | List of user IDs that are emailed when the Git abuse rate limit is exceeded. Default: `[]`, Maximum: 100 user IDs. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/110201) in GitLab 15.9. Self-managed, Ultimate only. | | `auto_ban_user_on_excessive_projects_download` | boolean | no | When enabled, users will get automatically banned from the application when they download more than the maximum number of unique projects in the time period specified by `max_number_of_repository_downloads` and `max_number_of_repository_downloads_within_time_period` respectively. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/94153) in GitLab 15.4. Self-managed, Ultimate only. | diff --git a/spec/lib/gitlab/ci/config/external/context_spec.rb b/spec/lib/gitlab/ci/config/external/context_spec.rb index 3409fc53d19bf4f9c46d4ba40dc6e5c716ec69e7..13cb3ae613093b4fd59147603aaf1d8c59deb8fc 100644 --- a/spec/lib/gitlab/ci/config/external/context_spec.rb +++ b/spec/lib/gitlab/ci/config/external/context_spec.rb @@ -63,7 +63,7 @@ describe 'max_total_yaml_size_bytes' do context 'when application setting `max_total_yaml_size_bytes` is requsted and was never updated by the admin' do it 'returns the default value `max_total_yaml_size_bytes`' do - expect(subject.max_total_yaml_size_bytes).to eq(157286400) + expect(subject.max_total_yaml_size_bytes).to eq(314572800) end end