Browse Source

web/lib/validation.py: disallow localhost.*

pull/1/head
Hidden Z 14 years ago
parent
commit
893d84c08f
  1. 3
      web/lib/validation.py

3
web/lib/validation.py

@ -53,6 +53,9 @@ def validate_hostname(data):
# Certain hostnames reserved for project use are not allowed # Certain hostnames reserved for project use are not allowed
if re.search(r'(^|\.)(proxy|router|console|b32|b64)$', namepart): if re.search(r'(^|\.)(proxy|router|console|b32|b64)$', namepart):
raise forms.ValidationError('Trying to use reserved hostname') raise forms.ValidationError('Trying to use reserved hostname')
# Block various localhost.* in addition
if re.match(r'^localhost($|\..*$)', namepart):
raise forms.ValidationError('localhost.* not allowed')
return data return data

Loading…
Cancel
Save