From 525d42a74df2255610c20ab3a4b51df0bd7c9081 Mon Sep 17 00:00:00 2001 From: "Ing. Jan KRCMAR" Date: Tue, 6 Sep 2016 13:01:45 +0200 Subject: [PATCH] instances/views.py check instance name, alloweed r^[a-zA-Z0-9-]+$ --- instances/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/instances/views.py b/instances/views.py index 028891c..d0f4dc1 100644 --- a/instances/views.py +++ b/instances/views.py @@ -3,6 +3,7 @@ import time import json import socket import crypt +import re from string import letters, digits from random import choice from bisect import insort @@ -610,6 +611,9 @@ def instance(request, compute_id, vname): elif check_instance: msg = _("Instance '%s' already exists!" % clone_data['name']) error_messages.append(msg) + elif not re.match(r'^[a-zA-Z0-9-]+$', clone_data['name']): + msg = _("Instance name '%s' contains invalid characters!" % clone_data['name']) + error_messages.append(msg) else: for post in request.POST: clone_data[post] = request.POST.get(post, '')