File tree Expand file tree Collapse file tree 4 files changed +38
-35
lines changed Expand file tree Collapse file tree 4 files changed +38
-35
lines changed Original file line number Diff line number Diff line change 1+ from hmac import compare_digest
2+
13from flask import Flask
24from flask import jsonify
35from flask import request
46from flask_sqlalchemy import SQLAlchemy
5- from werkzeug .security import safe_str_cmp
67
78from flask_jwt_extended import create_access_token
89from flask_jwt_extended import current_user
@@ -29,7 +30,7 @@ class User(db.Model):
2930
3031 # NOTE: In a real application make sure to properly hash and salt passwords
3132 def check_password (self , password ):
32- return safe_str_cmp (password , "password" )
33+ return compare_digest (password , "password" )
3334
3435
3536# Register a callback function that takes whatever object is passed in as the
Original file line number Diff line number Diff line change 22from datetime import datetime
33from datetime import timedelta
44from datetime import timezone
5+ from hmac import compare_digest
56
67import jwt
7- from werkzeug .security import safe_str_cmp
88
99from flask_jwt_extended .exceptions import CSRFError
1010from flask_jwt_extended .exceptions import JWTDecodeError
@@ -110,7 +110,7 @@ def _decode_jwt(
110110 if csrf_value :
111111 if "csrf" not in decoded_token :
112112 raise JWTDecodeError ("Missing claim: csrf" )
113- if not safe_str_cmp (decoded_token ["csrf" ], csrf_value ):
113+ if not compare_digest (decoded_token ["csrf" ], csrf_value ):
114114 raise CSRFError ("CSRF double submit tokens do not match" )
115115
116116 return decoded_token
Original file line number Diff line number Diff line change 11alabaster == 0.7.12
22appdirs == 1.4.4
3- Babel == 2.9.0
3+ Babel == 2.9.1
44black == 20.8b1
55bleach == 3.3.0
66certifi == 2020.12.5
7- cffi == 1.14.4
7+ cffi == 1.14.5
88cfgv == 3.2.0
99chardet == 4.0.0
10- click == 7.1.2
10+ click == 8.0.0
1111colorama == 0.4.4
12- cryptography == 3.3.2
12+ cryptography == 3.4.7
1313distlib == 0.3.1
14- docutils == 0.16
14+ docutils == 0.17.1
1515filelock == 3.0.12
16- Flask == 1.1.2
17- identify == 1.5.13
16+ Flask == 2.0.0
17+ identify == 2.2.4
1818idna == 2.10
1919imagesize == 1.2.0
20- itsdangerous == 1.1.0
20+ importlib-metadata == 4.0.1
21+ itsdangerous == 2.0.0
2122Jinja2 == 2.11.3
22- keyring == 21.8.0
23+ keyring == 23.0.1
2324MarkupSafe == 1.1.1
2425mypy-extensions == 0.4.3
25- nodeenv == 1.5 .0
26- packaging == 20.8
27- Pallets-Sphinx-Themes == 1.2.3
26+ nodeenv == 1.6 .0
27+ packaging == 20.9
28+ Pallets-Sphinx-Themes == 2.0.0
2829pathspec == 0.8.1
2930pkginfo == 1.7.0
3031pluggy == 0.13.1
31- pre-commit == 2.9.3
32+ pre-commit == 2.12.1
3233py == 1.10.0
3334pycparser == 2.20
34- Pygments == 2.7.4
35- PyJWT == 2.0.1
35+ Pygments == 2.9.0
36+ PyJWT == 2.1.0
3637pyparsing == 2.4.7
37- pytz == 2020.5
38- PyYAML == 5.4
39- readme-renderer == 28 .0
40- regex == 2020.11.13
38+ pytz == 2021.1
39+ PyYAML == 5.4.1
40+ readme-renderer == 29 .0
41+ regex == 2021.4.4
4142requests == 2.25.1
4243requests-toolbelt == 0.9.1
43- rfc3986 == 1.4 .0
44- six == 1.15 .0
45- snowballstemmer == 2.0 .0
46- Sphinx == 3.4.3
44+ rfc3986 == 1.5 .0
45+ six == 1.16 .0
46+ snowballstemmer == 2.1 .0
47+ Sphinx == 4.0.1
4748sphinxcontrib-applehelp == 1.0.2
4849sphinxcontrib-devhelp == 1.0.2
4950sphinxcontrib-htmlhelp == 1.0.3
5051sphinxcontrib-jsmath == 1.0.1
5152sphinxcontrib-qthelp == 1.0.3
5253sphinxcontrib-serializinghtml == 1.1.4
5354toml == 0.10.2
54- tox == 3.21 .1
55- tqdm == 4.56 .0
56- twine == 3.3.0
57- typed-ast == 1.4.2
58- typing-extensions == 3.7.4.3
55+ tox == 3.23 .1
56+ tqdm == 4.60 .0
57+ twine == 3.4.1
58+ typed-ast == 1.4.3
59+ typing-extensions == 3.10.0.0
5960urllib3 == 1.26.4
60- virtualenv == 20.3.1
61+ virtualenv == 20.4.6
6162webencodings == 0.5.1
62- Werkzeug == 1.0.1
63+ Werkzeug == 2.0.0
64+ zipp == 3.4.1
Original file line number Diff line number Diff line change 2727 platforms = "any" ,
2828 install_requires = [
2929 "Werkzeug>=0.14" , # Needed for SameSite cookie functionality
30- "Flask>=1.0,<2 .0" ,
30+ "Flask>=1.0,<3 .0" ,
3131 "PyJWT>=2.0,<3.0" ,
3232 ],
3333 extras_require = {"asymmetric_crypto" : ["cryptography>=3.0,<4.0" ]},
You can’t perform that action at this time.
0 commit comments