From cfafaa76b7502afa078c20dc752a70fa7878bd23 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 6 Dec 2023 03:34:24 +0100 Subject: [PATCH] Upgrade Python packages - Flask 3.0.0 - Migrate to scrypt password hash --- app/api/etudiants.py | 2 +- app/auth/models.py | 2 +- .../b4859c04205f_long_password_hash.py | 36 +++++++++ requirements-3.11.txt | 76 +++++++++---------- 4 files changed, 76 insertions(+), 40 deletions(-) create mode 100644 migrations/versions/b4859c04205f_long_password_hash.py diff --git a/app/api/etudiants.py b/app/api/etudiants.py index e460f29c24..6d0ec9e866 100755 --- a/app/api/etudiants.py +++ b/app/api/etudiants.py @@ -360,7 +360,7 @@ def bulletin( code_type: str = "etudid", code: str = None, formsemestre_id: int = None, - version: str = "long", + version: str = "selectedevals", pdf: bool = False, with_img_signatures_pdf: bool = True, ): diff --git a/app/auth/models.py b/app/auth/models.py index 759c5bd730..20149e14a4 100644 --- a/app/auth/models.py +++ b/app/auth/models.py @@ -90,7 +90,7 @@ class User(UserMixin, db.Model, ScoDocModel): """date du dernier login via CAS""" edt_id = db.Column(db.Text(), index=True, nullable=True) "identifiant emplois du temps (unicité non imposée)" - password_hash = db.Column(db.String(128)) + password_hash = db.Column(db.Text()) # les hashs modernes peuvent être très longs password_scodoc7 = db.Column(db.String(42)) last_seen = db.Column(db.DateTime, default=datetime.utcnow) date_modif_passwd = db.Column(db.DateTime, default=datetime.utcnow) diff --git a/migrations/versions/b4859c04205f_long_password_hash.py b/migrations/versions/b4859c04205f_long_password_hash.py new file mode 100644 index 0000000000..95ff48ae67 --- /dev/null +++ b/migrations/versions/b4859c04205f_long_password_hash.py @@ -0,0 +1,36 @@ +"""long password_hash + +Revision ID: b4859c04205f +Revises: c8f66652c77f +Create Date: 2023-12-06 03:23:33.992635 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = "b4859c04205f" +down_revision = "c8f66652c77f" +branch_labels = None +depends_on = None + + +def upgrade(): + with op.batch_alter_table("user", schema=None) as batch_op: + batch_op.alter_column( + "password_hash", + existing_type=sa.VARCHAR(length=128), + type_=sa.Text(), + existing_nullable=True, + ) + + +def downgrade(): + with op.batch_alter_table("user", schema=None) as batch_op: + batch_op.alter_column( + "password_hash", + existing_type=sa.Text(), + type_=sa.VARCHAR(length=128), + existing_nullable=True, + ) diff --git a/requirements-3.11.txt b/requirements-3.11.txt index 58eecb377f..e50f0cb71e 100644 --- a/requirements-3.11.txt +++ b/requirements-3.11.txt @@ -1,88 +1,88 @@ -alembic==1.12.0 -astroid==3.0.0 +alembic==1.13.0 +astroid==3.0.1 async-timeout==4.0.3 attrs==23.1.0 -Babel==2.13.0 -black==23.9.1 -blinker==1.6.2 +Babel==2.13.1 +black==23.11.0 +blinker==1.7.0 Brotli==1.1.0 cachelib==0.9.0 -certifi==2023.7.22 +certifi==2023.11.17 cffi==1.16.0 chardet==5.2.0 -charset-normalizer==3.3.0 +charset-normalizer==3.3.2 click==8.1.7 cracklib==2.9.6 -cryptography==41.0.4 +cryptography==41.0.7 cssselect2==0.7.0 Deprecated==1.2.14 dill==0.3.7 dnspython==2.4.2 -dominate==2.8.0 -email-validator==2.0.0.post2 +dominate==2.9.0 +email-validator==2.1.0.post1 ERAlchemy==1.2.10 et-xmlfile==1.1.0 -exceptiongroup==1.1.3 +exceptiongroup==1.2.0 execnet==2.0.2 flake8==6.1.0 -Flask==2.3.3 +Flask==3.0.0 flask-babel==4.0.0 -Flask-Caching==2.0.2 +Flask-Caching==2.1.0 Flask-HTTPAuth==4.8.0 Flask-JSON==0.4.0 -Flask-Login==0.6.2 +Flask-Login==0.6.3 Flask-Mail==0.9.1 Flask-Migrate==4.0.5 Flask-SQLAlchemy==3.1.1 Flask-WTF==1.2.1 -fonttools==4.43.1 +fonttools==4.46.0 gprof2dot==2022.7.29 -greenlet==3.0.0 +greenlet==3.0.1 gunicorn==21.2.0 html5lib==1.1 -icalendar==5.0.10 -idna==3.4 -importlib-metadata==6.8.0 +icalendar==5.0.11 +idna==3.6 +importlib-metadata==7.0.0 iniconfig==2.0.0 isort==5.12.0 itsdangerous==2.1.2 Jinja2==3.1.2 lazy-object-proxy==1.9.0 lxml==4.9.3 -Mako==1.2.4 +Mako==1.3.0 MarkupSafe==2.1.3 mccabe==0.7.0 -mypy==1.5.1 +mypy==1.7.1 mypy-extensions==1.0.0 -numpy==1.26.0 +numpy==1.26.2 openpyxl==3.1.2 packaging==23.2 -pandas==2.1.1 +pandas==2.1.3 pathspec==0.11.2 -Pillow==10.0.1 -platformdirs==3.11.0 +Pillow==10.1.0 +platformdirs==4.1.0 pluggy==1.3.0 psycopg2==2.9.9 puremagic==1.15 py==1.11.0 -pycodestyle==2.11.0 +pycodestyle==2.11.1 pycparser==2.21 pydot==1.4.2 pydyf==0.8.0 pyflakes==3.1.0 pygraphviz==1.11 PyJWT==2.8.0 -pylint==3.0.1 +pylint==3.0.2 pylint-flask==0.6 pylint-flask-sqlalchemy==0.2.0 pylint-plugin-utils==0.8.2 -pyOpenSSL==23.2.0 +pyOpenSSL==23.3.0 pyparsing==3.1.1 pyphen==0.14.0 -pytest==7.4.2 -pytest-xdist==3.3.1 +pytest==7.4.3 +pytest-xdist==3.5.0 python-dateutil==2.8.2 -python-docx==0.8.11 +python-docx==1.1.0 python-dotenv==1.0.0 python-editor==1.0.4 pytz==2023.3.post1 @@ -93,22 +93,22 @@ requests==2.31.0 rq==1.15.1 six==1.16.0 snakeviz==2.2.0 -SQLAlchemy==2.0.21 +SQLAlchemy==2.0.23 tinycss2==1.2.1 toml==0.10.2 tomli==2.0.1 -tomlkit==0.12.1 -tornado==6.3.3 +tomlkit==0.12.3 +tornado==6.4 tuna==0.5.11 typing_extensions==4.8.0 tzdata==2023.3 -urllib3==2.0.6 +urllib3==2.1.0 visitor==0.1.3 weasyprint==60.1 webencodings==0.5.1 -Werkzeug==2.3.7 -wrapt==1.15.0 -WTForms==3.0.1 +Werkzeug==3.0.1 +wrapt==1.16.0 +WTForms==3.1.1 xmltodict==0.13.0 zipp==3.17.0 zopfli==0.2.3