From 990af9a211f7505c7d08f2ecac97b43a1998b414 Mon Sep 17 00:00:00 2001 From: Conor Holden Date: Tue, 16 Jul 2024 11:38:47 +0200 Subject: [PATCH] :wrench:[#45] add session and CSRF samesite option --- open_api_framework/conf/base.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/open_api_framework/conf/base.py b/open_api_framework/conf/base.py index 85df04a..31ea865 100644 --- a/open_api_framework/conf/base.py +++ b/open_api_framework/conf/base.py @@ -416,8 +416,16 @@ # SESSION_COOKIE_SECURE = IS_HTTPS SESSION_COOKIE_HTTPONLY = True +# set same-site attribute to None to allow emdedding the SDK for making cross domain +# requests. +SESSION_COOKIE_SAMESITE = config( + "SESSION_COOKIE_SAMESITE", default="None" if IS_HTTPS else "Lax" +) CSRF_COOKIE_SECURE = IS_HTTPS +CSRF_COOKIE_SAMESITE = config( + "CSRF_COOKIE_SAMESITE", default="None" if IS_HTTPS else "Lax" +) X_FRAME_OPTIONS = "DENY"