-
Notifications
You must be signed in to change notification settings - Fork 6.5k
chore(deps): update dependency flask-cors to v6 [security] #13376
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 flask-cors to v6 [security] #13376
Conversation
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.
Hello @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!
Summary of Changes
Hello! Gemini here, providing a summary of this pull request. This PR, authored by renovate-bot, focuses on a dependency update. Specifically, it updates the flask-cors
library to version 6.0.0
. The primary motivation for this update, as indicated by the PR title and description, is to address several security vulnerabilities (CVEs) found in previous versions related to how CORS path matching and handling were implemented.
Highlights
- Dependency Update: The core change is the update of the
flask-cors
Python package from versions5.0.1
(for Python >= 3.9) and5.0.0
(for Python == 3.8) to the unified version6.0.0
for both Python ranges. - Security Fixes: Version 6.0.0 of
flask-cors
includes fixes for multiple security vulnerabilities (CVE-2024-6844, CVE-2024-6866, CVE-2024-6839). These CVEs address issues like inconsistent CORS matching due to '+' handling, case-insensitive path matching, and improper regex path specificity ordering. - Breaking Changes: The release notes for
v6.0.0
mention a breaking change regarding path specificity ordering, which was changed to improve correctness. Users who relied on the previous, incorrect ordering might experience changes in behavior.
Changelog
- endpoints/getting-started/requirements.txt
- Updated the
flask-cors
dependency specification. - Changed
flask-cors==5.0.1; python_version >= "3.9"
toflask-cors==6.0.0; python_version >= "3.9"
. - Changed
flask-cors==5.0.0; python_version == "3.8"
toflask-cors==6.0.0; python_version == "3.8"
.
- Updated the
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
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 .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and 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 to provide feedback.
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.
A package update,
Security flaws now fixed,
Code is safer now.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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 flask-cors
dependency to version 6.0.0. This is a crucial update as it addresses several security vulnerabilities (CVE-2024-6844, CVE-2024-6866, CVE-2024-6839) present in version 5.0.1. The update is well-justified and important for the security of the application.
I have one minor suggestion to improve the maintainability of the requirements.txt
file.
Summary of Findings
- Security Vulnerability Remediation: The update to
flask-cors
v6.0.0 successfully addresses multiple documented CVEs (CVE-2024-6844, CVE-2024-6866, CVE-2024-6839), which is a significant improvement for the application's security posture. - Dependency Specification Maintainability: The
requirements.txt
file can be slightly simplified by consolidating theflask-cors
dependency specification for different Python versions, as they now point to the same version. This improves readability and reduces redundancy.
Merge Readiness
This pull request is highly beneficial due to the security patches it incorporates by updating flask-cors
. The core change is excellent. I've requested a minor change to simplify the requirements.txt
file for better maintainability. Once this small adjustment is considered or made, the PR should be in a great state for merging. As I am an AI, I am not authorized to approve pull requests; please ensure further review and approval by authorized maintainers before merging.
flask-cors==6.0.0; python_version >= "3.9" | ||
flask-cors==6.0.0; python_version == "3.8" |
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.
Since flask-cors
is now pinned to the same version (6.0.0
) for both Python 3.8 and Python versions greater than or equal to 3.9, these two lines can be consolidated into a single line for better readability and conciseness. This would simplify the dependency specification.
Could we combine these to flask-cors==6.0.0; python_version >= "3.8"
?
flask-cors==6.0.0; python_version >= "3.8"
This PR contains the following updates:
==5.0.0
->==6.0.0
==5.0.1
->==6.0.0
GitHub Vulnerability Alerts
CVE-2024-6844
A vulnerability in corydolphin/flask-cors version 5.0.1 allows for inconsistent CORS matching due to the handling of the '+' character in URL paths. The request.path is passed through the unquote_plus function, which converts the '+' character to a space ' '. This behavior leads to incorrect path normalization, causing potential mismatches in CORS configuration. As a result, endpoints may not be matched correctly to their CORS settings, leading to unexpected CORS policy application. This can cause unauthorized cross-origin access or block valid requests, creating security vulnerabilities and usability issues.
CVE-2024-6866
corydolphin/flask-cors version 5.0.1 contains a vulnerability where the request path matching is case-insensitive due to the use of the
try_match
function, which is originally intended for matching hosts. This results in a mismatch because paths in URLs are case-sensitive, but the regex matching treats them as case-insensitive. This misconfiguration can lead to significant security vulnerabilities, allowing unauthorized origins to access paths meant to be restricted, resulting in data exposure and potential data leaks.CVE-2024-6839
corydolphin/flask-cors version 5.0.1 contains an improper regex path matching vulnerability. The plugin prioritizes longer regex patterns over more specific ones when matching paths, which can lead to less restrictive CORS policies being applied to sensitive endpoints. This mismatch in regex pattern priority allows unauthorized cross-origin access to sensitive data or functionality, potentially exposing confidential information and increasing the risk of unauthorized actions by malicious actors.
Release Notes
corydolphin/flask-cors (flask-cors)
v6.0.0
Compare Source
Breaking
Path specificity ordering has changed to improve specificity. This may break users who expected the previous incorrect ordering.
What's Changed
Full Changelog: corydolphin/flask-cors@5.0.1...6.0.0
v5.0.1
Compare Source
What's Changed
This primarily changes packaging to use uv and a new release pipeline, along with some small documentation improvements
New Contributors
Full Changelog: corydolphin/flask-cors@5.0.0...5.0.01
Configuration
📅 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.