File tree 4 files changed +38
-35
lines changed
4 files changed +38
-35
lines changed Original file line number Diff line number Diff line change
1
+ from hmac import compare_digest
2
+
1
3
from flask import Flask
2
4
from flask import jsonify
3
5
from flask import request
4
6
from flask_sqlalchemy import SQLAlchemy
5
- from werkzeug .security import safe_str_cmp
6
7
7
8
from flask_jwt_extended import create_access_token
8
9
from flask_jwt_extended import current_user
@@ -29,7 +30,7 @@ class User(db.Model):
29
30
30
31
# NOTE: In a real application make sure to properly hash and salt passwords
31
32
def check_password (self , password ):
32
- return safe_str_cmp (password , "password" )
33
+ return compare_digest (password , "password" )
33
34
34
35
35
36
# Register a callback function that takes whatever object is passed in as the
Original file line number Diff line number Diff line change 2
2
from datetime import datetime
3
3
from datetime import timedelta
4
4
from datetime import timezone
5
+ from hmac import compare_digest
5
6
6
7
import jwt
7
- from werkzeug .security import safe_str_cmp
8
8
9
9
from flask_jwt_extended .exceptions import CSRFError
10
10
from flask_jwt_extended .exceptions import JWTDecodeError
@@ -110,7 +110,7 @@ def _decode_jwt(
110
110
if csrf_value :
111
111
if "csrf" not in decoded_token :
112
112
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 ):
114
114
raise CSRFError ("CSRF double submit tokens do not match" )
115
115
116
116
return decoded_token
Original file line number Diff line number Diff line change 1
1
alabaster == 0.7.12
2
2
appdirs == 1.4.4
3
- Babel == 2.9.0
3
+ Babel == 2.9.1
4
4
black == 20.8b1
5
5
bleach == 3.3.0
6
6
certifi == 2020.12.5
7
- cffi == 1.14.4
7
+ cffi == 1.14.5
8
8
cfgv == 3.2.0
9
9
chardet == 4.0.0
10
- click == 7.1.2
10
+ click == 8.0.0
11
11
colorama == 0.4.4
12
- cryptography == 3.3.2
12
+ cryptography == 3.4.7
13
13
distlib == 0.3.1
14
- docutils == 0.16
14
+ docutils == 0.17.1
15
15
filelock == 3.0.12
16
- Flask == 1.1.2
17
- identify == 1.5.13
16
+ Flask == 2.0.0
17
+ identify == 2.2.4
18
18
idna == 2.10
19
19
imagesize == 1.2.0
20
- itsdangerous == 1.1.0
20
+ importlib-metadata == 4.0.1
21
+ itsdangerous == 2.0.0
21
22
Jinja2 == 2.11.3
22
- keyring == 21.8.0
23
+ keyring == 23.0.1
23
24
MarkupSafe == 1.1.1
24
25
mypy-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
28
29
pathspec == 0.8.1
29
30
pkginfo == 1.7.0
30
31
pluggy == 0.13.1
31
- pre-commit == 2.9.3
32
+ pre-commit == 2.12.1
32
33
py == 1.10.0
33
34
pycparser == 2.20
34
- Pygments == 2.7.4
35
- PyJWT == 2.0.1
35
+ Pygments == 2.9.0
36
+ PyJWT == 2.1.0
36
37
pyparsing == 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
41
42
requests == 2.25.1
42
43
requests-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
47
48
sphinxcontrib-applehelp == 1.0.2
48
49
sphinxcontrib-devhelp == 1.0.2
49
50
sphinxcontrib-htmlhelp == 1.0.3
50
51
sphinxcontrib-jsmath == 1.0.1
51
52
sphinxcontrib-qthelp == 1.0.3
52
53
sphinxcontrib-serializinghtml == 1.1.4
53
54
toml == 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
59
60
urllib3 == 1.26.4
60
- virtualenv == 20.3.1
61
+ virtualenv == 20.4.6
61
62
webencodings == 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 27
27
platforms = "any" ,
28
28
install_requires = [
29
29
"Werkzeug>=0.14" , # Needed for SameSite cookie functionality
30
- "Flask>=1.0,<2 .0" ,
30
+ "Flask>=1.0,<3 .0" ,
31
31
"PyJWT>=2.0,<3.0" ,
32
32
],
33
33
extras_require = {"asymmetric_crypto" : ["cryptography>=3.0,<4.0" ]},
You can’t perform that action at this time.
0 commit comments