Validate provisioner userdata with SafeLoader

Given the issues with FullLoader and its eventual deprecation, just use
SafeLoader instead. Any well-formatted Userdata document should conform.
This commit is contained in:
Joshua Boniface 2020-12-15 00:30:20 -05:00
parent 3705daff43
commit 37c3b4ef80
1 changed files with 2 additions and 2 deletions

View File

@ -3320,7 +3320,7 @@ def provisioner_userdata_add(name, filename):
userdata = filename.read()
filename.close()
try:
yaml.load(userdata, Loader=yaml.FullLoader)
yaml.load(userdata, Loader=yaml.SafeLoader)
except Exception as e:
click.echo("Error: Userdata document is malformed")
cleanup(False, e)
@ -3397,7 +3397,7 @@ def provisioner_userdata_modify(name, filename, editor):
filename.close()
try:
yaml.load(userdata, Loader=yaml.FullLoader)
yaml.load(userdata, Loader=yaml.SafeLoader)
except Exception as e:
click.echo("Error: Userdata document is malformed")
cleanup(False, e)