Merge "Avoid false positives of Jinja2 in Bandit scan"

This commit is contained in:
Jenkins 2017-07-19 20:15:34 +00:00 committed by Gerrit Code Review
commit 48cb13e501
2 changed files with 5 additions and 3 deletions

View File

@ -87,7 +87,8 @@ class XVPConsoleProxy(object):
conf_data = {'multiplex_port': CONF.xvp.console_xvp_multiplex_port, conf_data = {'multiplex_port': CONF.xvp.console_xvp_multiplex_port,
'pools': pools} 'pools': pools}
tmpl_path, tmpl_file = os.path.split(CONF.injected_network_template) tmpl_path, tmpl_file = os.path.split(CONF.injected_network_template)
env = jinja2.Environment(loader=jinja2.FileSystemLoader(tmpl_path)) env = jinja2.Environment( # nosec
loader=jinja2.FileSystemLoader(tmpl_path)) # nosec
env.filters['pass_encode'] = self.fix_console_password env.filters['pass_encode'] = self.fix_console_password
template = env.get_template(tmpl_file) template = env.get_template(tmpl_file)
self._write_conf(template.render(conf_data)) self._write_conf(template.render(conf_data))

View File

@ -155,7 +155,8 @@ def get_injected_network_template(network_info, template=None,
return return
tmpl_path, tmpl_file = os.path.split(template) tmpl_path, tmpl_file = os.path.split(template)
env = jinja2.Environment(loader=jinja2.FileSystemLoader(tmpl_path), env = jinja2.Environment( # nosec
loader=jinja2.FileSystemLoader(tmpl_path), # nosec
trim_blocks=True) trim_blocks=True)
template = env.get_template(tmpl_file) template = env.get_template(tmpl_file)
return template.render({'interfaces': nets, return template.render({'interfaces': nets,