Skip to content

Conversation

@pboling
Copy link

@pboling pboling commented Jan 15, 2025

Rails 5.2.8.1 is a security patch release to fix CVE-2022-32224.
See: https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017

The patch (Rails v5.2.8.1) causes an error with masq v0.3.4
(... actually it doesn't work at all on Rails v5, but some forks have been fixed):

Psych::DisallowedClass: Tried to load unspecified class: ActiveSupport::HashWithIndifferentAccess

when serializing a Hash the way we had done in previous versions app/models/masq/open_id_request.rb:

serialize :parameters, Hash

so we instead switch to serializing as JSON:

serialize :parameters, JSON

If an implementation needs to continue using the serialized Hash,
you will need to override the definition by reopening the model, and adding:

serialize :parameters, Hash

In addition, one of the following is also needed.

  1. Simple, but insecure fix, which reverts to previous unpatched behavior is:

    Rails.application.config.active_record.use_yaml_unsafe_load = true
  2. More complex, and a bit less insecure fix, is to explicitly list the allowed classes to serialize:

    Rails.application.config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time, HashWithIndifferentAccess]

pboling and others added 30 commits January 15, 2025 04:30
Update gemfile for rails 4
o Update Gemfile and gemspec
o Update dummy env and change to sqlite for tests
o Comment out model strong parameters
  moved to controllers instead
Update gemfile and gemspec to support rails 4.1
This was preventing tests from running.
Fixed warning in assert_match server controller test
Hopefully travis can find my fixtures now
Update gemfile for Rails 4.2
Update bin file
rename depricated before/after_filters
Fix on tests so they run
Gemfile updates
Remove deprication warnings from tests
Fix on permitted openid parameters
Fix on saving parameters for an OpenID request
Fix on site parameters correctly permitted
Update code removing depricated calls
- delete_all should not have arguments
- render text: has been depricated
remove find_by and replace with where first
- drop-in replacement for ⚰️ruby-openid⚰️
Rails 5.2.8.1 is a security patch release to fix CVE-2022-32224.
See: https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017

The patch (Rails v5.2.8.1) causes an error with `masq` v0.3.4
(... actually it doesn't work at all on Rails v5, but some forks have been fixed):

```
Psych::DisallowedClass: Tried to load unspecified class: ActiveSupport::HashWithIndifferentAccess
```

when serializing a Hash the way we had done in previous versions `app/models/masq/open_id_request.rb`:
```ruby
serialize :parameters, Hash
```

so we instead switch to serializing as JSON:
```ruby
serialize :parameters, JSON
```

If an implementation needs to continue using the serialized Hash,
you will need to override the definition by reopening the model, and adding:

```ruby
serialize :parameters, Hash
```

In addition, one of the following is also needed.

1. Simple, but insecure fix, which reverts to previous unpatched behavior is:

      ```ruby
      Rails.application.config.active_record.use_yaml_unsafe_load = true
      ```

2. More complex, and a bit less insecure fix, is to explicitly list the allowed classes to serialize:

      ```ruby
      Rails.application.config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time, HashWithIndifferentAccess]
      ```
@pboling pboling changed the title Rails 5 2 Rails 5.2 Jan 15, 2025
- switch to require_relative
…ite3Adapter.represent_boolean_as_integer`

  set to false is deprecated
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

Successfully merging this pull request may close these issues.

1 participant