ManageIQ / manageiq

ManageIQ Open-Source Management Platform
https://manageiq.org
Apache License 2.0
1.34k stars 900 forks source link

Support yaml safe_load for serialized columns (post ruby 3.1) #22795

Open jrafanie opened 7 months ago

jrafanie commented 7 months ago

Background:

As seen in the prior issue https://github.com/ManageIQ/manageiq/issues/22696, we see that psych 4 defaulted to using yaml safe_load and you have to permit classes beyond basic classes otherwise classes found in YAML strings will not be permitted to be loaded.

In rails, they have a similar setting for serialized columns. The default going forward is to not use unsafe_load, but instead always use safe_load.

It is controlled via config.active_record.use_yaml_unsafe_load generally in application.rb.

We'd like to set this to false but it requires we either add classes to a permitted list or change our code to no longer serialize objects in columns, thereby no longer needing to YAML load these classes.

Todo list

This list show the steps needed to disable use_yaml_unsafe_load. The workarounds below demonstrate places tests exposed as failing with ruby 3.1 or with use_yaml_unsafe_load = false. Note, it's possible the YAML.safe_load are outside of serialized columns and can be skipped. Future me, keep in mind that if we're needing to YAML.load stuff in tests, we might also be storing these in columns.

miq-bot commented 4 months ago

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

miq-bot commented 1 month ago

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.