From 43389ca67c11337805cbe90654c549dc45828939 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Wed, 24 Jul 2024 13:26:37 -0700 Subject: [PATCH 01/45] WIP: updating dependencies --- requirements.dev.txt | 101 +++++++++++++++++++++++++++++++++++-------- requirements.txt | 82 +++++++++++++++++++++++++---------- 2 files changed, 140 insertions(+), 43 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 86a576be..ddb14382 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -1,22 +1,85 @@ # -# This file is autogenerated by pip-compile -# To update, run: +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: # -# pip-compile +# pip-compile --extra=dev --output-file=requirements.dev.txt setup.cfg # ---requirement requirements.txt - -attrs==21.2.0 # via pytest -importlib-metadata==4.8.1 # via pluggy, pytest -iniconfig==1.1.1 # via pytest -packaging==21.0 # via pytest -pluggy==1.0.0 # via pytest -py==1.10.0 # via pytest -pyparsing==2.4.7 # via packaging -pytest-datadir==1.3.1 # via patientsearch (setup.py) -pytest-flask==1.2.0 # via patientsearch (setup.py) -pytest-mock==3.6.1 # via patientsearch (setup.py) -pytest==6.2.5 # via patientsearch (setup.py), pytest-datadir, pytest-mock -toml==0.10.2 # via pytest -typing-extensions==3.10.0.2 # via importlib-metadata -zipp==3.5.0 # via importlib-metadata +attrs==21.2.0 + # via pytest +cachelib==0.13.0 + # via flask-session +certifi==2021.5.30 + # via requests +charset-normalizer==2.0.6 + # via requests +click==8.0.1 + # via flask +flask==2.0.1 + # via + # flask-jwt-extended + # flask-session + # patientsearch (setup.cfg) + # pytest-flask +flask-jwt-extended==3.24.1 + # via patientsearch (setup.cfg) +flask-session==0.3.2 + # via patientsearch (setup.cfg) +future==1.0.0 + # via redis-dict +gunicorn==20.0.4 + # via patientsearch (setup.cfg) +idna==3.2 + # via requests +iniconfig==1.1.1 + # via pytest +itsdangerous==2.0.1 + # via flask +jinja2==3.0.1 + # via flask +jmespath==0.10.0 + # via patientsearch (setup.cfg) +markupsafe==2.0.1 + # via jinja2 +packaging==21.0 + # via pytest +pluggy==1.0.0 + # via pytest +py==1.10.0 + # via pytest +pyjwt==1.7.1 + # via flask-jwt-extended +pyparsing==2.4.7 + # via packaging +pytest==6.2.5 + # via + # patientsearch (setup.cfg) + # pytest-datadir + # pytest-flask + # pytest-mock +pytest-datadir==1.3.1 + # via patientsearch (setup.cfg) +pytest-flask==1.2.0 + # via patientsearch (setup.cfg) +pytest-mock==3.6.1 + # via patientsearch (setup.cfg) +python-json-logger==0.1.11 + # via patientsearch (setup.cfg) +redis==3.5.3 + # via + # patientsearch (setup.cfg) + # redis-dict +redis-dict==1.5.2 + # via patientsearch (setup.cfg) +requests==2.26.0 + # via patientsearch (setup.cfg) +six==1.15.0 + # via flask-jwt-extended +toml==0.10.2 + # via pytest +urllib3==1.26.7 + # via requests +werkzeug==2.0.1 + # via + # flask + # flask-jwt-extended + # pytest-flask diff --git a/requirements.txt b/requirements.txt index 616b9d10..7e6f07dc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,26 +1,60 @@ -certifi==2021.5.30 # via requests -charset-normalizer==2.0.6 # via requests -click==8.0.1 # via flask -flask-jwt-extended==3.24.1 # via patientsearch (setup.py) -# pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc -git+https://github.com/uwcirg/fhir-migrations@0.1.0 -flask==2.0.1 # via flask-jwt-extended, patientsearch (setup.py) -flask-session==0.3.2 # via patientsearch (setup.py) -gunicorn==20.0.4 # via patientsearch (setup.py) -idna==3.2 # via requests -importlib-metadata==4.8.1 # via click -itsdangerous==2.0.1 # via flask -jinja2==3.0.1 # via flask -jmespath==0.10.0 # via patientsearch (setup.py) -markupsafe==2.0.1 # via jinja2 +# +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: +# +# pip-compile +# +cachelib==0.13.0 + # via flask-session +certifi==2021.5.30 + # via requests +charset-normalizer==2.0.6 + # via requests +click==8.0.1 + # via flask +flask==2.0.1 + # via + # flask-jwt-extended + # flask-session + # patientsearch (setup.py) +flask-jwt-extended==3.24.1 + # via patientsearch (setup.py) +flask-session==0.3.2 + # via patientsearch (setup.py) +future==1.0.0 + # via redis-dict +gunicorn==20.0.4 + # via patientsearch (setup.py) +idna==3.2 + # via requests +itsdangerous==2.0.1 + # via flask +jinja2==3.0.1 + # via flask +jmespath==0.10.0 + # via patientsearch (setup.py) +markupsafe==2.0.1 + # via jinja2 +pyjwt==1.7.1 + # via flask-jwt-extended python-json-logger==0.1.11 -pyjwt==1.7.1 # via flask-jwt-extended + # via patientsearch (setup.py) redis==3.5.3 -redis-dict==1.5.2 # via patientsearch (setup.py) -requests==2.26.0 # via patientsearch (setup.py) -six==1.15.0 # via flask-jwt-extended -typing-extensions==3.10.0.2 # via importlib-metadata -urllib3==1.26.7 # via requests -werkzeug==2.0.1 # via flask, flask-jwt-extended -zipp==3.5.0 # via importlib-metadata + # via + # patientsearch (setup.py) + # redis-dict +redis-dict==1.5.2 + # via patientsearch (setup.py) +requests==2.26.0 + # via patientsearch (setup.py) +six==1.15.0 + # via flask-jwt-extended +urllib3==1.26.7 + # via requests +werkzeug==2.0.1 + # via + # flask + # flask-jwt-extended + +# The following packages are considered to be unsafe in a requirements file: +# setuptools From 5b36cdc4ce6250b6ee8d6ed4cb9145cebc29a0f6 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 19:48:35 -0700 Subject: [PATCH 02/45] Updating to version 3.9 --- .github/workflows/lint.yaml | 2 +- .github/workflows/test.yaml | 4 ++-- Dockerfile | 2 +- README.md | 2 +- requirements.txt | 3 --- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index bff9e724..e6fa2e71 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -37,7 +37,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.9 - name: Install Python linting dependencies run: pip install black flake8 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e8fc55c4..99b38d28 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,10 +9,10 @@ jobs: - name: Checkout git commit uses: actions/checkout@v1 - - name: Set up Python 3.7 + - name: Set up Python 3.9 uses: actions/setup-python@v1 with: - python-version: 3.7 + python-version: 3.9 - name: Install test runner run: python3 -m pip install tox diff --git a/Dockerfile b/Dockerfile index 7a55cd06..4586c660 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ COPY . . RUN npm run build # ----------------------------------------------------------------------------- -FROM python:3.7 as backend +FROM python:3.9 as backend RUN mkdir /opt/cosri-patientsearch WORKDIR /opt/cosri-patientsearch diff --git a/README.md b/README.md index a4800e43..aa16db57 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ All views require Keycloak authentication. Keycloak roles determine authorizati 1) `git clone ` 2) `cp client_secrets.json.default client_secrets.json` # Edit to fit 3) `cp patientsearch.env.default patientsearch.env` # Edit to fit -4) `mkvirtualenv patientsearch` # Python 3.7 +4) `mkvirtualenv patientsearch` # Python 3.9 5) `pip install nodeenv` 6) `nodeenv --python-virtualenv` 7) `pip install -e .` diff --git a/requirements.txt b/requirements.txt index 7e6f07dc..18d7947f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -55,6 +55,3 @@ werkzeug==2.0.1 # via # flask # flask-jwt-extended - -# The following packages are considered to be unsafe in a requirements file: -# setuptools From fadf5363ac4509caa9cdaec479bca38d2516b3f4 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 20:07:59 -0700 Subject: [PATCH 03/45] Adding flask_oidc --- requirements.dev.txt | 2 ++ requirements.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/requirements.dev.txt b/requirements.dev.txt index ddb14382..9fd6eb85 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -24,6 +24,8 @@ flask-jwt-extended==3.24.1 # via patientsearch (setup.cfg) flask-session==0.3.2 # via patientsearch (setup.cfg) +# pin to last hash of master, to remove requirement of freestanding JSON config file +git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc future==1.0.0 # via redis-dict gunicorn==20.0.4 diff --git a/requirements.txt b/requirements.txt index 18d7947f..dc174294 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,6 +21,8 @@ flask-jwt-extended==3.24.1 # via patientsearch (setup.py) flask-session==0.3.2 # via patientsearch (setup.py) +# pin to last hash of master, to remove requirement of freestanding JSON config file +git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc future==1.0.0 # via redis-dict gunicorn==20.0.4 From 566e548d704ea620db3a92dacb7b8d4f7e8498ce Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 21:05:53 -0700 Subject: [PATCH 04/45] Changing requirements --- requirements.dev.txt | 56 +------------------------------------------- requirements.txt | 6 +++++ 2 files changed, 7 insertions(+), 55 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 9fd6eb85..c56f7b66 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -4,52 +4,17 @@ # # pip-compile --extra=dev --output-file=requirements.dev.txt setup.cfg # +--requirement requirements.txt attrs==21.2.0 # via pytest -cachelib==0.13.0 - # via flask-session -certifi==2021.5.30 - # via requests -charset-normalizer==2.0.6 - # via requests -click==8.0.1 - # via flask -flask==2.0.1 - # via - # flask-jwt-extended - # flask-session - # patientsearch (setup.cfg) - # pytest-flask -flask-jwt-extended==3.24.1 - # via patientsearch (setup.cfg) -flask-session==0.3.2 - # via patientsearch (setup.cfg) -# pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc -future==1.0.0 - # via redis-dict -gunicorn==20.0.4 - # via patientsearch (setup.cfg) -idna==3.2 - # via requests iniconfig==1.1.1 # via pytest -itsdangerous==2.0.1 - # via flask -jinja2==3.0.1 - # via flask -jmespath==0.10.0 - # via patientsearch (setup.cfg) -markupsafe==2.0.1 - # via jinja2 packaging==21.0 # via pytest pluggy==1.0.0 # via pytest py==1.10.0 # via pytest -pyjwt==1.7.1 - # via flask-jwt-extended pyparsing==2.4.7 # via packaging pytest==6.2.5 @@ -64,24 +29,5 @@ pytest-flask==1.2.0 # via patientsearch (setup.cfg) pytest-mock==3.6.1 # via patientsearch (setup.cfg) -python-json-logger==0.1.11 - # via patientsearch (setup.cfg) -redis==3.5.3 - # via - # patientsearch (setup.cfg) - # redis-dict -redis-dict==1.5.2 - # via patientsearch (setup.cfg) -requests==2.26.0 - # via patientsearch (setup.cfg) -six==1.15.0 - # via flask-jwt-extended toml==0.10.2 # via pytest -urllib3==1.26.7 - # via requests -werkzeug==2.0.1 - # via - # flask - # flask-jwt-extended - # pytest-flask diff --git a/requirements.txt b/requirements.txt index dc174294..55b47486 100644 --- a/requirements.txt +++ b/requirements.txt @@ -57,3 +57,9 @@ werkzeug==2.0.1 # via # flask # flask-jwt-extended +importlib-metadata==4.8.1 + # via click +typing-extensions==3.10.0.2 + # via importlib-metadata +zipp==3.5.0 + # via importlib-metadata From 20e1e1e5a1d2921be327ec5b7d10888ebb61f3df Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 21:07:13 -0700 Subject: [PATCH 05/45] WIP: testing without libraries --- requirements.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 55b47486..d421f8cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,8 +21,6 @@ flask-jwt-extended==3.24.1 # via patientsearch (setup.py) flask-session==0.3.2 # via patientsearch (setup.py) -# pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc future==1.0.0 # via redis-dict gunicorn==20.0.4 From e1983ebfd60a3f98e9402c1cd05a0a3f3d01cabf Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 21:08:11 -0700 Subject: [PATCH 06/45] Returning to working libraries --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index d421f8cf..55b47486 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,6 +21,8 @@ flask-jwt-extended==3.24.1 # via patientsearch (setup.py) flask-session==0.3.2 # via patientsearch (setup.py) +# pin to last hash of master, to remove requirement of freestanding JSON config file +git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc future==1.0.0 # via redis-dict gunicorn==20.0.4 From 3147137c9f4cf87cb445eb3bdb2ff21e1fc60a7f Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:07:06 -0700 Subject: [PATCH 07/45] Updating requirements --- requirements.dev.txt | 90 ++++++++++++++++++++++++++++++++++++-------- requirements.txt | 82 +++++++++++++++++++++------------------- 2 files changed, 118 insertions(+), 54 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index c56f7b66..b4db1ada 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -4,30 +4,90 @@ # # pip-compile --extra=dev --output-file=requirements.dev.txt setup.cfg # ---requirement requirements.txt -attrs==21.2.0 +async-timeout==4.0.3 + # via redis +blinker==1.8.2 + # via flask +cachelib==0.13.0 + # via flask-session +certifi==2024.7.4 + # via requests +charset-normalizer==3.3.2 + # via requests +click==8.1.7 + # via flask +exceptiongroup==1.2.2 # via pytest -iniconfig==1.1.1 - # via pytest -packaging==21.0 - # via pytest -pluggy==1.0.0 +flask==3.0.3 + # via + # flask-jwt-extended + # flask-session + # patientsearch (setup.cfg) + # pytest-flask +flask-jwt-extended==4.6.0 + # via patientsearch (setup.cfg) +flask-session==0.8.0 + # via patientsearch (setup.cfg) +# pin to last hash of master, to remove requirement of freestanding JSON config file +git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc +gunicorn==22.0.0 + # via patientsearch (setup.cfg) +idna==3.7 + # via requests +importlib-metadata==8.2.0 + # via flask +iniconfig==2.0.0 # via pytest -py==1.10.0 +itsdangerous==2.2.0 + # via flask +jinja2==3.1.4 + # via flask +jmespath==1.0.1 + # via patientsearch (setup.cfg) +markupsafe==2.1.5 + # via + # jinja2 + # werkzeug +msgspec==0.18.6 + # via flask-session +packaging==24.1 + # via + # gunicorn + # pytest +pluggy==1.5.0 # via pytest -pyparsing==2.4.7 - # via packaging -pytest==6.2.5 +pyjwt==2.8.0 + # via flask-jwt-extended +pytest==8.3.2 # via # patientsearch (setup.cfg) # pytest-datadir # pytest-flask # pytest-mock -pytest-datadir==1.3.1 +pytest-datadir==1.5.0 + # via patientsearch (setup.cfg) +pytest-flask==1.3.0 # via patientsearch (setup.cfg) -pytest-flask==1.2.0 +pytest-mock==3.14.0 # via patientsearch (setup.cfg) -pytest-mock==3.6.1 +python-json-logger==2.0.7 # via patientsearch (setup.cfg) -toml==0.10.2 +redis==5.0.7 + # via + # patientsearch (setup.cfg) + # redis-dict +redis-dict==2.5.0 + # via patientsearch (setup.cfg) +requests==2.32.3 + # via patientsearch (setup.cfg) +tomli==2.0.1 # via pytest +urllib3==2.2.2 + # via requests +werkzeug==3.0.3 + # via + # flask + # flask-jwt-extended + # pytest-flask +zipp==3.19.2 + # via importlib-metadata \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 55b47486..6b2ab9fb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,62 +4,66 @@ # # pip-compile # +async-timeout==4.0.3 + # via redis +blinker==1.8.2 + # via flask cachelib==0.13.0 # via flask-session -certifi==2021.5.30 +certifi==2024.7.4 # via requests -charset-normalizer==2.0.6 +charset-normalizer==3.3.2 # via requests -click==8.0.1 +click==8.1.7 # via flask -flask==2.0.1 +flask==3.0.3 # via # flask-jwt-extended # flask-session - # patientsearch (setup.py) -flask-jwt-extended==3.24.1 - # via patientsearch (setup.py) -flask-session==0.3.2 - # via patientsearch (setup.py) + # patientsearch (setup.cfg) +flask-jwt-extended==4.6.0 + # via patientsearch (setup.cfg) +flask-session==0.8.0 + # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc -future==1.0.0 - # via redis-dict -gunicorn==20.0.4 - # via patientsearch (setup.py) -idna==3.2 +gunicorn==22.0.0 + # via patientsearch (setup.cfg) +idna==3.7 # via requests -itsdangerous==2.0.1 +importlib-metadata==8.2.0 + # via flask +itsdangerous==2.2.0 # via flask -jinja2==3.0.1 +jinja2==3.1.4 # via flask -jmespath==0.10.0 - # via patientsearch (setup.py) -markupsafe==2.0.1 - # via jinja2 -pyjwt==1.7.1 +jmespath==1.0.1 + # via patientsearch (setup.cfg) +markupsafe==2.1.5 + # via + # jinja2 + # werkzeug +msgspec==0.18.6 + # via flask-session +packaging==24.1 + # via gunicorn +pyjwt==2.8.0 # via flask-jwt-extended -python-json-logger==0.1.11 - # via patientsearch (setup.py) -redis==3.5.3 +python-json-logger==2.0.7 + # via patientsearch (setup.cfg) +redis==5.0.7 # via - # patientsearch (setup.py) + # patientsearch (setup.cfg) # redis-dict -redis-dict==1.5.2 - # via patientsearch (setup.py) -requests==2.26.0 - # via patientsearch (setup.py) -six==1.15.0 - # via flask-jwt-extended -urllib3==1.26.7 +redis-dict==2.5.0 + # via patientsearch (setup.cfg) +requests==2.32.3 + # via patientsearch (setup.cfg) +urllib3==2.2.2 # via requests -werkzeug==2.0.1 +werkzeug==3.0.3 # via # flask # flask-jwt-extended -importlib-metadata==4.8.1 - # via click -typing-extensions==3.10.0.2 - # via importlib-metadata -zipp==3.5.0 - # via importlib-metadata +zipp==3.19.2 + # via importlib-metadata \ No newline at end of file From 95ff06bad5f2bccf0e7e7613864b459060292890 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:10:14 -0700 Subject: [PATCH 08/45] Trying to replace flask safe_join with werkzeug --- patientsearch/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patientsearch/api.py b/patientsearch/api.py index eea163fc..aac81b75 100644 --- a/patientsearch/api.py +++ b/patientsearch/api.py @@ -6,7 +6,6 @@ make_response, redirect, request, - safe_join, session, send_from_directory, ) @@ -14,6 +13,7 @@ import jwt import requests from werkzeug.exceptions import Unauthorized, Forbidden +from werkzeug.utils import safe_join from copy import deepcopy from patientsearch.audit import audit_entry, audit_HAPI_change From 8b7c61d6b7844e30220b59ed0319edeac454a0ea Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:13:23 -0700 Subject: [PATCH 09/45] Downgrading flask --- requirements.dev.txt | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index b4db1ada..a693c15e 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -18,7 +18,7 @@ click==8.1.7 # via flask exceptiongroup==1.2.2 # via pytest -flask==3.0.3 +flask==2.2.5 # via # flask-jwt-extended # flask-session diff --git a/requirements.txt b/requirements.txt index 6b2ab9fb..d8f95ef0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,7 @@ charset-normalizer==3.3.2 # via requests click==8.1.7 # via flask -flask==3.0.3 +flask==2.2.5 # via # flask-jwt-extended # flask-session From dd69b36a00f1cf87db2d7e1a227ad0600d015c66 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:18:44 -0700 Subject: [PATCH 10/45] Upgrading --- patientsearch/api.py | 2 +- requirements.dev.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/patientsearch/api.py b/patientsearch/api.py index aac81b75..eea163fc 100644 --- a/patientsearch/api.py +++ b/patientsearch/api.py @@ -6,6 +6,7 @@ make_response, redirect, request, + safe_join, session, send_from_directory, ) @@ -13,7 +14,6 @@ import jwt import requests from werkzeug.exceptions import Unauthorized, Forbidden -from werkzeug.utils import safe_join from copy import deepcopy from patientsearch.audit import audit_entry, audit_HAPI_change diff --git a/requirements.dev.txt b/requirements.dev.txt index a693c15e..a22a211e 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -29,7 +29,7 @@ flask-jwt-extended==4.6.0 flask-session==0.8.0 # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc +git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c gunicorn==22.0.0 # via patientsearch (setup.cfg) idna==3.7 From 8ee35609545ad743b7d40f7803ebed4454f8990a Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:20:22 -0700 Subject: [PATCH 11/45] WIP: Changing safe_join --- patientsearch/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patientsearch/api.py b/patientsearch/api.py index eea163fc..aac81b75 100644 --- a/patientsearch/api.py +++ b/patientsearch/api.py @@ -6,7 +6,6 @@ make_response, redirect, request, - safe_join, session, send_from_directory, ) @@ -14,6 +13,7 @@ import jwt import requests from werkzeug.exceptions import Unauthorized, Forbidden +from werkzeug.utils import safe_join from copy import deepcopy from patientsearch.audit import audit_entry, audit_HAPI_change From 2d5e06a88d9a171591c11b2ee6d026eace66872c Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:24:04 -0700 Subject: [PATCH 12/45] Updating jwt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index d8f95ef0..8eac46d4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,7 +21,7 @@ flask==2.2.5 # flask-jwt-extended # flask-session # patientsearch (setup.cfg) -flask-jwt-extended==4.6.0 +flask-jwt-extended==3.24.1 # via patientsearch (setup.cfg) flask-session==0.8.0 # via patientsearch (setup.cfg) @@ -47,7 +47,7 @@ msgspec==0.18.6 # via flask-session packaging==24.1 # via gunicorn -pyjwt==2.8.0 +pyjwt==1.7.1 # via flask-jwt-extended python-json-logger==2.0.7 # via patientsearch (setup.cfg) From 053229c8eadb1eec62fe4bd3b33c7449f1d82646 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:27:07 -0700 Subject: [PATCH 13/45] Downgrade flask --- patientsearch/api.py | 2 +- requirements.txt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/patientsearch/api.py b/patientsearch/api.py index aac81b75..eea163fc 100644 --- a/patientsearch/api.py +++ b/patientsearch/api.py @@ -6,6 +6,7 @@ make_response, redirect, request, + safe_join, session, send_from_directory, ) @@ -13,7 +14,6 @@ import jwt import requests from werkzeug.exceptions import Unauthorized, Forbidden -from werkzeug.utils import safe_join from copy import deepcopy from patientsearch.audit import audit_entry, audit_HAPI_change diff --git a/requirements.txt b/requirements.txt index 8eac46d4..34539389 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,15 +16,15 @@ charset-normalizer==3.3.2 # via requests click==8.1.7 # via flask -flask==2.2.5 +flask==2.0.1 # via # flask-jwt-extended # flask-session - # patientsearch (setup.cfg) + # patientsearch (setup.py) flask-jwt-extended==3.24.1 - # via patientsearch (setup.cfg) -flask-session==0.8.0 - # via patientsearch (setup.cfg) + # via patientsearch (setup.py) +flask-session==0.3.2 + # via patientsearch (setup.py) # pin to last hash of master, to remove requirement of freestanding JSON config file git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc gunicorn==22.0.0 From f209a24c7d63841f1d74e413c185d727154b43f9 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:28:57 -0700 Subject: [PATCH 14/45] Downgrading flask --- requirements.dev.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index a22a211e..2f373852 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -18,18 +18,18 @@ click==8.1.7 # via flask exceptiongroup==1.2.2 # via pytest -flask==2.2.5 +flask==2.0.1 # via # flask-jwt-extended # flask-session - # patientsearch (setup.cfg) + # patientsearch (setup.py) # pytest-flask -flask-jwt-extended==4.6.0 - # via patientsearch (setup.cfg) -flask-session==0.8.0 - # via patientsearch (setup.cfg) +flask-jwt-extended==3.24.1 + # via patientsearch (setup.py) +flask-session==0.3.2 + # via patientsearch (setup.py) # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c +git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc gunicorn==22.0.0 # via patientsearch (setup.cfg) idna==3.7 From 1498ab8bcf6cc1166d6ca52c97cd4e8e80e56101 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:31:12 -0700 Subject: [PATCH 15/45] Downgrading flask --- requirements.dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 2f373852..a151b8a7 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -66,7 +66,7 @@ pytest==8.3.2 # pytest-mock pytest-datadir==1.5.0 # via patientsearch (setup.cfg) -pytest-flask==1.3.0 +pytest-flask==1.2.0 # via patientsearch (setup.cfg) pytest-mock==3.14.0 # via patientsearch (setup.cfg) From 126dc1f0ea9a6f63b85f32574933bcd8bf803355 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:34:28 -0700 Subject: [PATCH 16/45] Downgrading pluggy --- requirements.dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index a151b8a7..ba46fedb 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -54,7 +54,7 @@ packaging==24.1 # via # gunicorn # pytest -pluggy==1.5.0 +pluggy==1.0.0 # via pytest pyjwt==2.8.0 # via flask-jwt-extended From d05b6976df8c70aac048e8f1ba3a2bf71cd10b62 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:37:59 -0700 Subject: [PATCH 17/45] Downgrading pytest --- requirements.dev.txt | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index ba46fedb..3d7d5443 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -58,18 +58,16 @@ pluggy==1.0.0 # via pytest pyjwt==2.8.0 # via flask-jwt-extended -pytest==8.3.2 - # via - # patientsearch (setup.cfg) - # pytest-datadir - # pytest-flask - # pytest-mock -pytest-datadir==1.5.0 - # via patientsearch (setup.cfg) -pytest-flask==1.2.0 - # via patientsearch (setup.cfg) -pytest-mock==3.14.0 - # via patientsearch (setup.cfg) +pytest-datadir==1.3.1 + # via patientsearch (setup.py) +pytest-flask==1.2.0 + # via patientsearch (setup.py) +pytest-mock==3.6.1 + # via patientsearch (setup.py) +pytest==6.2.5 + # via patientsearch (setup.py), pytest-datadir, pytest-mock +toml==0.10.2 + # via pytest python-json-logger==2.0.7 # via patientsearch (setup.cfg) redis==5.0.7 @@ -80,8 +78,6 @@ redis-dict==2.5.0 # via patientsearch (setup.cfg) requests==2.32.3 # via patientsearch (setup.cfg) -tomli==2.0.1 - # via pytest urllib3==2.2.2 # via requests werkzeug==3.0.3 From bc10861665ee8eeb66a71217064350f505da161b Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:40:39 -0700 Subject: [PATCH 18/45] Downgrading werkzeug --- requirements.dev.txt | 3 +-- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 3d7d5443..60009fa3 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -80,10 +80,9 @@ requests==2.32.3 # via patientsearch (setup.cfg) urllib3==2.2.2 # via requests -werkzeug==3.0.3 +werkzeug==2.0.1 # via # flask # flask-jwt-extended - # pytest-flask zipp==3.19.2 # via importlib-metadata \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 34539389..f0299592 100644 --- a/requirements.txt +++ b/requirements.txt @@ -61,7 +61,7 @@ requests==2.32.3 # via patientsearch (setup.cfg) urllib3==2.2.2 # via requests -werkzeug==3.0.3 +werkzeug==2.0.1 # via # flask # flask-jwt-extended From 5df077ae39ea21c791ab1dc783372ad77e8b1e12 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:42:39 -0700 Subject: [PATCH 19/45] Downgrading itsdangerous --- requirements.dev.txt | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 60009fa3..7eb6f1b3 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -38,7 +38,7 @@ importlib-metadata==8.2.0 # via flask iniconfig==2.0.0 # via pytest -itsdangerous==2.2.0 +itsdangerous==2.0.1 # via flask jinja2==3.1.4 # via flask diff --git a/requirements.txt b/requirements.txt index f0299592..caff627d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -33,7 +33,7 @@ idna==3.7 # via requests importlib-metadata==8.2.0 # via flask -itsdangerous==2.2.0 +itsdangerous==2.0.1 # via flask jinja2==3.1.4 # via flask From 43d091c8e7bbb9c04a326324eb9ce79bd8641b3d Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:48:12 -0700 Subject: [PATCH 20/45] Downgrading jwt --- requirements.dev.txt | 5 +++-- requirements.txt | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 7eb6f1b3..de740862 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -56,7 +56,7 @@ packaging==24.1 # pytest pluggy==1.0.0 # via pytest -pyjwt==2.8.0 +pyjwt==1.7.1 # via flask-jwt-extended pytest-datadir==1.3.1 # via patientsearch (setup.py) @@ -85,4 +85,5 @@ werkzeug==2.0.1 # flask # flask-jwt-extended zipp==3.19.2 - # via importlib-metadata \ No newline at end of file + # via importlib-metadata +six==1.15.0 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index caff627d..be4105af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -66,4 +66,5 @@ werkzeug==2.0.1 # flask # flask-jwt-extended zipp==3.19.2 - # via importlib-metadata \ No newline at end of file + # via importlib-metadata +six==1.15.0 \ No newline at end of file From 85d341e2960e77fb68c8873caa027aeb02132d55 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 23:04:28 -0700 Subject: [PATCH 21/45] Adding six --- requirements.dev.txt | 3 ++- requirements.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index de740862..819ef601 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -86,4 +86,5 @@ werkzeug==2.0.1 # flask-jwt-extended zipp==3.19.2 # via importlib-metadata -six==1.15.0 \ No newline at end of file +six==1.15.0 + # via flask-jwt-extended \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index be4105af..e024d57f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -67,4 +67,5 @@ werkzeug==2.0.1 # flask-jwt-extended zipp==3.19.2 # via importlib-metadata -six==1.15.0 \ No newline at end of file +six==1.15.0 + # via flask-jwt-extended \ No newline at end of file From ce34150e5a7c6cb801637fac0a3b8786f8073fc5 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Sat, 27 Jul 2024 23:07:14 -0700 Subject: [PATCH 22/45] Cleaning up dev requirements. --- requirements.dev.txt | 70 ++------------------------------------------ 1 file changed, 3 insertions(+), 67 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 819ef601..7109446f 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -4,60 +4,16 @@ # # pip-compile --extra=dev --output-file=requirements.dev.txt setup.cfg # -async-timeout==4.0.3 - # via redis -blinker==1.8.2 - # via flask -cachelib==0.13.0 - # via flask-session -certifi==2024.7.4 - # via requests -charset-normalizer==3.3.2 - # via requests -click==8.1.7 - # via flask -exceptiongroup==1.2.2 - # via pytest -flask==2.0.1 - # via - # flask-jwt-extended - # flask-session - # patientsearch (setup.py) - # pytest-flask -flask-jwt-extended==3.24.1 - # via patientsearch (setup.py) -flask-session==0.3.2 - # via patientsearch (setup.py) -# pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc -gunicorn==22.0.0 - # via patientsearch (setup.cfg) -idna==3.7 - # via requests -importlib-metadata==8.2.0 - # via flask +--requirement requirements.txt + iniconfig==2.0.0 # via pytest -itsdangerous==2.0.1 - # via flask -jinja2==3.1.4 - # via flask -jmespath==1.0.1 - # via patientsearch (setup.cfg) -markupsafe==2.1.5 - # via - # jinja2 - # werkzeug -msgspec==0.18.6 - # via flask-session packaging==24.1 # via # gunicorn # pytest pluggy==1.0.0 # via pytest -pyjwt==1.7.1 - # via flask-jwt-extended pytest-datadir==1.3.1 # via patientsearch (setup.py) pytest-flask==1.2.0 @@ -67,24 +23,4 @@ pytest-mock==3.6.1 pytest==6.2.5 # via patientsearch (setup.py), pytest-datadir, pytest-mock toml==0.10.2 - # via pytest -python-json-logger==2.0.7 - # via patientsearch (setup.cfg) -redis==5.0.7 - # via - # patientsearch (setup.cfg) - # redis-dict -redis-dict==2.5.0 - # via patientsearch (setup.cfg) -requests==2.32.3 - # via patientsearch (setup.cfg) -urllib3==2.2.2 - # via requests -werkzeug==2.0.1 - # via - # flask - # flask-jwt-extended -zipp==3.19.2 - # via importlib-metadata -six==1.15.0 - # via flask-jwt-extended \ No newline at end of file + # via pytest \ No newline at end of file From f25d7a820448b7d40f7eae5231a205b0f79dcde4 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Thu, 1 Aug 2024 14:24:49 -0700 Subject: [PATCH 23/45] WIP: updating python to 3.11 --- .github/workflows/lint.yaml | 2 +- .github/workflows/test.yaml | 4 ++-- Dockerfile | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index e6fa2e71..ad9495f5 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -37,7 +37,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: 3.9 + python-version: 3.11 - name: Install Python linting dependencies run: pip install black flake8 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 99b38d28..08ab91d0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,10 +9,10 @@ jobs: - name: Checkout git commit uses: actions/checkout@v1 - - name: Set up Python 3.9 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: 3.9 + python-version: 3.11 - name: Install test runner run: python3 -m pip install tox diff --git a/Dockerfile b/Dockerfile index 4586c660..6fcf0dac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ COPY . . RUN npm run build # ----------------------------------------------------------------------------- -FROM python:3.9 as backend +FROM python:3.11 as backend RUN mkdir /opt/cosri-patientsearch WORKDIR /opt/cosri-patientsearch From 783223c53f36bd363b5f25b18fd1eef41300b50e Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Tue, 6 Aug 2024 18:43:32 -0700 Subject: [PATCH 24/45] Updating python version in the readme to correspond to one in the docker --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aa16db57..c4622638 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ All views require Keycloak authentication. Keycloak roles determine authorizati 1) `git clone ` 2) `cp client_secrets.json.default client_secrets.json` # Edit to fit 3) `cp patientsearch.env.default patientsearch.env` # Edit to fit -4) `mkvirtualenv patientsearch` # Python 3.9 +4) `mkvirtualenv patientsearch` # Python 3.11 5) `pip install nodeenv` 6) `nodeenv --python-virtualenv` 7) `pip install -e .` From b73dfdbc90ed21f46614526a5f080a70a9638acd Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Tue, 6 Aug 2024 19:35:57 -0700 Subject: [PATCH 25/45] Updating JSONEncoder to import from json --- patientsearch/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patientsearch/api.py b/patientsearch/api.py index eea163fc..927f571d 100644 --- a/patientsearch/api.py +++ b/patientsearch/api.py @@ -10,7 +10,7 @@ session, send_from_directory, ) -from flask.json import JSONEncoder +from json import JSONEncoder import jwt import requests from werkzeug.exceptions import Unauthorized, Forbidden From a7ea132450867621dc83a122cc189e815d927bf2 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:31:53 -0700 Subject: [PATCH 26/45] Switching to DefaultJSONProvider --- patientsearch/api.py | 6 +-- requirements.dev.txt | 91 +++++++++++++++++++++++++++++++++++++------- requirements.txt | 22 +++++------ 3 files changed, 90 insertions(+), 29 deletions(-) diff --git a/patientsearch/api.py b/patientsearch/api.py index 927f571d..29e61c09 100644 --- a/patientsearch/api.py +++ b/patientsearch/api.py @@ -10,7 +10,7 @@ session, send_from_directory, ) -from json import JSONEncoder +from flask.json.provider import DefaultJSONProvider import jwt import requests from werkzeug.exceptions import Unauthorized, Forbidden @@ -145,11 +145,11 @@ def config_settings(config_key): """Non-secret application settings""" # workaround no JSON representation for datetime.timedelta - class CustomJSONEncoder(JSONEncoder): + class CustomJSONProvider(DefaultJSONProvider): def default(self, obj): return str(obj) - current_app.json_encoder = CustomJSONEncoder + current_app.json = CustomJSONProvider # return selective keys - not all can be be viewed by users, e.g.secret key blacklist = ("SECRET", "KEY", "TOKEN", "CREDENTIALS") diff --git a/requirements.dev.txt b/requirements.dev.txt index 7109446f..baa7972e 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -4,23 +4,88 @@ # # pip-compile --extra=dev --output-file=requirements.dev.txt setup.cfg # ---requirement requirements.txt - +async-timeout==4.0.3 + # via redis +blinker==1.8.2 + # via flask +cachelib==0.13.0 + # via flask-session +certifi==2024.7.4 + # via requests +charset-normalizer==3.3.2 + # via requests +click==8.1.7 + # via flask +exceptiongroup==1.2.2 + # via pytest +flask==3.0.3 + # via + # flask-jwt-extended + # flask-session + # patientsearch (setup.cfg) + # pytest-flask +flask-jwt-extended==4.6.0 + # via patientsearch (setup.cfg) +flask-session==0.8.0 + # via patientsearch (setup.cfg) +gunicorn==22.0.0 + # via patientsearch (setup.cfg) +idna==3.7 + # via requests +importlib-metadata==8.2.0 + # via flask iniconfig==2.0.0 # via pytest +itsdangerous==2.2.0 + # via flask +jinja2==3.1.4 + # via flask +jmespath==1.0.1 + # via patientsearch (setup.cfg) +markupsafe==2.1.5 + # via + # jinja2 + # werkzeug +msgspec==0.18.6 + # via flask-session packaging==24.1 # via # gunicorn # pytest -pluggy==1.0.0 +pluggy==1.5.0 # via pytest -pytest-datadir==1.3.1 - # via patientsearch (setup.py) -pytest-flask==1.2.0 - # via patientsearch (setup.py) -pytest-mock==3.6.1 - # via patientsearch (setup.py) -pytest==6.2.5 - # via patientsearch (setup.py), pytest-datadir, pytest-mock -toml==0.10.2 - # via pytest \ No newline at end of file +pyjwt==2.8.0 + # via flask-jwt-extended +pytest==8.3.2 + # via + # patientsearch (setup.cfg) + # pytest-datadir + # pytest-flask + # pytest-mock +pytest-datadir==1.5.0 + # via patientsearch (setup.cfg) +pytest-flask==1.3.0 + # via patientsearch (setup.cfg) +pytest-mock==3.14.0 + # via patientsearch (setup.cfg) +python-json-logger==2.0.7 + # via patientsearch (setup.cfg) +redis==5.0.7 + # via + # patientsearch (setup.cfg) + # redis-dict +redis-dict==2.5.0 + # via patientsearch (setup.cfg) +requests==2.32.3 + # via patientsearch (setup.cfg) +tomli==2.0.1 + # via pytest +urllib3==2.2.2 + # via requests +werkzeug==3.0.3 + # via + # flask + # flask-jwt-extended + # pytest-flask +zipp==3.19.2 + # via importlib-metadata diff --git a/requirements.txt b/requirements.txt index e024d57f..d9f45a90 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,24 +16,22 @@ charset-normalizer==3.3.2 # via requests click==8.1.7 # via flask -flask==2.0.1 +flask==3.0.3 # via # flask-jwt-extended # flask-session - # patientsearch (setup.py) -flask-jwt-extended==3.24.1 - # via patientsearch (setup.py) -flask-session==0.3.2 - # via patientsearch (setup.py) -# pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc + # patientsearch (setup.cfg) +flask-jwt-extended==4.6.0 + # via patientsearch (setup.cfg) +flask-session==0.8.0 + # via patientsearch (setup.cfg) gunicorn==22.0.0 # via patientsearch (setup.cfg) idna==3.7 # via requests importlib-metadata==8.2.0 # via flask -itsdangerous==2.0.1 +itsdangerous==2.2.0 # via flask jinja2==3.1.4 # via flask @@ -47,7 +45,7 @@ msgspec==0.18.6 # via flask-session packaging==24.1 # via gunicorn -pyjwt==1.7.1 +pyjwt==2.8.0 # via flask-jwt-extended python-json-logger==2.0.7 # via patientsearch (setup.cfg) @@ -61,11 +59,9 @@ requests==2.32.3 # via patientsearch (setup.cfg) urllib3==2.2.2 # via requests -werkzeug==2.0.1 +werkzeug==3.0.3 # via # flask # flask-jwt-extended zipp==3.19.2 # via importlib-metadata -six==1.15.0 - # via flask-jwt-extended \ No newline at end of file From cbec5b593d95748a6569f36cdf9edb41e0b92b71 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:46:45 -0700 Subject: [PATCH 27/45] from safe_join to werkzeug.utils --- patientsearch/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patientsearch/api.py b/patientsearch/api.py index 29e61c09..51d58c8e 100644 --- a/patientsearch/api.py +++ b/patientsearch/api.py @@ -6,7 +6,6 @@ make_response, redirect, request, - safe_join, session, send_from_directory, ) @@ -14,6 +13,7 @@ import jwt import requests from werkzeug.exceptions import Unauthorized, Forbidden +from werkzeug.utils import safe_join from copy import deepcopy from patientsearch.audit import audit_entry, audit_HAPI_change From b5f9ee7eba5d0c2f0feeda1bbe6131b9529af267 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:51:44 -0700 Subject: [PATCH 28/45] Adding flask-oidc back --- requirements.dev.txt | 2 ++ requirements.txt | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/requirements.dev.txt b/requirements.dev.txt index baa7972e..11d71427 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -28,6 +28,8 @@ flask-jwt-extended==4.6.0 # via patientsearch (setup.cfg) flask-session==0.8.0 # via patientsearch (setup.cfg) +# pin to last hash of master, to remove requirement of freestanding JSON config file +git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc gunicorn==22.0.0 # via patientsearch (setup.cfg) idna==3.7 diff --git a/requirements.txt b/requirements.txt index d9f45a90..83ca01c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,6 +25,8 @@ flask-jwt-extended==4.6.0 # via patientsearch (setup.cfg) flask-session==0.8.0 # via patientsearch (setup.cfg) +# pin to last hash of master, to remove requirement of freestanding JSON config file +git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc gunicorn==22.0.0 # via patientsearch (setup.cfg) idna==3.7 @@ -65,3 +67,5 @@ werkzeug==3.0.3 # flask-jwt-extended zipp==3.19.2 # via importlib-metadata +# pin to last hash of master, to remove requirement of freestanding JSON config file +git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc From 7b8e4ef2b1238b22b8aede0339bce2418e4719c6 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Tue, 20 Aug 2024 19:03:02 -0700 Subject: [PATCH 29/45] Changing flask-oidc to not use depreciated itsdangerous --- requirements.dev.txt | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 11d71427..b2d6f3e5 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -29,7 +29,7 @@ flask-jwt-extended==4.6.0 flask-session==0.8.0 # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc +git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c gunicorn==22.0.0 # via patientsearch (setup.cfg) idna==3.7 diff --git a/requirements.txt b/requirements.txt index 83ca01c4..84fcd466 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,7 +26,7 @@ flask-jwt-extended==4.6.0 flask-session==0.8.0 # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc +git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c gunicorn==22.0.0 # via patientsearch (setup.cfg) idna==3.7 From 048af5fbb0ef6acdf6c40c68b3c52f815cd8e1d5 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Tue, 20 Aug 2024 19:05:40 -0700 Subject: [PATCH 30/45] Fixing tests With newer pyjwt library, the jwt.encode() function returns a string instead of a byte object. --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index b62675af..b32313c7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -28,7 +28,7 @@ def generate_claims(email, sub, roles): def generate_jwt(email="fake@testy.org", sub="fake-subject", roles=None): claims = generate_claims(email, sub, roles) encoded = jwt.encode(claims, SECRET, algorithm="HS256") - return encoded.decode("utf-8") + return encoded @pytest.fixture() From c2cabdeafb812dd7a8796191301abb9af0130b58 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:12:57 -0700 Subject: [PATCH 31/45] Adding pytest-datadir --- requirements.dev.txt | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index b2d6f3e5..3c2c6f2a 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -29,7 +29,7 @@ flask-jwt-extended==4.6.0 flask-session==0.8.0 # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c +git+https://github.com/puiterwijk/flask-oidc.git@refs/pull/144/head#egg=flask-oidc gunicorn==22.0.0 # via patientsearch (setup.cfg) idna==3.7 diff --git a/requirements.txt b/requirements.txt index 84fcd466..4c39f045 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,7 +26,7 @@ flask-jwt-extended==4.6.0 flask-session==0.8.0 # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c +git+https://github.com/puiterwijk/flask-oidc.git@refs/pull/144/head#egg=flask-oidc gunicorn==22.0.0 # via patientsearch (setup.cfg) idna==3.7 From 97d0637d168799ca5ebf0e7efaf824cf3fca502b Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:19:11 -0700 Subject: [PATCH 32/45] Returning to working flask-oidc declaration --- requirements.dev.txt | 4 ++-- requirements.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 3c2c6f2a..f7b947f4 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -29,7 +29,7 @@ flask-jwt-extended==4.6.0 flask-session==0.8.0 # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/puiterwijk/flask-oidc.git@refs/pull/144/head#egg=flask-oidc +git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c gunicorn==22.0.0 # via patientsearch (setup.cfg) idna==3.7 @@ -90,4 +90,4 @@ werkzeug==3.0.3 # flask-jwt-extended # pytest-flask zipp==3.19.2 - # via importlib-metadata + # via importlib-metadata \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 4c39f045..61937339 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,7 +26,7 @@ flask-jwt-extended==4.6.0 flask-session==0.8.0 # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/puiterwijk/flask-oidc.git@refs/pull/144/head#egg=flask-oidc +git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c gunicorn==22.0.0 # via patientsearch (setup.cfg) idna==3.7 @@ -68,4 +68,4 @@ werkzeug==3.0.3 zipp==3.19.2 # via importlib-metadata # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc +git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc \ No newline at end of file From dbe4587f402ad2323778d31c0dbaeb20e8af020b Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:51:00 -0700 Subject: [PATCH 33/45] Updating to latest versions --- requirements.dev.txt | 12 ++++++------ requirements.txt | 16 +++++++--------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index f7b947f4..6bc18187 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -29,12 +29,12 @@ flask-jwt-extended==4.6.0 flask-session==0.8.0 # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c -gunicorn==22.0.0 +git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc +gunicorn==23.0.0 # via patientsearch (setup.cfg) idna==3.7 # via requests -importlib-metadata==8.2.0 +importlib-metadata==8.4.0 # via flask iniconfig==2.0.0 # via pytest @@ -56,7 +56,7 @@ packaging==24.1 # pytest pluggy==1.5.0 # via pytest -pyjwt==2.8.0 +pyjwt==2.9.0 # via flask-jwt-extended pytest==8.3.2 # via @@ -72,7 +72,7 @@ pytest-mock==3.14.0 # via patientsearch (setup.cfg) python-json-logger==2.0.7 # via patientsearch (setup.cfg) -redis==5.0.7 +redis==5.0.8 # via # patientsearch (setup.cfg) # redis-dict @@ -89,5 +89,5 @@ werkzeug==3.0.3 # flask # flask-jwt-extended # pytest-flask -zipp==3.19.2 +zipp==3.20.0 # via importlib-metadata \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 61937339..aa28b817 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,12 +26,12 @@ flask-jwt-extended==4.6.0 flask-session==0.8.0 # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c -gunicorn==22.0.0 +git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc +gunicorn==23.0.0 # via patientsearch (setup.cfg) idna==3.7 # via requests -importlib-metadata==8.2.0 +importlib-metadata==8.4.0 # via flask itsdangerous==2.2.0 # via flask @@ -47,11 +47,11 @@ msgspec==0.18.6 # via flask-session packaging==24.1 # via gunicorn -pyjwt==2.8.0 +pyjwt==2.9.0 # via flask-jwt-extended python-json-logger==2.0.7 # via patientsearch (setup.cfg) -redis==5.0.7 +redis==5.0.8 # via # patientsearch (setup.cfg) # redis-dict @@ -65,7 +65,5 @@ werkzeug==3.0.3 # via # flask # flask-jwt-extended -zipp==3.19.2 - # via importlib-metadata -# pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc \ No newline at end of file +zipp==3.20.0 + # via importlib-metadata \ No newline at end of file From e70af92933d6b7dbab15db1900ff630f70538621 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Tue, 20 Aug 2024 23:03:43 -0700 Subject: [PATCH 34/45] Updating flask --- requirements.dev.txt | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 6bc18187..37cbb2a4 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -29,7 +29,7 @@ flask-jwt-extended==4.6.0 flask-session==0.8.0 # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc +git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c gunicorn==23.0.0 # via patientsearch (setup.cfg) idna==3.7 diff --git a/requirements.txt b/requirements.txt index aa28b817..c447a044 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,7 +26,7 @@ flask-jwt-extended==4.6.0 flask-session==0.8.0 # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc +git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c gunicorn==23.0.0 # via patientsearch (setup.cfg) idna==3.7 From 29deee035120601701cfd78599b2c3bfb0a2fefa Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Wed, 4 Dec 2024 20:01:15 -0800 Subject: [PATCH 35/45] Add back in fhir-migrations (accidental omission from rebasing) --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c447a044..07f0c73a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,6 +27,7 @@ flask-session==0.8.0 # via patientsearch (setup.cfg) # pin to last hash of master, to remove requirement of freestanding JSON config file git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c +git+https://github.com/uwcirg/fhir-migrations@0.1.0 gunicorn==23.0.0 # via patientsearch (setup.cfg) idna==3.7 @@ -66,4 +67,4 @@ werkzeug==3.0.3 # flask # flask-jwt-extended zipp==3.20.0 - # via importlib-metadata \ No newline at end of file + # via importlib-metadata From 870c7f379ca2573e1583dde61a7d277dcdd3033b Mon Sep 17 00:00:00 2001 From: Paul Bugni Date: Thu, 5 Dec 2024 01:12:24 -0800 Subject: [PATCH 36/45] Correct OIDC config to fit upgraded version (2.2.2) --- patientsearch/config.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/patientsearch/config.py b/patientsearch/config.py index 640662f0..a0b5aa1c 100644 --- a/patientsearch/config.py +++ b/patientsearch/config.py @@ -134,8 +134,7 @@ def load_json_config(potential_json_string): ) OIDC_ID_TOKEN_COOKIE_SECURE = False -OIDC_REQUIRE_VERIFIED_EMAIL = False -OIDC_SCOPES = ["email", "openid", "roles"] +OIDC_SCOPES = "email openid roles" PROJECT_NAME = os.getenv("PROJECT_NAME", "COSRI") REQUIRED_ROLES = json.loads(os.getenv("REQUIRED_ROLES", "[]")) UDS_LAB_TYPES = json.loads(os.getenv("UDS_LAB_TYPES", "[]")) From ebf93c906370206830d17210fdd894b5b4e74798 Mon Sep 17 00:00:00 2001 From: Paul Bugni Date: Thu, 5 Dec 2024 01:13:31 -0800 Subject: [PATCH 37/45] Found functional, supported version of flask-oidc Don't repeat requirements.txt within requirements.dev.txt (simply require it!) --- requirements.dev.txt | 64 +------------------------------------------- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 64 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 37cbb2a4..62a0b7ab 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -1,63 +1,16 @@ +-r requirements.txt # # This file is autogenerated by pip-compile with Python 3.9 # by the following command: # # pip-compile --extra=dev --output-file=requirements.dev.txt setup.cfg # -async-timeout==4.0.3 - # via redis -blinker==1.8.2 - # via flask -cachelib==0.13.0 - # via flask-session -certifi==2024.7.4 - # via requests -charset-normalizer==3.3.2 - # via requests -click==8.1.7 - # via flask exceptiongroup==1.2.2 # via pytest -flask==3.0.3 - # via - # flask-jwt-extended - # flask-session - # patientsearch (setup.cfg) - # pytest-flask -flask-jwt-extended==4.6.0 - # via patientsearch (setup.cfg) -flask-session==0.8.0 - # via patientsearch (setup.cfg) -# pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c -gunicorn==23.0.0 - # via patientsearch (setup.cfg) -idna==3.7 - # via requests -importlib-metadata==8.4.0 - # via flask iniconfig==2.0.0 # via pytest -itsdangerous==2.2.0 - # via flask -jinja2==3.1.4 - # via flask -jmespath==1.0.1 - # via patientsearch (setup.cfg) -markupsafe==2.1.5 - # via - # jinja2 - # werkzeug -msgspec==0.18.6 - # via flask-session -packaging==24.1 - # via - # gunicorn - # pytest pluggy==1.5.0 # via pytest -pyjwt==2.9.0 - # via flask-jwt-extended pytest==8.3.2 # via # patientsearch (setup.cfg) @@ -72,22 +25,7 @@ pytest-mock==3.14.0 # via patientsearch (setup.cfg) python-json-logger==2.0.7 # via patientsearch (setup.cfg) -redis==5.0.8 - # via - # patientsearch (setup.cfg) - # redis-dict -redis-dict==2.5.0 - # via patientsearch (setup.cfg) requests==2.32.3 # via patientsearch (setup.cfg) tomli==2.0.1 # via pytest -urllib3==2.2.2 - # via requests -werkzeug==3.0.3 - # via - # flask - # flask-jwt-extended - # pytest-flask -zipp==3.20.0 - # via importlib-metadata \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 07f0c73a..06316da5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,8 +25,8 @@ flask-jwt-extended==4.6.0 # via patientsearch (setup.cfg) flask-session==0.8.0 # via patientsearch (setup.cfg) +flask-oidc==2.2.2 # pin to last hash of master, to remove requirement of freestanding JSON config file -git+https://github.com/puiterwijk/flask-oidc.git@b10e6bf881a3fe0c3972e4093648f2b77f32a97c git+https://github.com/uwcirg/fhir-migrations@0.1.0 gunicorn==23.0.0 # via patientsearch (setup.cfg) From 419993e2b85c3c2232b65b970cbbce48cf3248e8 Mon Sep 17 00:00:00 2001 From: Paul Bugni Date: Thu, 5 Dec 2024 01:18:33 -0800 Subject: [PATCH 38/45] Additional duplication found in requirements.dev.txt --- requirements.dev.txt | 4 ---- requirements.txt | 1 - 2 files changed, 5 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 62a0b7ab..b8a28216 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -23,9 +23,5 @@ pytest-flask==1.3.0 # via patientsearch (setup.cfg) pytest-mock==3.14.0 # via patientsearch (setup.cfg) -python-json-logger==2.0.7 - # via patientsearch (setup.cfg) -requests==2.32.3 - # via patientsearch (setup.cfg) tomli==2.0.1 # via pytest diff --git a/requirements.txt b/requirements.txt index 06316da5..143a93ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,7 +26,6 @@ flask-jwt-extended==4.6.0 flask-session==0.8.0 # via patientsearch (setup.cfg) flask-oidc==2.2.2 -# pin to last hash of master, to remove requirement of freestanding JSON config file git+https://github.com/uwcirg/fhir-migrations@0.1.0 gunicorn==23.0.0 # via patientsearch (setup.cfg) From 0a858a9413bc809e471980ef6da637032511c885 Mon Sep 17 00:00:00 2001 From: Paul Bugni Date: Fri, 6 Dec 2024 15:21:09 -0800 Subject: [PATCH 39/45] flask upgrade requires name change of send_from_directory() parameter s/cache_timeout/max_age --- patientsearch/api.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/patientsearch/api.py b/patientsearch/api.py index 51d58c8e..2270411f 100644 --- a/patientsearch/api.py +++ b/patientsearch/api.py @@ -124,7 +124,7 @@ def home(): "templates", ), "index.html", - cache_timeout=-1, + max_age=-1, ) @@ -658,7 +658,7 @@ def logout(): "templates", ), "logout.html", - cache_timeout=-1, + max_age=-1, ) ) resp.set_cookie( @@ -690,7 +690,7 @@ def main(): "templates", ), "home.html", - cache_timeout=-1, + max_age=-1, ) @@ -703,5 +703,5 @@ def target(): "templates", ), "targetLaunch.html", - cache_timeout=-1, + max_age=-1, ) From fa47c2e73e3a094570d7ba5c33e41591a3ef453c Mon Sep 17 00:00:00 2001 From: Paul Bugni Date: Mon, 9 Dec 2024 12:37:29 -0800 Subject: [PATCH 40/45] add missing `flask-oidc` dependency to setup.cfg --- requirements.txt | 24 +++++++++++++++++++----- setup.cfg | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 143a93ac..83fd6b11 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,31 +2,41 @@ # This file is autogenerated by pip-compile with Python 3.9 # by the following command: # -# pip-compile +# pip-compile --output-file=requirements.txt setup.cfg # async-timeout==4.0.3 # via redis +authlib==1.3.2 + # via flask-oidc blinker==1.8.2 - # via flask + # via + # flask + # flask-oidc cachelib==0.13.0 # via flask-session certifi==2024.7.4 # via requests +cffi==1.17.1 + # via cryptography charset-normalizer==3.3.2 # via requests click==8.1.7 # via flask +cryptography==44.0.0 + # via authlib flask==3.0.3 # via # flask-jwt-extended + # flask-oidc # flask-session # patientsearch (setup.cfg) flask-jwt-extended==4.6.0 # via patientsearch (setup.cfg) +git+https://github.com/uwcirg/fhir-migrations@0.1.0 +flask-oidc==2.2.2 + # via patientsearch (setup.cfg) flask-session==0.8.0 # via patientsearch (setup.cfg) -flask-oidc==2.2.2 -git+https://github.com/uwcirg/fhir-migrations@0.1.0 gunicorn==23.0.0 # via patientsearch (setup.cfg) idna==3.7 @@ -47,6 +57,8 @@ msgspec==0.18.6 # via flask-session packaging==24.1 # via gunicorn +pycparser==2.22 + # via cffi pyjwt==2.9.0 # via flask-jwt-extended python-json-logger==2.0.7 @@ -58,7 +70,9 @@ redis==5.0.8 redis-dict==2.5.0 # via patientsearch (setup.cfg) requests==2.32.3 - # via patientsearch (setup.cfg) + # via + # flask-oidc + # patientsearch (setup.cfg) urllib3==2.2.2 # via requests werkzeug==3.0.3 diff --git a/setup.cfg b/setup.cfg index 4a717be5..95719ba8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,6 +19,7 @@ setup_requires = install_requires = flask flask-jwt-extended + flask-oidc flask-session gunicorn requests From ef1e992713b66fdfa5f1952f0340db8174921518 Mon Sep 17 00:00:00 2001 From: Paul Bugni Date: Mon, 9 Dec 2024 12:47:36 -0800 Subject: [PATCH 41/45] return to using `pip-compile` for full generation of `requirements.dev.txt`. --- requirements.dev.txt | 82 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index b8a28216..0af63f5d 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -1,16 +1,75 @@ --r requirements.txt # # This file is autogenerated by pip-compile with Python 3.9 # by the following command: # # pip-compile --extra=dev --output-file=requirements.dev.txt setup.cfg # +async-timeout==4.0.3 + # via redis +authlib==1.3.2 + # via flask-oidc +blinker==1.8.2 + # via + # flask + # flask-oidc +cachelib==0.13.0 + # via flask-session +certifi==2024.7.4 + # via requests +cffi==1.17.1 + # via cryptography +charset-normalizer==3.3.2 + # via requests +click==8.1.7 + # via flask +cryptography==44.0.0 + # via authlib exceptiongroup==1.2.2 # via pytest +flask==3.0.3 + # via + # flask-jwt-extended + # flask-oidc + # flask-session + # patientsearch (setup.cfg) + # pytest-flask +flask-jwt-extended==4.6.0 + # via patientsearch (setup.cfg) +git+https://github.com/uwcirg/fhir-migrations@0.1.0 +flask-oidc==2.2.2 + # via patientsearch (setup.cfg) +flask-session==0.8.0 + # via patientsearch (setup.cfg) +gunicorn==23.0.0 + # via patientsearch (setup.cfg) +idna==3.7 + # via requests +importlib-metadata==8.4.0 + # via flask iniconfig==2.0.0 # via pytest +itsdangerous==2.2.0 + # via flask +jinja2==3.1.4 + # via flask +jmespath==1.0.1 + # via patientsearch (setup.cfg) +markupsafe==2.1.5 + # via + # jinja2 + # werkzeug +msgspec==0.18.6 + # via flask-session +packaging==24.1 + # via + # gunicorn + # pytest pluggy==1.5.0 # via pytest +pycparser==2.22 + # via cffi +pyjwt==2.9.0 + # via flask-jwt-extended pytest==8.3.2 # via # patientsearch (setup.cfg) @@ -23,5 +82,26 @@ pytest-flask==1.3.0 # via patientsearch (setup.cfg) pytest-mock==3.14.0 # via patientsearch (setup.cfg) +python-json-logger==2.0.7 + # via patientsearch (setup.cfg) +redis==5.0.8 + # via + # patientsearch (setup.cfg) + # redis-dict +redis-dict==2.5.0 + # via patientsearch (setup.cfg) +requests==2.32.3 + # via + # flask-oidc + # patientsearch (setup.cfg) tomli==2.0.1 # via pytest +urllib3==2.2.2 + # via requests +werkzeug==3.0.3 + # via + # flask + # flask-jwt-extended + # pytest-flask +zipp==3.20.0 + # via importlib-metadata From 6d051743853c93363d85eab2ef8399ce08a0a8ef Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 9 Dec 2024 14:07:33 -0800 Subject: [PATCH 42/45] DO NOT KEEP this commit - fighting with dev env that won't reload /settings --- patientsearch/api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patientsearch/api.py b/patientsearch/api.py index 2270411f..bc82193c 100644 --- a/patientsearch/api.py +++ b/patientsearch/api.py @@ -143,6 +143,8 @@ def user_info(): @api_blueprint.route("/settings/") def config_settings(config_key): """Non-secret application settings""" + raise ValueError("it's me1!!!!!!!!!!!!") + return jsonify({"message": "ok"}) # workaround no JSON representation for datetime.timedelta class CustomJSONProvider(DefaultJSONProvider): @@ -161,7 +163,7 @@ def default(self, obj): jsonify_abort( status_code=400, messag=f"Configuration key {key} not available" ) - return jsonify({key: current_app.config.get(key)}) + return {key: current_app.config.get(key)} config_settings = {} for key in current_app.config: @@ -170,7 +172,7 @@ def default(self, obj): continue config_settings[key] = current_app.config.get(key) - return jsonify(config_settings) + return config_settings @api_blueprint.route("/validate_token", methods=["GET"]) From ebad9faaa5fb3ef3fe21250e8ab86937499bc7f8 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 9 Dec 2024 15:04:09 -0800 Subject: [PATCH 43/45] Revert "DO NOT KEEP this commit - fighting with dev env that won't reload" This reverts commit 6d051743853c93363d85eab2ef8399ce08a0a8ef. --- patientsearch/api.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/patientsearch/api.py b/patientsearch/api.py index bc82193c..2270411f 100644 --- a/patientsearch/api.py +++ b/patientsearch/api.py @@ -143,8 +143,6 @@ def user_info(): @api_blueprint.route("/settings/") def config_settings(config_key): """Non-secret application settings""" - raise ValueError("it's me1!!!!!!!!!!!!") - return jsonify({"message": "ok"}) # workaround no JSON representation for datetime.timedelta class CustomJSONProvider(DefaultJSONProvider): @@ -163,7 +161,7 @@ def default(self, obj): jsonify_abort( status_code=400, messag=f"Configuration key {key} not available" ) - return {key: current_app.config.get(key)} + return jsonify({key: current_app.config.get(key)}) config_settings = {} for key in current_app.config: @@ -172,7 +170,7 @@ def default(self, obj): continue config_settings[key] = current_app.config.get(key) - return config_settings + return jsonify(config_settings) @api_blueprint.route("/validate_token", methods=["GET"]) From 7d5649136bc82ca7237aefdc9c749fe251e648a6 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 9 Dec 2024 17:04:33 -0800 Subject: [PATCH 44/45] with Flask upgrade, overloading DefaultJSONProvider.default no longer functions as needed. simplify serialization of needed types. --- patientsearch/api.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/patientsearch/api.py b/patientsearch/api.py index 2270411f..6461e9f9 100644 --- a/patientsearch/api.py +++ b/patientsearch/api.py @@ -9,7 +9,7 @@ session, send_from_directory, ) -from flask.json.provider import DefaultJSONProvider +import json import jwt import requests from werkzeug.exceptions import Unauthorized, Forbidden @@ -144,12 +144,14 @@ def user_info(): def config_settings(config_key): """Non-secret application settings""" - # workaround no JSON representation for datetime.timedelta - class CustomJSONProvider(DefaultJSONProvider): - def default(self, obj): + # workaround no JSON representation for datetime.timedelta and others + def serialize(obj): + try: + json.dumps(obj) + return obj + except (TypeError, OverflowError): return str(obj) - current_app.json = CustomJSONProvider # return selective keys - not all can be be viewed by users, e.g.secret key blacklist = ("SECRET", "KEY", "TOKEN", "CREDENTIALS") @@ -161,14 +163,14 @@ def default(self, obj): jsonify_abort( status_code=400, messag=f"Configuration key {key} not available" ) - return jsonify({key: current_app.config.get(key)}) + return jsonify({key: serialize(current_app.config.get(key))}) config_settings = {} for key in current_app.config: matches = any(pattern for pattern in blacklist if pattern in key) if matches: continue - config_settings[key] = current_app.config.get(key) + config_settings[key] = serialize(current_app.config.get(key)) return jsonify(config_settings) From a78ea2fb6cfb3a73e2fd74df905b88a177421e81 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 9 Dec 2024 17:07:52 -0800 Subject: [PATCH 45/45] whitespace error --- patientsearch/api.py | 1 - 1 file changed, 1 deletion(-) diff --git a/patientsearch/api.py b/patientsearch/api.py index 6461e9f9..485d2c29 100644 --- a/patientsearch/api.py +++ b/patientsearch/api.py @@ -152,7 +152,6 @@ def serialize(obj): except (TypeError, OverflowError): return str(obj) - # return selective keys - not all can be be viewed by users, e.g.secret key blacklist = ("SECRET", "KEY", "TOKEN", "CREDENTIALS")