From ab7ea069de5cecf1c26af50996a26e1a7f86def4 Mon Sep 17 00:00:00 2001 From: John Perkins Date: Mon, 6 Oct 2014 16:24:57 -0500 Subject: [PATCH] Fix hostname regex pattern Current hostname_pattern regex complexity grows exponentially when given a string of just digits, which can be exploited to cause neutron-server to freeze. Change-Id: I886c6d883a9cb0acd9908495eec50bf0411d8ba8 Closes-bug: #1378450 --- neutron/api/v2/attributes.py | 4 ++-- neutron/tests/unit/test_attributes.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/neutron/api/v2/attributes.py b/neutron/api/v2/attributes.py index 04875890b22..8eb2c3a587d 100644 --- a/neutron/api/v2/attributes.py +++ b/neutron/api/v2/attributes.py @@ -537,8 +537,8 @@ def convert_to_list(data): return [data] -HOSTNAME_PATTERN = ("(?=^.{1,254}$)(^(?:(?!\d+\.|-)[a-zA-Z0-9_\-]" - "{1,63}(?