chore(deps): update dependency flask to v3 [security] - #1491
Conversation
|
/gcbrun |
There was a problem hiding this comment.
Code Review
This pull request upgrades the Flask dependency from version 2.3.3 to 3.1.3 across multiple Python projects. While this keeps the dependencies up to date, the upgrade introduces a critical compatibility issue in the backend guestbook application, as Flask-PyMongo 2.3.0 is incompatible with Flask 3.x due to the removal of deprecated context stacks. It is recommended to replace Flask-PyMongo with the official pymongo driver to resolve this issue.
| @@ -1,4 +1,4 @@ | |||
| Flask==2.3.3 | |||
| Flask==3.1.3 | |||
There was a problem hiding this comment.
Upgrading to Flask 3.x will break the backend application due to an incompatibility with Flask-PyMongo==2.3.0.\n\n### Issue Details\nFlask 3.0 completely removed the deprecated _app_ctx_stack and _request_ctx_stack globals. Flask-PyMongo (last released in 2020) imports _app_ctx_stack from flask, which will raise an ImportError and cause the application to crash on startup.\n\n### Recommended Solution\nSince Flask-PyMongo is unmaintained, the best approach is to replace it with the official pymongo driver directly:\n\n1. In python/python-guestbook/src/backend/requirements.txt, replace Flask-PyMongo==2.3.0 with pymongo>=4.0.0.\n2. In python/python-guestbook/src/backend/back.py, update the MongoDB initialization:\npython\nfrom pymongo import MongoClient\n\nclient = MongoClient(os.environ.get('GUESTBOOK_DB_ADDR'))\ndb = client.guestbook\n\nAnd update the route handlers to use db instead of mongo.db.
This PR contains the following updates:
==2.3.3→==3.1.3Flask session does not add
Vary: Cookieheader when accessed in some waysCVE-2026-27205 / GHSA-68rp-wp8r-4726
More information
Details
When the
sessionobject is accessed, Flask should set theVary: Cookieheader. This instructs caches not to cache the response, as it may contain information specific to a logged in user. This is handled in most cases, but some forms of access such as the Pythoninoperator were overlooked.The severity depends on the application's use of the session, and the cache's behavior regarding cookies. The risk depends on all these conditions being met.
Cache-Controlheader to indicate that a page is private or should not be cached.Severity
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:N/VA:N/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
pallets/flask (Flask)
v3.1.3Compare Source
Released 2026-02-18
but not the values, such as
inandlen. :ghsa:68rp-wp8r-4726v3.1.2Compare Source
Released 2025-08-19
stream_with_contextdoes not fail inside async views. :issue:5774follow_redirectsin the test client, the final stateof
sessionis correct. :issue:5786send_file. :issue:5776v3.1.1Compare Source
Released 2025-05-13
SECRET_KEY_FALLBACKS. :ghsa:4grg-w6v8-c28gcli_runner.invoke. :issue:5645flask --helploads the app and plugins first to make sure all commandsare shown. :issue:
5673AsyncIterable. This is not accurate for Flask, but makes typing easierfor Quart. :pr:
5659v3.1.0Compare Source
Released 2024-11-13
5623Werkzeug >= 3.1, ItsDangerous >= 2.2, Blinker >= 1.9. :pr:
5624,5633responses. :pr:
5496Flask.open_resource/open_instance_resourceandBlueprint.open_resourcetake anencodingparameter to use whenopening in text mode. It defaults to
utf-8. :issue:5504Request.max_content_lengthcan be customized per-request instead of onlythrough the
MAX_CONTENT_LENGTHconfig. AddedMAX_FORM_MEMORY_SIZEandMAX_FORM_PARTSconfig. Added documentationabout resource limits to the security page. :issue:
5625Partitionedcookie attribute (CHIPS), with theSESSION_COOKIE_PARTITIONEDconfig. :issue:5472-e pathtakes precedence over default.envand.flaskenvfiles.load_dotenvloads default files in addition to a path unlessload_defaults=Falseis passed. :issue:5628SECRET_KEY_FALLBACKSconfig, a list of oldsecret keys that can still be used for unsigning. Extensions will need to
add support. :issue:
5621host_matching=Trueorsubdomain_matching=Falseinteracts with
SERVER_NAME. SettingSERVER_NAMEno longer restrictsrequests to only that domain. :issue:
5553Request.trusted_hostsis checked during routing, and can be set throughthe
TRUSTED_HOSTSconfig. :issue:5636v3.0.3Compare Source
Released 2024-04-07
hashlib.sha1may not be available in FIPS builds. Don'taccess it at import time so the developer has time to change the default.
:issue:
5448cliattribute in the sansio scaffold, but rather inthe
Flaskconcrete class. :pr:5270v3.0.2Compare Source
Released 2024-02-03
jinja_loaderproperty. :issue:5388--extra-filesand--exclude-patternsCLI options.:issue:
5391v3.0.1Compare Source
Released 2024-01-18
pathargument tosend_file. :issue:5336flask run --keyoption. :pr:5344json.loadsobject_hook. This allows other JSON providers that don't implement that.:issue:
53815383v3.0.0Compare Source
Released 2023-09-30
5223__version__attribute. Use feature detection, orimportlib.metadata.version("flask"), instead. :issue:5230classes have Sans-IO bases. :pr:
51275264Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.