[Snyk] Security upgrade urllib3 from 1.26.13 to 2.6.0 - #1
Conversation
The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-URLLIB3-14192442 - https://snyk.io/vuln/SNYK-PYTHON-URLLIB3-14192443
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
| @@ -79,7 +79,7 @@ types-cachetools==4.2.10 | |||
| types-requests==2.28.11.5 | |||
| types-urllib3==1.26.25.4 | |||
There was a problem hiding this comment.
Bug: Upgrading urllib3 to 2.6.0 with requests==2.28.1 causes AttributeError due to missing HTTPResponse methods.
Severity: CRITICAL | Confidence: High
🔍 Detailed Analysis
Upgrading urllib3 to version 2.6.0 introduces an incompatibility with the pinned requests version 2.28.1. urllib3 2.6.0 removed HTTPResponse.getheaders() and HTTPResponse.getheader(), which requests 2.28.1 internally relies on in its HTTPAdapter.build_response() method. This will lead to an AttributeError: 'HTTPResponse' object has no attribute 'getheaders' whenever an HTTP request is made using requests.get(), causing the application to crash as there is no error handling.
💡 Suggested Fix
Upgrade requests to version 2.30.0 or newer, which officially supports urllib3 2.x. Alternatively, downgrade urllib3 to a 1.x version compatible with requests==2.28.1.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: requirements.txt#L80
Potential issue: Upgrading `urllib3` to version 2.6.0 introduces an incompatibility with
the pinned `requests` version 2.28.1. `urllib3` 2.6.0 removed
`HTTPResponse.getheaders()` and `HTTPResponse.getheader()`, which `requests` 2.28.1
internally relies on in its `HTTPAdapter.build_response()` method. This will lead to an
`AttributeError: 'HTTPResponse' object has no attribute 'getheaders'` whenever an HTTP
request is made using `requests.get()`, causing the application to crash as there is no
error handling.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 6416724
Snyk has created this PR to fix 2 vulnerabilities in the pip dependencies of this project.
Snyk changed the following file(s):
requirements.txtImportant
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open fix PRs.
For more information:
🧐 View latest project report
📜 Customise PR templates
🛠 Adjust project settings
📚 Read about Snyk's upgrade logic
Learn how to fix vulnerabilities with free interactive lessons:
🦉 Allocation of Resources Without Limits or Throttling