Repository navigation
Conversation
…ficate
When AppiumService starts the server with --ssl-cert-path and
--ssl-key-path, it probes https://<address>:<port>/status to check that
the server is listening. is_service_listening verified the server
certificate, so the probe failed whenever the certificate was
self-signed or not issued for the probed address, which is the usual
case for a local server on 127.0.0.1. start() then stopped the server
and raised AppiumServiceError ("Appium server has started but is not
listening ..."), and is_listening returned False, although the server
was up.
Don't verify the certificate in this liveness probe, and ignore
urllib3's InsecureRequestWarning only while the probe request runs, so
the global warning filters are left as they were. The probe only sends
a HEAD request and reads the response status, so no data is exposed.
Plain HTTP urls are not affected: urllib3 drops the TLS options for
http pools.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
AppiumService.start()gets--ssl-cert-pathand--ssl-key-path, it checks that the server is up by sendingHEAD https://<address>:<port>/statusthroughis_service_listening. That probe verifies the server certificate. The address defaults to127.0.0.1, so the check fails whenever the certificate is self-signed or not issued for that address, which is the usual case for a local server:The server is up, but
start()stops it and raises.service.is_listeningreturnsFalsefor the same reason.Fix
Only
is_service_listeningchanges:PoolManageris created withcert_reqs='CERT_NONE', so it does not verify the certificate.InsecureRequestWarningfor every probe request. The warning is ignored insidewarnings.catch_warnings()around that one request only. The global warning filters are not changed.http://urls are not affected, because urllib3 drops the TLS options for http connection pools.This is safe because the probe only sends a
HEADrequest without a body or credentials to the status endpoint, and only reads the response status. Skipping verification here does not affect the WebDriver session: commands still go through Selenium'sRemoteConnectionwith its own certificate settings.is_service_listeningis a public function, so calling it directly with anhttps://url also skips certificate verification. It still only sends thatHEADrequest and reads the status code.Tests
test/unit/webdriver/appium_service_https_test.pychecks that:PoolManageris created withcert_reqs='CERT_NONE';InsecureRequestWarningraised during the probe request does not reach the caller, while one raised after the probe still does.KeyError: 'cert_reqs', and the recorded warning list is not empty.urllib3.PoolManager, like the existingAppiumServicetests, because the dev dependencies have no package to generate a certificate (cryptographyortrustme).http.serverusing a self-signed certificate made withopenssl, for a cert issued tolocalhostand probed on127.0.0.1:is_service_listening('https://127.0.0.1:<port>/status')returnsFalse;True, and no warning is shown;Truebefore and after.ruff check,ruff format --check,mypy appiumand the full unit test suite pass.🤖 Generated with Claude Code