summaryrefslogtreecommitdiff
path: root/config/application.rb
diff options
context:
space:
mode:
Diffstat (limited to 'config/application.rb')
-rw-r--r--config/application.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/config/application.rb b/config/application.rb
index a3fe4935fdf..61dfa59a90d 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -59,6 +59,7 @@ module Gitlab
require_dependency Rails.root.join('lib/gitlab/redis/trace_chunks')
require_dependency Rails.root.join('lib/gitlab/redis/rate_limiting')
require_dependency Rails.root.join('lib/gitlab/redis/sessions')
+ require_dependency Rails.root.join('lib/gitlab/redis/repository_cache')
require_dependency Rails.root.join('lib/gitlab/current_settings')
require_dependency Rails.root.join('lib/gitlab/middleware/read_only')
require_dependency Rails.root.join('lib/gitlab/middleware/compressed_json')
@@ -595,6 +596,29 @@ module Gitlab
Gitlab::Color, # https://gitlab.com/gitlab-org/gitlab/-/issues/368844,
Hashie::Array # https://gitlab.com/gitlab-org/gitlab/-/issues/378089
]
+ #
+ # Restore setting the YAML permitted classes for ActiveRecord
+ #
+ # In [94d81c3c39e3ddc441c3af3f874e53b197cf3f54][0] rails upstream removed
+ # the code that copied the values of
+ # config.active_record.yaml_column_permitted_classes to
+ # ActiveRecord.yaml_column_permitted_classes during the
+ # config.after_initialize stage.
+ #
+ # We can not move the setting of
+ # config.active_record.yaml_column_permitted_classes out of the
+ # after_initialize because then the gitlab classes are not loaded yet
+ #
+ # This change was also ported to the 6.1 branch and released in 6.1.7.
+ # Some distributions like Debian even [backported this change to
+ # 6.1.6.1][1].
+ #
+ # This restores the code needed to have gitlab work in those cases.
+ #
+ # [0]: https://github.com/rails/rails/commit/94d81c3c39e3ddc441c3af3f874e53b197cf3f54
+ # [1]: https://salsa.debian.org/ruby-team/rails/-/commit/5663e598b41dc4e2058db22e1ee0d678e5c483ba
+ #
+ ActiveRecord::Base.yaml_column_permitted_classes = config.active_record.yaml_column_permitted_classes
# on_master_start yields immediately in unclustered environments and runs
# when the primary process is done initializing otherwise.