From adce474cc1ba64428bcceca7d2faba272a16eeb8 Mon Sep 17 00:00:00 2001 From: chang-ning Date: Thu, 13 Sep 2018 21:25:32 +0800 Subject: [PATCH] add attr for csrf --- app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app.py b/app.py index 5b9fdcc0..bf788029 100644 --- a/app.py +++ b/app.py @@ -39,6 +39,11 @@ def find_key(token): } app = Flask(__name__) app.config["SECRET_KEY"] = os.urandom(16) +app.config["SESSION_COOKIE_NAME"] = "__Secure-session" +app.config["SESSION_COOKIE_SAMESITE"] = "Strict" +app.config["CSRF_COOKIE_NAME"] = "__Secure-csrf-token" +app.config["CSRF_COOKIE_HTTPONLY"] = True +app.config["CSRF_COOKIE_SECURE"] = True csrf = SeaSurf(app) talisman = Talisman(app, force_https=False, content_security_policy=csp) @@ -65,6 +70,7 @@ def index_redirection(): return send_from_directory(ROOT, "index.html") +@csrf.exempt @app.route("/.well-known/acme-challenge/") def acme(token): """Find the acme-key from environment variable."""