-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permit subscription classes to be serialized in queue args #8964
Permit subscription classes to be serialized in queue args #8964
Conversation
25640dd
to
287d5c9
Compare
@@ -182,6 +182,7 @@ def pglogical_save_subscriptions | |||
task_opts = {:action => "Save subscriptions for global region", :userid => session[:userid]} | |||
queue_opts = {:class_name => "MiqPglogical", :method_name => "save_global_region", | |||
:args => [subscriptions_to_save, subsciptions_to_remove]} | |||
ActiveRecord::Base.yaml_column_permitted_classes = ActiveRecord::Base.yaml_column_permitted_classes | [subscriptions_to_save.first.class, subsciptions_to_remove.first.class] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but you can one-shot this
ActiveRecord::Base.yaml_column_permitted_classes = ActiveRecord::Base.yaml_column_permitted_classes | [subscriptions_to_save.first.class, subsciptions_to_remove.first.class] | |
ActiveRecord::Base.yaml_column_permitted_classes |= [subscriptions_to_save.first.class, subsciptions_to_remove.first.class] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like an emoji... -1 NACK. 🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, these are really out there to show what would be required to do config.active_record.use_yaml_unsafe_load = false
in the application. I feel like the proper solution is to not serialize these objects so anything easy to grep can enable that in the future.
I can change it. Just giving background as there are a few like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, fixed
287d5c9
to
e228bd8
Compare
Checked commit jrafanie@e228bd8 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint |
it would be nice if in development we display a warning or blow up. |
@kbrock I opened ManageIQ/manageiq#22795 to track next steps... I'm going to list all the places we did this temporary hack and that suggestion would go nicely there. |
This is ready to be merged, ManageIQ/manageiq#22795 has been opened and this PR is linked as a work item to fix going forward to support safe serialized columns. |
yes, the workaround added here will be removed when we work on ManageIQ/manageiq#22795 |
ok, we will merge it today. |
Part of ManageIQ/manageiq#22696
This is for ruby 3.1/psych 4 defaults using safe_load and activerecord using safe_load in serialized yaml columns.