Skip to content

Commit b2a02af

Browse files
committed
HP-1842 Update python-jose to version 3.3.0
Move python-jose dependency to requirements.in, as it's not just a development dependency. It's needed by the actual server too; via django-helusers, but still. Use the `cryptography` backend with python-jose, which is the recommended choice. Python-jose depends on `ecdsa`, `pyasn1` and `rsa` packages, but it doesn't need them when the `cryptography` backend is used. Those packages are excluded from the requirements.txt file by using --unsafe-package arguments with pip-compile. This works for now, since python-jose is the ONLY package that depends on those packages. If any other package update needs any of those other dependencies, then they need to be allwed again. There is a proposal to pip-tools [1] to provide a better tool for this kind of use case, but it hasn't been accepted. In order to not get those unnecessary dependencies installed anyways, the --no-deps argument needs to be given to `pip`. This was added to Dockerfile. [1] jazzband/pip-tools#1645
1 parent 9a9462f commit b2a02af

File tree

5 files changed

+18
-36
lines changed

5 files changed

+18
-36
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN apt-install.sh \
1818
python3-gdal \
1919
postgresql-client \
2020
&& pip install -U pip \
21-
&& pip install --no-cache-dir -r /app/requirements.txt \
21+
&& pip install --no-cache-dir --no-deps -r /app/requirements.txt \
2222
&& pip install --no-cache-dir -r /app/requirements-prod.txt \
2323
&& apt-cleanup.sh build-essential pkg-config
2424

requirements-dev.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pytest
1717
pytest-cov
1818
pytest-django
1919
pytest-mock
20-
python-jose
2120
requests-mock
2221
pytest-factoryboy
2322
rope

requirements-dev.txt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ decorator==4.4.2
4242
# traitlets
4343
distlib==0.3.0
4444
# via virtualenv
45-
ecdsa==0.16.1
46-
# via
47-
# -c requirements.txt
48-
# python-jose
4945
entrypoints==0.3
5046
# via flake8
5147
exceptiongroup==1.0.4
@@ -68,10 +64,6 @@ flake8-polyfill==1.0.2
6864
# via pep8-naming
6965
freezegun==0.3.15
7066
# via -r requirements-dev.in
71-
future==0.17.1
72-
# via
73-
# -c requirements.txt
74-
# python-jose
7567
identify==1.4.15
7668
# via pre-commit
7769
idna==2.9
@@ -140,10 +132,6 @@ prompt-toolkit==3.0.5
140132
# via ipython
141133
ptyprocess==0.6.0
142134
# via pexpect
143-
pyasn1==0.4.5
144-
# via
145-
# -c requirements.txt
146-
# rsa
147135
pycodestyle==2.5.0
148136
# via
149137
# autopep8
@@ -177,10 +165,6 @@ python-dateutil==2.8.1
177165
# via
178166
# faker
179167
# freezegun
180-
python-jose==3.0.1
181-
# via
182-
# -c requirements.txt
183-
# -r requirements-dev.in
184168
pyyaml==5.4.1
185169
# via
186170
# -c requirements.txt
@@ -193,17 +177,11 @@ requests-mock==1.8.0
193177
# via -r requirements-dev.in
194178
rope==0.16.0
195179
# via -r requirements-dev.in
196-
rsa==4.7.2
197-
# via
198-
# -c requirements.txt
199-
# python-jose
200180
six==1.14.0
201181
# via
202182
# -c requirements.txt
203-
# ecdsa
204183
# freezegun
205184
# python-dateutil
206-
# python-jose
207185
# requests-mock
208186
# snapshottest
209187
# traitlets

requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ graphene-federation
1414
git+https://github.com/City-of-Helsinki/graphene-validator.git@main
1515
iso3166
1616
psycopg2
17+
python-jose[cryptography]
1718
pyyaml>=5.3
1819
requests
1920
requests-oauthlib

requirements.txt

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile with Python 3.7
33
# by the following command:
44
#
5-
# pip-compile requirements.in
5+
# pip-compile --unsafe-package=ecdsa --unsafe-package=pyasn1 --unsafe-package=rsa requirements.in
66
#
77
--no-binary psycopg2
88

@@ -16,8 +16,12 @@ certifi==2020.4.5.1
1616
# via
1717
# requests
1818
# sentry-sdk
19+
cffi==1.15.1
20+
# via cryptography
1921
chardet==3.0.4
2022
# via requests
23+
cryptography==40.0.1
24+
# via python-jose
2125
database-sanitizer==1.1.0
2226
# via django-sanitized-dump
2327
deprecation==2.1.0
@@ -53,10 +57,6 @@ django-sanitized-dump==1.2.1
5357
# via -r requirements.in
5458
django-searchable-encrypted-fields==0.1.3
5559
# via -r requirements.in
56-
ecdsa==0.16.1
57-
# via python-jose
58-
future==0.17.1
59-
# via python-jose
6060
graphene==2.1.8
6161
# via
6262
# graphene-django
@@ -90,12 +90,14 @@ promise==2.2.1
9090
# graphql-relay
9191
psycopg2==2.8.3
9292
# via -r requirements.in
93-
pyasn1==0.4.5
94-
# via rsa
93+
pycparser==2.21
94+
# via cffi
9595
pycryptodome==3.15.0
9696
# via django-searchable-encrypted-fields
97-
python-jose==3.0.1
98-
# via django-helusers
97+
python-jose[cryptography]==3.3.0
98+
# via
99+
# -r requirements.in
100+
# django-helusers
99101
pytz==2019.1
100102
# via django
101103
pyyaml==5.4.1
@@ -110,8 +112,6 @@ requests==2.25.1
110112
# requests-oauthlib
111113
requests-oauthlib==1.3.0
112114
# via -r requirements.in
113-
rsa==4.7.2
114-
# via python-jose
115115
rx==1.6.1
116116
# via graphql-core
117117
sentry-sdk==0.10.2
@@ -128,7 +128,6 @@ six==1.14.0
128128
# graphql-core
129129
# graphql-relay
130130
# promise
131-
# python-jose
132131
# singledispatch
133132
sqlparse==0.4.2
134133
# via django
@@ -138,3 +137,8 @@ urllib3==1.26.6
138137
# via
139138
# requests
140139
# sentry-sdk
140+
141+
# The following packages are considered to be unsafe in a requirements file:
142+
# ecdsa
143+
# pyasn1
144+
# rsa

0 commit comments

Comments
 (0)