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

PyYAML Deprecation of Full Loader method #34

Closed
burncycl opened this issue Mar 21, 2019 · 4 comments
Closed

PyYAML Deprecation of Full Loader method #34

burncycl opened this issue Mar 21, 2019 · 4 comments

Comments

@burncycl
Copy link

burncycl commented Mar 21, 2019

Hello,

The j2cli 0.3.5.post1, Jinja2 2.10 is broken, as it calls a deprecated and vulnerable method (FullLoader) in PyYAML.

Please reference:

Traceback (most recent call last):
File "./venv/bin/j2", line 10, in
sys.exit(main())
File "/builds/ansible/venv/lib/python3.6/site-packages/j2cli/cli.py", line 175, in main
sys.argv[1:]
File "/builds/ansible/venv/lib/python3.6/site-packages/j2cli/cli.py", line 141, in render_command
args.import_env
File "/builds/ansible/venv/lib/python3.6/site-packages/j2cli/context.py", line 192, in read_context_data
context = FORMATSformat
File "/builds/ansible/venv/lib/python3.6/site-packages/j2cli/context.py", line 88, in _parse_yaml
return yaml.load(data_string, Loader=yaml.FullLoader)
AttributeError: module 'yaml' has no attribute 'FullLoader'

@kolypto
Copy link
Owner

kolypto commented Mar 21, 2019

Wow I messed up! Sorry :)
I removed the new release from pypi for now. Will fix it in a day or two, and will make sure I understand what I'm doing :D

@burncycl
Copy link
Author

burncycl commented Mar 21, 2019

We import j2cli in a virtual environment at runtime. That said, I modified our requirements.txt to reference the tagged fix. This resolved the issue. Albiet a hacky temporary fix.
py3_requirements.txt

#j2cli[yaml] # Temporarily deprecated due to security issue.
git+git://github.com/kolypto/j2cli.git@v0.3.6
PyYAML==5.1

Thanks for your software and support!

@kolypto
Copy link
Owner

kolypto commented Mar 21, 2019

Fixed in 0.3.6.post1.
I hope it works for you now! :)

@kolypto kolypto closed this as completed Mar 21, 2019
@burncycl
Copy link
Author

burncycl commented Mar 22, 2019

Nuked the virtual enviroment, and remade it with just the following:

py3_requirements.txt

j2cli[yaml]

Works!

Can verify the proper version is installed from within the sourced virtual environment:

(venv) $ j2 --version
j2cli 0.3.6.post1, Jinja2 2.10

Thanks again for your support! Have a great one!

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

No branches or pull requests

2 participants