Skip to content
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

pyaml library updated, loader needs Loader= parameter #326

Closed
frosencrantz opened this issue Jul 31, 2019 · 9 comments
Closed

pyaml library updated, loader needs Loader= parameter #326

frosencrantz opened this issue Jul 31, 2019 · 9 comments

Comments

@frosencrantz
Copy link
Contributor

The pyyaml library has changed since the yaml loader was last updated. There is a new requirement for adding Loader= parameter.

/usr/lib/python3.6/site-packages/visidata/loaders/yaml.py:13: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.

@anjakefala
Copy link
Collaborator

Hi @frosencrantz, thanks for letting me know about this!

For now, I am going to set an upper limit on the version of the pyaml library that we support. (I should have been doing the same for all of our dependencies.)

I have also added looking into this more deeply, and possibly modifying the yaml loader code into my queue. If anyone wants to take the reigns on this investigation (which minimum versions of pyaml supports the Loader= parameter being the main question), they are welcome to.

anjakefala added a commit that referenced this issue Aug 1, 2019
@anjakefala
Copy link
Collaborator

I ended up making the code change and bumping the minimum PyYAML version!

@tsibley
Copy link
Contributor

tsibley commented Jun 17, 2020

I'm looking at the YAML loader because I'd like to add support for YAML files with multiple documents, and I'm wondering why the full loader is used instead of the safe loader? Ideally, I'd like to be able to trust vd to open files from unknown sources without verifying them first another way.

@anjakefala
Copy link
Collaborator

There was not a thoughtful reason behind that decision. If you would like to open a PR with a modification to use the safe loader, that would be welcome!

@tsibley
Copy link
Contributor

tsibley commented Jun 17, 2020

@anjakefala Great! I submitted #600. Thanks for your quick reply!

@anjakefala
Copy link
Collaborator

@tsibley If someone requests the full loader, or if @saulpw things it would be a good idea, we can negotiate adding an --unsafe option. But the default should be safe because VisiData is often used as a first-pass tool. Thanks for writing up the change so quickly!

@saulpw
Copy link
Owner

saulpw commented Jun 17, 2020

Of course it should be yaml_unsafe, unless we wanted to combine it with safety_first somehow (but that's False/unsafe by default, and I agree, this should be safe by default as it's more of a security rather than data issue).

@anjakefala
Copy link
Collaborator

I do not think we want to combine it with safety_first for the reasons you outlined.

My only hesitation with yaml_unsafe was knowing that you have a hesitance with option-deluge. If it is one that you would like to have, I can add it!

@saulpw
Copy link
Owner

saulpw commented Jun 17, 2020

Let's not add it proactively, but if someone desires the unsafe behavior, then we can add it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants