Skip to content

Commit

Permalink
Always use a Loader in yaml.load (#745)
Browse files Browse the repository at this point in the history
A recent change within pyyaml 6.0 has enforce use of a Loader argument
to yaml.load [1].

To comply, Bandit will use yaml.load with a Loader always. The plugin
to check for unsafe loaders of yaml module still applies.

[1] yaml/pyyaml#561

Closes #744

Signed-off-by: Eric Brown <browne@vmware.com>
  • Loading branch information
ericwb committed Oct 24, 2021
1 parent 44f5c41 commit aac3f16
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/unit/formatters/test_yaml.py
Expand Up @@ -70,7 +70,7 @@ def test_report(self, get_issue_list):
self.issue.confidence)

with open(self.tmp_fname) as f:
data = yaml.load(f.read())
data = yaml.load(f.read(), Loader=yaml.SafeLoader)
self.assertIsNotNone(data['generated_at'])
self.assertEqual(self.tmp_fname, data['results'][0]['filename'])
self.assertEqual(self.issue.severity,
Expand Down

0 comments on commit aac3f16

Please sign in to comment.