Skip to content

Commit 307b36f

Browse files
committed
unset_jwt_cookies now removes csrf tokesn too
Practically, there isn't any security concerns by leaving them set. We don't do any verification on these cookies when they are sent to a protected endpoint, and if we generated new tokens the values in those cookies would be updated. This is just to make sure we are cleaning up after ourselfs (refs #34)
1 parent 45628cf commit 307b36f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

flask_jwt_extended/utils.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,4 +455,19 @@ def unset_jwt_cookies(response):
455455
secure=get_cookie_secure(),
456456
httponly=True,
457457
path=get_access_cookie_path())
458+
459+
if get_cookie_csrf_protect():
460+
response.set_cookie(get_refresh_csrf_cookie_name(),
461+
value='',
462+
expires=0,
463+
secure=get_cookie_secure(),
464+
httponly=False,
465+
path='/')
466+
response.set_cookie(get_access_csrf_cookie_name(),
467+
value='',
468+
expires=0,
469+
secure=get_cookie_secure(),
470+
httponly=False,
471+
path='/')
472+
458473
return response

0 commit comments

Comments
 (0)