From a6720ef77285f4bed0f49e6c57dfce4bb9f704d2 Mon Sep 17 00:00:00 2001
From: "pixeebot[bot]" <104101892+pixeebot[bot]@users.noreply.github.com>
Date: Sun, 10 Aug 2025 03:28:38 +0000
Subject: [PATCH] Use Safe Parameters in `flask` Response `set_cookie` Call
---
.../d_using_flask/a_simple_apps/d_set_cookies.py | 2 +-
.../d_using_flask/h_blueprints/f_blueprints.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/python3/16_Web_Services/f_web_application/d_using_flask/a_simple_apps/d_set_cookies.py b/python3/16_Web_Services/f_web_application/d_using_flask/a_simple_apps/d_set_cookies.py
index 2d4b3d93..e0a1209c 100644
--- a/python3/16_Web_Services/f_web_application/d_using_flask/a_simple_apps/d_set_cookies.py
+++ b/python3/16_Web_Services/f_web_application/d_using_flask/a_simple_apps/d_set_cookies.py
@@ -7,7 +7,7 @@
def index():
# return '
Hello World!
'
response = make_response("This document carries a cookie!
")
- response.set_cookie("answer", "42")
+ response.set_cookie("answer", "42", secure=True, httponly=True, samesite='Lax')
return response
diff --git a/python3/16_Web_Services/f_web_application/d_using_flask/h_blueprints/f_blueprints.py b/python3/16_Web_Services/f_web_application/d_using_flask/h_blueprints/f_blueprints.py
index adaa6b5e..05fd9b7d 100644
--- a/python3/16_Web_Services/f_web_application/d_using_flask/h_blueprints/f_blueprints.py
+++ b/python3/16_Web_Services/f_web_application/d_using_flask/h_blueprints/f_blueprints.py
@@ -40,7 +40,7 @@ def logout():
def index():
# return 'Hello World!
'
response = make_response("This document carries a cookie!
")
- response.set_cookie("answer", "42")
+ response.set_cookie("answer", "42", secure=True, httponly=True, samesite='Lax')
return response