Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 16:18:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 16:18:24 +0300
commit0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch)
tree4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /db/migrate/20210830154358_add_yaml_limit_constraints.rb
parent744144d28e3e7fddc117924fef88de5d9674fe4c (diff)
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'db/migrate/20210830154358_add_yaml_limit_constraints.rb')
-rw-r--r--db/migrate/20210830154358_add_yaml_limit_constraints.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/db/migrate/20210830154358_add_yaml_limit_constraints.rb b/db/migrate/20210830154358_add_yaml_limit_constraints.rb
new file mode 100644
index 00000000000..74236993fff
--- /dev/null
+++ b/db/migrate/20210830154358_add_yaml_limit_constraints.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+# See https://docs.gitlab.com/ee/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddYamlLimitConstraints < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ SIZE_CONSTRAINT_NAME = 'app_settings_yaml_max_size_positive'
+ DEPTH_CONSTRAINT_NAME = 'app_settings_yaml_max_depth_positive'
+
+ disable_ddl_transaction!
+
+ def up
+ add_check_constraint :application_settings, 'max_yaml_size_bytes > 0', SIZE_CONSTRAINT_NAME
+ add_check_constraint :application_settings, 'max_yaml_depth > 0', DEPTH_CONSTRAINT_NAME
+ end
+
+ def down
+ remove_check_constraint :application_settings, SIZE_CONSTRAINT_NAME
+ remove_check_constraint :application_settings, DEPTH_CONSTRAINT_NAME
+ end
+end