diff --git a/changedetectionio/processors/__init__.py b/changedetectionio/processors/__init__.py index 92ba46a8..944a0085 100644 --- a/changedetectionio/processors/__init__.py +++ b/changedetectionio/processors/__init__.py @@ -1,6 +1,7 @@ from abc import abstractmethod import os import hashlib +import re from copy import deepcopy from changedetectionio import content_fetcher @@ -18,6 +19,12 @@ class difference_detection_processor(): self.datastore = datastore self.watch = deepcopy(self.datastore.data['watching'].get(watch_uuid)) + # Protect against file:// access + if re.search(r'^file', self.watch.get('url', ''), re.IGNORECASE) and not os.getenv('ALLOW_FILE_URI', False): + raise Exception( + "file:// type access is denied for security reasons." + ) + def call_browser(self): diff --git a/changedetectionio/processors/text_json_diff.py b/changedetectionio/processors/text_json_diff.py index 8e070fa7..8136374b 100644 --- a/changedetectionio/processors/text_json_diff.py +++ b/changedetectionio/processors/text_json_diff.py @@ -44,12 +44,6 @@ class perform_site_check(difference_detection_processor): if not watch: raise Exception("Watch no longer exists.") - # Protect against file:// access - if re.search(r'^file', watch.get('url', ''), re.IGNORECASE) and not os.getenv('ALLOW_FILE_URI', False): - raise Exception( - "file:// type access is denied for security reasons." - ) - # Unset any existing notification error update_obj = {'last_notification_error': False, 'last_error': False}