mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-22 20:44:55 +00:00
web/lib/validation.py: disallow localhost.*
This commit is contained in:
parent
f34a78c9ab
commit
893d84c08f
@ -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…
x
Reference in New Issue
Block a user