-
Notifications
You must be signed in to change notification settings - Fork 898
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
Autoload Rails Models unless called from safe_load #19701
Merged
Fryguy
merged 2 commits into
ManageIQ:master
from
jrafanie:do_not_autoload_models_in_safe_load
Jan 9, 2020
Merged
Autoload Rails Models unless called from safe_load #19701
Fryguy
merged 2 commits into
ManageIQ:master
from
jrafanie:do_not_autoload_models_in_safe_load
Jan 9, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1789153 Psych::ClassLoader::Restricted is the class_loader if you use safe_load and was added in psych 2.0.0: ruby/psych@2c644e1 Note, ruby 2.4.0 shipped with psych 2.2.2+. This class_loader would not work with ruby 2.3 and older.
jrafanie
force-pushed
the
do_not_autoload_models_in_safe_load
branch
from
January 8, 2020 22:37
60a6372
to
85adac0
Compare
Checked commits jrafanie/manageiq@85adac0~...11a69b5 with ruby 2.5.5, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 spec/initializers/yaml_autoloader_spec.rb
spec/lib/rbac/filterer_spec.rb
|
jrafanie
added a commit
to jrafanie/manageiq-ui-classic
that referenced
this pull request
Jan 9, 2020
https://bugzilla.redhat.com/show_bug.cgi?id=1789153 Followup to ManageIQ/manageiq#19701 At the very least, we know MiqExpression objects are in the YAML but other custom classes could be in the YAML so we need to use YAML.load to return to the prior behavior.
jrafanie
added a commit
to jrafanie/manageiq-ui-classic
that referenced
this pull request
Jan 9, 2020
https://bugzilla.redhat.com/show_bug.cgi?id=1789153 Followup to ManageIQ/manageiq#19701 At the very least, we know MiqExpression objects are in the YAML but other custom classes could be in the YAML so we need to use YAML.load to return to the prior behavior.
jrafanie
added a commit
to jrafanie/manageiq-automation_engine
that referenced
this pull request
Jan 9, 2020
https://bugzilla.redhat.com/show_bug.cgi?id=1789153 Followup to ManageIQ/manageiq#19701 We're trying to load MiqAeMethodService::MiqAeServiceService and ActiveSupport::HashWithIndifferentAccess in these places. The prior behavior in core was to treat YAML.safe_load like YAML.load so let's change these to .load for now. If we want to use safe_load, we'll need to enumerate all of the additional classes we want to allow to be loaded beyond the ruby basic types.
jrafanie
added a commit
to jrafanie/manageiq-automation_engine
that referenced
this pull request
Jan 9, 2020
https://bugzilla.redhat.com/show_bug.cgi?id=1789153 Followup to ManageIQ/manageiq#19701 The prior behavior in core was to treat YAML.safe_load like YAML.load so let's change some of these to .load for now. We'll enumerate the list of classes where we can.
jrafanie
added a commit
to jrafanie/manageiq-automation_engine
that referenced
this pull request
Jan 9, 2020
https://bugzilla.redhat.com/show_bug.cgi?id=1789153 Followup to ManageIQ/manageiq#19701 Seen when run locally or in travis output: ``` 472.50s$ bundle exec rake ** ManageIQ master, codename: Jansa [Coveralls] Set up the SimpleCov formatter. [Coveralls] Using SimpleCov's 'rails' settings. ** ManageIQ master, codename: Jansa /home/travis/build/ManageIQ/manageiq-automation_engine/vendor/bundle/gems/rspec-core-3.9.1/exe/rspec: No such file or directory - does /home/travis/build/ManageIQ/manageiq-automation_engine/vendor/bundle/gems/rspec-core-3.9.1/exe/rspec: No such file or directory - does Randomized with seed 8807 .... ```
jrafanie
added a commit
to jrafanie/manageiq-automation_engine
that referenced
this pull request
Jan 9, 2020
https://bugzilla.redhat.com/show_bug.cgi?id=1789153 Followup to ManageIQ/manageiq#19701 The prior behavior in core was to treat YAML.safe_load like YAML.load so let's change some of these to .load for now. We'll enumerate the list of classes where we can.
jrafanie
added a commit
to jrafanie/manageiq-automation_engine
that referenced
this pull request
Jan 9, 2020
https://bugzilla.redhat.com/show_bug.cgi?id=1789153 Followup to ManageIQ/manageiq#19701 Seen when run locally or in travis output: ``` 472.50s$ bundle exec rake ** ManageIQ master, codename: Jansa [Coveralls] Set up the SimpleCov formatter. [Coveralls] Using SimpleCov's 'rails' settings. ** ManageIQ master, codename: Jansa /home/travis/build/ManageIQ/manageiq-automation_engine/vendor/bundle/gems/rspec-core-3.9.1/exe/rspec: No such file or directory - does /home/travis/build/ManageIQ/manageiq-automation_engine/vendor/bundle/gems/rspec-core-3.9.1/exe/rspec: No such file or directory - does Randomized with seed 8807 .... ```
pkomanek
pushed a commit
to pkomanek/manageiq-automation_engine
that referenced
this pull request
Jan 22, 2020
https://bugzilla.redhat.com/show_bug.cgi?id=1789153 Followup to ManageIQ/manageiq#19701 The prior behavior in core was to treat YAML.safe_load like YAML.load so let's change some of these to .load for now. We'll enumerate the list of classes where we can.
pkomanek
pushed a commit
to pkomanek/manageiq-automation_engine
that referenced
this pull request
Jan 22, 2020
https://bugzilla.redhat.com/show_bug.cgi?id=1789153 Followup to ManageIQ/manageiq#19701 Seen when run locally or in travis output: ``` 472.50s$ bundle exec rake ** ManageIQ master, codename: Jansa [Coveralls] Set up the SimpleCov formatter. [Coveralls] Using SimpleCov's 'rails' settings. ** ManageIQ master, codename: Jansa /home/travis/build/ManageIQ/manageiq-automation_engine/vendor/bundle/gems/rspec-core-3.9.1/exe/rspec: No such file or directory - does /home/travis/build/ManageIQ/manageiq-automation_engine/vendor/bundle/gems/rspec-core-3.9.1/exe/rspec: No such file or directory - does Randomized with seed 8807 .... ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1789153
Psych::ClassLoader::Restricted is the class_loader if you use safe_load and was
added in psych 2.0.0:
ruby/psych@2c644e1
Note, ruby 2.4.0 shipped with psych 2.2.2+. This class_loader would not work with ruby 2.3 and older.
From the BZ:
Steps to Reproduce:
Actual results:
This should have failed ^^^
Expected results:
This is what should be happening ^^^