From 33664e472ad279bca97d51644cf011bed151590b 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 893d0446d2..1edcb7d0b5 100644 --- a/neutron/api/v2/attributes.py +++ b/neutron/api/v2/attributes.py @@ -538,8 +538,8 @@ def convert_to_list(data): return [data] -HOSTNAME_PATTERN = ("(?=^.{1,254}$)(^(?:(?!\d+\.|-)[a-zA-Z0-9_\-]" - "{1,63}(?