Fix handling of invalid IP networks
@@ -35,7 +35,7 @@ USER_AGENT = 'sentry/{version} (https://getsentry.com)'.format(
)
DISALLOWED_IPS = {
- ipaddress.ip_network(six.text_type(i))
+ ipaddress.ip_network(six.text_type(i), strict=False)
for i in settings.SENTRY_DISALLOWED_IPS
}
@@ -179,7 +179,7 @@ def is_valid_ip(ip_address, project):
return False
# Check to make sure it's actually a range before
- if '/' in addr and ipaddress.ip_address(six.text_type(ip_address)) in ipaddress.ip_network(six.text_type(addr)):
+ if '/' in addr and ipaddress.ip_address(six.text_type(ip_address)) in ipaddress.ip_network(six.text_type(addr), strict=False):
return True
@@ -12,7 +12,7 @@ def validate_ip(value, required=True):
return
# will raise a ValueError
- ipaddress.ip_network(six.text_type(value))
+ ipaddress.ip_network(six.text_type(value), strict=False)
return value