-
Notifications
You must be signed in to change notification settings - Fork 49
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
Use safe_load when using Psych >=3.1 #34
Conversation
lib/http/cookie_jar/yaml_saver.rb
Outdated
|
||
if YAML.name == 'Psych' && Psych::VERSION >= '3.1' | ||
def load_yaml(yaml) | ||
YAML.safe_load(yaml, :permitted_classes => %w[Time HTTP::Cookie Mechanize::Cookie]) |
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.
psych >=3.1 supports keyword arguments. We still support ruby 1.8.7, hence the rocket syntax.
@@ -73,4 +73,14 @@ def load(io, jar) | |||
def default_options | |||
{} | |||
end | |||
|
|||
if YAML.name == 'Psych' && Psych::VERSION >= '3.1' |
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.
"3.10" > "3.1", in case you wonder.
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.
I am so very late here (thanks for doing this update btw), but in the distant future "10.0" < "3.1" :)
…le occurrences of an object
Just pushed v1.0.4. |
I don't think there are use cases where an untrusted YAML jar should be loaded, but it is a good practice to be explicit about which classes are expected to be serialized in the YAML jar format.
Because CI for 1.8.7/REE was broken, I ran the test suite manually in my local environment with ruby 1.8.7.
This fixes #33.