requests: Requests 2.32.0 Not supported URL scheme http+docker
Newest version of requests 2.32.0 has an incompatibility with python lib docker
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/var/lib/jenkins/workspace/Development_sm_master/gravity/.nox/lib/python3.10/site-packages/requests/adapters.py", line 532, in send
INTERNALERROR> conn = self._get_connection(request, verify, proxies=proxies, cert=cert)
INTERNALERROR> File "/var/lib/jenkins/workspace/Development_sm_master/gravity/.nox/lib/python3.10/site-packages/requests/adapters.py", line 400, in _get_connection
INTERNALERROR> conn = self.poolmanager.connection_from_host(
INTERNALERROR> File "/var/lib/jenkins/workspace/Development_sm_master/gravity/.nox/lib/python3.10/site-packages/urllib3/poolmanager.py", line 304, in connection_from_host
INTERNALERROR> return self.connection_from_context(request_context)
INTERNALERROR> File "/var/lib/jenkins/workspace/Development_sm_master/gravity/.nox/lib/python3.10/site-packages/urllib3/poolmanager.py", line 326, in connection_from_context
INTERNALERROR> raise URLSchemeUnknown(scheme)
INTERNALERROR> urllib3.exceptions.URLSchemeUnknown: Not supported URL scheme http+docker
INTERNALERROR>
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR>
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/var/lib/jenkins/workspace/Development_sm_master/gravity/.nox/lib/python3.10/site-packages/docker/api/client.py", line 213, in _retrieve_server_version
INTERNALERROR> return self.version(api_version=False)["ApiVersion"]
INTERNALERROR> File "/var/lib/jenkins/workspace/Development_sm_master/gravity/.nox/lib/python3.10/site-packages/docker/api/daemon.py", line 181, in version
INTERNALERROR> return self._result(self._get(url), json=True)
INTERNALERROR> File "/var/lib/jenkins/workspace/Development_sm_master/gravity/.nox/lib/python3.10/site-packages/docker/utils/decorators.py", line 44, in inner
INTERNALERROR> return f(self, *args, **kwargs)
INTERNALERROR> File "/var/lib/jenkins/workspace/Development_sm_master/gravity/.nox/lib/python3.10/site-packages/docker/api/client.py", line 236, in _get
INTERNALERROR> return self.get(url, **self._set_request_timeout(kwargs))
INTERNALERROR> File "/var/lib/jenkins/workspace/Development_sm_master/gravity/.nox/lib/python3.10/site-packages/requests/sessions.py", line 602, in get
INTERNALERROR> return self.request("GET", url, **kwargs)
INTERNALERROR> File "/var/lib/jenkins/workspace/Development_sm_master/gravity/.nox/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
INTERNALERROR> resp = self.send(prep, **send_kwargs)
INTERNALERROR> File "/var/lib/jenkins/workspace/Development_sm_master/gravity/.nox/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
INTERNALERROR> r = adapter.send(request, **kwargs)
INTERNALERROR> File "/var/lib/jenkins/workspace/Development_sm_master/gravity/.nox/lib/python3.10/site-packages/requests/adapters.py", line 534, in send
INTERNALERROR> raise InvalidURL(e, request=request)
INTERNALERROR> requests.exceptions.InvalidURL: Not supported URL scheme http+docker
Expected Result
Normal initalization of docker client
Actual Result
Stack trace posted above
Reproduction Steps
mkvirtualenv debug_issue
pip install docker
pip install 'requests>=2.32.0'
python
import docker
docker.from_env()
System Information
$ python -m requests.help
{
"chardet": {
"version": null
},
"charset_normalizer": {
"version": "3.3.2"
},
"cryptography": {
"version": ""
},
"idna": {
"version": "3.7"
},
"implementation": {
"name": "CPython",
"version": "3.10.12"
},
"platform": {
"release": "6.5.0-28-generic",
"system": "Linux"
},
"pyOpenSSL": {
"openssl_version": "",
"version": null
},
"requests": {
"version": "2.31.0"
},
"system_ssl": {
"version": "30000020"
},
"urllib3": {
"version": "2.2.1"
},
"using_charset_normalizer": true,
"using_pyopenssl": false
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 45
- Comments: 16 (7 by maintainers)
Commits related to this issue
- Pin the version of requests library to 2.31.0 to avoid the bug https://github.com/psf/requests/issues/6707 . — committed to gregorjerse/resolwe by gregorjerse 3 years ago
- pin `requests` version https://github.com/psf/requests/issues/6707 — committed to belegnar/pytest-django-docker-pg by belegnar 3 years ago
- pin `requests` version https://github.com/psf/requests/issues/6707 — committed to anna-money/pytest-service by belegnar 3 years ago
- Use requests 2.31.0 Workaround for: https://github.com/psf/requests/issues/6707 Signed-off-by: Ondra Machacek <omachace@redhat.com> — committed to machacekondra/vmware.vmware by machacekondra 3 years ago
- Use requests 2.31.0 Workaround for: https://github.com/psf/requests/issues/6707 Signed-off-by: Ondra Machacek <omachace@redhat.com> — committed to machacekondra/vmware.vmware by machacekondra 3 years ago
- Use requests 2.31.0 Workaround for: https://github.com/psf/requests/issues/6707 Signed-off-by: Ondra Machacek <omachace@redhat.com> — committed to machacekondra/vmware.vmware by machacekondra 3 years ago
- Use requests 2.31.0 Workaround for: https://github.com/psf/requests/issues/6707 Signed-off-by: Ondra Machacek <omachace@redhat.com> — committed to machacekondra/vmware.vmware by machacekondra 3 years ago
- Pin a version of requests that works See https://github.com/psf/requests/issues/6707 — committed to nextgens/Mailu by nextgens 3 years ago
- Hardcode Requests package version Hardcode Requests package version This is due to the recent update to this package which breaks running the molecule tests. See https://github.com/psf/requests/iss... — committed to merative/spm-middleware by deleted user 3 years ago
- pyproject: pin requests to 2.31 With requests 2.32 the following failure shows up: FAILED test/test_lava_test_plans.py::test_call_lava_test_plan_testcase_lkft_android[param105] - requests.exceptions.... — committed to roxell/lava-test-plans by roxell 3 years ago
- Hardcode Requests package version (#86) * Hardcode Requests package version Hardcode Requests package version This is due to the recent update to this package which breaks running the molecule ... — committed to merative/spm-middleware by martinfanning1 3 years ago
- Pin requests to <2.32.0 https://github.com/psf/requests/issues/6707 — committed to anna-money/pytest-pg by Pliner 3 years ago
- Pin requests to <2.32.0 https://github.com/psf/requests/issues/6707 — committed to anna-money/pytest-pg by Pliner 3 years ago
- Merge pull request #10 from Rheinwerk/PT-187641848-pin-requests [#187641848] Pin requests due to https://github.com/psf/requests/issues/6707 — committed to Rheinwerk/molecule by eifelmicha 3 years ago
- pyproject: pin requests to 2.31 With requests 2.32 the following failure shows up: FAILED test/test_lava_test_plans.py::test_call_lava_test_plan_testcase_lkft_android[param105] - requests.exceptions.... — committed to Linaro/lava-test-plans by roxell 3 years ago
- integration-tests: downgrade "requests" package to 2.31.0 To fix the build failing. See https://github.com/psf/requests/issues/6707 for more details. — committed to cirruslabs/tart by edigaryev 3 years ago
- integration-tests: downgrade "requests" package to 2.31.0 (#829) To fix the build failing. See https://github.com/psf/requests/issues/6707 for more details. — committed to cirruslabs/tart by edigaryev 3 years ago
- Switch our requests pin to only exclude 2.32.0 Both docker-py and requests have fixes in flight. We can narrow our pin to only exclude the breaking version. https://github.com/docker/docker-py/pull/... — committed to dagster-io/dagster by jmsanders 3 years ago
- pin requests to work around https://github.com/psf/requests/issues/6707 — committed to shaneknapp/datahub by shaneknapp 3 years ago
- Merge pull request #5744 from shaneknapp/pin-requests pin requests to work around https://github.com/psf/requests/issues/6707 — committed to berkeley-dsep-infra/datahub by shaneknapp 3 years ago
@felixfontein and everyone else following along, we’ve iterated through a few alternatives but each has similar impact on a different user group so a “fix” would only be shifting the problem.
We’ve decided to move
_get_connectionto a new public API on HTTPAdapter calledget_connection_with_tls_context. Going forward this will be the expanded API signature that enables us and other libraries to properly handle TLS settings when fetching connections. The existingget_connectionwill be marked as deprecated and users will be pointed to the new API.This will avoid the clunkiness of needing to override a private method and gives a clear path forward for the API. It’s likely other custom adapters implementing
get_connectionmay also suffer from something similar to CVE-2024-35195 and will need this behavior. While we didn’t intend to suddenly force this shift, we appreciate everyone’s patience while we get things stabilized.I anticipate we’ll have a patch staged at some point today and intend to push that out in 2.32.2 asap.
requests-unixsocket, which implements thehttp+unixscheme, is also broken by this change.@sergiosmcr the patch needs to be done in docker-py which is already staged in https://github.com/docker/docker-py/pull/3257. Requests 2.23.2 was just to make the integration point for docker-py easier. As I noted at the top, we cannot fix this in Requests. Any changes will just move the current problem on to another package using Requests.
We wrote the #6655 fix trying to avoid breaking users that were relying on the existing behavior of
get_connectionin their custom Adapters but missed the other side where they implemented a customget_connectionbut were still using the defaultsend.I don’t think what
docker-pywas doing is unreasonable, but unfortunately I don’t see a clear way to mitigate this in Requests while maintaining the security fix. https://github.com/docker/docker-py/pull/3257 seems like the least invasive option at the moment.I have a hunch
docker-pymay not be the only package that hits this issue so I’d like to track these kinds of problems to evaluate if we need to take further action on our side. I’ll leave this open for now to gather any other cases.This should be resolved with docker-py 7.1.0, no longer requiring pinning Requests<2.32. I’ll leave this open for a few more hours for comment and then plan to resolve this as completed by the end of today.
I am still facing the problem with version 2.32.2. Was the patch to fix the issue included in that release?