-
-
Notifications
You must be signed in to change notification settings - Fork 177
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 'yaml.safe_load' in 'load_yaml_from_docstring' #278
Comments
Thanks for the report! I think you're right re: using If you don't have time right now, I can take a look this weekend. |
Sorry, I had a look the other day because we had a warning from pyup.io/safety-ci and forgot to comment here. Here's my understanding (can be incorrect / incomplete): pyyaml has had two ways to load yaml docstrings for a while, the normal and the safe. The safe is meant to be used when loading yaml strings from unknown sources, because the normal allows code injection. Since users overlooked this and used the normal way to parse input data, they decided it was safer to make safe the default. This was done in 4.1 thanks to yaml/pyyaml#74. But then for some reasons, this lead to issues (yaml/pyyaml#187) and the 4.1 was sort of retracted and the commit was reverted (yaml/pyyaml#194) and they hope to find a nice way out for 4.2 (yaml/pyyaml#193). Meanwhile, a CVS was reported to account for the fact that default load is not safe, which had been the case since the beginning. It was a known issue, since And now, people using dependencies security issues tracking solutions get warnings because In our case, the docstring being parsed is not external data, it is written by the developer of the application, so I see no reason to use This said, I don't know exactly the downsides of using Yet, assuming I understood everything correctly, this would only serve the purpose of silencing a spurious security warning. I may be wrong and if it is simpler to use |
Good points, @lafrech . @lbeaufort Do you know if there are trade-offs with using |
Thanks for your replies, @sloria and @lafrech. Everything I've read has indicated that it's best to use |
From my quick search through the issues @lafrech posted and some other sources, there doesn't appear to be any downside to using @lbeaufort Would you like to send the PR? |
@sloria sounds good! I will put one in today. |
Hi there! 👋Thanks for providing a great project.
Because
yaml.load()
has known security issues, would it be feasible to use the existingyaml.safe_load()
option instead ofyaml.load()
here forload_yaml_from_docstring
? I'm happy to put in a PR if you agree. It looks like Ansible has been using only yaml.safe_load() since v1.1.It doesn't look like there's been much activity by PyYAML to move forward with making
load()
safe by default. Here is the pending PyYAML 4.2 release plan: yaml/pyyaml#193The PyYAML security vulnerability is being flagged for our FEC API.
Please let me know if you have any questions, and thanks!
Laura
The text was updated successfully, but these errors were encountered: