-
Notifications
You must be signed in to change notification settings - Fork 6.6k
chore(deps): update dependency werkzeug to v3.1.4 [security] #13651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore(deps): update dependency werkzeug to v3.1.4 [security] #13651
Conversation
Summary of ChangesHello @renovate-bot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request performs a crucial dependency update, upgrading the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request updates the werkzeug dependency to version 3.1.4 across many requirements.txt files to address a security vulnerability. While updating is necessary, the chosen version 3.1.4 introduces breaking changes for several samples.
Specifically, Werkzeug 3.1.4 requires Python 3.9 or newer. Many of the samples are configured to support older Python versions (like 3.7 and 3.8), so this update will cause installation to fail on those versions. In some cases, the update to Werkzeug 3.1.4 is also incompatible with other pinned dependencies like Flask==1.1.4, which requires Werkzeug<2.0.
I've added specific comments on a few files to illustrate the issues. The main recommendations are:
- For projects supporting Python 3.8+, update to
Werkzeug==3.0.4. This version includes the security fix and maintains Python 3.8 compatibility. - For projects using older versions of Flask (e.g., 1.x), a simple
Werkzeugupdate is not possible. It requires a more careful upgrade of multiple packages. - For projects supporting Python 3.7, please be aware that the
Werkzeug 2.3.xseries does not seem to have a security patch for this vulnerability. You may need to consider dropping support for Python 3.7 or accepting the risk.
Please review the individual comments for detailed suggestions. The same logic should be applied to all other requirements.txt files changed in this PR.
| Werkzeug==3.1.4; python_version > '3.6' | ||
| Werkzeug==3.1.4; python_version < '3.7' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating Werkzeug to 3.1.4 is problematic as this version requires Python 3.9+. The previous configuration supported older Python versions, and this change would break compatibility for environments using Python < 3.9.
To address the security vulnerability (GHSA-hgf8-39gv-g3f2) while maintaining broader Python version support, I recommend using different versions of Werkzeug depending on the Python version. The vulnerability is patched in version 3.0.4, which supports Python 3.8+.
For Python 3.7, Werkzeug 2.3.8 was used. The security advisory does not list a patch for the 2.3.x series, which implies it might be vulnerable and unpatched. You should consider dropping support for Python 3.7 for this sample if security is a high priority, or accept the risk.
A better approach would be to use version-specific dependencies that are secure and compatible.
Werkzeug==3.0.4; python_version >= '3.8'
Werkzeug==2.3.8; python_version == '3.7'
| requests==2.31.0 | ||
| markupsafe==2.0.1 | ||
| Werkzeug==1.0.1; | ||
| Werkzeug==3.1.4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This update to Werkzeug==3.1.4 is incompatible with Flask==1.1.4 used in this project. Flask==1.1.4 requires Werkzeug<2.0. This change will break the application.
To address the security vulnerability, both Flask and Werkzeug would need to be updated. However, as the comment on line 1 notes, Flask-Sockets may have compatibility issues with newer versions of Flask. This dependency conflict needs to be resolved carefully. A simple version bump of Werkzeug is not a valid solution here.
| werkzeug==3.1.4; python_version > '3.7' | ||
| werkzeug==3.1.4; python_version <= '3.7' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating werkzeug to 3.1.4 across all Python versions is incorrect. Werkzeug 3.1.4 requires Python 3.9+, so this change will break the application for Python 3.7 and 3.8.
To fix the security vulnerability (GHSA-hgf8-39gv-g3f2) correctly, you should use patched versions that are compatible with the respective Python versions. The vulnerability is patched in 3.0.4 (for Python 3.8+).
For Python 3.7, werkzeug 2.3.8 is likely vulnerable and unpatched. You should consider the security implications of continuing to support Python 3.7 with this package.
werkzeug==3.0.4; python_version > '3.7'
werkzeug==2.3.8; python_version <= '3.7'
| Werkzeug==3.1.4; python_version >= '3.7' | ||
| Werkzeug==3.1.4; python_version < '3.7' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating Werkzeug to 3.1.4 is problematic as this version requires Python 3.9+. The previous configuration, although having some inconsistencies in Python version markers, aimed to support older Python versions. This change will break the setup for Python versions < 3.9.
To correctly address the security vulnerability (GHSA-hgf8-39gv-g3f2), you should use patched versions compatible with each Python version. The vulnerability is patched in version 3.0.4 (for Python 3.8+).
The existing markers seem inconsistent with package requirements. A corrected and secure setup would be as suggested.
Werkzeug==3.0.4; python_version >= '3.8'
Werkzeug==2.3.8; python_version == '3.7'
| requests==2.31.0 | ||
| markupsafe==2.0.1 | ||
| Werkzeug==1.0.1; | ||
| Werkzeug==3.1.4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This update to Werkzeug==3.1.4 is incompatible with Flask==1.1.4 used in this project. Flask==1.1.4 requires Werkzeug<2.0. This change will break the application.
To address the security vulnerability, both Flask and Werkzeug would need to be updated. However, as the comment on line 1 notes, Flask-Sockets may have compatibility issues with newer versions of Flask. This dependency conflict needs to be resolved carefully. A simple version bump of Werkzeug is not a valid solution here.
| functions-framework==3.9.2 | ||
| google-cloud-documentai==3.0.1 | ||
| Werkzeug==2.3.8 | ||
| Werkzeug==3.1.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating Werkzeug to 3.1.4 drops support for Python 3.7 and 3.8, as Werkzeug 3.1.4 requires Python 3.9+. This is a significant breaking change.
To fix the security vulnerability (GHSA-hgf8-39gv-g3f2) while maintaining support for Python 3.8, you should update to Werkzeug==3.0.4. This version is patched and compatible with Python 3.8+.
Note that Werkzeug 2.3.8 (used for Python 3.7) is likely vulnerable and does not have a security patch. You may need to consider dropping support for Python 3.7 to be fully secure.
Werkzeug==3.0.4
| Flask==3.0.3 | ||
| requests==2.31.0 | ||
| Werkzeug==3.0.3 | ||
| Werkzeug==3.1.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating Werkzeug from 3.0.3 to 3.1.4 drops support for Python 3.8, as Werkzeug 3.1.4 requires Python 3.9+. This might be an unintended breaking change.
To fix the security vulnerability (GHSA-hgf8-39gv-g3f2) while retaining Python 3.8 support, you should update to Werkzeug==3.0.4. This version contains the security patch and is compatible with Python 3.8.
Werkzeug==3.0.4
This PR contains the following updates:
==3.0.3->==3.1.4==2.3.8->==3.1.4==1.0.1->==3.1.4==2.3.8->==3.1.4==3.0.3->==3.1.4GitHub Vulnerability Alerts
CVE-2025-66221
Werkzeug's
safe_joinfunction allows path segments with Windows device names. On Windows, there are special device names such asCON,AUX, etc that are implicitly present and readable in every directory.send_from_directoryusessafe_jointo safely serve files at user-specified paths under a directory. If the application is running on Windows, and the requested path ends with a special device name, the file will be opened successfully, but reading will hang indefinitely.Release Notes
pallets/werkzeug (Werkzeug)
v3.1.4Compare Source
Released 2025-11-28
safe_joinon Windows does not allow special device names. This preventsreading from these when using
send_from_directory.secure_filenamealready prevented writing to these. :ghsa:
hgf8-39gv-g3f23020\r\nsequence at a chunk boundary.:issue:
30653054Request.jsonannotation is more accurate. :issue:3067source lines. :issue:
3044HTTPException.get_responseannotation and doc better conveys thedistinction between WSGI and sans-IO responses. :issue:
3056v3.1.3Compare Source
Released 2024-11-08
MultiDictand similar interfaces only acceptslist,tuple, orsetwhen passing multiple values. It had beenchanged to accept any
Collection, but this matched types that should betreated as single values, such as
bytes. :issue:2994Hostheader is not set andRequest.hostfalls back to theWSGI
SERVER_NAMEvalue, if that value is an IPv6 address it is wrappedin
[]to match theHostheader. :issue:2993v3.1.2Compare Source
Released 2024-11-04
TypeConversionDict.getto allow thetypeparameter to be a callable. :issue:
2988Headersdoes not inherit fromMutableMapping, as it is does notexactly match that interface. :issue:
2989v3.1.1Compare Source
Released 2024-11-01
str(Request.headers)to always appear empty.:issue:
2985v3.1.0Compare Source
Released 2024-10-31
Drop support for Python 3.8. :pr:
2966Remove previously deprecated code. :pr:
2967Request.max_form_memory_sizedefaults to 500kB instead of unlimited.Non-file form fields over this size will cause a
RequestEntityTooLargeerror. :issue:
2964OrderedMultiDictandImmutableOrderedMultiDictare deprecated.Use
MultiDictandImmutableMultiDictinstead. :issue:2968Behavior of properties on
request.cache_controlandresponse.cache_controlhas been significantly adjusted.str | None. Setting properties will convertthe value to a string. Setting a property to
Falseis equivalent tosetting it to
None. Getting typed properties will returnNoneifconversion raises
ValueError, rather than the string. :issue:2980max_ageisNoneif present without a value, rather than-1.:issue:
2980no_cacheis a boolean for requests, it isTrueinstead of"*"when present. It remains a string for responses. :issue:2980max_staleisTrueif present without a value, ratherthan
"*". :issue:2980no_transformis a boolean. Previously it was mistakenly alwaysNone. :issue:2881min_freshisNoneif present without a value, rather than"*". :issue:2881privateisTrueif present without a value, rather than"*".:issue:
2980must_understandproperty. :issue:2881stale_while_revalidate, andstale_if_errorproperties. :issue:
29482881Support Cookie CHIPS (Partitioned Cookies). :issue:
2797Add 421
MisdirectedRequestHTTP exception. :issue:2850Increase default work factor for PBKDF2 to 1,000,000 iterations.
:issue:
2969Inline annotations for
datastructures, removing stub files.:issue:
2970MultiDict.getlistcatchesTypeErrorin addition toValueErrorwhen doing type conversion. :issue:
2976Implement
|and|=operators forMultiDict,Headers, andCallbackDict, and disallow|=on immutable types. :issue:2977v3.0.6Compare Source
Released 2024-10-25
max_form_memory_sizeis applied when parsing large non-filefields. :ghsa:
q34m-jh98-gwm2safe_joincatches certain paths on Windows that were not caught byntpath.isabson Python < 3.11. :ghsa:f9vj-2wh5-fj8jv3.0.5Compare Source
Released 2024-10-24
294529522955SharedDataMiddleware. :issue:2958UID does not have an associated name. :issue:
2957v3.0.4Compare Source
Released 2024-08-21
multipart/x-www-form-urlencodeddata withinvalid UTF-8 bytes in the body results in no form data parsed rather than a
413 error. :issue:
2930parse_options_headerperformance when parsing unterminatedquoted string values. :issue:
2904failed entries. :issue:
2916SSLEOFErrordue to issue in Python < 3.13.:issue:
2926:issue:
2918Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Never, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.