Skip to content
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

New error upon upgrading to Rails 5.2.8.1: Tried to load unspecified class: ActiveSupport::HashWithIndifferentAccess #307

Open
mekinsie opened this issue Oct 25, 2022 · 0 comments

Comments

@mekinsie
Copy link

mekinsie commented Oct 25, 2022

Context:
I recently updated an app to Rails 5.2.8.1 and am encountering an issue regarding the serialization of HashWithIndifferentAccess via the Impressionist gem.

The new rails upgrade added a security fix that prevents potential SQL injections via the serialization of columns: https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017

Issue:
The The impressionist gem serializes HashWithIndifferentAccess here - line 28 in /app/controllers/impressionist_controller.rb (this is where the error occurs)

Specifically, calling obj.impressions.create() serializes the params hash in associative_create_statement. I was unable to determine where in this method the serialization is happening (it is abstracted away somewhere). I'm hoping that this information might give the Impressionist team some insight as to where exactly this serialization might be happening, and create a fix for it so that we may continue to use the gem.

Temporary solution
Until then, I have to add the following to my application.rb file to prevent the error from occurring:
config.active_record.yaml_column_permitted_classes = [ActiveSupport::HashWithIndifferentAccess]

This will allow the serialization to occur, but also means that the application is vulnerable to SQL injections according to the documentation I have linked above.

@mekinsie mekinsie changed the title New error upon upgrading to Rails 5.2.8.1: Tried to load unspecified class: ActiveSupport::Tried to load unspecified class: ActiveSupport::HashWithIndifferentAccess New error upon upgrading to Rails 5.2.8.1: Tried to load unspecified class: ActiveSupport::HashWithIndifferentAccess Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant