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

Replace yaml.load with yaml.safe_load #644

Closed
wants to merge 2 commits into from

Conversation

FabioRosado
Copy link
Member

Description

I promised to have a look at this safe_load issue, today I have been cracking my head to try and figure out why safe_load doesn't seem to work as expected. I made some changes to the code (added yaml.SafeLoader.add_constructor to the !include constructor) but when the change was implemented on the ENVVARs the test failed no matter what I tried.

I'm raising this PR to ask for help. I tried to google and go around but seems that pyyaml is a mysterious beast, or at least safe_load is. I can't figure out why the envvar constructor is failing - mainly what happens is that the environmental variable isn't translated from the pattern $ENVVAR. The test fails because the value it expected to get was test and instead it got $ENVVAR.

Not sure how to go tackle this issue. Perhaps the whole envvar function needs to be changed into something else?

Fixes #580

Status

READY | UNDER DEVELOPMENT | ON HOLD

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

  • Tox - all green but envvar test
  • Ran opsdroid - all ok
  • Ran skill-chat with !included yaml file - opsdroid replied correctly

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@stale
Copy link

stale bot commented Oct 23, 2018

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 23, 2018
@stale stale bot closed this Oct 30, 2018
@FabioRosado FabioRosado reopened this Oct 30, 2018
@stale stale bot closed this Nov 6, 2018
@FabioRosado FabioRosado deleted the safe_load branch December 18, 2018 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Potential vulnerability with yaml.loader
1 participant