-
Notifications
You must be signed in to change notification settings - Fork 182
Use yaml.safe_load and yaml.safe_dump #111
Use yaml.safe_load and yaml.safe_dump #111
Conversation
Codecov Report
@@ Coverage Diff @@
## master #111 +/- ##
=======================================
Coverage 92.04% 92.04%
=======================================
Files 13 13
Lines 1182 1182
=======================================
Hits 1088 1088
Misses 94 94
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: xvello, yliaog The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
When loading a
kubeconfig
file, the library uses the unsafeyaml.load
method, which is vulnerable to arbitrary code execution, as described in https://nvd.nist.gov/vuln/detail/CVE-2017-18342This PR makes sure we use the
safe_load
method. For consistency, I also change test to use thesafe_dump
method, although there is probably no risk there.The use case for the unsafe
load
is to load data in arbitrary python classes, but in this case we unmarshal the file in a classic dict.safe_load
has what we need for this use case.