Skip to content

Commit a6720ef

Browse files
Use Safe Parameters in flask Response set_cookie Call
1 parent 03f4992 commit a6720ef

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

python3/16_Web_Services/f_web_application/d_using_flask/a_simple_apps/d_set_cookies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
def index():
88
# return '<h1>Hello World!</h1>'
99
response = make_response("<h1>This document carries a cookie!</h1>")
10-
response.set_cookie("answer", "42")
10+
response.set_cookie("answer", "42", secure=True, httponly=True, samesite='Lax')
1111
return response
1212

1313

python3/16_Web_Services/f_web_application/d_using_flask/h_blueprints/f_blueprints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def logout():
4040
def index():
4141
# return '<h1>Hello World!</h1>'
4242
response = make_response("<h1>This document carries a cookie!</h1>")
43-
response.set_cookie("answer", "42")
43+
response.set_cookie("answer", "42", secure=True, httponly=True, samesite='Lax')
4444
return response
4545

4646

0 commit comments

Comments
 (0)