diff --git a/changedetectionio/model/Watch.py b/changedetectionio/model/Watch.py index a2e38ce1..0898c98a 100644 --- a/changedetectionio/model/Watch.py +++ b/changedetectionio/model/Watch.py @@ -89,6 +89,10 @@ class model(watch_base): if ready_url.startswith('source:'): ready_url=ready_url.replace('source:', '') + + # Also double check it after any Jinja2 formatting just incase + if not is_safe_url(ready_url): + return 'DISABLED' return ready_url def clear_watch(self): diff --git a/changedetectionio/processors/__init__.py b/changedetectionio/processors/__init__.py index 7586d4c7..fbe62937 100644 --- a/changedetectionio/processors/__init__.py +++ b/changedetectionio/processors/__init__.py @@ -31,15 +31,15 @@ class difference_detection_processor(): from requests.structures import CaseInsensitiveDict - # Protect against file:// access - if re.search(r'^file://', self.watch.get('url', '').strip(), re.IGNORECASE): + url = self.watch.link + + # Protect against file:// access, check the real "link" without any meta "source:" etc prepended. + if re.search(r'^file://', url, re.IGNORECASE): if not strtobool(os.getenv('ALLOW_FILE_URI', 'false')): raise Exception( "file:// type access is denied for security reasons." ) - url = self.watch.link - # Requests, playwright, other browser via wss:// etc, fetch_extra_something prefer_fetch_backend = self.watch.get('fetch_backend', 'system')