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

feat: Use PyYAML's safe_load for better security #1383

Merged
merged 5 commits into from Mar 29, 2021

Conversation

matthewfeickert
Copy link
Member

@matthewfeickert matthewfeickert commented Mar 26, 2021

Description

In light of a discussion, motivated by PR #1378, with @alexander-held, @henryiii, and @jpivarski about the security risk of PyYAML, use yaml.safe_load over yaml.full_load in pyhf.utils.options_from_eqdelimstring.

Checklist Before Requesting Reviewer

  • Tests are passing
  • "WIP" removed from the title of the pull request
  • Selected an Assignee for the PR to be responsible for the log summary

Before Merging

For the PR Assignees:

  • Summarize commit messages into a comprehensive review of the PR
* Use yaml.safe_load over yaml.full_load in pyhf.utils.options_from_eqdelimstring
* Further safeguards against things like CVE-2020-14343
   - c.f. PR #1378

@matthewfeickert matthewfeickert added the feat/enhancement New feature or request label Mar 26, 2021
@matthewfeickert matthewfeickert self-assigned this Mar 26, 2021
@matthewfeickert matthewfeickert added this to In progress in v0.6.2 via automation Mar 26, 2021
@matthewfeickert
Copy link
Member Author

For additional context on yaml.FullLoader vs. yaml.SafeLoader @alexander-held pointed me to yaml/pyyaml#265 👍

@codecov
Copy link

codecov bot commented Mar 26, 2021

Codecov Report

Merging #1383 (e0461b4) into master (99212ea) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1383   +/-   ##
=======================================
  Coverage   97.53%   97.53%           
=======================================
  Files          63       63           
  Lines        3808     3808           
  Branches      538      538           
=======================================
  Hits         3714     3714           
  Misses         55       55           
  Partials       39       39           
Flag Coverage Δ
contrib 24.18% <0.00%> (ø)
unittests 97.53% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/pyhf/utils.py 96.82% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 99212ea...e0461b4. Read the comment docs.

@matthewfeickert
Copy link
Member Author

This might also reduce the dependabot PRs that we get. :/

@matthewfeickert matthewfeickert merged commit df6f53e into master Mar 29, 2021
v0.6.2 automation moved this from In progress to Done Mar 29, 2021
@matthewfeickert matthewfeickert deleted the fix/use-safe-loader branch March 29, 2021 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat/enhancement New feature or request
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants