Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(self):
auth_view(self.request)
if 'command' not in self.request.POST:
raise pyramid.httpexceptions.HTTPBadRequest("The POST argument 'command' is required")
command = shlex.split(self.request.POST['command'])
if command[0] not in self.gene.config.get('server', {}).get('allowed_commands', [
'generate_tiles', 'generate_controller'
]):
raise pyramid.httpexceptions.HTTPBadRequest(
"The given executable '{}' is not allowed".format(command[0])
)
lt = LogThread(command)
lt.start()
return pyramid.httpexceptions.HTTPFound(self.request.route_url('admin'))