Project

General

Profile

Actions

Defect #36226

closed

Psych 4: Psych::DisallowedClass exception when unserializing a setting value

Added by Go MAEDA over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Gems support
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Psych 4.0 uses safe_load by default (see https://github.com/ruby/psych/pull/487). Due to this change, Setting#value may raise Psych::DisallowedClass exception.

$ echo gem "'psych', '~> 4.0.0'" >> Gemfile.local
$ bundle install
$ bin/rails test test/functional/settings_controller_test.rb 
Run options: --seed 45283

# Running:

...................E

Error:
SettingsControllerTest#test_post_plugin_settings:
Psych::DisallowedClass: Tried to load unspecified class: ActiveSupport::HashWithIndifferentAccess
    app/models/setting.rb:109:in `value'
    app/models/setting.rb:131:in `[]='
    app/models/setting.rb:326:in `plugin_foo='
    app/controllers/settings_controller.rb:73:in `plugin'
    lib/redmine/sudo_mode.rb:61:in `sudo_mode'
    test/functional/settings_controller_test.rb:244:in `test_post_plugin_settings'

rails test test/functional/settings_controller_test.rb:237

Related issues

Related to Redmine - Feature #36205: Ruby 3.1 supportClosedGo MAEDA

Actions
Has duplicate Redmine - Defect #36584: Error on creating custom fields using Ruby version 2.7.2Closed

Actions
Actions

Also available in: Atom PDF