From b8286c829a9c248624eb9e9867d7e23e5e7bdba2 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Mon, 21 Mar 2022 22:40:11 +0100 Subject: [PATCH] Adding CSRF protection Disable during tests --- changedetectionio/__init__.py | 4 ++++ changedetectionio/templates/edit.html | 1 + changedetectionio/templates/import.html | 1 + changedetectionio/templates/login.html | 1 + changedetectionio/templates/scrub.html | 1 + changedetectionio/templates/settings.html | 1 + changedetectionio/templates/watch-overview.html | 1 + changedetectionio/tests/conftest.py | 3 +++ changedetectionio/tests/test_backend.py | 1 + 9 files changed, 14 insertions(+) diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index 860625870..f887c05cf 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -35,6 +35,7 @@ from flask import ( url_for, ) from flask_login import login_required +from flask_wtf import CSRFProtect from changedetectionio import html_tools @@ -72,6 +73,9 @@ app.config['LOGIN_DISABLED'] = False # Disables caching of the templates app.config['TEMPLATES_AUTO_RELOAD'] = True +csrf = CSRFProtect() +csrf.init_app(app) + notification_debug_log=[] def init_app_secret(datastore_path): diff --git a/changedetectionio/templates/edit.html b/changedetectionio/templates/edit.html index 0f10c8fa1..74d41725c 100644 --- a/changedetectionio/templates/edit.html +++ b/changedetectionio/templates/edit.html @@ -19,6 +19,7 @@
+
diff --git a/changedetectionio/templates/import.html b/changedetectionio/templates/import.html index 943e580d6..e9376fc46 100644 --- a/changedetectionio/templates/import.html +++ b/changedetectionio/templates/import.html @@ -4,6 +4,7 @@
+
Enter one URL per line, and optionally add tags for each URL after a space, delineated by comma (,): diff --git a/changedetectionio/templates/login.html b/changedetectionio/templates/login.html index 32259930d..2e24ddb4b 100644 --- a/changedetectionio/templates/login.html +++ b/changedetectionio/templates/login.html @@ -4,6 +4,7 @@