-
Notifications
You must be signed in to change notification settings - Fork 518
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
Why does PyYAML 5.1 raise YAMLLoadWarning when the default loader has been made safer already? #292
Comments
Because if your code also ran against an older version of PyYAML, then it would still be vulnerable. The purpose of the warning is to get you (the developer) to change your code to explicitly pass a loader, so that it can be safe on any version of PyYAML. |
Updates the PyYaml version to 5.1. Adds in YamlLoader as per yaml/pyyaml#292 Other incompatible changes were reviewed (yaml/pyyaml#265) and the yaml.Loader appears to the be only concern for now. [Resolves #665]
Updates the PyYaml version to 5.1. Adds in YamlLoader as per yaml/pyyaml#292 Other incompatible changes were reviewed (yaml/pyyaml#265) and the yaml.Loader appears to the be only concern for now. [Resolves #665]
And how it can be safer on any version of PyYAML if Loader.FullLoader was implemented recently? |
Updates the PyYaml version to 5.1. Adds in YamlLoader as per yaml/pyyaml#292 Other incompatible changes were reviewed (yaml/pyyaml#265) and the yaml.Loader appears to the be only concern for now. [Resolves #665]
I recently also encounter this warning, after some reading, I posted an answer for your question in StackOverflow, just copied the answer here: I think this warning is more like a notification & guidance to let the user know what is the PyYAML best practice in the future. Recall that: Explicit is better than implicit. Before version 5.1 (e.g. 4.1), the
At that time, there were only three available choice for
But there are still a lot of resources and tutorials prefer using And since PyYAML version 5.1, the
And a new
|
I just want my YAML loaded. I don't care about best practices, moral views of creators and other unrelated stuff. You made it more secure? Awesome, good job. But make changes unnoticeable: set securest loader by default. It's service library and it should make things done and not "educate users". And if you like to cite principles, here is one for you too: |
Flectra has a problem with pyyaml 5.1, which would not need to be. I just changed I would suggest some tests that test the interface of pyyaml as a whole, i.e. the interoperability of the functions, like I wonder whether semantic versioning is the right way to go at all. |
This has been fixed in the 5.2 release branch a while ago, but the release was blocked. |
We released 5.2: https://pypi.org/project/PyYAML/5.2/ |
Updates the PyYaml version to 5.1. Adds in YamlLoader as per yaml/pyyaml#292 Other incompatible changes were reviewed (yaml/pyyaml#265) and the yaml.Loader appears to the be only concern for now. [Resolves Sceptre#665]
@perlpunk Is there a way to silence this warning without changing the code or has it been fixed in any newer versions? I am currently using |
Here is my code:
This code leads to the following warning with PyYAML (5.1).
So I visited https://msg.pyyaml.org/load to see what this is about but I do not understand the need for this warning.
First, the documentation says,
Okay, that makes sense. In an earlier version, the original loader was unsafe. Further, it says,
So the current version uses
FullLoader
which is not unsafe. This is confirmed again in the document.If the current version that uses
FullLoader
is not unsafe, then why do we need theYAMLLoadWarning
at all?The text was updated successfully, but these errors were encountered: