Skip to content

Restore setting the YAML permitted classes for ActiveRecord

What does this MR do and why?

In 94d81c3c39e3ddc441c3af3f874e53b197cf3f54 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.

This restores the code needed to have gitlab work in those cases.

./bin/rails c
p ActiveRecord::Base.yaml_column_permitted_classes

without the patch you will get [Symbol], with the patch you will get the expected list.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by darix

Merge request reports