mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-11-27 20:03:28 +00:00
Security - Possible stored XSS in watch list - Only permit HTTP/HTTP/FTP by default - override with env var SAFE_PROTOCOL_REGEX (#1359)
This commit is contained in:
@@ -232,12 +232,17 @@ class validateURL(object):
|
||||
|
||||
def __call__(self, form, field):
|
||||
import validators
|
||||
|
||||
try:
|
||||
validators.url(field.data.strip())
|
||||
except validators.ValidationFailure:
|
||||
message = field.gettext('\'%s\' is not a valid URL.' % (field.data.strip()))
|
||||
raise ValidationError(message)
|
||||
|
||||
from .model.Watch import is_safe_url
|
||||
if not is_safe_url(field.data):
|
||||
raise ValidationError('Watch protocol is not permitted by SAFE_PROTOCOL_REGEX')
|
||||
|
||||
|
||||
class ValidateListRegex(object):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user